3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2016
37 * This class contains generic upgrade logic which runs regardless of version.
39 class CRM_Upgrade_Incremental_General
{
42 * The recommended PHP version.
44 const MIN_RECOMMENDED_PHP_VER
= '5.5';
47 * The minimum PHP version required to install Civi.
49 * @see install/index.php
51 const MIN_INSTALL_PHP_VER
= '5.3.4';
54 * The minimum PHP version required to avoid known
57 const MIN_DEFECT_PHP_VER
= '5.3.23';
60 * Compute any messages which should be displayed before upgrade.
62 * @param string $preUpgradeMessage
67 public static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
68 if (version_compare(phpversion(), self
::MIN_RECOMMENDED_PHP_VER
) < 0) {
69 $preUpgradeMessage .= '<p>' .
70 ts('This webserver is running an outdated version of PHP (%1). It is strongly recommended to upgrade to PHP %2 or later, as older versions can present a security risk.', array(
72 2 => self
::MIN_RECOMMENDED_PHP_VER
,
77 // http://issues.civicrm.org/jira/browse/CRM-13572
78 // Depending on how the code was upgraded, some sites may still have copies of old
79 // source files left behind. This is often a forgivable offense, but it's quite
80 // dangerous for CIVI-SA-2013-001.
82 $ofcFile = "$civicrm_root/packages/OpenFlashChart/php-ofc-library/ofc_upload_image.php";
83 if (file_exists($ofcFile)) {
84 if (@unlink
($ofcFile)) {
85 $preUpgradeMessage .= '<br />' . ts('This system included an outdated, insecure script (%1). The file was automatically deleted.', array(
90 $preUpgradeMessage .= '<br />' . ts('This system includes an outdated, insecure script (%1). Please delete it.', array(
96 if (Civi
::settings()->get('enable_innodb_fts')) {
97 // The FTS indexing feature dynamically manipulates the schema which could
98 // cause conflicts with other layers that manipulate the schema. The
99 // simplest thing is to turn it off and back on.
101 // It may not always be necessary to do this -- but I doubt we're going to test
102 // systematically in future releases. When it is necessary, one could probably
103 // ignore the matter and simply run CRM_Core_InnoDBIndexer::fixSchemaDifferences
104 // after the upgrade. But that's speculative. For now, we'll leave this
105 // advanced feature in the hands of the sysadmin.
106 $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".');
115 public static function checkMessageTemplate(&$message, $latestVer, $currentVer) {
117 $sql = "SELECT orig.workflow_id as workflow_id,
118 orig.msg_title as title
119 FROM civicrm_msg_template diverted JOIN civicrm_msg_template orig ON (
120 diverted.workflow_id = orig.workflow_id AND
121 orig.is_reserved = 1 AND (
122 diverted.msg_subject != orig.msg_subject OR
123 diverted.msg_text != orig.msg_text OR
124 diverted.msg_html != orig.msg_html
128 $dao = CRM_Core_DAO
::executeQuery($sql);
129 while ($dao->fetch()) {
130 $workflows[$dao->workflow_id
] = $dao->title
;
133 if (empty($workflows)) {
138 $pathName = dirname(dirname(__FILE__
));
140 foreach ($workflows as $workflow => $title) {
141 $name = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionValue',
147 // check if file exists locally
148 $textFileName = implode(DIRECTORY_SEPARATOR
,
151 "{$latestVer}.msg_template",
157 $htmlFileName = implode(DIRECTORY_SEPARATOR
,
160 "{$latestVer}.msg_template",
166 if (file_exists($textFileName) ||
167 file_exists($htmlFileName)
170 $html .= "<li>{$title}</li>";
175 $html = "<ul>" . $html . "<ul>";
177 $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(
178 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates',