Add upgrade system task
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 29 Jul 2009 18:59:10 +0000 (12:59 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 29 Jul 2009 18:59:10 +0000 (12:59 -0600)
imp/lib/IMP.php
imp/lib/LoginTasks/SystemTask/Upgrade.php [new file with mode: 0644]

index 7bd73b8..674cfe9 100644 (file)
@@ -1044,12 +1044,6 @@ class IMP
 
         if (!isset($entry['b'])) {
             $sortby = $GLOBALS['prefs']->getValue('sortby');
-            /* IMP 4 upgrade: check for old, non-existent sort values.
-             * See Bug #7296. */
-            if ($sortby > 10) {
-                $sortby = Horde_Imap_Client::SORT_ARRIVAL;
-                $GLOBALS['prefs']->setValue('sortby', $sortby);
-            }
         }
 
         $ob = array(
diff --git a/imp/lib/LoginTasks/SystemTask/Upgrade.php b/imp/lib/LoginTasks/SystemTask/Upgrade.php
new file mode 100644 (file)
index 0000000..fc74521
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Login system task for automated upgrade tasks.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author  Michael Slusarz <slusarz@horde.org>
+ * @package Horde_LoginTasks
+ */
+class IMP_LoginTasks_SystemTask_Upgrade extends Horde_LoginTasks_SystemTask
+{
+    /**
+     * The interval at which to run the task.
+     *
+     * @var integer
+     */
+    public $interval = Horde_LoginTasks::ONCE;
+
+    /**
+     * Perform all functions for this task.
+     */
+    public function execute()
+    {
+        IMP::initialize();
+
+        /* IMP 4 upgrade: check for old, non-existent sort values.
+         * See Bug #7296. */
+        $sortby = $GLOBALS['prefs']->getValue('sortby');
+        if ($sortby > 10) {
+            $GLOBALS['prefs']->setValue('sortby', Horde_Imap_Client::SORT_ARRIVAL);
+        }
+    }
+
+}