Author: sevein
Date: Wed Sep 21 11:29:56 2011
New Revision: 9776

Log:
Migrate to sfCaribou theme tousers that are currently using sfClassic

Modified:
   trunk/data/fixtures/settings.yml
   trunk/lib/task/migrate/QubitMigrate110.class.php

Modified: trunk/data/fixtures/settings.yml
==============================================================================
--- trunk/data/fixtures/settings.yml    Wed Sep 21 11:19:59 2011        (r9775)
+++ trunk/data/fixtures/settings.yml    Wed Sep 21 11:29:56 2011        (r9776)
@@ -3,7 +3,7 @@
     name: version
     editable: 0
     deleteable: 0
-    value: 72
+    value: 73
   QubitSetting_2:
     name: upload_dir
     editable: 0

Modified: trunk/lib/task/migrate/QubitMigrate110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate110.class.php    Wed Sep 21 11:19:59 
2011        (r9775)
+++ trunk/lib/task/migrate/QubitMigrate110.class.php    Wed Sep 21 11:29:56 
2011        (r9776)
@@ -79,6 +79,9 @@
 
       case 71:
         $this->addPhysicalObjectBrowseMenu();
+
+      case 72:
+        $this->switchFromClassicToCaribouTheme();
     }
 
     // Delete "stub" objects
@@ -740,6 +743,38 @@
   }
 
   /**
+   * Migrate to sfCaribou theme to users that are currently using sfClassic
+   *
+   * @return QubitMigrate110 SELF
+   */
+  protected function switchFromClassicToCaribouTheme()
+  {
+    $plugin = 'sfClassicPlugin';
+    $replacement = 'sfCaribouPlugin';
+
+    // Find setting
+    foreach ($this->data['QubitSetting'] as $key => $value)
+    {
+      if ('plugins' == $value['name'])
+      {
+        $settings = unserialize($value['value'][$value['source_culture']]);
+
+        // Find plugin
+        if (-1 < ($index = array_search($plugin, $settings)))
+        {
+          // Replace
+          $settings[$index] = $replacement;
+          $this->data['QubitSetting'][$key]['value'][$value['source_culture']] 
= serialize($settings);
+        }
+
+        break;
+      }
+    }
+
+    return $this;
+  }
+
+  /**
    * Slugs are inserted when some resources are inserted, but slugs are dumped
    * separately when data is dumped. So loading slug data will try to insert
    * duplicate slugs. To work around this, turn slugs into resource properties

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