phpcs - Fix error, "Visibility must be declared on method"
[civicrm-core.git] / CRM / Upgrade / Form.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2014
32 * $Id$
33 *
34 */
35 class CRM_Upgrade_Form extends CRM_Core_Form {
36 const QUEUE_NAME = 'CRM_Upgrade';
37
38 /**
39 * Minimum size of MySQL's thread_stack option
40 *
41 * @see install/index.php MINIMUM_THREAD_STACK
42 */
43 const MINIMUM_THREAD_STACK = 192;
44
45 protected $_config;
46
47 /**
48 * Upgrade for multilingual
49 *
50 * @var boolean
51 * @public
52 */
53 public $multilingual = FALSE;
54
55 /**
56 * Locales available for multilingual upgrade
57 *
58 * @var array
59 * @public
60 */
61 public $locales;
62
63 /**
64 * Number to string mapper
65 *
66 * @var array
67 * @public
68 */
69 static $_numberMap = array(
70 0 => 'Zero',
71 1 => 'One',
72 2 => 'Two',
73 3 => 'Three',
74 4 => 'Four',
75 5 => 'Five',
76 6 => 'Six',
77 7 => 'Seven',
78 8 => 'Eight',
79 9 => 'Nine',
80 );
81
82 /**
83 * Constructor for the basic form page
84 *
85 * We should not use QuickForm directly. This class provides a lot
86 * of default convenient functions, rules and buttons
87 *
88 * @param object $state State associated with this form
89 * @param \const|\enum $action The mode the form is operating in (None/Create/View/Update/Delete)
90 * @param string $method The type of http method used (GET/POST)
91 * @param string $name The name of the form if different from class name
92 *
93 * @return \CRM_Core_Form
94 @access public
95 */
96 /**
97 * @param null|object $state
98 * @param const|enum|int $action
99 * @param string $method
100 * @param null|string $name
101 */
102 function __construct($state = NULL,
103 $action = CRM_Core_Action::NONE,
104 $method = 'post',
105 $name = NULL
106 ) {
107 $this->_config = CRM_Core_Config::singleton();
108
109 $domain = new CRM_Core_DAO_Domain();
110 $domain->find(TRUE);
111
112 $this->multilingual = (bool) $domain->locales;
113 $this->locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
114
115 $smarty = CRM_Core_Smarty::singleton();
116 $smarty->compile_dir = $this->_config->templateCompileDir;
117 $smarty->assign('multilingual', $this->multilingual);
118 $smarty->assign('locales', $this->locales);
119
120 // we didn't call CRM_Core_BAO_ConfigSetting::retrieve(), so we need to set $dbLocale by hand
121 if ($this->multilingual) {
122 global $dbLocale;
123 $dbLocale = "_{$this->_config->lcMessages}";
124 }
125
126 parent::__construct($state, $action, $method, $name);
127 }
128
129 /**
130 * @param $version
131 *
132 * @return mixed
133 */
134 public static function &incrementalPhpObject($version) {
135 static $incrementalPhpObject = array();
136
137 $versionParts = explode('.', $version);
138 $versionName = self::$_numberMap[$versionParts[0]] . self::$_numberMap[$versionParts[1]];
139
140 if (!array_key_exists($versionName, $incrementalPhpObject)) {
141 $className = "CRM_Upgrade_Incremental_php_{$versionName}";
142 $incrementalPhpObject[$versionName] = new $className();
143 }
144 return $incrementalPhpObject[$versionName];
145 }
146
147 /**
148 * @param $version
149 * @param $release
150 *
151 * @return bool
152 */
153 public function checkVersionRelease($version, $release) {
154 $versionParts = explode('.', $version);
155 if ($versionParts[2] == $release) {
156 return TRUE;
157 }
158 return FALSE;
159 }
160
161 /**
162 * @param $constraints
163 *
164 * @return array
165 */
166 public function checkSQLConstraints(&$constraints) {
167 $pass = $fail = 0;
168 foreach ($constraints as $constraint) {
169 if ($this->checkSQLConstraint($constraint)) {
170 $pass++;
171 }
172 else {
173 $fail++;
174 }
175 return array($pass, $fail);
176 }
177 }
178
179 /**
180 * @param $constraint
181 *
182 * @return bool
183 */
184 public function checkSQLConstraint($constraint) {
185 // check constraint here
186 return TRUE;
187 }
188
189 /**
190 * @param string $fileName
191 * @param bool $isQueryString
192 */
193 public function source($fileName, $isQueryString = FALSE) {
194
195 CRM_Utils_File::sourceSQLFile($this->_config->dsn,
196 $fileName, NULL, $isQueryString
197 );
198 }
199
200 public function preProcess() {
201 CRM_Utils_System::setTitle($this->getTitle());
202 if (!$this->verifyPreDBState($errorMessage)) {
203 if (!isset($errorMessage)) {
204 $errorMessage = 'pre-condition failed for current upgrade step';
205 }
206 CRM_Core_Error::fatal($errorMessage);
207 }
208 $this->assign('recentlyViewed', FALSE);
209 }
210
211 public function buildQuickForm() {
212 $this->addDefaultButtons($this->getButtonTitle(),
213 'next',
214 NULL,
215 TRUE
216 );
217 }
218
219 /**
220 * Getter function for title. Should be over-ridden by derived class
221 *
222 * @return string
223 * @access public
224 */
225 /**
226 * @return string
227 */
228 public function getTitle() {
229 return ts('Title not Set');
230 }
231
232 /**
233 * @return string
234 */
235 public function getFieldsetTitle() {
236 return ts('');
237 }
238
239 /**
240 * @return string
241 */
242 public function getButtonTitle() {
243 return ts('Continue');
244 }
245
246 /**
247 * Use the form name to create the tpl file name
248 *
249 * @return string
250 * @access public
251 */
252 /**
253 * @return string
254 */
255 public function getTemplateFileName() {
256 $this->assign('title',
257 $this->getFieldsetTitle()
258 );
259 $this->assign('message',
260 $this->getTemplateMessage()
261 );
262 return 'CRM/Upgrade/Base.tpl';
263 }
264
265 public function postProcess() {
266 $this->upgrade();
267
268 if (!$this->verifyPostDBState($errorMessage)) {
269 if (!isset($errorMessage)) {
270 $errorMessage = 'post-condition failed for current upgrade step';
271 }
272 CRM_Core_Error::fatal($errorMessage);
273 }
274 }
275
276 /**
277 * @param $query
278 *
279 * @return Object
280 */
281 public function runQuery($query) {
282 return CRM_Core_DAO::executeQuery($query,
283 CRM_Core_DAO::$_nullArray
284 );
285 }
286
287 /**
288 * @param $version
289 *
290 * @return Object
291 */
292 public function setVersion($version) {
293 $this->logVersion($version);
294
295 $query = "
296 UPDATE civicrm_domain
297 SET version = '$version'
298 ";
299 return $this->runQuery($query);
300 }
301
302 /**
303 * @param $newVersion
304 *
305 * @return bool
306 */
307 public function logVersion($newVersion) {
308 if ($newVersion) {
309 $oldVersion = CRM_Core_BAO_Domain::version();
310
311 $session = CRM_Core_Session::singleton();
312 $logParams = array(
313 'entity_table' => 'civicrm_domain',
314 'entity_id' => 1,
315 'data' => "upgrade:{$oldVersion}->{$newVersion}",
316 // lets skip 'modified_id' for now, as it causes FK issues And
317 // is not very important for now.
318 'modified_date' => date('YmdHis'),
319 );
320 CRM_Core_BAO_Log::add($logParams);
321 return TRUE;
322 }
323
324 return FALSE;
325 }
326
327 /**
328 * @param $version
329 *
330 * @return bool
331 */
332 public function checkVersion($version) {
333 $domainID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain',
334 $version, 'id',
335 'version'
336 );
337 return $domainID ? TRUE : FALSE;
338 }
339
340 /**
341 * @return array
342 * @throws Exception
343 */
344 public function getRevisionSequence() {
345 $revList = array();
346 $sqlDir = implode(DIRECTORY_SEPARATOR,
347 array(dirname(__FILE__), 'Incremental', 'sql')
348 );
349 $sqlFiles = scandir($sqlDir);
350
351 $sqlFilePattern = '/^((\d{1,2}\.\d{1,2})\.(\d{1,2}\.)?(\d{1,2}|\w{4,7}))\.(my)?sql(\.tpl)?$/i';
352 foreach ($sqlFiles as $file) {
353 if (preg_match($sqlFilePattern, $file, $matches)) {
354 if ($matches[2] == '4.0') {
355 CRM_Core_Error::fatal(ts("4.0.x upgrade files shouldn't exist. Contact Lobo to discuss this. This is related to the issue CRM-7731."));
356 }
357 if (!in_array($matches[1], $revList)) {
358 $revList[] = $matches[1];
359 }
360 }
361 }
362
363 // sample test list
364 /* $revList = array(
365 '2.1.0', '2.2.beta2', '2.2.beta1', '2.2.alpha1', */
366
367 /* '2.2.alpha3', '2.2.0', '2.2.2', '2.1.alpha1', '2.1.3'); */
368
369
370 usort($revList, 'version_compare');
371 return $revList;
372 }
373
374 /**
375 * @param $rev
376 * @param int $index
377 *
378 * @return null
379 */
380 public static function getRevisionPart($rev, $index = 1) {
381 $revPattern = '/^((\d{1,2})\.\d{1,2})\.(\d{1,2}|\w{4,7})?$/i';
382 preg_match($revPattern, $rev, $matches);
383
384 return array_key_exists($index, $matches) ? $matches[$index] : NULL;
385 }
386
387 /**
388 * @param $tplFile
389 * @param $rev
390 *
391 * @return bool
392 */
393 public function processLocales($tplFile, $rev) {
394 $smarty = CRM_Core_Smarty::singleton();
395 $smarty->assign('domainID', CRM_Core_Config::domainID());
396
397 $this->source($smarty->fetch($tplFile), TRUE);
398
399 if ($this->multilingual) {
400 CRM_Core_I18n_Schema::rebuildMultilingualSchema($this->locales, $rev);
401 }
402 return $this->multilingual;
403 }
404
405 /**
406 * @param $rev
407 */
408 public function setSchemaStructureTables($rev) {
409 if ($this->multilingual) {
410 CRM_Core_I18n_Schema::schemaStructureTables($rev, TRUE);
411 }
412 }
413
414 /**
415 * @param $rev
416 *
417 * @throws Exception
418 */
419 public function processSQL($rev) {
420 $sqlFile = implode(DIRECTORY_SEPARATOR,
421 array(
422 dirname(__FILE__), 'Incremental',
423 'sql', $rev . '.mysql',
424 )
425 );
426 $tplFile = "$sqlFile.tpl";
427
428 if (file_exists($tplFile)) {
429 $this->processLocales($tplFile, $rev);
430 }
431 else {
432 if (!file_exists($sqlFile)) {
433 CRM_Core_Error::fatal("sqlfile - $rev.mysql not found.");
434 }
435 $this->source($sqlFile);
436 }
437 }
438
439 /**
440 * Determine the start and end version of the upgrade process
441 *
442 * @return array(0=>$currentVer, 1=>$latestVer)
443 */
444 public function getUpgradeVersions() {
445 $latestVer = CRM_Utils_System::version();
446 $currentVer = CRM_Core_BAO_Domain::version(true);
447 if (!$currentVer) {
448 CRM_Core_Error::fatal(ts('Version information missing in civicrm database.'));
449 }
450 elseif (stripos($currentVer, 'upgrade')) {
451 CRM_Core_Error::fatal(ts('Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.'));
452 }
453 if (!$latestVer) {
454 CRM_Core_Error::fatal(ts('Version information missing in civicrm codebase.'));
455 }
456
457 // hack to make past ver compatible /w new incremental upgrade process
458 $convertVer = array(
459 '2.1' => '2.1.0',
460 '2.2' => '2.2.alpha1',
461 '2.2.alph' => '2.2.alpha3',
462 // since 3.1.1 had domain.version set as 3.1.0
463 '3.1.0' => '3.1.1',
464 );
465 if (isset($convertVer[$currentVer])) {
466 $currentVer = $convertVer[$currentVer];
467 }
468
469 return array($currentVer, $latestVer);
470 }
471
472 /**
473 * Determine if $currentVer can be upgraded to $latestVer
474 *
475 * @param $currentVer
476 * @param $latestVer
477 *
478 * @return mixed, a string error message or boolean 'false' if OK
479 */
480 public function checkUpgradeableVersion($currentVer, $latestVer) {
481 $error = FALSE;
482 // since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
483 // lets do a pattern check -
484 if (!CRM_Utils_System::isVersionFormatValid($currentVer)) {
485 $error = ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.');
486 }
487 elseif (version_compare($currentVer, $latestVer) > 0) {
488 // DB version number is higher than codebase being upgraded to. This is unexpected condition-fatal error.
489 $error = ts('Your database is marked with an unexpected version number: %1. The automated upgrade to version %2 can not be run - and the %2 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using prior to beginning this upgrade until you resolve this problem.',
490 array(1 => $currentVer, 2 => $latestVer, 3 => $dbToolsLink)
491 );
492 }
493 elseif (version_compare($currentVer, $latestVer) == 0) {
494 $error = ts('Your database has already been upgraded to CiviCRM %1',
495 array(1 => $latestVer)
496 );
497 }
498
499 $phpVersion = phpversion();
500 $minPhpVersion = '5.3.3';
501 if (version_compare($phpVersion, $minPhpVersion) < 0) {
502 $error = ts('CiviCRM %3 requires PHP version %1 (or newer), but the current system uses %2 ',
503 array(
504 1 => $minPhpVersion,
505 2 => $phpVersion,
506 3 => $latestVer
507 ));
508 }
509
510 // check for mysql trigger privileges
511 if (!CRM_Core_DAO::checkTriggerViewPermission(FALSE, TRUE)) {
512 $error = ts('CiviCRM %1 requires MySQL trigger privileges.',
513 array(1 => $latestVer));
514 }
515
516 if (CRM_Core_DAO::getGlobalSetting('thread_stack', 0) < (1024*self::MINIMUM_THREAD_STACK)) {
517 $error = ts('CiviCRM %1 requires MySQL thread stack >= %2k', array(
518 1 => $latestVer,
519 2 => self::MINIMUM_THREAD_STACK
520 ));
521 }
522
523 return $error;
524 }
525
526 /**
527 * Determine if $currentver already matches $latestVer
528 *
529 * @param $currentVer
530 * @param $latestVer
531 *
532 * @return mixed, a string error message or boolean 'false' if OK
533 */
534 public function checkCurrentVersion($currentVer, $latestVer) {
535 $error = FALSE;
536
537 // since version is suppose to be in valid format at this point, especially after conversion ($convertVer),
538 // lets do a pattern check -
539 if (!CRM_Utils_System::isVersionFormatValid($currentVer)) {
540 $error = ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.');
541 }
542 elseif (version_compare($currentVer, $latestVer) != 0) {
543 $error = ts('Your database is not configured for version %1',
544 array(1 => $latestVer)
545 );
546 }
547 return $error;
548 }
549
550 /**
551 * Fill the queue with upgrade tasks
552 *
553 * @param $currentVer string, the original revision
554 * @param $latestVer string, the target (final) revision
555 * @param $postUpgradeMessageFile string, path of a modifiable file which lists the post-upgrade messages
556 *
557 * @return CRM_Queue
558 */
559 public static function buildQueue($currentVer, $latestVer, $postUpgradeMessageFile) {
560 $upgrade = new CRM_Upgrade_Form();
561
562 // hack to make 4.0.x (D7,J1.6) codebase go through 3.4.x (d6, J1.5) upgrade files,
563 // since schema wise they are same
564 if (CRM_Upgrade_Form::getRevisionPart($currentVer) == '4.0') {
565 $currentVer = str_replace('4.0.', '3.4.', $currentVer);
566 }
567
568 // Ensure that queue can be created
569 if (!CRM_Queue_BAO_QueueItem::findCreateTable()) {
570 CRM_Core_Error::fatal(ts('Failed to find or create queueing table'));
571 }
572 $queue = CRM_Queue_Service::singleton()->create(array(
573 'name' => self::QUEUE_NAME,
574 'type' => 'Sql',
575 'reset' => TRUE,
576 ));
577
578 $revisions = $upgrade->getRevisionSequence();
579 foreach ($revisions as $rev) {
580 // proceed only if $currentVer < $rev
581 if (version_compare($currentVer, $rev) < 0) {
582 $beginTask = new CRM_Queue_Task(
583 // callback
584 array('CRM_Upgrade_Form', 'doIncrementalUpgradeStart'),
585 // arguments
586 array($rev),
587 "Begin Upgrade to $rev"
588 );
589 $queue->createItem($beginTask);
590
591 $task = new CRM_Queue_Task(
592 // callback
593 array('CRM_Upgrade_Form', 'doIncrementalUpgradeStep'),
594 // arguments
595 array($rev, $currentVer, $latestVer, $postUpgradeMessageFile),
596 "Upgrade DB to $rev"
597 );
598 $queue->createItem($task);
599
600 $task = new CRM_Queue_Task(
601 // callback
602 array('CRM_Upgrade_Form', 'doIncrementalUpgradeFinish'),
603 // arguments
604 array($rev, $currentVer, $latestVer, $postUpgradeMessageFile),
605 "Finish Upgrade DB to $rev"
606 );
607 $queue->createItem($task);
608 }
609 }
610
611 return $queue;
612 }
613
614 /**
615 * Perform an incremental version update
616 *
617 * @param CRM_Queue_TaskContext $ctx
618 * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
619 *
620 * @return bool
621 */
622 public static function doIncrementalUpgradeStart(CRM_Queue_TaskContext $ctx, $rev) {
623 $upgrade = new CRM_Upgrade_Form();
624
625 // as soon as we start doing anything we append ".upgrade" to version.
626 // this also helps detect any partial upgrade issues
627 $upgrade->setVersion($rev . '.upgrade');
628
629 return TRUE;
630 }
631
632 /**
633 * Perform an incremental version update
634 *
635 * @param CRM_Queue_TaskContext $ctx
636 * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
637 * @param $originalVer string, the original revision
638 * @param $latestVer string, the target (final) revision
639 * @param $postUpgradeMessageFile string, path of a modifiable file which lists the post-upgrade messages
640 *
641 * @return bool
642 */
643 public static function doIncrementalUpgradeStep(CRM_Queue_TaskContext$ctx, $rev, $originalVer, $latestVer, $postUpgradeMessageFile) {
644 $upgrade = new CRM_Upgrade_Form();
645
646 $phpFunctionName = 'upgrade_' . str_replace('.', '_', $rev);
647
648 $versionObject = $upgrade->incrementalPhpObject($rev);
649
650 // pre-db check for major release.
651 if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
652 if (!(is_callable(array(
653 $versionObject, 'verifyPreDBstate')))) {
654 CRM_Core_Error::fatal("verifyPreDBstate method was not found for $rev");
655 }
656
657 $error = NULL;
658 if (!($versionObject->verifyPreDBstate($error))) {
659 if (!isset($error)) {
660 $error = "post-condition failed for current upgrade for $rev";
661 }
662 CRM_Core_Error::fatal($error);
663 }
664
665 }
666
667 $upgrade->setSchemaStructureTables($rev);
668
669 if (is_callable(array(
670 $versionObject, $phpFunctionName))) {
671 $versionObject->$phpFunctionName($rev, $originalVer, $latestVer);
672 }
673 else {
674 $upgrade->processSQL($rev);
675 }
676
677 // set post-upgrade-message if any
678 if (is_callable(array(
679 $versionObject, 'setPostUpgradeMessage'))) {
680 $postUpgradeMessage = file_get_contents($postUpgradeMessageFile);
681 $versionObject->setPostUpgradeMessage($postUpgradeMessage, $rev);
682 file_put_contents($postUpgradeMessageFile, $postUpgradeMessage);
683 } else {
684 $postUpgradeMessage = file_get_contents($postUpgradeMessageFile);
685 CRM_Upgrade_Incremental_Legacy::setPostUpgradeMessage($postUpgradeMessage, $rev);
686 file_put_contents($postUpgradeMessageFile, $postUpgradeMessage);
687 }
688
689 return TRUE;
690 }
691
692 /**
693 * Perform an incremental version update
694 *
695 * @param CRM_Queue_TaskContext $ctx
696 * @param $rev string, the target (intermediate) revision e.g '3.2.alpha1'
697 * @param $currentVer string, the original revision
698 * @param $latestVer string, the target (final) revision
699 * @param $postUpgradeMessageFile string, path of a modifiable file which lists the post-upgrade messages
700 *
701 * @return bool
702 */
703 public static function doIncrementalUpgradeFinish(CRM_Queue_TaskContext $ctx, $rev, $currentVer, $latestVer, $postUpgradeMessageFile) {
704 $upgrade = new CRM_Upgrade_Form();
705 $upgrade->setVersion($rev);
706 CRM_Utils_System::flushCache();
707
708 $config = CRM_Core_Config::singleton();
709 $config->userSystem->flush();
710 return TRUE;
711 }
712
713 public static function doFinish() {
714 $upgrade = new CRM_Upgrade_Form();
715 list($ignore, $latestVer) = $upgrade->getUpgradeVersions();
716 // Seems extraneous in context, but we'll preserve old behavior
717 $upgrade->setVersion($latestVer);
718
719 // lets rebuild the config array in case we've made a few changes in the
720 // code base
721 // this also helps us always store the latest version of civi in the DB
722 $params = array();
723 CRM_Core_BAO_ConfigSetting::add($params);
724
725 // CRM-12804 comment-51411 : add any missing settings
726 // at the end of upgrade
727 CRM_Core_BAO_Setting::updateSettingsFromMetaData();
728
729 // cleanup caches CRM-8739
730 $config = CRM_Core_Config::singleton();
731 $config->cleanupCaches(1);
732
733 // Rebuild all triggers and re-enable logging if needed
734 $logging = new CRM_Logging_Schema();
735 $logging->fixSchemaDifferences();
736 }
737
738 /**
739 * Compute any messages which should be displayed before upgrade
740 * by calling the 'setPreUpgradeMessage' on each incremental upgrade
741 * object.
742 *
743 * @param $preUpgradeMessage string, alterable
744 * @param $currentVer
745 * @param $latestVer
746 */
747 public function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
748 CRM_Upgrade_Incremental_Legacy::setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
749
750 // Scan through all php files and see if any file is interested in setting pre-upgrade-message
751 // based on $currentVer, $latestVer.
752 // Please note, at this point upgrade hasn't started executing queries.
753 $revisions = $this->getRevisionSequence();
754 foreach ($revisions as $rev) {
755 if (version_compare($currentVer, $rev) < 0 &&
756 version_compare($rev, '3.2.alpha1') > 0
757 ) {
758 $versionObject = $this->incrementalPhpObject($rev);
759 if (is_callable(array(
760 $versionObject, 'setPreUpgradeMessage'))) {
761 $versionObject->setPreUpgradeMessage($preUpgradeMessage, $rev, $currentVer);
762 }
763 }
764 }
765 }
766 }