*/
/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- * $Id$
- *
+ * Class CRM_Upgrade_Form
*/
class CRM_Upgrade_Form extends CRM_Core_Form {
const QUEUE_NAME = 'CRM_Upgrade';
if (!isset($errorMessage)) {
$errorMessage = 'pre-condition failed for current upgrade step';
}
- CRM_Core_Error::fatal($errorMessage);
+ throw new CRM_Core_Exception($errorMessage);
}
$this->assign('recentlyViewed', FALSE);
}
if (!isset($errorMessage)) {
$errorMessage = 'post-condition failed for current upgrade step';
}
- CRM_Core_Error::fatal($errorMessage);
+ throw new CRM_Core_Exception($errorMessage);
}
}
}
else {
if (!file_exists($sqlFile)) {
- CRM_Core_Error::fatal("sqlfile - $rev.mysql not found.");
+ throw new CRM_Core_Exception("sqlfile - $rev.mysql not found.");
}
$this->source($sqlFile);
}
$latestVer = CRM_Utils_System::version();
$currentVer = CRM_Core_BAO_Domain::version(TRUE);
if (!$currentVer) {
- CRM_Core_Error::fatal(ts('Version information missing in civicrm database.'));
+ throw new CRM_Core_Exception(ts('Version information missing in civicrm database.'));
}
elseif (stripos($currentVer, 'upgrade')) {
- 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.'));
+ throw new CRM_Core_Exception(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.'));
}
if (!$latestVer) {
- CRM_Core_Error::fatal(ts('Version information missing in civicrm codebase.'));
+ throw new CRM_Core_Exception(ts('Version information missing in civicrm codebase.'));
}
return [$currentVer, $latestVer];
// Ensure that queue can be created
if (!CRM_Queue_BAO_QueueItem::findCreateTable()) {
- CRM_Core_Error::fatal(ts('Failed to find or create queueing table'));
+ throw new CRM_Core_Exception(ts('Failed to find or create queueing table'));
}
$queue = CRM_Queue_Service::singleton()->create([
'name' => self::QUEUE_NAME,
// pre-db check for major release.
if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
if (!(is_callable([$versionObject, 'verifyPreDBstate']))) {
- CRM_Core_Error::fatal("verifyPreDBstate method was not found for $rev");
+ throw new CRM_Core_Exception("verifyPreDBstate method was not found for $rev");
}
$error = NULL;
if (!isset($error)) {
$error = "post-condition failed for current upgrade for $rev";
}
- CRM_Core_Error::fatal($error);
+ throw new CRM_Core_Exception($error);
}
}
// Seems extraneous in context, but we'll preserve old behavior
$upgrade->setVersion($latestVer);
- // TODO: Consider running a general system flush instead of piecemeal flushes.
- // Historically, that would not have worked well because hooks are restricted
- // in upgrade-mode. But the dispatch-policy for 'upgrade.finish' is probably
- // more suitable.
-
- // Clear cached metadata.
- Civi::service('settings_manager')->flush();
-
- // cleanup caches CRM-8739
- $config = CRM_Core_Config::singleton();
- $config->cleanupCaches(1);
+ CRM_Core_Invoke::rebuildMenuAndCaches(FALSE, TRUE);
+ // NOTE: triggerRebuild is FALSE becaues it will run again in a moment (via fixSchemaDifferences).
$versionCheck = new CRM_Utils_VersionCheck();
$versionCheck->flushCache();
// Rebuild all triggers and re-enable logging if needed
$logging = new CRM_Logging_Schema();
$logging->fixSchemaDifferences();
-
- CRM_Core_ManagedEntities::singleton(TRUE)->reconcile(TRUE);
}
/**