Author: david
Date: Thu Jul 26 14:51:09 2012
New Revision: 11991

Log:
Fix logic for PARAMETER_NONE parameters.  Tweak confirmation message

Modified:
   trunk/lib/task/digitalObjectRegenDerivativesTask.class.php

Modified: trunk/lib/task/digitalObjectRegenDerivativesTask.class.php
==============================================================================
--- trunk/lib/task/digitalObjectRegenDerivativesTask.class.php  Thu Jul 26 
14:37:20 2012        (r11990)
+++ trunk/lib/task/digitalObjectRegenDerivativesTask.class.php  Thu Jul 26 
14:51:09 2012        (r11991)
@@ -28,8 +28,7 @@
       new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 
'The environment', 'cli'),
       new sfCommandOption('connection', null, 
sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'),
       new sfCommandOption('slug', 'l', sfCommandOption::PARAMETER_OPTIONAL, 
'Information object slug', null),
-      //new sfCommandOption('repo', 'r', sfCommandOption::PARAMETER_NONE, 
'Update all description in given repository', null)
-      new sfCommandOption('index', null, sfCommandOption::PARAMETER_NONE, 
'Update search index (defaults to false)', null),
+      new sfCommandOption('index', 'i', sfCommandOption::PARAMETER_NONE, 
'Update search index (defaults to false)', null),
       new sfCommandOption('force', 'f', sfCommandOption::PARAMETER_NONE, 'No 
confirmation message', null)
     ));
 
@@ -47,7 +46,7 @@
     $databaseManager = new sfDatabaseManager($this->configuration);
     $conn = $databaseManager->getDatabase('propel')->getConnection();
 
-    if (isset($options['index']))
+    if ($options['index'])
     {
       QubitSearch::getInstance()->disabled = false;
       QubitSearch::getInstance()->enableBatch(); // Batched update is faster
@@ -79,14 +78,18 @@
     }
 
     // Final confirmation
-    if (!isset($options['force']))
+    if (!$options['force'])
     {
       $confirm = array();
-      $confirm[] = 'Continuing will regenerate the dervivatives for ALL 
digital objects';
 
       if ($options['slug'])
       {
-        $confirm[] = 'within the '.$options['slug'].' branch';
+        $confirm[] = 'Continuing will regenerate the dervivatives for ALL 
descendants of';
+        $confirm[] = '"'.$options['slug'].'"';
+      }
+      else
+      {
+        $confirm[] = 'Continuing will regenerate the dervivatives for ALL 
digital objects';
       }
 
       $confirm[] = 'This will PERMANENTLY DELETE any existing derivatives';
@@ -121,7 +124,7 @@
 
       $do->createRepresentations(QubitTerm::MASTER_ID, $conn);
 
-      if (isset($options['index']))
+      if ($options['index'])
       {
         // Update index
         QubitSearch::updateInformationObject($do->informationObject);
@@ -133,7 +136,7 @@
     }
 
     // Warn user to manually update search index
-    if (!isset($options['index']))
+    if (!$options['index'])
     {
       $this->logSection('Done!', 'Please update the search index manually with 
"php symfony search:populate QubitSearch" to reflect any changes.');
     }

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