comment fixes
[civicrm-core.git] / CRM / Upgrade / Incremental / php / FourSix.php
index d3ad74d7c8d1ec8d57a93e8bb3d80a12a9178767..2c1f3113b2e539f4923107dcf6e13f3a281f280a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6.alpha1                                         |
+ | CiviCRM version 4.7.alpha1                                         |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  */
 
 /**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
+ * Upgrade logic for 4.6
  */
-class CRM_Upgrade_Incremental_php_FourSix {
-  const BATCH_SIZE = 5000;
-
-  /**
-   * Verify DB state.
-   *
-   * @param $errors
-   *
-   * @return bool
-   */
-  public function verifyPreDBstate(&$errors) {
-    return TRUE;
-  }
-
-  /**
-   * Compute any messages which should be displayed before upgrade.
-   *
-   * Note: This function is called iteratively for each upcoming
-   * revision to the database.
-   *
-   * @param $preUpgradeMessage
-   * @param string $rev
-   *   a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
-   * @param null $currentVer
-   */
-  public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
-  }
+class CRM_Upgrade_Incremental_php_FourSix extends CRM_Upgrade_Incremental_Base {
 
   /**
    * Compute any messages which should be displayed after upgrade.
@@ -66,7 +37,6 @@ class CRM_Upgrade_Incremental_php_FourSix {
    *   alterable.
    * @param string $rev
    *   an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
-   * @return void
    */
   public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
     if ($rev == '4.6.alpha1') {
@@ -77,41 +47,6 @@ class CRM_Upgrade_Incremental_php_FourSix {
     }
   }
 
-
-  /**
-   * (Queue Task Callback)
-   */
-  public static function task_4_6_x_runSql(CRM_Queue_TaskContext $ctx, $rev) {
-    $upgrade = new CRM_Upgrade_Form();
-    $upgrade->processSQL($rev);
-
-    return TRUE;
-  }
-
-  /**
-   * Syntactic sugar for adding a task which (a) is in this class and (b) has
-   * a high priority.
-   *
-   * After passing the $funcName, you can also pass parameters that will go to
-   * the function. Note that all params must be serializable.
-   */
-  protected function addTask($title, $funcName) {
-    $queue = CRM_Queue_Service::singleton()->load(array(
-      'type' => 'Sql',
-      'name' => CRM_Upgrade_Form::QUEUE_NAME,
-    ));
-
-    $args = func_get_args();
-    $title = array_shift($args);
-    $funcName = array_shift($args);
-    $task = new CRM_Queue_Task(
-      array(get_class($this), $funcName),
-      $args,
-      $title
-    );
-    $queue->createItem($task, array('weight' => -1));
-  }
-
   /**
    * CRM-16846 - This function incorrectly omits running the 4.6.alpha3 sql file.
    *
@@ -210,7 +145,7 @@ class CRM_Upgrade_Incremental_php_FourSix {
     // CRM-16846 - This sql file may have been previously skipped. No harm in running it again because it's just UPDATE statements.
     $this->addTask('State-province update from 4.4.7', 'task_4_6_x_runOnlySql', '4.4.7');
 
-    $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_6_x_runSql', $rev);
+    $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
   }
 
   /**