MDL-29029 move multilang upgrade to admin tools

AMOS BEGIN
 MOV [multilangupgrade,core_admin],[pluginname,tool_ multilangupgrade]
 MOV [multilangupgradeinfo,core_admin],[multilangupgradeinfo,tool_ multilangupgrade]
AMOS END
This commit is contained in:
Petr Skoda 2011-09-18 09:42:45 +02:00
parent b007a5d041
commit 0715e3d938
7 changed files with 124 additions and 16 deletions

View File

@ -17,7 +17,4 @@ if ($hassiteconfig) {
$ADMIN->add('language', $temp);
// Hidden multilang upgrade page.
$ADMIN->add('language', new admin_externalpage('multilangupgrade', get_string('multilangupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/multilangupgrade.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
} // end of speedup

View File

@ -1,26 +1,51 @@
<?php
/// Search and replace strings throughout all texts in the whole database
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Search and replace strings throughout all texts in the whole database.
*
* Unfortunately it was a bad idea to use spans for multilang because it
* can not support nesting. Hopefully this will get thrown away soon....
*
* @package tool
* @subpackage multilangupgrade
* @copyright 2006 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require('../../../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('multilangupgrade');
admin_externalpage_setup('toolmultilangupgrade');
$go = optional_param('go', 0, PARAM_BOOL);
###################################################################
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('multilangupgrade', 'admin'));
echo $OUTPUT->heading(get_string('pluginname', 'tool_multilangupgrade'));
$strmultilangupgrade = get_String('multilangupgradeinfo', 'admin');
$strmultilangupgrade = get_String('multilangupgradeinfo', 'tool_multilangupgrade');
if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
$optionsyes = array('go'=>1, 'sesskey'=>sesskey());
echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('multilangupgrade.php', $optionsyes), 'index.php');
echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('/admin/tool/multilangupgrade/index.php', $optionsyes), new moodle_url('/admin/'));
echo $OUTPUT->footer();
die;
}
@ -38,7 +63,7 @@ echo $OUTPUT->box_start();
echo '<strong>Progress:</strong>';
$i = 0;
$skiptables = array('config', 'user_students', 'user_teachers');
$skiptables = array('config', 'block_instances', 'sessions'); // we can not process tables with serialised data here
foreach ($tables as $table) {
if (strpos($table,'pma') === 0) { // Not our tables
@ -99,7 +124,7 @@ echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
rebuild_course_cache();
echo $OUTPUT->notification('...finished', 'notifysuccess');
echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->continue_button(new moodle_url('/admin/'));
echo $OUTPUT->footer();
die;

View File

@ -0,0 +1,27 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'tool_multilangupgrade', language 'en', branch 'MOODLE_22_STABLE'
*
* @package report
* @subpackage multilangupgrade
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['multilangupgradeinfo'] = 'The multilang filter syntax was changed in 1.8, &lt;lang&gt; tag is not supported any more. <br /><br />Example: &lt;span lang="en" class="multilang">Hello!&lt;/span&gt;&lt;span lang="es" class="multilang">Hola!&lt;/span&gt;<br /><br /><strong>Do you want to upgrade the syntax in all existing texts now?</strong>';
$string['pluginname'] = 'Multilang upgrade';

View File

@ -0,0 +1,31 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Link to multilang upgrade script.
*
* @package tool
* @subpackage multilangupgrade
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
// Hidden multilang upgrade page - show in settings root to get more attention.
$ADMIN->add('root', new admin_externalpage('toolmultilangupgrade', get_string('pluginname', 'tool_multilangupgrade'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/multilangupgrade/index.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted)));
}

View File

@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Plugin version info
*
* @package tool
* @subpackage multilangupgrade
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011091600; // Requires this Moodle version
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)

View File

@ -683,9 +683,6 @@ $string['modeditdefaults'] = 'Default values for activity settings';
$string['modsettings'] = 'Manage activities';
$string['modulesecurity'] = 'Module security';
$string['multilangforceold'] = 'Force old multilang syntax: &lt;span&gt; without the class="multilang" and &lt;lang&gt;';
$string['multilangupgrade'] = 'Multilang upgrade';
$string['multilangupgradeinfo'] = 'The multilang filter syntax was changed in 1.8, &lt;lang&gt; tag is not supported any more. <br /><br />Example: &lt;span lang="en" class="multilang">Hello!&lt;/span&gt;&lt;span lang="es" class="multilang">Hola!&lt;/span&gt;<br /><br /><strong>Do you want to upgrade the syntax in all existing texts now?</strong>';
$string['multilangupgradenotice'] = 'Your site is probably using old multilang syntax, <a href="multilangupgrade.php">multilang upgrade</a> is recommended.';
$string['mustenablestats'] = 'Stats have not yet been enabled on this site.';
$string['mycoursesperpage'] = 'Number of courses';
$string['mydashboard'] = 'System default dashboard';

View File

@ -367,8 +367,9 @@ class plugin_manager {
),
'tool' => array(
'bloglevelupgrade', 'capability', 'dbtransfer', 'generator', 'health',
'innodb', 'langimport', 'profiling', 'unittest', 'unsuproles', 'xmldb'
'bloglevelupgrade', 'capability', 'dbtransfer', 'generator',
'health', 'innodb', 'langimport', 'multilangupgrade',
'profiling', 'unittest', 'unsuproles', 'xmldb'
),
'webservice' => array(