CRM/Upgrade add missing comment blocks
[civicrm-core.git] / CRM / Upgrade / TwoOne / Form / Step4.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
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 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-2014
32 * $Id$
33 *
34 */
35 class CRM_Upgrade_TwoOne_Form_Step4 extends CRM_Upgrade_Form {
36 /**
37 * @param $errorMessage
38 *
39 * @return bool
40 */
41 function verifyPreDBState(&$errorMessage) {
42 $errorMessage = ts('Pre-condition failed for upgrade step %1.', array(1 => '2'));
43
44 if (!CRM_Core_DAO::checkTableExists('civicrm_cache') ||
45 !CRM_Core_DAO::checkTableExists('civicrm_group_contact_cache') ||
46 !CRM_Core_DAO::checkTableExists('civicrm_menu') ||
47 !CRM_Core_DAO::checkTableExists('civicrm_discount') ||
48 !CRM_Core_DAO::checkTableExists('civicrm_pledge') ||
49 !CRM_Core_DAO::checkTableExists('civicrm_pledge_block') ||
50 !CRM_Core_DAO::checkTableExists('civicrm_pledge_payment')
51 ) {
52 return FALSE;
53 }
54
55 // check fields which MUST be present if a proper 2.1 db
56 if (!CRM_Core_DAO::checkFieldExists('civicrm_cache', 'group_name') ||
57 !CRM_Core_DAO::checkFieldExists('civicrm_cache', 'created_date') ||
58 !CRM_Core_DAO::checkFieldExists('civicrm_cache', 'expired_date') ||
59 !CRM_Core_DAO::checkFieldExists('civicrm_discount', 'option_group_id') ||
60 !CRM_Core_DAO::checkFieldExists('civicrm_discount', 'end_date') ||
61 !CRM_Core_DAO::checkFieldExists('civicrm_group_contact_cache', 'contact_id') ||
62 !CRM_Core_DAO::checkFieldExists('civicrm_menu', 'path_arguments') ||
63 !CRM_Core_DAO::checkFieldExists('civicrm_menu', 'is_exposed') ||
64 !CRM_Core_DAO::checkFieldExists('civicrm_menu', 'page_type') ||
65 !CRM_Core_DAO::checkFieldExists('civicrm_option_value', 'component_id') ||
66 !CRM_Core_DAO::checkFieldExists('civicrm_option_group', 'id') ||
67 !CRM_Core_DAO::checkFieldExists('civicrm_option_group', 'name')
68 ) {
69 // db looks to have stuck somewhere between 2.0 & 2.1
70 $errorMessage .= ' Few important fields were found missing in some of the tables.';
71 return FALSE;
72 }
73 if ($this->checkVersion('2.03')) {
74 $this->setVersion($this->latestVersion);
75 }
76 else {
77 return FALSE;
78 }
79
80 return $this->checkVersion($this->latestVersion);
81 }
82
83 function buildQuickForm() {}
84
85 /**
86 * @return string
87 */
88 function getTitle() {
89 return ts('Database Upgrade to v2.1 Completed');
90 }
91
92 /**
93 * @return string
94 */
95 function getTemplateMessage() {
96 if ($this->_config->userSystem->is_drupal) {
97 $upgradeDoc = 'http://wiki.civicrm.org/confluence/x/7IFH';
98 }
99 else {
100 $upgradeDoc = 'http://wiki.civicrm.org/confluence/x/SoJH';
101 }
102 return '<p><strong>' . ts('Your CiviCRM database has been successfully upgraded to v2.1.') . '</strong></p><p>' . ts('Please be sure to follow the remaining steps in the <a href=\'%1\' target=\'_blank\'><strong>Upgrade Instructions</strong></a>.', array(
103 1 => $upgradeDoc)) . '</p><p>' . ts('Thank you for using CiviCRM.') . '</p>';
104 }
105 }
106