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