Update version to 4.6.alpha3
[civicrm-core.git] / CRM / Upgrade / Incremental / Legacy.php
index e489ce0d05c6e215af97813a14fc1c81b0ae21e7..b893d3b2b796199ff01db9f0b31aadd46eaf208c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -42,11 +42,12 @@ class CRM_Upgrade_Incremental_Legacy {
   /**
    * Compute any messages which should be displayed before upgrade
    *
-   * @param $preUpgradeMessage string, alterable
+   * @param string $preUpgradeMessage
+   *   alterable.
    * @param $currentVer
    * @param $latestVer
    */
-  static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
+  public static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
     $upgrade = new CRM_Upgrade_Form();
     $template = CRM_Core_Smarty::singleton();
 
@@ -80,7 +81,10 @@ SELECT  id
       version_compare($upgradeTo, '3.4.beta3') >= 0
     ) {
       $config = CRM_Core_Config::singleton();
-      $preUpgradeMessage .= '<br />' . ts("As per <a href='%1'>the related blog post</a>, we are making contact names, addresses and mailings monolingual; the values entered for the default locale (%2) will be preserved and values for other locales removed.", array(1 => 'http://civicrm.org/blogs/shot/multilingual-civicrm-3440-making-some-fields-monolingual', 2 => $config->lcMessages));
+      $preUpgradeMessage .= '<br />' . ts("As per <a href='%1'>the related blog post</a>, we are making contact names, addresses and mailings monolingual; the values entered for the default locale (%2) will be preserved and values for other locales removed.", array(
+            1 => 'http://civicrm.org/blogs/shot/multilingual-civicrm-3440-making-some-fields-monolingual',
+            2 => $config->lcMessages
+          ));
     }
 
     if (version_compare($currentVer, '3.4.6') == -1 &&
@@ -102,16 +106,17 @@ SELECT  id
     if (file_exists($ofcFile)) {
       if (@unlink($ofcFile)) {
         $preUpgradeMessage .= '<br />' . ts('This system included an outdated, insecure script (%1). The file was automatically deleted.', array(
-          1 => $ofcFile
-        ));
-      } else {
+            1 => $ofcFile,
+          ));
+      }
+      else {
         $preUpgradeMessage .= '<br />' . ts('This system includes an outdated, insecure script (%1). Please delete it.', array(
-          1 => $ofcFile
-        ));
+            1 => $ofcFile,
+          ));
       }
     }
 
