Author: jablko
Date: 2008-11-27 10:36:08 -0800 (Thu, 27 Nov 2008)
New Revision: 1631

Added:
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/indexAction.class.php
Modified:
   trunk/qubit/apps/qubit/config/routing.yml
   trunk/qubit/lib/vendor/symfony/lib/routing/sfRoute.class.php
   trunk/qubit/lib/vendor/symfony/lib/routing/sfRouting.class.php
   
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
   trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/callbackAction.class.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/checkAction.class.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/configureAction.class.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/finishAction.class.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/loadAction.class.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/checkSuccess.php
   
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/configureSuccess.php
Log:
Initial sfInstallPlugin cleanup. Try using routing system to configure help 
URLs.


Modified: trunk/qubit/apps/qubit/config/routing.yml
===================================================================
--- trunk/qubit/apps/qubit/config/routing.yml   2008-11-27 18:27:22 UTC (rev 
1630)
+++ trunk/qubit/apps/qubit/config/routing.yml   2008-11-27 18:36:08 UTC (rev 
1631)
@@ -1,3 +1,11 @@
+homepage:
+  url:   /
+  param: { module: staticpage, action: static, permalink: homepage }
+
+default_index:
+  url:   /:module
+  param: { action: index }
+
 createDc:
   url: /:module/create/dc/*
   param: { action: createDc }
@@ -77,17 +85,5 @@
   param: { module: repository }
   requirements: { action: create|edit|show }
 
-homepage:
-  url:   /
-  param: { module: staticpage, action: static, permalink: homepage }
-
-permalink:
-  url:   /:permalink
-  param: { module: staticpage, action: static }
-
-default_index:
-  url:   /:module
-  param: { action: index }
-
 default:
   url:   /:module/:action/*

Modified: trunk/qubit/lib/vendor/symfony/lib/routing/sfRoute.class.php
===================================================================
--- trunk/qubit/lib/vendor/symfony/lib/routing/sfRoute.class.php        
2008-11-27 18:27:22 UTC (rev 1630)
+++ trunk/qubit/lib/vendor/symfony/lib/routing/sfRoute.class.php        
2008-11-27 18:36:08 UTC (rev 1631)
@@ -451,11 +451,6 @@
    */
   protected function preCompile()
   {
-    // a route must start with a slash
-    if (empty($this->pattern) || '/' != $this->pattern[0])
-    {
-      $this->pattern = '/'.$this->pattern;
-    }
   }
 
   /**
@@ -490,8 +485,17 @@
         // a custom token
         $this->customToken = true;
       }
-      else if ($afterASeparator && 
preg_match('#^'.$this->options['variable_prefix_regex'].'('.$this->options['variable_regex'].')#',
 $buffer, $match))
+      else if (preg_match('#^'.$this->options['segment_separators_regex'].'#', 
$buffer, $match))
       {
+        // a separator
+        $this->tokens[] = array('separator', $currentSeparator, $match[0], 
null);
+
+        $currentSeparator = $match[0];
+        $buffer = substr($buffer, strlen($match[0]));
+        $afterASeparator = true;
+      }
+      else if 
(preg_match('#^'.$this->options['variable_prefix_regex'].'('.$this->options['variable_regex'].')#',
 $buffer, $match))
+      {
         // a variable
         $this->tokens[] = array('variable', $currentSeparator, $match[0], 
$match[1]);
 
@@ -499,7 +503,7 @@
         $buffer = substr($buffer, strlen($match[0]));
         $afterASeparator = false;
       }
-      else if ($afterASeparator && 
preg_match('#^('.$this->options['text_regex'].')(?:'.$this->options['segment_separators_regex'].'|$)#',
 $buffer, $match))
+      else if 
(preg_match('#^('.$this->options['text_regex'].')(?:'.$this->options['segment_separators_regex'].'|'.$this->options['variable_prefix_regex'].$this->options['variable_regex'].'|$)#',
 $buffer, $match))
       {
         // a text
         $this->tokens[] = array('text', $currentSeparator, $match[1], null);
@@ -508,15 +512,6 @@
         $buffer = substr($buffer, strlen($match[1]));
         $afterASeparator = false;
       }
-      else if (!$afterASeparator && 
preg_match('#^'.$this->options['segment_separators_regex'].'#', $buffer, 
$match))
-      {
-        // a separator
-        $this->tokens[] = array('separator', $currentSeparator, $match[0], 
null);
-
-        $currentSeparator = $match[0];
-        $buffer = substr($buffer, strlen($match[0]));
-        $afterASeparator = true;
-      }
       else if (false !== $this->tokenizeBufferAfter($buffer, $tokens, 
$afterASeparator, $currentSeparator))
       {
         // a custom token

Modified: trunk/qubit/lib/vendor/symfony/lib/routing/sfRouting.class.php
===================================================================
--- trunk/qubit/lib/vendor/symfony/lib/routing/sfRouting.class.php      
2008-11-27 18:27:22 UTC (rev 1630)
+++ trunk/qubit/lib/vendor/symfony/lib/routing/sfRouting.class.php      
2008-11-27 18:36:08 UTC (rev 1631)
@@ -262,16 +262,14 @@
 
   protected function fixGeneratedUrl($url, $absolute = false)
   {
+    if (preg_match('/^[a-z][a-z0-9+\-.]*:\/\//i', $url))
+    {
+      return $url;
+    }
+
     if (isset($this->options['context']['prefix']))
     {
-      if (0 === strpos($url, 'http'))
-      {
-        $url = preg_replace('#https?\://[^/]+#', 
'$0'.$this->options['context']['prefix'], $url);
-      }
-      else
-      {
-        $url = $this->options['context']['prefix'].$url;
-      }
+      $url = $this->options['context']['prefix'].$url;
     }
 
     if ($absolute && isset($this->options['context']['host']))

Modified: 
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
   2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/config/sfInstallPluginConfiguration.class.php
   2008-11-27 18:36:08 UTC (rev 1631)
@@ -19,6 +19,7 @@
     $enabledModules[] = 'sfInstallPlugin';
     sfConfig::set('sf_enabled_modules', $enabledModules);
 
-    $this->dispatcher->connect('application.throw_exception', 
array('sfInstall', 'throwException'));
+    $this->dispatcher->connect('application.throw_exception', 
array('sfInstall', 'applicationThrowException'));
+    $this->dispatcher->connect('routing.load_configuration', 
array('sfInstall', 'routingLoadConfiguration'));
   }
 }

Modified: trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php
===================================================================
--- trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php 2008-11-27 
18:27:22 UTC (rev 1630)
+++ trunk/qubit/plugins/sfInstallPlugin/lib/sfInstall.class.php 2008-11-27 
18:36:08 UTC (rev 1631)
@@ -8,16 +8,22 @@
 {
   public static $MINIMUM_MEMORY_LIMIT_MB = 64;
 
-  public static function throwException(sfEvent $event)
+  public static function applicationThrowException(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'));
+      sfContext::getInstance()->getController()->redirect(array('module' => 
'sfInstallPlugin'));
     }
   }
 
+  public static function routingLoadConfiguration(sfEvent $event)
+  {
+    $routing = $event->getSubject();
+    $routing->prependRoute('sfInstallPlugin/help', new 
sfRoute('http://qubit-toolkit.org/wiki/index.php?title=Installer_Warnings', 
array('module' => 'sfInstallPlugin', 'action' => 'help')));
+  }
+
   // Returns an array of missing dependencies
   // TODO: This is already implemented in PEAR.  Make this check more robust by
   // calling their code.

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/callbackAction.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/callbackAction.class.php
        2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/callbackAction.class.php
        2008-11-27 18:36:08 UTC (rev 1631)
@@ -1,5 +1,8 @@
 <?php
 
+/*
+ */
+
 class sfInstallPluginCallbackAction extends sfAction
 {
   public function execute($request)

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/checkAction.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/checkAction.class.php
   2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/checkAction.class.php
   2008-11-27 18:36:08 UTC (rev 1631)
@@ -1,9 +1,11 @@
 <?php
 
+/*
+ */
+
 class sfInstallPluginCheckAction extends sfAction
 {
   public function execute($request)
   {
-    $this->qubitWikiIndexUrl = 'http://qubit-toolkit.org/wiki/index.php';
   }
 }

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/configureAction.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/configureAction.class.php
       2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/configureAction.class.php
       2008-11-27 18:36:08 UTC (rev 1631)
@@ -1,5 +1,8 @@
 <?php
 
+/*
+ */
+
 class sfInstallPluginConfigureAction extends sfAction
 {
   // TODO: Load values from existing database configuration

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/finishAction.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/finishAction.class.php
  2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/finishAction.class.php
  2008-11-27 18:36:08 UTC (rev 1631)
@@ -1,5 +1,8 @@
 <?php
 
+/*
+ */
+
 class sfInstallPluginFinishAction extends sfAction
 {
   public function execute($request)

Added: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/indexAction.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/indexAction.class.php
                           (rev 0)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/indexAction.class.php
   2008-11-27 18:36:08 UTC (rev 1631)
@@ -0,0 +1,12 @@
+<?php
+
+/*
+ */
+
+class sfInstallPluginIndexAction extends sfAction
+{
+  public function execute($request)
+  {
+    $this->redirect(array('module' => 'sfInstallPlugin', 'action' => 'check'));
+  }
+}


Property changes on: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/indexAction.class.php
___________________________________________________________________
Added: svn:keywords
   + Author Id Revision
Added: svn:eol-style
   + native

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/loadAction.class.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/loadAction.class.php
    2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/actions/loadAction.class.php
    2008-11-27 18:36:08 UTC (rev 1631)
@@ -1,5 +1,8 @@
 <?php
 
+/*
+ */
+
 class sfInstallPluginLoadAction extends sfAction
 {
   public function execute($request)

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/checkSuccess.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/checkSuccess.php
      2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/checkSuccess.php
      2008-11-27 18:36:08 UTC (rev 1631)
@@ -1,14 +1,14 @@
 <h2>System checks</h2>
 
 <!-- FIXME: We currently do this logic in the template instead of the action 
to give the user more immediate feedback, but symfony apparently buffers output 
and does not start sending it to the user until it is finished being generated 
: ( -->
-<!-- TODO: Considder using array keys for wiki anchors -->
+<!-- TODO: Consider using array keys for wiki anchors -->
 <?php $error = false ?>
 
 <?php $error |= count($dependencies = sfInstall::checkDependencies()) > 0 ?>
 <?php if (isset($dependencies['php']['min'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('Minimum PHP version', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#Minimum_PHP_version') ?>: <?php 
echo $dependencies['php']['min'] ?>
+      <?php echo link_to('Minimum PHP version', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'Minimum_PHP_version')) ?>: <?php echo $dependencies['php']['min'] ?>
     </p>
     <p>
       Current version is <?php echo PHP_VERSION ?>
@@ -19,7 +19,7 @@
   <?php foreach ($dependencies['extensions'] as $extension): ?>
     <div class="messages error">
       <p>
-        <?php echo link_to($extension.' extension', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#'.$extension.'_extension') ?>
+        <?php echo link_to($extension.' extension', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
$extension.'_extension')) ?>
       </p>
     </div>
   <?php endforeach; ?>
@@ -29,7 +29,7 @@
 <?php if (count($writablePaths) > 0): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('Writable paths', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#Writable_paths') ?>
+      <?php echo link_to('Writable paths', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 'Writable_paths')) ?>
     </p>
     <ul>
       <?php foreach ($writablePaths as $path): ?>
@@ -43,7 +43,7 @@
 <?php if (isset($databasesYml['notWritable'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('databases.yml not writable', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#databases.yml_not_writable') ?>
+      <?php echo link_to('databases.yml not writable', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'databases.yml_not_writable')) ?>
     </p>
   </div>
 <?php endif; ?>
@@ -52,40 +52,37 @@
 <?php if (isset($propelIni['notWritable'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('propel.ini not writable', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#propel.ini_not_writable') ?>
+      <?php echo link_to('propel.ini not writable', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'propel.ini_not_writable')) ?>
     </p>
   </div>
 <?php endif; ?>
 
-<!-- HACK: This checkSettingsYml() was meant to get called after 
checkHtaccess() but without settings.yml, sfInstallPlugin is disabled, breaking 
the checkHtaccess() callbacks : ( -->
-<?php sfInstall::checkSettingsYml(false) ?>
-
 <?php $error |= count($htaccess = sfInstall::checkHtaccess()) > 0 ?>
 <?php if (isset($htaccess['notWritable'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('.htaccess not writable', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#.htaccess_not_writable') ?>
+      <?php echo link_to('.htaccess not writable', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'.htaccess_not_writable')) ?>
     </p>
   </div>
 <?php endif; ?>
 <?php if (isset($htaccess['ignored'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('.htaccess files are completely ignored', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#.htaccess_files_are_completely_ignored')
 ?>
+      <?php echo link_to('.htaccess files are completely ignored', 
array('module' => 'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'.htaccess_files_are_completely_ignored')) ?>
     </p>
   </div>
 <?php endif; ?>
 <?php if (isset($htaccess['optionsNotAllowed'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('Options not allowed in .htaccess files', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#Options_not_allowed_in_.htaccess_files')
 ?>
+      <?php echo link_to('Options not allowed in .htaccess files', 
array('module' => 'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'Options_not_allowed_in_.htaccess_files')) ?>
     </p>
   </div>
 <?php endif; ?>
 <?php if (isset($htaccess['modRewriteNotConfigured'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('mod_rewrite not configured', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#mod_rewrite_not_configured') ?>
+      <?php echo link_to('mod_rewrite not configured', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'mod_rewrite_not_configured')) ?>
     </p>
   </div>
 <?php endif; ?>
@@ -94,7 +91,7 @@
 <?php if (isset($settingsYml['notWritable'])): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('settings.yml not writable', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#settings.yml_not_writable') ?>
+      <?php echo link_to('settings.yml not writable', array('module' => 
'sfInstallPlugin', 'action' => 'help'), array('anchor' => 
'settings.yml_not_writable')) ?>
     </p>
   </div>
 <?php endif; ?>
@@ -103,7 +100,7 @@
 <?php if (count($searchIndex) > 0): ?>
   <div class="messages error">
     <p>
-      <?php echo link_to('Search index', 
$qubitWikiIndexUrl.'?title=Installer_Warnings#Search_index') ?>
+      <?php echo link_to('Search index', array('module' => 'sfInstallPlugin', 
'action' => 'help'), array('anchor' => 'Search_index')) ?>
     </p>
     <ul>
       <?php foreach ($searchIndex as $e): ?>
@@ -118,7 +115,7 @@
   <div class="messages error">
     <p>
       <?php echo link_to('Your current PHP memory limit is '.$memoryLimit.' MB 
which is less than the minimum limit of '.sfInstall::$MINIMUM_MEMORY_LIMIT_MB.' 
MB.',
-        $qubitWikiIndexUrl.'?title=Installer_Warnings#PHP_memory_limit') ?>
+        array('module' => 'sfInstallPlugin', 'action' => 'help'), 
array('anchor' => 'PHP_memory_limit')) ?>
     </p>
   </div>
 <?php endif; ?>

Modified: 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/configureSuccess.php
===================================================================
--- 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/configureSuccess.php
  2008-11-27 18:27:22 UTC (rev 1630)
+++ 
trunk/qubit/plugins/sfInstallPlugin/modules/sfInstallPlugin/templates/configureSuccess.php
  2008-11-27 18:36:08 UTC (rev 1631)
@@ -15,7 +15,7 @@
   <?php echo link_to('A database must exist on your server before 
'.sfConfig::get('app_name', 'Qubit').' can be installed.', 
'http://qubit-toolkit.org/wiki/index.php?title=Installation#B._Create_your_MySQL_database')
 ?>
 </p>
 
-<form action="<?php echo url_for(array('module' => 'sfInstallPlugin', 'action' 
=> 'configure')) ?>" method="post">
+<?php echo $form->renderFormTag(url_for(array('module' => 'sfInstallPlugin', 
'action' => 'configure'))) ?>
   <div class="description">
     <p>
       To set up your database, enter the following information.


--~--~---------~--~----~------------~-------~--~----~
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