| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.6.alpha1 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 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. | |
| 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 along with this program; if not, contact CiviCRM LLC | |
| 21 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 22 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 24 | +--------------------------------------------------------------------+ |
| 25 | */ |
| 26 | |
| 27 | /** |
| 28 | * |
| 29 | * @package CRM |
| 30 | * @copyright CiviCRM LLC (c) 2004-2014 |
| 31 | * $Id$ |
| 32 | * |
| 33 | */ |
| 34 | class CRM_Upgrade_Incremental_php_FourSix { |
| 35 | const BATCH_SIZE = 5000; |
| 36 | |
| 37 | /** |
| 38 | * @param $errors |
| 39 | * |
| 40 | * @return bool |
| 41 | */ |
| 42 | public function verifyPreDBstate(&$errors) { |
| 43 | return TRUE; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Compute any messages which should be displayed beforeupgrade |
| 48 | * |
| 49 | * Note: This function is called iteratively for each upcoming |
| 50 | * revision to the database. |
| 51 | * |
| 52 | * @param $preUpgradeMessage |
| 53 | * @param string $rev |
| 54 | * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'. |
| 55 | * @param null $currentVer |
| 56 | * |
| 57 | * @return void |
| 58 | */ |
| 59 | public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) { |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Compute any messages which should be displayed after upgrade |
| 64 | * |
| 65 | * @param string $postUpgradeMessage |
| 66 | * alterable. |
| 67 | * @param string $rev |
| 68 | * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs. |
| 69 | * @return void |
| 70 | */ |
| 71 | public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { |
| 72 | if ($rev == '4.6.alpha1') { |
| 73 | $postUpgradeMessage .= '<br /><br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li><li>Events - Registration Confirmation and Receipt (off-line)</li><li>Contributions - Receipt (on-line)</li><li>Contributions - Receipt (off-line)</li><li>Memberships - Receipt (on-line)</li><li>Memberships - Signup and Renewal Receipts (off-line)</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).'); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * (Queue Task Callback) |
| 80 | */ |
| 81 | public static function task_4_6_x_runSql(CRM_Queue_TaskContext $ctx, $rev) { |
| 82 | $upgrade = new CRM_Upgrade_Form(); |
| 83 | $upgrade->processSQL($rev); |
| 84 | |
| 85 | return TRUE; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Syntactic sugar for adding a task which (a) is in this class and (b) has |
| 90 | * a high priority. |
| 91 | * |
| 92 | * After passing the $funcName, you can also pass parameters that will go to |
| 93 | * the function. Note that all params must be serializable. |
| 94 | */ |
| 95 | protected function addTask($title, $funcName) { |
| 96 | $queue = CRM_Queue_Service::singleton()->load(array( |
| 97 | 'type' => 'Sql', |
| 98 | 'name' => CRM_Upgrade_Form::QUEUE_NAME, |
| 99 | )); |
| 100 | |
| 101 | $args = func_get_args(); |
| 102 | $title = array_shift($args); |
| 103 | $funcName = array_shift($args); |
| 104 | $task = new CRM_Queue_Task( |
| 105 | array(get_class($this), $funcName), |
| 106 | $args, |
| 107 | $title |
| 108 | ); |
| 109 | $queue->createItem($task, array('weight' => -1)); |
| 110 | } |
| 111 | } |