r605 - /scripts/supported_platforms.php

fst-guest at users.alioth.debian.org fst-guest at users.alioth.debian.org
Mon Mar 19 20:29:04 CET 2007


Author: fst-guest
Date: Mon Mar 19 19:29:04 2007
New Revision: 605

URL: http://svn.debian.org/wsvn/pkg-boinc/?sc=1&rev=605
Log:
Use apps.php instead of get_project_config.php because the latter web RPC
does not list the platforms yet.

Modified:
    scripts/supported_platforms.php

Modified: scripts/supported_platforms.php
URL: http://svn.debian.org/wsvn/pkg-boinc/scripts/supported_platforms.php?rev=605&op=diff
==============================================================================
--- scripts/supported_platforms.php (original)
+++ scripts/supported_platforms.php Mon Mar 19 19:29:04 2007
@@ -57,48 +57,47 @@
     'xtrem' => array('http://xw01.lri.fr:4320/', 'XtremLab')
 );
 
-$cfg_dir = 'projects_cfg';
+$xml_dir = 'apps';
 
-function cfg_file($project) {
-    global $cfg_dir;
-    return $cfg_dir.'/'.$project.'_config.xml';
+function apps_file($project) {
+    global $xml_dir;
+    return $xml_dir.'/'.$project.'_apps.xml';
 }
 
-function get_project_configs($projects, $force_update = false) {
-    global $cfg_dir;
-    if (! is_dir($cfg_dir))
-        mkdir($cfg_dir);
+function get_project_apps($projects, $force_update = false) {
+    global $xml_dir;
+    if (! is_dir($xml_dir))
+        mkdir($xml_dir);
 
-    // Only update project configs if $cfg_dir was last accessed more
-    // than 12h ago.
-    if ((time() - fileatime($cfg_dir)) < 12*3600 and !$force_update)
+    // Only update apps files if $xml_dir was last accessed more than 12h ago.
+    if ((time() - fileatime($xml_dir)) < 12*3600 and !$force_update)
         return;
 
-    foreach ($projects as $key => $project) {
-        copy($project[0].'/get_project_config.php', cfg_file($key));
-    }
+    foreach ($projects as $key => $project)
+        copy($project[0].'apps.php?xml=1', apps_file($key));
 }
 
 function get_supported_platforms($projects) {
     $supported_platforms = array();
 
     foreach ($projects as $key => $project) {
-        $cfg_file = cfg_file($key);
-        if (! file_exists($cfg_file) or filesize($cfg_file) < 64)
+        $apps_file = apps_file($key);
+        if (! file_exists($apps_file) or filesize($apps_file) < 64)
             continue;
 
         $supported_platforms[$key] = array();
 
-        $cfg_xml = simplexml_load_file($cfg_file);
+        $apps_xml = @simplexml_load_file($apps_file);
 
-        // Continue if the config file does not contain the platforms element.
-        if (! $cfg_xml->platforms)
+        // Continue if the apps file is not a valid XML file.
+        if (! $apps_xml)
             continue;
 
         $platforms = array();
-        foreach ($cfg_xml->platforms[0] as $platform) {
-            array_push($platforms, (string) $platform);
-        }
+        foreach ($apps_xml->application as $application)
+            foreach($application->version as $version)
+                array_push($platforms, (string) $version->platform_short);
+ 
         $supported_platforms[$key] = $platforms;
     }
     return $supported_platforms;
@@ -141,7 +140,7 @@
 
 // main program logic
 
-get_project_configs($projects);
+get_project_apps($projects, true);
 
 $supported_platforms = get_supported_platforms($projects);
 




More information about the pkg-boinc-commits mailing list