Skip to content
Snippets Groups Projects
Unverified Commit d5f70861 authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Merge pull request #14139 from agh1/upgrade-rebuild-caseact-views

#832 CiviCase: rebuild case activity views during upgrade
parents b632d5ee 478107f1
No related branches found
No related tags found
No related merge requests found
......@@ -67,21 +67,40 @@ class CRM_Upgrade_Incremental_php_FiveFourteen extends CRM_Upgrade_Incremental_B
* (change the x in the function name):
*/
// /**
// * Upgrade function.
// *
// * @param string $rev
// */
// public function upgrade_5_0_x($rev) {
// $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
// $this->addTask('Do the foo change', 'taskFoo', ...);
// // Additional tasks here...
// // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
// // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
// }
/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_5_14_alpha1($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
// Only need to rebuild view if CiviCase is enabled: otherwise will be
// rebuilt when component is enabled
$config = CRM_Core_Config::singleton();
if (in_array('CiviCase', $config->enableComponents)) {
$this->addTask('Rebuild case activity views', 'rebuildCaseActivityView', $rev);
}
// Additional tasks here...
// Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
// The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
}
// public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
// return TRUE;
// }
/**
* Rebuild the view of recent and upcoming case activities
*
* See https://github.com/civicrm/civicrm-core/pull/14086 and
* https://lab.civicrm.org/dev/core/issues/832
*
* @param CRM_Queue_TaskContext $ctx
* @return bool
*/
public static function rebuildCaseActivityView($ctx) {
if (!CRM_Case_BAO_Case::createCaseViews()) {
CRM_Core_Error::debug_log_message(ts("Could not create the MySQL views for CiviCase. Your mysql user needs to have the 'CREATE VIEW' permission"));
return FALSE;
}
return TRUE;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment