[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/sites/www/applications
From:       Harald Sitter <null () kde ! org>
Date:       2018-03-12 13:49:35
Message-ID: E1evNpX-0004mt-7B () code ! kde ! org
[Download RAW message or body]

SVN commit 1512207 by sitter:

differentiate our id from the appstream id

appstream doesn't consider foo.desktop equal to foo, we do so as to
have consistent naming all around. this however then breaks when giving
the id to libappstream e.g. through the appstream:// URI.
to fix this we now have two different id concepts, our internal one and
the actual appstream id.

additionally we'll try very hard to always have an internal one by infering
it through the class constructor whenever possible

additionally the crawler will stop mangling the appstream ID and instead
set x-kde-id which is the new mangled id for internal use


 M  +1 -1      applicationpage.php  
 M  +10 -4     includes/class_appdata2.inc  


--- trunk/www/sites/www/applications/applicationpage.php #1512206:1512207
@@ -23,7 +23,7 @@
 
     $content .= '<div id="infobox-return">';
     if ($backToOverview) {
-        $content .= '<a \
href="/applications/'.$category.'/'.$app->AppStreamId().'">Back to overview</a>'; +   \
$content .= '<a href="/applications/'.$category.'/'.$app->id().'">Back to \
overview</a>';  } else {
         $content .= <<<BACK_LINK
         <a href="/applications/$category">
--- trunk/www/sites/www/applications/includes/class_appdata2.inc #1512206:1512207
@@ -34,8 +34,18 @@
         if (file_exists($extension_file)) {
             $this->data = array_merge_recursive($this->data, \
json_decode(file_get_contents($extension_file), true));  }
+
+        $this->id = $name;
     }
 
+    # Same as AppStreamId but with .desktop stripped to force consistent naming.
+    function id() {
+        if (empty($this->id)) {
+            return $this->data['X-KDE-ID'];
+        }
+        return $this->id;
+    }
+
     function name() {
         return $this->l10n($this->data['Name']);
     }
@@ -208,10 +218,6 @@
         return $this->data['ID'];
     }
 
-    function id() {
-        return $this->AppStreamId();
-    }
-
     function icon() {
         return $this->data['Icon']['local'][0]['name'];
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic