Commit | Line | Data |
---|---|---|
6cc25669 CW |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2015 | | |
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. | | |
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 along with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
27 | /** | |
bf6a5362 | 28 | * Upgrade logic for 4.7 |
6cc25669 | 29 | */ |
bf6a5362 | 30 | class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base { |
6cc25669 CW |
31 | |
32 | /** | |
33 | * Compute any messages which should be displayed after upgrade. | |
34 | * | |
35 | * @param string $postUpgradeMessage | |
36 | * alterable. | |
37 | * @param string $rev | |
38 | * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs. | |
39 | * @return void | |
40 | */ | |
41 | public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { | |
6dbe2c23 CW |
42 | if ($rev == '4.7.alpha1') { |
43 | $config = CRM_Core_Config::singleton(); | |
bf6a5362 | 44 | // FIXME: Performing an upgrade step during postUpgrade message phase is probably bad |
6dbe2c23 CW |
45 | $editor_id = self::updateWysiwyg(); |
46 | $msg = NULL; | |
47 | $ext_href = 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1') . '"'; | |
48 | $dsp_href = 'href="' . CRM_Utils_System::url('civicrm/admin/setting/preferences/display', 'reset=1') . '"'; | |
49 | $blog_href = 'href="https://civicrm.org/blogs/colemanw/big-changes-wysiwyg-editing-47"'; | |
50 | switch ($editor_id) { | |
51 | // TinyMCE | |
52 | case 1: | |
53 | $msg = ts('Your configured editor "TinyMCE" is no longer part of the main CiviCRM download. To continue using it, visit the <a %1>Manage Extensions</a> page to download and install the TinyMCE extension.', array(1 => $ext_href)); | |
54 | break; | |
55 | ||
56 | // Drupal/Joomla editor | |
57 | case 3: | |
58 | case 4: | |
59 | $msg = ts('CiviCRM no longer integrates with the "%1 Default Editor." Your wysiwyg setting has been reset to the built-in CKEditor. <a %2>Learn more...</a>', array(1 => $config->userFramework, 2 => $blog_href)); | |
60 | break; | |
61 | } | |
62 | if ($msg) { | |
63 | $postUpgradeMessage .= '<p>' . $msg . '</p>'; | |
64 | } | |
65 | $postUpgradeMessage .= '<p>' . ts('CiviCRM now includes the easy-to-use CKEditor Configurator. To customize the features and display of your wysiwyg editor, visit the <a %1>Display Preferences</a> page. <a %2>Learn more...</a>', array(1 => $dsp_href, 2 => $blog_href)) . '</p>'; | |
dd55005c | 66 | |
67 | $postUpgradeMessage .= '<br /><br />' . ts('Default version of the following System Workflow Message Templates have been modified: <ul><li>Personal Campaign Pages - Owner Notification</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).'); | |
6dbe2c23 | 68 | } |
6cc25669 CW |
69 | } |
70 | ||
6cc25669 CW |
71 | /** |
72 | * Upgrade function. | |
73 | * | |
74 | * @param string $rev | |
75 | */ | |
76 | public function upgrade_4_7_alpha1($rev) { | |
bf6a5362 | 77 | $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); |
6cc25669 CW |
78 | } |
79 | ||
80 | /** | |
81 | * CRM-16354 | |
82 | * | |
6dbe2c23 | 83 | * @return int |
6cc25669 | 84 | */ |
6dbe2c23 | 85 | public static function updateWysiwyg() { |
6cc25669 | 86 | $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id'); |
6dbe2c23 CW |
87 | // Previously a numeric value indicated one of 4 wysiwyg editors shipped in core, and no value indicated 'Textarea' |
88 | // Now the options are "Textarea", "CKEditor", and the rest have been dropped from core. | |
89 | $newEditor = $editorID ? "CKEditor" : "Textarea"; | |
90 | CRM_Core_BAO_Setting::setItem($newEditor, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id'); | |
6cc25669 | 91 | |
6dbe2c23 | 92 | return $editorID; |
6cc25669 CW |
93 | } |
94 | ||
95 | } |