3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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-2015
37 * This class contains generic upgrade logic which runs regardless of version.
39 class CRM_Upgrade_Incremental_General
{
40 const MIN_RECOMMENDED_PHP_VER
= '5.5';
43 * Compute any messages which should be displayed before upgrade.
45 * @param string $preUpgradeMessage
50 public static function setPreUpgradeMessage(&$preUpgradeMessage, $currentVer, $latestVer) {
51 if (version_compare(phpversion(), self
::MIN_RECOMMENDED_PHP_VER
) < 0) {
52 $preUpgradeMessage .= '<p>' .
53 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(
55 2 => self
::MIN_RECOMMENDED_PHP_VER
,
60 // http://issues.civicrm.org/jira/browse/CRM-13572
61 // Depending on how the code was upgraded, some sites may still have copies of old
62 // source files left behind. This is often a forgivable offense, but it's quite
63 // dangerous for CIVI-SA-2013-001.
65 $ofcFile = "$civicrm_root/packages/OpenFlashChart/php-ofc-library/ofc_upload_image.php";
66 if (file_exists($ofcFile)) {
67 if (@unlink
($ofcFile)) {
68 $preUpgradeMessage .= '<br />' . ts('This system included an outdated, insecure script (%1). The file was automatically deleted.', array(
73 $preUpgradeMessage .= '<br />' . ts('This system includes an outdated, insecure script (%1). Please delete it.', array(
79 if (Civi
::settings()->get('enable_innodb_fts')) {
80 // The FTS indexing feature dynamically manipulates the schema which could
81 // cause conflicts with other layers that manipulate the schema. The
82 // simplest thing is to turn it off and back on.
84 // It may not always be necessary to do this -- but I doubt we're going to test
85 // systematically in future releases. When it is necessary, one could probably
86 // ignore the matter and simply run CRM_Core_InnoDBIndexer::fixSchemaDifferences
87 // after the upgrade. But that's speculative. For now, we'll leave this
88 // advanced feature in the hands of the sysadmin.
89 $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".');
98 public static function checkMessageTemplate(&$message, $latestVer, $currentVer) {
100 $sql = "SELECT orig.workflow_id as workflow_id,
101 orig.msg_title as title
102 FROM civicrm_msg_template diverted JOIN civicrm_msg_template orig ON (
103 diverted.workflow_id = orig.workflow_id AND
104 orig.is_reserved = 1 AND (
105 diverted.msg_subject != orig.msg_subject OR
106 diverted.msg_text != orig.msg_text OR
107 diverted.msg_html != orig.msg_html
111 $dao = CRM_Core_DAO
::executeQuery($sql);
112 while ($dao->fetch()) {
113 $workflows[$dao->workflow_id
] = $dao->title
;
116 if (empty($workflows)) {
121 $pathName = dirname(dirname(__FILE__
));
123 foreach ($workflows as $workflow => $title) {
124 $name = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionValue',
130 // check if file exists locally
131 $textFileName = implode(DIRECTORY_SEPARATOR
,
134 "{$latestVer}.msg_template",
140 $htmlFileName = implode(DIRECTORY_SEPARATOR
,
143 "{$latestVer}.msg_template",
149 if (file_exists($textFileName) ||
150 file_exists($htmlFileName)
153 $html .= "<li>{$title}</li>";
158 $html = "<ul>" . $html . "<ul>";
160 $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(
161 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Message+Templates#MessageTemplates-UpgradesandCustomizedSystemWorkflowTemplates',