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. |
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 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 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2015
33 class CRM_Upgrade_Incremental_php_FourSeven
{
34 const BATCH_SIZE
= 5000;
43 public function verifyPreDBstate(&$errors) {
48 * Compute any messages which should be displayed before upgrade.
50 * Note: This function is called iteratively for each upcoming
51 * revision to the database.
53 * @param $preUpgradeMessage
55 * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
56 * @param null $currentVer
58 public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
62 * Compute any messages which should be displayed after upgrade.
64 * @param string $postUpgradeMessage
67 * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
70 public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
71 if ($rev == '4.7.alpha1') {
72 $config = CRM_Core_Config
::singleton();
73 $editor_id = self
::updateWysiwyg();
75 $ext_href = 'href="' . CRM_Utils_System
::url('civicrm/admin/extensions', 'reset=1') . '"';
76 $dsp_href = 'href="' . CRM_Utils_System
::url('civicrm/admin/setting/preferences/display', 'reset=1') . '"';
77 $blog_href = 'href="https://civicrm.org/blogs/colemanw/big-changes-wysiwyg-editing-47"';
81 $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));
84 // Drupal/Joomla editor
87 $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));
91 $postUpgradeMessage .= '<p>' . $msg . '</p>';
93 $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>';
99 * (Queue Task Callback)
101 public static function task_4_7_x_runSql(CRM_Queue_TaskContext
$ctx, $rev) {
102 $upgrade = new CRM_Upgrade_Form();
103 $upgrade->processSQL($rev);
109 * Syntactic sugar for adding a task which (a) is in this class and (b) has
112 * After passing the $funcName, you can also pass parameters that will go to
113 * the function. Note that all params must be serializable.
115 protected function addTask($title, $funcName) {
116 $queue = CRM_Queue_Service
::singleton()->load(array(
118 'name' => CRM_Upgrade_Form
::QUEUE_NAME
,
121 $args = func_get_args();
122 $title = array_shift($args);
123 $funcName = array_shift($args);
124 $task = new CRM_Queue_Task(
125 array(get_class($this), $funcName),
129 $queue->createItem($task, array('weight' => -1));
137 public function upgrade_4_7_alpha1($rev) {
138 $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'task_4_7_x_runSql', $rev);
146 public static function updateWysiwyg() {
147 $editorID = CRM_Core_BAO_Setting
::getItem(CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
, 'editor_id');
148 // Previously a numeric value indicated one of 4 wysiwyg editors shipped in core, and no value indicated 'Textarea'
149 // Now the options are "Textarea", "CKEditor", and the rest have been dropped from core.
150 $newEditor = $editorID ?
"CKEditor" : "Textarea";
151 CRM_Core_BAO_Setting
::setItem($newEditor, CRM_Core_BAO_Setting
::SYSTEM_PREFERENCES_NAME
, 'editor_id');