| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* 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
*/
/**
* @param null|object $state
* @param string $method
* @param null|string $name
*/
- function __construct($state = NULL,
+ public function __construct(
+ $state = NULL,
$action = CRM_Core_Action::NONE,
$method = 'post',
- $name = NULL
+ $name = NULL
) {
$this->_config = CRM_Core_Config::singleton();
// sample test list
/* $revList = array(
- '2.1.0', '2.2.beta2', '2.2.beta1', '2.2.alpha1', */
+ '2.1.0', '2.2.beta2', '2.2.beta1', '2.2.alpha1', */
/* '2.2.alpha3', '2.2.0', '2.2.2', '2.1.alpha1', '2.1.3'); */
-
usort($revList, 'version_compare');
return $revList;
}
public function processSQL($rev) {
$sqlFile = implode(DIRECTORY_SEPARATOR,
array(
- dirname(__FILE__), 'Incremental',
- 'sql', $rev . '.mysql',
+ dirname(__FILE__),
+ 'Incremental',
+ 'sql',
+ $rev . '.mysql',
)
);
$tplFile = "$sqlFile.tpl";
*/
public function getUpgradeVersions() {
$latestVer = CRM_Utils_System::version();
- $currentVer = CRM_Core_BAO_Domain::version(true);
+ $currentVer = CRM_Core_BAO_Domain::version(TRUE);
if (!$currentVer) {
CRM_Core_Error::fatal(ts('Version information missing in civicrm database.'));
}
$minPhpVersion = '5.3.3';
if (version_compare($phpVersion, $minPhpVersion) < 0) {
$error = ts('CiviCRM %3 requires PHP version %1 (or newer), but the current system uses %2 ',
- array(
- 1 => $minPhpVersion,
- 2 => $phpVersion,
- 3 => $latestVer
- ));
+ array(
+ 1 => $minPhpVersion,
+ 2 => $phpVersion,
+ 3 => $latestVer,
+ ));
}
// check for mysql trigger privileges
if (!CRM_Core_DAO::checkTriggerViewPermission(FALSE, TRUE)) {
$error = ts('CiviCRM %1 requires MySQL trigger privileges.',
- array(1 => $latestVer));
+ array(1 => $latestVer));
}
- if (CRM_Core_DAO::getGlobalSetting('thread_stack', 0) < (1024*self::MINIMUM_THREAD_STACK)) {
+ if (CRM_Core_DAO::getGlobalSetting('thread_stack', 0) < (1024 * self::MINIMUM_THREAD_STACK)) {
$error = ts('CiviCRM %1 requires MySQL thread stack >= %2k', array(
1 => $latestVer,
- 2 => self::MINIMUM_THREAD_STACK
+ 2 => self::MINIMUM_THREAD_STACK,
));
}
/**
* 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 string $currentVer
+ * the original revision.
+ * @param string $latestVer
+ * the target (final) revision.
+ * @param string $postUpgradeMessageFile
+ * path of a modifiable file which lists the post-upgrade messages.
*
* @return CRM_Queue
*/
CRM_Core_Error::fatal(ts('Failed to find or create queueing table'));
}
$queue = CRM_Queue_Service::singleton()->create(array(
- 'name' => self::QUEUE_NAME,
- 'type' => 'Sql',
- 'reset' => TRUE,
- ));
+ 'name' => self::QUEUE_NAME,
+ 'type' => 'Sql',
+ 'reset' => TRUE,
+ ));
$revisions = $upgrade->getRevisionSequence();
foreach ($revisions as $rev) {
// proceed only if $currentVer < $rev
if (version_compare($currentVer, $rev) < 0) {
$beginTask = new CRM_Queue_Task(
- // callback
+ // callback
array('CRM_Upgrade_Form', 'doIncrementalUpgradeStart'),
// arguments
array($rev),
$queue->createItem($beginTask);
$task = new CRM_Queue_Task(
- // callback
+ // callback
array('CRM_Upgrade_Form', 'doIncrementalUpgradeStep'),
// arguments
array($rev, $currentVer, $latestVer, $postUpgradeMessageFile),
$queue->createItem($task);
$task = new CRM_Queue_Task(
- // callback
+ // callback
array('CRM_Upgrade_Form', 'doIncrementalUpgradeFinish'),
// arguments
array($rev, $currentVer, $latestVer, $postUpgradeMessageFile),
* Perform an incremental version update
*
* @param CRM_Queue_TaskContext $ctx
- * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
+ * @param string $rev
+ * the target (intermediate) revision e.g '3.2.alpha1'.
*
* @return bool
*/
* 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 string $rev
+ * the target (intermediate) revision e.g '3.2.alpha1'.
+ * @param string $originalVer
+ * the original revision.
+ * @param string $latestVer
+ * the target (final) revision.
+ * @param string $postUpgradeMessageFile
+ * path of a modifiable file which lists the post-upgrade messages.
*
* @return bool
*/
- public 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);
// pre-db check for major release.
if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
if (!(is_callable(array(
- $versionObject, 'verifyPreDBstate')))) {
+ $versionObject,
+ 'verifyPreDBstate',
+ )))
+ ) {
CRM_Core_Error::fatal("verifyPreDBstate method was not found for $rev");
}
$upgrade->setSchemaStructureTables($rev);
if (is_callable(array(
- $versionObject, $phpFunctionName))) {
+ $versionObject,
+ $phpFunctionName,
+ ))) {
$versionObject->$phpFunctionName($rev, $originalVer, $latestVer);
}
else {
// set post-upgrade-message if any
if (is_callable(array(
- $versionObject, 'setPostUpgradeMessage'))) {
+ $versionObject,
+ 'setPostUpgradeMessage',
+ ))) {
$postUpgradeMessage = file_get_contents($postUpgradeMessageFile);
$versionObject->setPostUpgradeMessage($postUpgradeMessage, $rev);
file_put_contents($postUpgradeMessageFile, $postUpgradeMessage);
- } else {
+ }
+ else {
$postUpgradeMessage = file_get_contents($postUpgradeMessageFile);
CRM_Upgrade_Incremental_Legacy::setPostUpgradeMessage($postUpgradeMessage, $rev);
file_put_contents($postUpgradeMessageFile, $postUpgradeMessage);
* 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 string $rev
+ * the target (intermediate) revision e.g '3.2.alpha1'.
+ * @param string $currentVer
+ * the original revision.
+ * @param string $latestVer
+ * the target (final) revision.
+ * @param string $postUpgradeMessageFile
+ * path of a modifiable file which lists the post-upgrade messages.
*
* @return bool
*/
* by calling the 'setPreUpgradeMessage' on each incremental upgrade
* object.
*
- * @param $preUpgradeMessage string, alterable
+ * @param string $preUpgradeMessage
+ * alterable.
* @param $currentVer
* @param $latestVer
*/
version_compare($rev, '3.2.alpha1') > 0
) {
$versionObject = $this->incrementalPhpObject($rev);
- if (is_callable(array(
- $versionObject, 'setPreUpgradeMessage'))) {
- $versionObject->setPreUpgradeMessage($preUpgradeMessage, $rev, $currentVer);
- }
+ if (is_callable(array(
+ $versionObject,
+ 'setPreUpgradeMessage',
+ ))) {
+ $versionObject->setPreUpgradeMessage($preUpgradeMessage, $rev, $currentVer);
+ }
}
}
}
+
}