-    if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_innodb_fts', NULL, FALSE)) {
+    if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'enable_innodb_fts', NULL, FALSE)) {
       // The FTS indexing feature dynamically manipulates the schema which could
       // cause conflicts with other layers that manipulate the schema. The
       // simplest thing is to turn it off and back on.
@@ -131,7 +136,7 @@ SELECT  id
    * @param $latestVer
    * @param $currentVer
    */
-  static function checkMessageTemplate(&$template, &$message, $latestVer, $currentVer) {
+  public static function checkMessageTemplate(&$template, &$message, $latestVer, $currentVer) {
     if (version_compare($currentVer, '3.1.alpha1') < 0) {
       return;
     }
@@ -156,9 +161,9 @@ SELECT  id
       return;
     }
 
-    $html     = NULL;
+    $html = NULL;
     $pathName = dirname(dirname(__FILE__));
-    $flag     = FALSE;
+    $flag = FALSE;
     foreach ($workflows as $workflow => $title) {
       $name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
         $workflow,
@@ -196,18 +201,23 @@ SELECT  id
     if ($flag == TRUE) {
       $html = "<ul>" . $html . "<ul>";
 
-      $message .= '<br />' . ts("The default copies of the message templates listed below will be updated to handle new features. Your installation has customized versions of these message templates, and you will need to apply the updates manually after running this upgrade. <a href='%1' style='color:white; text-decoration:underline; font-weight:bold;' target='_blank'>Click here</a> for detailed instructions. %2", array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates', 2 => $html));
+      $message .= '<br />' . ts("The default copies of the message templates listed below will be updated to handle new features or correct a problem. Your installation has customized versions of these message templates, and you will need to apply the updates manually after running this upgrade. <a href='%1' style='color:white; text-decoration:underline; font-weight:bold;' target='_blank'>Click here</a> for detailed instructions. %2", array(
+            1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates',
+            2 => $html
+          ));
     }
   }
 
   /**
    * Compute any messages which should be displayed after upgrade
    *
-   * @param $postUpgradeMessage string, alterable
-   * @param $rev string, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs
+   * @param string $postUpgradeMessage
+   *   alterable.
+   * @param string $rev
+   *   an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
    * @return void
    */
-  static function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+  public static function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
     if ($rev == '3.2.alpha1') {
       $postUpgradeMessage .= '<br />' . ts("We have reset the COUNTED flag to false for the event participant status 'Pending from incomplete transaction'. This change ensures that people who have a problem during registration can try again.");
     }
@@ -238,7 +248,10 @@ SELECT  id
 
         if (!empty($subTypeTemplates)) {
           $subTypeTemplates = implode(',', $subTypeTemplates);
-          $postUpgradeMessage .= '<br />' . ts('You are using custom template for contact subtypes: %1.', array(1 => $subTypeTemplates)) . '<br />' . ts('You need to move these subtype templates to the SubType directory in %1 and %2 respectively.', array(1 => 'CRM/Contact/Form/Edit', 2 => 'CRM/Contact/Page/View'));
+          $postUpgradeMessage .= '<br />' . ts('You are using custom template for contact subtypes: %1.', array(1 => $subTypeTemplates)) . '<br />' . ts('You need to move these subtype templates to the SubType directory in %1 and %2 respectively.', array(
+                1 => 'CRM/Contact/Form/Edit',
+                2 => 'CRM/Contact/Page/View'
+              ));
         }
       }
     }
@@ -268,9 +281,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_2_2_alpha1($rev) {
+  public static function upgrade_2_2_alpha1($rev) {
     for ($stepID = 1; $stepID <= 4; $stepID++) {
       $formName = "CRM_Upgrade_TwoTwo_Form_Step{$stepID}";
       $form = new $formName();
@@ -290,9 +304,9 @@ SELECT  count( id ) as statusCount
       $template = CRM_Core_Smarty::singleton();
 
       $eventFees = array();
-      $query     = "SELECT og.id ogid FROM civicrm_option_group og WHERE og.name LIKE  %1";
-      $params    = array(1 => array('civicrm_event_page.amount%', 'String'));
-      $dao       = CRM_Core_DAO::executeQuery($query, $params);
+      $query = "SELECT og.id ogid FROM civicrm_option_group og WHERE og.name LIKE  %1";
+      $params = array(1 => array('civicrm_event_page.amount%', 'String'));
+      $dao = CRM_Core_DAO::executeQuery($query, $params);
       while ($dao->fetch()) {
         $eventFees[$dao->ogid] = $dao->ogid;
       }
@@ -312,9 +326,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_2_1_2($rev) {
+  public static function upgrade_2_1_2($rev) {
     $formName = "CRM_Upgrade_TwoOne_Form_TwoOneTwo";
     $form = new $formName($rev);
 
@@ -339,9 +354,8 @@ SELECT  count( id ) as statusCount
   /**
    * This function should check if if need to skip current sql file
    * Name of this function will change according to the latest release
-   *
    */
-  static function upgrade_2_2_alpha3($rev) {
+  public static function upgrade_2_2_alpha3($rev) {
     // skip processing sql file, if fresh install -
     if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'mail_protocol', 'id', 'name')) {
       $upgrade = new CRM_Upgrade_Form();
@@ -353,9 +367,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_2_2_beta1($rev) {
+  public static function upgrade_2_2_beta1($rev) {
     if (!CRM_Core_DAO::checkFieldExists('civicrm_pcp_block', 'notify_email')) {
       $template = CRM_Core_Smarty::singleton();
       $template->assign('notifyAbsent', TRUE);
@@ -367,18 +382,21 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_2_2_beta2($rev) {
+  public static function upgrade_2_2_beta2($rev) {
     $template = CRM_Core_Smarty::singleton();
     if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
-        'CRM_Contact_Form_Search_Custom_ZipCodeRange', 'id', 'name'
-      )) {
+      'CRM_Contact_Form_Search_Custom_ZipCodeRange', 'id', 'name'
+    )
+    ) {
       $template->assign('customSearchAbsentAll', TRUE);
     }
     elseif (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
-        'CRM_Contact_Form_Search_Custom_MultipleValues', 'id', 'name'
-      )) {
+      'CRM_Contact_Form_Search_Custom_MultipleValues', 'id', 'name'
+    )
+    ) {
       $template->assign('customSearchAbsent', TRUE);
     }
     $upgrade = new CRM_Upgrade_Form();
@@ -388,9 +406,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_2_2_beta3($rev) {
+  public static function upgrade_2_2_beta3($rev) {
     $template = CRM_Core_Smarty::singleton();
     if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'custom_data_type', 'id', 'name')) {
       $template->assign('customDataType', TRUE);
@@ -403,9 +422,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_0_alpha1($rev) {
+  public static function upgrade_3_0_alpha1($rev) {
 
     $threeZero = new CRM_Upgrade_ThreeZero_ThreeZero();
 
@@ -423,9 +443,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_1_alpha1($rev) {
+  public static function upgrade_3_1_alpha1($rev) {
 
     $threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
 
@@ -443,9 +464,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_2_2_7($rev) {
+  public static function upgrade_2_2_7($rev) {
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->processSQL($rev);
     $sql = "UPDATE civicrm_report_instance
@@ -475,9 +497,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_0_2($rev) {
+  public static function upgrade_3_0_2($rev) {
 
     $template = CRM_Core_Smarty::singleton();
     //check whether upgraded from 2.1.x or 2.2.x
@@ -497,9 +520,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_0_4($rev) {
+  public static function upgrade_3_0_4($rev) {
     //make sure 'Deceased' membership status present in db,CRM-5636
     $template = CRM_Core_Smarty::singleton();
 
@@ -517,14 +541,17 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_1_0($rev) {
+  public static function upgrade_3_1_0($rev) {
     // upgrade all roles who have 'access CiviEvent' permission, to also have
     // newly added permission 'edit_all_events', CRM-5472
     $config = CRM_Core_Config::singleton();
     if (is_callable(array(
-      $config->userSystem, 'replacePermission'))) {
+      $config->userSystem,
+      'replacePermission'
+    ))) {
       $config->userSystem->replacePermission('access CiviEvent', array('access CiviEvent', 'edit all events'));
     }
 
@@ -545,9 +572,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_1_3($rev) {
+  public static function upgrade_3_1_3($rev) {
     $threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
     $threeOne->upgrade_3_1_3();
 
@@ -558,9 +586,10 @@ SELECT  count( id ) as statusCount
   /**
    * Perform an incremental upgrade
    *
-   * @param $rev string, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final)
+   * @param string $rev
+   *   the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
    */
-  static function upgrade_3_1_4($rev) {
+  public static function upgrade_3_1_4($rev) {
     $threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
     $threeOne->upgrade_3_1_4();
 
@@ -568,4 +597,3 @@ SELECT  count( id ) as statusCount
     $upgrade->processSQL($rev);
   }
 }
-