Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.3 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | |
31 | * @copyright CiviCRM LLC (c) 2004-2013 | |
32 | * $Id$ | |
33 | * | |
34 | */ | |
35 | class CRM_Upgrade_TwoTwo_Form_Step4 extends CRM_Upgrade_Form { | |
36 | function verifyPreDBState(&$errorMessage) { | |
37 | $errorMessage = ts('Pre-condition failed for upgrade step %1.', array(1 => '4')); | |
38 | ||
39 | if (CRM_Core_DAO::checkTableExists('civicrm_event_page')) { | |
40 | return FALSE; | |
41 | } | |
42 | ||
43 | // check fields which MUST be present if a proper 2.2 db | |
44 | if (!CRM_Core_DAO::checkFieldExists('civicrm_event', 'intro_text') || | |
45 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'footer_text') || | |
46 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_title') || | |
47 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_text') || | |
48 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_footer_text') || | |
49 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'is_email_confirm') || | |
50 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_email_text') || | |
51 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_from_name') || | |
52 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'confirm_from_email') || | |
53 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'cc_confirm') || | |
54 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'bcc_confirm') || | |
55 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'default_fee_id') || | |
56 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'default_discount_id') || | |
57 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'thankyou_title') || | |
58 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'thankyou_text') || | |
59 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'thankyou_footer_text') || | |
60 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'is_pay_later') || | |
61 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'pay_later_text') || | |
62 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'pay_later_receipt') || | |
63 | !CRM_Core_DAO::checkFieldExists('civicrm_event', 'is_multiple_registrations') | |
64 | ) { | |
65 | // db looks to have stuck somewhere between 2.1 & 2.2 | |
66 | $errorMessage .= ' Few important fields were found missing in some of the tables.'; | |
67 | return FALSE; | |
68 | } | |
69 | if ($this->checkVersion('2.1.103')) { | |
70 | $this->setVersion('2.2'); | |
71 | } | |
72 | else { | |
73 | return FALSE; | |
74 | } | |
75 | ||
76 | // update config defaults | |
77 | $domain = new CRM_Core_DAO_Domain(); | |
78 | $domain->selectAdd(); | |
79 | $domain->selectAdd('config_backend'); | |
80 | $domain->find(TRUE); | |
81 | if ($domain->config_backend) { | |
82 | $defaults = unserialize($domain->config_backend); | |
83 | // reset components | |
84 | $defaults['enableComponents'] = array('CiviContribute', 'CiviPledge', 'CiviMember', 'CiviEvent', 'CiviMail'); | |
85 | $defaults['enableComponentIDs'] = array(1, 6, 2, 3, 4); | |
86 | $defaults['moneyvalueformat'] = '%!i'; | |
87 | $defaults['fieldSeparator'] = ','; | |
88 | $defaults['fatalErrorTemplate'] = 'CRM/common/fatal.tpl'; | |
89 | // serialise settings | |
90 | CRM_Core_BAO_ConfigSetting::add($defaults); | |
91 | } | |
92 | ||
93 | return $this->checkVersion('2.2'); | |
94 | } | |
95 | ||
96 | function buildQuickForm() {} | |
97 | ||
98 | function getTitle() { | |
99 | return ts('Database Upgrade to v2.2 Completed'); | |
100 | } | |
101 | ||
102 | function getTemplateMessage() { | |
103 | $upgradeDoc = CRM_Utils_System::docURL2('Installation and Upgrades', TRUE, NULL, NULL, NULL, "wiki"); | |
104 | return '<p><strong>' . ts('Your CiviCRM database has been successfully upgraded to v2.2.') . '</strong></p><p>' . ts('Please be sure to follow the remaining steps in the upgrade instructions specific to your version of CiviCRM: %1.', array( | |
105 | 1 => $upgradeDoc)) . '</p><p>' . ts('Thank you for using CiviCRM.') . '</p>'; | |
106 | } | |
107 | } | |
108 |