Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#832 CiviCase: rebuild case activity views during upgrade #14139

Merged
merged 1 commit into from
Apr 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 34 additions & 15 deletions CRM/Upgrade/Incremental/php/FiveFourteen.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,40 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
* (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;
}

}