From 51de810aaf25d4cd873f81f0c0bb67f018249d0f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 8 Dec 2021 08:44:07 -0500 Subject: [PATCH] NFC - Cleanup messy boilerplate --- CRM/Upgrade/Incremental/php/FiveFortySix.php | 41 +++++--------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FiveFortySix.php b/CRM/Upgrade/Incremental/php/FiveFortySix.php index 6b94c7836b..26d9bdc87e 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortySix.php +++ b/CRM/Upgrade/Incremental/php/FiveFortySix.php @@ -10,11 +10,12 @@ */ /** - * Upgrade logic for FiveFortySix */ + * Upgrade logic for FiveFortySix + */ class CRM_Upgrade_Incremental_php_FiveFortySix extends CRM_Upgrade_Incremental_Base { /** - * Compute any messages which should be displayed beforeupgrade. + * Compute any messages which should be displayed before upgrade. * * Note: This function is called iteratively for each incremental upgrade step. * There must be a concrete step (eg 'X.Y.Z.mysql.tpl' or 'upgrade_X_Y_Z()'). @@ -25,10 +26,6 @@ class CRM_Upgrade_Incremental_php_FiveFortySix extends CRM_Upgrade_Incremental_B * @param null $currentVer */ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL): void { - // Example: Generate a pre-upgrade message. - // if ($rev == '5.12.34') { - // $preUpgradeMessage .= '

' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '

'; - // } } /** @@ -43,33 +40,15 @@ class CRM_Upgrade_Incremental_php_FiveFortySix extends CRM_Upgrade_Incremental_B * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs. */ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev): void { - // Example: Generate a post-upgrade message. - // if ($rev == '5.12.34') { - // $postUpgradeMessage .= '

' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'."); - // } } - /* - * Important! All upgrade functions MUST add a 'runSql' task. - * Uncomment and use the following template for a new upgrade version - * (change the x in the function name): + /** + * Upgrade function. + * + * @param string $rev */ - - // /** - // * Upgrade function. - // * - // * @param string $rev - // */ - // public function upgrade_5_0_x($rev): void { - // $this->addTask(ts('Upgrade DB to %1: SQL', [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. - // } - - // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...): bool { - // return TRUE; - // } + public function upgrade_5_46_alpha1($rev): void { + $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); + } } -- 2.25.1