INFRA-132 - CRM/Upgrade - Convert single-line @param to multi-line
[civicrm-core.git] / CRM / Upgrade / Form.php
index 6f9dda2573e2e69cca9c966611d8d2dba6d9d12e..05f578c7d8018a7bcbf523e3fb6d7dee680db14c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -33,7 +33,7 @@
  *
  */
 class CRM_Upgrade_Form extends CRM_Core_Form {
-  CONST QUEUE_NAME = 'CRM_Upgrade';
+  const QUEUE_NAME = 'CRM_Upgrade';
 
   /**
    * Minimum size of MySQL's thread_stack option
@@ -48,7 +48,6 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * Upgrade for multilingual
    *
    * @var boolean
-   * @public
    */
   public $multilingual = FALSE;
 
@@ -56,7 +55,6 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * Locales available for multilingual upgrade
    *
    * @var array
-   * @public
    */
   public $locales;
 
@@ -64,7 +62,6 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * Number to string mapper
    *
    * @var array
-   * @public
    */
   static $_numberMap = array(
     0 => 'Zero',
@@ -85,10 +82,13 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * We should not use QuickForm directly. This class provides a lot
    * of default convenient functions, rules and buttons
    *
-   * @param object $state State associated with this form
+   * @param object $state
+   *   State associated with this form.
    * @param \const|\enum $action The mode the form is operating in (None/Create/View/Update/Delete)
-   * @param string $method The type of http method used (GET/POST)
-   * @param string $name The name of the form if different from class name
+   * @param string $method
+   *   The type of http method used (GET/POST).
+   * @param string $name
+   *   The name of the form if different from class name.
    *
    * @return \CRM_Core_Form
   @access public
@@ -131,7 +131,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    *
    * @return mixed
    */
-  static function &incrementalPhpObject($version) {
+  public static function &incrementalPhpObject($version) {
     static $incrementalPhpObject = array();
 
     $versionParts = explode('.', $version);
@@ -150,7 +150,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    *
    * @return bool
    */
-  function checkVersionRelease($version, $release) {
+  public function checkVersionRelease($version, $release) {
     $versionParts = explode('.', $version);
     if ($versionParts[2] == $release) {
       return TRUE;
@@ -163,7 +163,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    *
    * @return array
    */
-  function checkSQLConstraints(&$constraints) {
+  public function checkSQLConstraints(&$constraints) {
     $pass = $fail = 0;
     foreach ($constraints as $constraint) {
       if ($this->checkSQLConstraint($constraint)) {
@@ -181,7 +181,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    *
    * @return bool
    */
-  function checkSQLConstraint($constraint) {
+  public function checkSQLConstraint($constraint) {
     // check constraint here
     return TRUE;
   }
@@ -190,14 +190,14 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * @param string $fileName
    * @param bool $isQueryString
    */
-  function source($fileName, $isQueryString = FALSE) {
+  public function source($fileName, $isQueryString = FALSE) {
 
     CRM_Utils_File::sourceSQLFile($this->_config->dsn,
       $fileName, NULL, $isQueryString
     );
   }
 
-  function preProcess() {
+  public function preProcess() {
     CRM_Utils_System::setTitle($this->getTitle());
     if (!$this->verifyPreDBState($errorMessage)) {
       if (!isset($errorMessage)) {
@@ -208,7 +208,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
     $this->assign('recentlyViewed', FALSE);
   }
 
-  function buildQuickForm() {
+  public function buildQuickForm() {
     $this->addDefaultButtons($this->getButtonTitle(),
       'next',
       NULL,
@@ -220,26 +220,25 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * Getter function for title. Should be over-ridden by derived class
    *
    * @return string
-   * @access public
    */
   /**
    * @return string
    */
-  function getTitle() {
+  public function getTitle() {
     return ts('Title not Set');
   }
 
   /**
    * @return string
    */
-  function getFieldsetTitle() {
+  public function getFieldsetTitle() {
     return ts('');
   }
 
   /**
    * @return string
    */
-  function getButtonTitle() {
+  public function getButtonTitle() {
     return ts('Continue');
   }
 
@@ -247,12 +246,11 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    * Use the form name to create the tpl file name
    *
    * @return string
-   * @access public
    */
   /**
    * @return string
    */
-  function getTemplateFileName() {
+  public function getTemplateFileName() {
     $this->assign('title',
       $this->getFieldsetTitle()
     );
@@ -262,7 +260,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
     return 'CRM/Upgrade/Base.tpl';
   }
 
-  function postProcess() {
+  public function postProcess() {
     $this->upgrade();
 
     if (!$this->verifyPostDBState($errorMessage)) {
@@ -278,7 +276,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    *
    * @return Object
    */
-  function runQuery($query) {
+  public function runQuery($query) {
     return CRM_Core_DAO::executeQuery($query,
       CRM_Core_DAO::$_nullArray
     );
@@ -289,7 +287,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
    *
    * @return Object
    */
-  function setVersion($version) {
+  public function setVersion($version) {
     $this->logVersion($version);
 
     $query = "
@@ -304,7 +302,7 @@ SET    version = '$version'
    *
    * @return bool
    */
-  function logVersion($newVersion) {
+  public function logVersion($newVersion) {
     if ($newVersion) {
       $oldVersion = CRM_Core_BAO_Domain::version();
 
@@ -329,7 +327,7 @@ SET    version = '$version'
    *
    * @return bool
    */
-  function checkVersion($version) {
+  public function checkVersion($version) {
     $domainID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain',
       $version, 'id',
       'version'
@@ -341,7 +339,7 @@ SET    version = '$version'
    * @return array
    * @throws Exception
    */
-  function getRevisionSequence() {
+  public function getRevisionSequence() {
     $revList = array();
     $sqlDir = implode(DIRECTORY_SEPARATOR,
       array(dirname(__FILE__), 'Incremental', 'sql')
@@ -377,7 +375,7 @@ SET    version = '$version'
    *
    * @return null
    */
-  static function getRevisionPart($rev, $index = 1) {
+  public static function getRevisionPart($rev, $index = 1) {
     $revPattern = '/^((\d{1,2})\.\d{1,2})\.(\d{1,2}|\w{4,7})?$/i';
     preg_match($revPattern, $rev, $matches);
 
@@ -390,7 +388,7 @@ SET    version = '$version'
    *
    * @return bool
    */
-  function processLocales($tplFile, $rev) {
+  public function processLocales($tplFile, $rev) {
     $smarty = CRM_Core_Smarty::singleton();
     $smarty->assign('domainID', CRM_Core_Config::domainID());
 
@@ -405,7 +403,7 @@ SET    version = '$version'
   /**
    * @param $rev
    */
-  function setSchemaStructureTables($rev) {
+  public function setSchemaStructureTables($rev) {
     if ($this->multilingual) {
       CRM_Core_I18n_Schema::schemaStructureTables($rev, TRUE);
     }
@@ -416,7 +414,7 @@ SET    version = '$version'
    *
    * @throws Exception
    */
-  function processSQL($rev) {
+  public function processSQL($rev) {
     $sqlFile = implode(DIRECTORY_SEPARATOR,
       array(
         dirname(__FILE__), 'Incremental',
@@ -441,7 +439,7 @@ SET    version = '$version'
    *
    * @return array(0=>$currentVer, 1=>$latestVer)
    */
-  function getUpgradeVersions() {
+  public function getUpgradeVersions() {
     $latestVer = CRM_Utils_System::version();
     $currentVer = CRM_Core_BAO_Domain::version(true);
     if (!$currentVer) {
@@ -477,7 +475,7 @@ SET    version = '$version'
    *
    * @return mixed, a string error message or boolean 'false' if OK
    */
-  function checkUpgradeableVersion($currentVer, $latestVer) {
+  public function checkUpgradeableVersion($currentVer, $latestVer) {
     $error = FALSE;
     // since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
     // lets do a pattern check -
@@ -531,7 +529,7 @@ SET    version = '$version'
    *
    * @return mixed, a string error message or boolean 'false' if OK
    */
-  function checkCurrentVersion($currentVer, $latestVer) {
+  public function checkCurrentVersion($currentVer, $latestVer) {
     $error = FALSE;
 
     // since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
@@ -550,13 +548,16 @@ SET    version = '$version'
   /**
    * Fill the queue with upgrade tasks
    *
-   * @param $currentVer string, the original revision
-   * @param $latestVer string, the target (final) revision
-   * @param $postUpgradeMessageFile string, path of a modifiable file which lists the post-upgrade messages
+   * @param $currentVer
+   *   String, the original revision.
+   * @param $latestVer
+   *   String, the target (final) revision.
+   * @param $postUpgradeMessageFile
+   *   String, path of a modifiable file which lists the post-upgrade messages.
    *
    * @return CRM_Queue
    */
-  static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
+  public static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
     $upgrade = new CRM_Upgrade_Form();
 
     // hack to make 4.0.x (D7,J1.6) codebase go through 3.4.x (d6, J1.5) upgrade files,
@@ -615,11 +616,12 @@ SET    version = '$version'
    * Perform an incremental version update
    *
    * @param CRM_Queue_TaskContext $ctx
-   * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
+   * @param $rev
+   *   String, the target (intermediate) revision e.g '3.2.alpha1'.
    *
    * @return bool
    */
-  static function doIncrementalUpgradeStart(CRM_Queue_TaskContext $ctx, $rev) {
+  public static function doIncrementalUpgradeStart(CRM_Queue_TaskContext $ctx, $rev) {
     $upgrade = new CRM_Upgrade_Form();
 
     // as soon as we start doing anything we append ".upgrade" to version.
@@ -633,14 +635,18 @@ SET    version = '$version'
    * Perform an incremental version update
    *
    * @param CRM_Queue_TaskContext $ctx
-   * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
-   * @param $originalVer string, the original revision
-   * @param $latestVer string, the target (final) revision
-   * @param $postUpgradeMessageFile string, path of a modifiable file which lists the post-upgrade messages
+   * @param $rev
+   *   String, the target (intermediate) revision e.g '3.2.alpha1'.
+   * @param $originalVer
+   *   String, the original revision.
+   * @param $latestVer
+   *   String, the target (final) revision.
+   * @param $postUpgradeMessageFile
+   *   String, path of a modifiable file which lists the post-upgrade messages.
    *
    * @return bool
    */
-  static function doIncrementalUpgradeStep(CRM_Queue_TaskContext$ctx, $rev, $originalVer, $latestVer, $postUpgradeMessageFile) {
+  public static function doIncrementalUpgradeStep(CRM_Queue_TaskContext$ctx, $rev, $originalVer, $latestVer, $postUpgradeMessageFile) {
     $upgrade = new CRM_Upgrade_Form();
 
     $phpFunctionName = 'upgrade_' . str_replace('.', '_', $rev);
@@ -693,14 +699,18 @@ SET    version = '$version'
    * Perform an incremental version update
    *
    * @param CRM_Queue_TaskContext $ctx
-   * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
-   * @param $currentVer string, the original revision
-   * @param $latestVer string, the target (final) revision
-   * @param $postUpgradeMessageFile string, path of a modifiable file which lists the post-upgrade messages
+   * @param $rev
+   *   String, the target (intermediate) revision e.g '3.2.alpha1'.
+   * @param $currentVer
+   *   String, the original revision.
+   * @param $latestVer
+   *   String, the target (final) revision.
+   * @param $postUpgradeMessageFile
+   *   String, path of a modifiable file which lists the post-upgrade messages.
    *
    * @return bool
    */
-  static function doIncrementalUpgradeFinish(CRM_Queue_TaskContext $ctx, $rev, $currentVer, $latestVer, $postUpgradeMessageFile) {
+  public static function doIncrementalUpgradeFinish(CRM_Queue_TaskContext $ctx, $rev, $currentVer, $latestVer, $postUpgradeMessageFile) {
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->setVersion($rev);
     CRM_Utils_System::flushCache();
@@ -710,7 +720,7 @@ SET    version = '$version'
     return TRUE;
   }
 
-  static function doFinish() {
+  public static function doFinish() {
     $upgrade = new CRM_Upgrade_Form();
     list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
     // Seems extraneous in context, but we'll preserve old behavior
@@ -740,11 +750,12 @@ SET    version = '$version'
    * by calling the 'setPreUpgradeMessage' on each incremental upgrade
    * object.
    *
-   * @param $preUpgradeMessage string, alterable
+   * @param $preUpgradeMessage
+   *   String, alterable.
    * @param $currentVer
    * @param $latestVer
    */
-  function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
+  public function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
     CRM_Upgrade_Incremental_Legacy::setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
 
     // Scan through all php files and see if any file is interested in setting pre-upgrade-message