Author: jablko
Date: 2008-11-21 12:39:31 -0800 (Fri, 21 Nov 2008)
New Revision: 1614

Modified:
   
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
   trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php
Log:
Redirect to the installer using an event listener, instead of the custom 
error500.php


Modified: 
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
   2008-11-21 18:41:55 UTC (rev 1613)
+++ 
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
   2008-11-21 20:39:31 UTC (rev 1614)
@@ -18,5 +18,7 @@
     $enabledModules = sfConfig::get('sf_enabled_modules');
     $enabledModules[] = 'sfInstallPlugin';
     sfConfig::set('sf_enabled_modules', $enabledModules);
+
+    $this->dispatcher->connect('application.throw_exception', 
array('sfInstall', 'throwException'));
   }
 }

Modified: trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php
===================================================================
--- trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php 2008-11-21 
18:41:55 UTC (rev 1613)
+++ trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php 2008-11-21 
20:39:31 UTC (rev 1614)
@@ -7,8 +7,17 @@
 class sfInstall
 {
   public static $MINIMUM_MEMORY_LIMIT_MB = 64;
-  
-  
+
+  public static function throwException(sfEvent $event)
+  {
+    // TODO: Choose a more specific test.  Do not redirect to the installer on
+    // all PropelExceptions
+    if ($event->getSubject() instanceof PropelException)
+    {
+      sfContext::getInstance()->getController()->redirect(array('module' => 
'sfInstallPlugin', 'action' => 'check'));
+    }
+  }
+
   // Returns an array of missing dependencies
   // TODO: This is already implemented in PEAR.  Make this check more robust by
   // calling their code.
@@ -419,8 +428,7 @@
 
     return $searchIndex;
   }
-  
-  
+
   /**
    * Check that memory_limit ini value meets Qubit's minimum requirements
    * (currently 64 MB)
@@ -430,7 +438,7 @@
   public static function checkMemoryLimit()
   {
     $memoryLimit = ini_get('memory_limit');
-    
+
     // Convert memoryLimit to float or integer value in units of MB
     // See http://ca.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
     switch (strtolower(substr($memoryLimit, -1)))
@@ -443,15 +451,14 @@
         break;
       case 'g':
         $memoryLimit = intval(substr($memoryLimit, 0, -1))*1024;
-        break; 
+        break;
       default:
         // If suffix is not K, M, or G (case-insensitive), then value is 
assumed to be bytes
         $memoryLimit = round(intval($memoryLimit)/1048576, 3);
     }
-    
+
     if ($memoryLimit < self::$MINIMUM_MEMORY_LIMIT_MB)
     {
-    
       return $memoryLimit;
     }
   }


--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to