Author: sevein
Date: Mon Oct 11 04:43:23 2010
New Revision: 8058

Log:
Store distribution value in user session to load the file only one time.

Modified:
   trunk/apps/qubit/modules/default/actions/updateCheckComponent.class.php

Modified: 
trunk/apps/qubit/modules/default/actions/updateCheckComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/default/actions/updateCheckComponent.class.php     
Mon Oct 11 00:03:08 2010        (r8057)
+++ trunk/apps/qubit/modules/default/actions/updateCheckComponent.class.php     
Mon Oct 11 04:43:23 2010        (r8058)
@@ -43,15 +43,18 @@
     $this->updateCheckData['address'] = $request->getUriPrefix() . 
$request->getScriptName() . $request->getPathInfo();
     $this->updateCheckData['version'] = qubitConfiguration::VERSION.' - 
'.sfConfig::get('app_version');
 
-    $packageXmlPath = sfConfig::get('sf_config_dir').'/package.xml';
-    if (file_exists($packageXmlPath))
+    if (null === ($this->updateCheckData['distribution'] = 
$this->getUser()->getAttribute('distribution')))
     {
-      require_once 
sfConfig::get('sf_root_dir').'/vendor/FluentDOM/FluentDOM.php';
+      $packageXmlPath = sfConfig::get('sf_config_dir').'/package.xml';
+      if (file_exists($packageXmlPath))
+      {
+        require_once 
sfConfig::get('sf_root_dir').'/vendor/FluentDOM/FluentDOM.php';
 
-      $fd = FluentDOM($packageXmlPath)
-        ->namespaces(array('p' => 'http://pear.php.net/dtd/package-2.0'));
+        $fd = FluentDOM($packageXmlPath)
+          ->namespaces(array('p' => 'http://pear.php.net/dtd/package-2.0'));
 
-      $this->updateCheckData['distribution'] = 
$fd->find('/*/p:name')->item(0)->textContent;
+        $this->getUser()->setAttribute('distribution', 
$this->updateCheckData['distribution'] = 
$fd->find('/*/p:name')->item(0)->textContent);
+      }
     }
 
     $this->updateCheckData['site_description'] = 
sfConfig::get('app_siteDescription');

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to