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