INFRA-132 - Docblock cleanup
[civicrm-core.git] / CRM / Upgrade / Incremental / Legacy.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
06b69b18 6 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
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 and the CiviCRM Licensing Exception. |
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 and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26*/
27
28/**
29 *
30 * @package CRM
06b69b18 31 * @copyright CiviCRM LLC (c) 2004-2014
6a488035
TO
32 * $Id$
33 *
34 */
35
36/**
37 * This class is a container for legacy upgrade logic which predates
38 * the current 'CRM/Incremental/php/*' structure.
39 */
40class CRM_Upgrade_Incremental_Legacy {
41
42 /**
43 * Compute any messages which should be displayed before upgrade
44 *
c68f8bfa
TO
45 * @param $preUpgradeMessage
46 * String, alterable.
77b97be7
EM
47 * @param $currentVer
48 * @param $latestVer
6a488035 49 */
00be9182 50 public static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
6a488035
TO
51 $upgrade = new CRM_Upgrade_Form();
52 $template = CRM_Core_Smarty::singleton();
53
54 if ((version_compare($currentVer, '3.3.alpha1') < 0 &&
55 version_compare($latestVer, '3.3.alpha1') >= 0
56 ) ||
57 (version_compare($currentVer, '3.4.alpha1') < 0 &&
58 version_compare($latestVer, '3.4.alpha1') >= 0
59 )
60 ) {
61 $query = "
10824d34 62SELECT id
63 FROM civicrm_mailing_job
6a488035
TO
64 WHERE status NOT IN ( 'Complete', 'Canceled' ) AND is_test = 0 LIMIT 1";
65 $mjId = CRM_Core_DAO::singleValueQuery($query);
66 if ($mjId) {
67 $preUpgradeMessage = ts("There are one or more Scheduled or In Progress mailings in your install. Scheduled mailings will not be sent and In Progress mailings will not finish if you continue with the upgrade. We strongly recommend that all Scheduled and In Progress mailings be completed or cancelled and then upgrade your CiviCRM install.");
68 }
69 }
70
71 //turning some tables to monolingual during 3.4.beta3, CRM-7869
72 $upgradeTo = str_replace('4.0.', '3.4.', $latestVer);
73 $upgradeFrom = str_replace('4.0.', '3.4.', $currentVer);
74
75 // check for changed message templates
76 self::checkMessageTemplate($template, $preUpgradeMessage, $upgradeTo, $upgradeFrom);
77
78 $upgrade = new CRM_Upgrade_Form();
79 if ($upgrade->multilingual &&
80 version_compare($upgradeFrom, '3.4.beta3') == -1 &&
81 version_compare($upgradeTo, '3.4.beta3') >= 0
82 ) {
83 $config = CRM_Core_Config::singleton();
84 $preUpgradeMessage .= '<br />' . ts("As per <a href='%1'>the related blog post</a>, we are making contact names, addresses and mailings monolingual; the values entered for the default locale (%2) will be preserved and values for other locales removed.", array(1 => 'http://civicrm.org/blogs/shot/multilingual-civicrm-3440-making-some-fields-monolingual', 2 => $config->lcMessages));
85 }
86
87 if (version_compare($currentVer, '3.4.6') == -1 &&
88 version_compare($latestVer, '3.4.6') >= 0
89 ) {
90 $googleProcessorExists = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_payment_processor WHERE payment_processor_type = 'Google_Checkout' AND is_active = 1 LIMIT 1;");
91
92 if ($googleProcessorExists) {
93 $preUpgradeMessage .= '<br />' . ts('To continue using Google Checkout Payment Processor with latest version of CiviCRM, requires updating merchant account settings. Please refer "Set API callback URL and other settings" section of <a href="%1" target="_blank"><strong>Google Checkout Configuration</strong></a> doc.', array(1 => 'http://wiki.civicrm.org/confluence/x/zAJTAg'));
94 }
95 }
fde21984 96
7abafcbc
TO
97 // http://issues.civicrm.org/jira/browse/CRM-13572
98 // Depending on how the code was upgraded, some sites may still have copies of old
99 // source files left behind. This is often a forgivable offense, but it's quite
100 // dangerous for CIVI-SA-2013-001.
fde21984
TO
101 global $civicrm_root;
102 $ofcFile = "$civicrm_root/packages/OpenFlashChart/php-ofc-library/ofc_upload_image.php";
103 if (file_exists($ofcFile)) {
7abafcbc
TO
104 if (@unlink($ofcFile)) {
105 $preUpgradeMessage .= '<br />' . ts('This system included an outdated, insecure script (%1). The file was automatically deleted.', array(
21dfd5f5 106 1 => $ofcFile,
7abafcbc 107 ));
0db6c3e1
TO
108 }
109 else {
7abafcbc 110 $preUpgradeMessage .= '<br />' . ts('This system includes an outdated, insecure script (%1). Please delete it.', array(
21dfd5f5 111 1 => $ofcFile,
7abafcbc
TO
112 ));
113 }
fde21984 114 }
f3103b87 115
56c2750b 116 if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'enable_innodb_fts', NULL, FALSE)) {
f3103b87
TO
117 // The FTS indexing feature dynamically manipulates the schema which could
118 // cause conflicts with other layers that manipulate the schema. The
119 // simplest thing is to turn it off and back on.
120
121 // It may not always be necessary to do this -- but I doubt we're going to test
122 // systematically in future releases. When it is necessary, one could probably
123 // ignore the matter and simply run CRM_Core_InnoDBIndexer::fixSchemaDifferences
124 // after the upgrade. But that's speculative. For now, we'll leave this
125 // advanced feature in the hands of the sysadmin.
126 $preUpgradeMessage .= '<br />' . ts('This database uses InnoDB Full Text Search for optimized searching. The upgrade procedure has not been tested with this feature. You should disable (and later re-enable) the feature by navigating to "Administer => System Settings => Miscellaneous".');
127 }
6a488035
TO
128 }
129
624e56fa
EM
130 /**
131 * @param $template
132 * @param $message
133 * @param $latestVer
134 * @param $currentVer
135 */
00be9182 136 public static function checkMessageTemplate(&$template, &$message, $latestVer, $currentVer) {
6a488035
TO
137 if (version_compare($currentVer, '3.1.alpha1') < 0) {
138 return;
139 }
140
141 $sql = "SELECT orig.workflow_id as workflow_id,
142 orig.msg_title as title
143 FROM civicrm_msg_template diverted JOIN civicrm_msg_template orig ON (
144 diverted.workflow_id = orig.workflow_id AND
145 orig.is_reserved = 1 AND (
146 diverted.msg_subject != orig.msg_subject OR
147 diverted.msg_text != orig.msg_text OR
148 diverted.msg_html != orig.msg_html
149 )
150 )";
151
152 $dao = &CRM_Core_DAO::executeQuery($sql);
153 while ($dao->fetch()) {
154 $workflows[$dao->workflow_id] = $dao->title;
155 }
156
157 if (empty($workflows)) {
158 return;
159 }
160
161 $html = NULL;
162 $pathName = dirname(dirname(__FILE__));
163 $flag = FALSE;
164 foreach ($workflows as $workflow => $title) {
165 $name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
166 $workflow,
167 'name',
168 'id'
169 );
170
171 // check if file exists locally
172 $textFileName = implode(DIRECTORY_SEPARATOR,
173 array(
174 $pathName,
175 "{$latestVer}.msg_template",
176 'message_templates',
177 "{$name}_text.tpl",
178 )
179 );
180
181 $htmlFileName = implode(DIRECTORY_SEPARATOR,
182 array(
183 $pathName,
184 "{$latestVer}.msg_template",
185 'message_templates',
186 "{$name}_html.tpl",
187 )
188 );
189
190 if (file_exists($textFileName) ||
191 file_exists($htmlFileName)
192 ) {
193 $flag = TRUE;
194 $html .= "<li>{$title}</li>";
195 }
196 }
197
198 if ($flag == TRUE) {
199 $html = "<ul>" . $html . "<ul>";
200
e2cd07fc 201 $message .= '<br />' . ts("The default copies of the message templates listed below will be updated to handle new features or correct a problem. Your installation has customized versions of these message templates, and you will need to apply the updates manually after running this upgrade. <a href='%1' style='color:white; text-decoration:underline; font-weight:bold;' target='_blank'>Click here</a> for detailed instructions. %2", array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates', 2 => $html));
6a488035
TO
202 }
203 }
204
205 /**
206 * Compute any messages which should be displayed after upgrade
207 *
c68f8bfa
TO
208 * @param $postUpgradeMessage
209 * String, alterable.
210 * @param $rev
211 * String, an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
6a488035
TO
212 * @return void
213 */
00be9182 214 public static function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
6a488035
TO
215 if ($rev == '3.2.alpha1') {
216 $postUpgradeMessage .= '<br />' . ts("We have reset the COUNTED flag to false for the event participant status 'Pending from incomplete transaction'. This change ensures that people who have a problem during registration can try again.");
217 }
218 if ($rev == '3.2.beta3') {
219 $subTypes = CRM_Contact_BAO_ContactType::subTypes();
220
221 if (is_array($subTypes) && !empty($subTypes)) {
222 $config = CRM_Core_Config::singleton();
223 $subTypeTemplates = array();
224
225 if (isset($config->customTemplateDir)) {
226 foreach ($subTypes as $key => $subTypeName) {
227 $customContactSubTypeEdit = $config->customTemplateDir . "CRM/Contact/Form/Edit/" . $subTypeName . ".tpl";
228 $customContactSubTypeView = $config->customTemplateDir . "CRM/Contact/Page/View/" . $subTypeName . ".tpl";
229 if (file_exists($customContactSubTypeEdit) || file_exists($customContactSubTypeView)) {
230 $subTypeTemplates[$subTypeName] = $subTypeName;
231 }
232 }
233 }
234
235 foreach ($subTypes as $key => $subTypeName) {
236 $customContactSubTypeEdit = $config->templateDir . "CRM/Contact/Form/Edit/" . $subTypeName . ".tpl";
237 $customContactSubTypeView = $config->templateDir . "CRM/Contact/Page/View/" . $subTypeName . ".tpl";
238 if (file_exists($customContactSubTypeEdit) || file_exists($customContactSubTypeView)) {
239 $subTypeTemplates[$subTypeName] = $subTypeName;
240 }
241 }
242
243 if (!empty($subTypeTemplates)) {
244 $subTypeTemplates = implode(',', $subTypeTemplates);
245 $postUpgradeMessage .= '<br />' . ts('You are using custom template for contact subtypes: %1.', array(1 => $subTypeTemplates)) . '<br />' . ts('You need to move these subtype templates to the SubType directory in %1 and %2 respectively.', array(1 => 'CRM/Contact/Form/Edit', 2 => 'CRM/Contact/Page/View'));
246 }
247 }
248 }
249 if ($rev == '3.2.beta4') {
250 $statuses = array('New', 'Current', 'Grace', 'Expired', 'Pending', 'Cancelled', 'Deceased');
251 $sql = "
10824d34 252SELECT count( id ) as statusCount
253 FROM civicrm_membership_status
6a488035
TO
254 WHERE name IN ( '" . implode("' , '", $statuses) . "' ) ";
255 $count = CRM_Core_DAO::singleValueQuery($sql);
256 if ($count < count($statuses)) {
257 $postUpgradeMessage .= '<br />' . ts("One or more Membership Status Rules was disabled during the upgrade because it did not match a recognized status name. if custom membership status rules were added to this site - review the disabled statuses and re-enable any that are still needed (Administer > CiviMember > Membership Status Rules).");
258 }
259 }
260 if ($rev == '3.4.alpha1') {
261 $renamedBinScripts = array(
262 'ParticipantProcessor.php',
263 'RespondentProcessor.php',
264 'UpdateGreeting.php',
265 'UpdateMembershipRecord.php',
266 'UpdatePledgeRecord.php ',
267 );
268 $postUpgradeMessage .= '<br />' . ts('The following files have been renamed to have a ".php" extension instead of a ".php.txt" extension') . ': ' . implode(', ', $renamedBinScripts);
269 }
270 }
271
272 /**
273 * Perform an incremental upgrade
274 *
c68f8bfa
TO
275 * @param $rev
276 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 277 */
00be9182 278 public static function upgrade_2_2_alpha1($rev) {
6a488035
TO
279 for ($stepID = 1; $stepID <= 4; $stepID++) {
280 $formName = "CRM_Upgrade_TwoTwo_Form_Step{$stepID}";
4d5c2eb5 281 $form = new $formName();
6a488035
TO
282
283 $error = NULL;
284 if (!$form->verifyPreDBState($error)) {
285 if (!isset($error)) {
286 $error = "pre-condition failed for current upgrade step $stepID, rev $rev";
287 }
288 CRM_Core_Error::fatal($error);
289 }
290
291 if ($stepID == 4) {
292 return;
293 }
294
295 $template = CRM_Core_Smarty::singleton();
296
297 $eventFees = array();
298 $query = "SELECT og.id ogid FROM civicrm_option_group og WHERE og.name LIKE %1";
299 $params = array(1 => array('civicrm_event_page.amount%', 'String'));
300 $dao = CRM_Core_DAO::executeQuery($query, $params);
301 while ($dao->fetch()) {
302 $eventFees[$dao->ogid] = $dao->ogid;
303 }
304 $template->assign('eventFees', $eventFees);
305
306 $form->upgrade();
307
308 if (!$form->verifyPostDBState($error)) {
309 if (!isset($error)) {
310 $error = "post-condition failed for current upgrade step $stepID, rev $rev";
311 }
312 CRM_Core_Error::fatal($error);
313 }
314 }
315 }
316
317 /**
318 * Perform an incremental upgrade
319 *
c68f8bfa
TO
320 * @param $rev
321 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 322 */
00be9182 323 public static function upgrade_2_1_2($rev) {
6a488035 324 $formName = "CRM_Upgrade_TwoOne_Form_TwoOneTwo";
4d5c2eb5 325 $form = new $formName($rev);
6a488035
TO
326
327 $error = NULL;
328 if (!$form->verifyPreDBState($error)) {
329 if (!isset($error)) {
330 $error = "pre-condition failed for current upgrade for $rev";
331 }
332 CRM_Core_Error::fatal($error);
333 }
334
335 $form->upgrade();
336
337 if (!$form->verifyPostDBState($error)) {
338 if (!isset($error)) {
339 $error = "post-condition failed for current upgrade for $rev";
340 }
341 CRM_Core_Error::fatal($error);
342 }
343 }
344
345 /**
346 * This function should check if if need to skip current sql file
347 * Name of this function will change according to the latest release
348 *
349 */
00be9182 350 public static function upgrade_2_2_alpha3($rev) {
6a488035
TO
351 // skip processing sql file, if fresh install -
352 if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'mail_protocol', 'id', 'name')) {
353 $upgrade = new CRM_Upgrade_Form();
354 $upgrade->processSQL($rev);
355 }
356 return TRUE;
357 }
358
359 /**
360 * Perform an incremental upgrade
361 *
c68f8bfa
TO
362 * @param $rev
363 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 364 */
00be9182 365 public static function upgrade_2_2_beta1($rev) {
6a488035
TO
366 if (!CRM_Core_DAO::checkFieldExists('civicrm_pcp_block', 'notify_email')) {
367 $template = CRM_Core_Smarty::singleton();
368 $template->assign('notifyAbsent', TRUE);
369 }
370 $upgrade = new CRM_Upgrade_Form();
371 $upgrade->processSQL($rev);
372 }
373
374 /**
375 * Perform an incremental upgrade
376 *
c68f8bfa
TO
377 * @param $rev
378 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 379 */
00be9182 380 public static function upgrade_2_2_beta2($rev) {
6a488035
TO
381 $template = CRM_Core_Smarty::singleton();
382 if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
383 'CRM_Contact_Form_Search_Custom_ZipCodeRange', 'id', 'name'
384 )) {
385 $template->assign('customSearchAbsentAll', TRUE);
386 }
387 elseif (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
388 'CRM_Contact_Form_Search_Custom_MultipleValues', 'id', 'name'
389 )) {
390 $template->assign('customSearchAbsent', TRUE);
391 }
392 $upgrade = new CRM_Upgrade_Form();
393 $upgrade->processSQL($rev);
394 }
395
396 /**
397 * Perform an incremental upgrade
398 *
c68f8bfa
TO
399 * @param $rev
400 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 401 */
00be9182 402 public static function upgrade_2_2_beta3($rev) {
6a488035
TO
403 $template = CRM_Core_Smarty::singleton();
404 if (!CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'custom_data_type', 'id', 'name')) {
405 $template->assign('customDataType', TRUE);
406 }
407
408 $upgrade = new CRM_Upgrade_Form();
409 $upgrade->processSQL($rev);
410 }
411
412 /**
413 * Perform an incremental upgrade
414 *
c68f8bfa
TO
415 * @param $rev
416 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 417 */
00be9182 418 public static function upgrade_3_0_alpha1($rev) {
6a488035
TO
419
420 $threeZero = new CRM_Upgrade_ThreeZero_ThreeZero();
421
422 $error = NULL;
423 if (!$threeZero->verifyPreDBState($error)) {
424 if (!isset($error)) {
425 $error = 'pre-condition failed for current upgrade for 3.0.alpha2';
426 }
427 CRM_Core_Error::fatal($error);
428 }
429
430 $threeZero->upgrade($rev);
431 }
432
433 /**
434 * Perform an incremental upgrade
435 *
c68f8bfa
TO
436 * @param $rev
437 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 438 */
00be9182 439 public static function upgrade_3_1_alpha1($rev) {
6a488035
TO
440
441 $threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
442
443 $error = NULL;
444 if (!$threeOne->verifyPreDBState($error)) {
445 if (!isset($error)) {
446 $error = 'pre-condition failed for current upgrade for 3.0.alpha2';
447 }
448 CRM_Core_Error::fatal($error);
449 }
450
451 $threeOne->upgrade($rev);
452 }
453
454 /**
455 * Perform an incremental upgrade
456 *
c68f8bfa
TO
457 * @param $rev
458 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 459 */
00be9182 460 public static function upgrade_2_2_7($rev) {
6a488035
TO
461 $upgrade = new CRM_Upgrade_Form();
462 $upgrade->processSQL($rev);
10824d34 463 $sql = "UPDATE civicrm_report_instance
6a488035
TO
464 SET form_values = REPLACE(form_values,'#',';') ";
465 CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
466
467 // make report component enabled by default
468 $domain = new CRM_Core_DAO_Domain();
469 $domain->selectAdd();
470 $domain->selectAdd('config_backend');
471 $domain->find(TRUE);
472 if ($domain->config_backend) {
473 $defaults = unserialize($domain->config_backend);
474
475 if (is_array($defaults['enableComponents'])) {
476 $compId = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_component WHERE name = 'CiviReport'");
477 if ($compId) {
478 $defaults['enableComponents'][] = 'CiviReport';
479 $defaults['enableComponentIDs'][] = $compId;
480
481 CRM_Core_BAO_ConfigSetting::add($defaults);
482 }
483 }
484 }
485 }
486
487 /**
488 * Perform an incremental upgrade
489 *
c68f8bfa
TO
490 * @param $rev
491 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 492 */
00be9182 493 public static function upgrade_3_0_2($rev) {
6a488035
TO
494
495 $template = CRM_Core_Smarty::singleton();
496 //check whether upgraded from 2.1.x or 2.2.x
497 $inboundEmailID = CRM_Core_OptionGroup::getValue('activity_type', 'Inbound Email', 'name');
498
499 if (!empty($inboundEmailID)) {
500 $template->assign('addInboundEmail', FALSE);
501 }
502 else {
503 $template->assign('addInboundEmail', TRUE);
504 }
505
506 $upgrade = new CRM_Upgrade_Form();
507 $upgrade->processSQL($rev);
508 }
509
510 /**
511 * Perform an incremental upgrade
512 *
c68f8bfa
TO
513 * @param $rev
514 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 515 */
00be9182 516 public static function upgrade_3_0_4($rev) {
6a488035
TO
517 //make sure 'Deceased' membership status present in db,CRM-5636
518 $template = CRM_Core_Smarty::singleton();
519
520 $addDeceasedStatus = FALSE;
521 $sql = "SELECT max(id) FROM civicrm_membership_status where name = 'Deceased'";
522 if (!CRM_Core_DAO::singleValueQuery($sql)) {
523 $addDeceasedStatus = TRUE;
524 }
525 $template->assign('addDeceasedStatus', $addDeceasedStatus);
526
527 $upgrade = new CRM_Upgrade_Form();
528 $upgrade->processSQL($rev);
529 }
530
531 /**
532 * Perform an incremental upgrade
533 *
c68f8bfa
TO
534 * @param $rev
535 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 536 */
00be9182 537 public static function upgrade_3_1_0($rev) {
6a488035
TO
538 // upgrade all roles who have 'access CiviEvent' permission, to also have
539 // newly added permission 'edit_all_events', CRM-5472
540 $config = CRM_Core_Config::singleton();
541 if (is_callable(array(
542 $config->userSystem, 'replacePermission'))) {
543 $config->userSystem->replacePermission('access CiviEvent', array('access CiviEvent', 'edit all events'));
544 }
545
546 //make sure 'Deceased' membership status present in db,CRM-5636
547 $template = CRM_Core_Smarty::singleton();
548
549 $addDeceasedStatus = FALSE;
550 $sql = "SELECT max(id) FROM civicrm_membership_status where name = 'Deceased'";
551 if (!CRM_Core_DAO::singleValueQuery($sql)) {
552 $addDeceasedStatus = TRUE;
553 }
554 $template->assign('addDeceasedStatus', $addDeceasedStatus);
555
556 $upgrade = new CRM_Upgrade_Form();
557 $upgrade->processSQL($rev);
558 }
559
560 /**
561 * Perform an incremental upgrade
562 *
c68f8bfa
TO
563 * @param $rev
564 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 565 */
00be9182 566 public static function upgrade_3_1_3($rev) {
6a488035
TO
567 $threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
568 $threeOne->upgrade_3_1_3();
569
570 $upgrade = new CRM_Upgrade_Form();
571 $upgrade->processSQL($rev);
572 }
573
574 /**
575 * Perform an incremental upgrade
576 *
c68f8bfa
TO
577 * @param $rev
578 * String, the revision to which we are upgrading (Note: When processing a series of upgrades, this is the immediate upgrade - not the final).
6a488035 579 */
00be9182 580 public static function upgrade_3_1_4($rev) {
6a488035
TO
581 $threeOne = new CRM_Upgrade_ThreeOne_ThreeOne();
582 $threeOne->upgrade_3_1_4();
583
584 $upgrade = new CRM_Upgrade_Form();
585 $upgrade->processSQL($rev);
586 }
587}