Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/moodle/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
pcharsle committed Mar 15, 2012
2 parents 9ea62d0 + a2b30aa commit bcd284c
Show file tree
Hide file tree
Showing 1,054 changed files with 18,542 additions and 12,119 deletions.
4 changes: 4 additions & 0 deletions admin/cli/upgrade.php
Expand Up @@ -92,6 +92,10 @@
$oldversion = "$CFG->release ($CFG->version)";
$newversion = "$release ($version)";

if (!moodle_needs_upgrading()) {
cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
}

// Test environment first.
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
if (!$envstatus) {
Expand Down
1 change: 1 addition & 0 deletions admin/environment.xml
Expand Up @@ -651,6 +651,7 @@
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="40M" level="required">
Expand Down
4 changes: 2 additions & 2 deletions admin/index.php
Expand Up @@ -306,8 +306,8 @@
}
}

// at this stage there can be only one admin - users may change username, so do not rely on that
$adminuser = get_complete_user_data('id', $CFG->siteadmins);
// at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that
$adminuser = get_complete_user_data('id', reset(explode(',', $CFG->siteadmins)));

if ($adminuser->password === 'adminsetuppending') {
// prevent installation hijacking
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/access_control.php
Expand Up @@ -103,7 +103,7 @@
$usernames = explode(',', $form->username);

foreach ($usernames as $username) {
$username = trim(moodle_strtolower($username));
$username = trim(textlib::strtolower($username));
if (!empty($username)) {
if (mnet_update_sso_access_control($username, $form->mnet_host_id, $form->accessctrl)) {
if ($form->accessctrl == 'allow') {
Expand Down
4 changes: 2 additions & 2 deletions admin/roles/lib.php
Expand Up @@ -610,8 +610,8 @@ public function read_submitted_permissions() {
$shortname = optional_param('shortname', null, PARAM_RAW);
if (!is_null($shortname)) {
$this->role->shortname = $shortname;
$this->role->shortname = textlib_get_instance()->specialtoascii($this->role->shortname);
$this->role->shortname = moodle_strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
$this->role->shortname = textlib::specialtoascii($this->role->shortname);
$this->role->shortname = textlib::strtolower(clean_param($this->role->shortname, PARAM_ALPHANUMEXT));
if (empty($this->role->shortname)) {
$this->errors['shortname'] = get_string('errorbadroleshortname', 'role');
}
Expand Down
4 changes: 2 additions & 2 deletions admin/settings.php
Expand Up @@ -131,8 +131,8 @@
echo '</form>';
}

$PAGE->requires->yui_module('moodle-core-formslib',
'M.core.init_formslib',
$PAGE->requires->yui_module('moodle-core-formchangechecker',
'M.core_formchangechecker.init',
array(array(
'formid' => 'adminsettings'
))
Expand Down
1 change: 1 addition & 0 deletions admin/settings/appearance.php
Expand Up @@ -97,6 +97,7 @@
);
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
$temp->add(new admin_setting_configcheckbox('navlinkcoursesections', new lang_string('navlinkcoursesections', 'admin'), new lang_string('navlinkcoursesections_help', 'admin'), 0));
Expand Down
2 changes: 0 additions & 2 deletions admin/settings/courses.php
Expand Up @@ -97,7 +97,6 @@
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_users', new lang_string('generalusers','backup'), new lang_string('configgeneralusers','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_anonymize', new lang_string('generalanonymize','backup'), new lang_string('configgeneralanonymize','backup'), array('value'=>0, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_user_files', new lang_string('generaluserfiles','backup'), new lang_string('configgeneraluserfiles','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
Expand Down Expand Up @@ -144,7 +143,6 @@
$temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), ''));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_user_files', new lang_string('generaluserfiles', 'backup'), new lang_string('configgeneraluserfiles','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1));
Expand Down
14 changes: 7 additions & 7 deletions admin/settings/plugins.php
Expand Up @@ -477,6 +477,13 @@
$ADMIN->add('reportplugins', $page);
}

/// Add all admin tools
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
$ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
$CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
}

// Now add various admin tools
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
Expand All @@ -485,13 +492,6 @@
}
}

/// Add all admin tools
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
$ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
$CFG->wwwroot . '/' . $CFG->admin . '/tools.php'));
}

/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
Expand Down
3 changes: 1 addition & 2 deletions admin/tool/customlang/db/access.php
Expand Up @@ -18,8 +18,7 @@
/**
* Defines the capabilities used by the Language customization admin tool
*
* @package tool
* @subpackage customlang
* @package tool_customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
16 changes: 8 additions & 8 deletions admin/tool/customlang/db/install.xml
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="admin/tool/customlang/db" VERSION="20110925" COMMENT="XMLDB file for Moodle admin/tool/customlang"
<XMLDB PATH="admin/tool/customlang/db" VERSION="20120122" COMMENT="XMLDB file for Moodle admin/tool/customlang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="tool_customlang" COMMENT="Contains the working checkout of all strings and their customization" NEXT="tool_customlang_components">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="lang"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="lang"/>
<FIELD NAME="lang" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="The code of the language this string belongs to. Like en, cs or es" PREVIOUS="id" NEXT="componentid"/>
<FIELD NAME="componentid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The id of the component" PREVIOUS="lang" NEXT="stringid"/>
<FIELD NAME="componentid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of the component" PREVIOUS="lang" NEXT="stringid"/>
<FIELD NAME="stringid" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The identifier of the string" PREVIOUS="componentid" NEXT="original"/>
<FIELD NAME="original" TYPE="text" LENGTH="big" NOTNULL="true" SEQUENCE="false" COMMENT="English original of the string" PREVIOUS="stringid" NEXT="master"/>
<FIELD NAME="master" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Master translation of the string as is distributed in the official lang pack, null if not translated" PREVIOUS="original" NEXT="local"/>
<FIELD NAME="local" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Local customization of the string, null if not customized" PREVIOUS="master" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The timestamp of when the original or master was recently modified" PREVIOUS="local" NEXT="timecustomized"/>
<FIELD NAME="timecustomized" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" COMMENT="The timestamp of when the value of the local translation was recently modified, null if not customized yet" PREVIOUS="timemodified" NEXT="outdated"/>
<FIELD NAME="outdated" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Either the English original or the master translation changed and the customization may be outdated" PREVIOUS="timecustomized" NEXT="modified"/>
<FIELD NAME="modified" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Has the string been modified via the translator?" PREVIOUS="outdated"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The timestamp of when the original or master was recently modified" PREVIOUS="local" NEXT="timecustomized"/>
<FIELD NAME="timecustomized" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The timestamp of when the value of the local translation was recently modified, null if not customized yet" PREVIOUS="timemodified" NEXT="outdated"/>
<FIELD NAME="outdated" TYPE="int" LENGTH="3" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Either the English original or the master translation changed and the customization may be outdated" PREVIOUS="timecustomized" NEXT="modified"/>
<FIELD NAME="modified" TYPE="int" LENGTH="3" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Has the string been modified via the translator?" PREVIOUS="outdated"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="fk_component"/>
Expand All @@ -28,7 +28,7 @@
</TABLE>
<TABLE NAME="tool_customlang_components" COMMENT="Contains the list of all installed plugins that provide their own language pack" PREVIOUS="tool_customlang">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The normalized name of the plugin" PREVIOUS="id" NEXT="version"/>
<FIELD NAME="version" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="The checked out version of the plugin, null if the version is unknown" PREVIOUS="name"/>
</FIELDS>
Expand Down
5 changes: 3 additions & 2 deletions admin/tool/unittest/db/access.php
Expand Up @@ -17,12 +17,13 @@
/**
* Unitest caps.
*
* @package tool
* @subpackage unittest
* @package tool_unittest
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$capabilities = array(

// Note: do not add managers here, unittests are dangerous and not intended for production sites!!!
Expand Down
14 changes: 5 additions & 9 deletions admin/tool/uploaduser/locallib.php
Expand Up @@ -179,13 +179,11 @@ function uu_validate_user_upload_columns(csv_import_reader $cir, $stdfields, $pr
print_error('csvfewcolumns', 'error', $returnurl);
}

$textlib = textlib_get_instance(); // profile fields may contain unicode chars

// test columns
$processed = array();
foreach ($columns as $key=>$unused) {
$field = $columns[$key];
$lcfield = $textlib->strtolower($field);
$lcfield = textlib::strtolower($field);
if (in_array($field, $stdfields) or in_array($lcfield, $stdfields)) {
// standard fields are only lowercase
$newfield = $lcfield;
Expand Down Expand Up @@ -281,8 +279,6 @@ function uu_process_template($template, $user) {
* Internal callback function.
*/
function uu_process_template_callback($username, $firstname, $lastname, $block) {
$textlib = textlib_get_instance();

switch ($block[3]) {
case 'u':
$repl = $username;
Expand All @@ -299,18 +295,18 @@ function uu_process_template_callback($username, $firstname, $lastname, $block)

switch ($block[1]) {
case '+':
$repl = $textlib->strtoupper($repl);
$repl = textlib::strtoupper($repl);
break;
case '-':
$repl = $textlib->strtolower($repl);
$repl = textlib::strtolower($repl);
break;
case '~':
$repl = $textlib->strtotitle($repl);
$repl = textlib::strtotitle($repl);
break;
}

if (!empty($block[2])) {
$repl = $textlib->substr($repl, 0 , $block[2]);
$repl = textlib::substr($repl, 0 , $block[2]);
}

return $repl;
Expand Down
3 changes: 1 addition & 2 deletions admin/tool/uploaduser/user_form.php
Expand Up @@ -53,8 +53,7 @@ function definition () {
$mform->setDefault('delimiter_name', 'comma');
}

$textlib = textlib_get_instance();
$choices = $textlib->get_encodings();
$choices = textlib::get_encodings();
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
$mform->setDefault('encoding', 'UTF-8');

Expand Down
Expand Up @@ -23,8 +23,7 @@

/**
* reporting about the ones not physically implemented as BIGINTs
* and providing one SQL script to fix all them. Also, under MySQL,
* it performs one check of signed bigints. MDL-11038
* and providing one SQL script to fix all them. MDL-11038
*
* @package tool
* @subpackage xmldb
Expand Down Expand Up @@ -53,7 +52,6 @@ function init() {
'wrongints' => 'tool_xmldb',
'nowrongintsfound' => 'tool_xmldb',
'yeswrongintsfound' => 'tool_xmldb',
'mysqlextracheckbigints' => 'tool_xmldb',
));

// Correct fields must be type bigint for MySQL and int8 for PostgreSQL
Expand Down Expand Up @@ -90,8 +88,8 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$metacolumn = $metacolumns[$xmldb_field->getName()];
// Going to check this field in DB
$o.=' <li>' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' ';
// Detect if the physical field is wrong and, under mysql, check for incorrect signed fields too
if ($metacolumn->type != $this->correct_type || ($this->dbfamily == 'mysql' && $xmldb_field->getUnsigned() && !$metacolumn->unsigned)) {
// Detect if the physical field is wrong
if ($metacolumn->type != $this->correct_type) {
$o.='<font color="red">' . $this->str['wrong'] . '</font>';
// Add the wrong field to the list
$obj = new stdClass();
Expand Down
Expand Up @@ -88,7 +88,7 @@ function invoke() {
$c.= ' <TABLES>' . "\n";
$c.= ' <TABLE NAME="' . $xmltable . '" COMMENT="Default comment for ' . $xmltable .', please edit me">' . "\n";
$c.= ' <FIELDS>' . "\n";
$c.= ' <FIELD NAME="id" TYPE="int" LENGTH="10" UNSIGNED="true" NOTNULL="true" SEQUENCE="true" />' . "\n";
$c.= ' <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />' . "\n";
$c.= ' </FIELDS>' . "\n";
$c.= ' <KEYS>' . "\n";
$c.= ' <KEY NAME="primary" TYPE="primary" FIELDS="id" />' . "\n";
Expand Down
5 changes: 0 additions & 5 deletions admin/tool/xmldb/actions/edit_field/edit_field.class.php
Expand Up @@ -155,11 +155,6 @@ function invoke() {
// xmldb_field Decimals
$o.= ' <tr valign="top"><td><label for="decimals" accesskey="d">Decimals:</label></td>';
$o.= ' <td colspan="2"><input name="decimals" type="text" size="6" maxlength="6" id="decimals" value="' . s($field->getDecimals()) . '" /><span id="decimalstip"></span></td></tr>';
// xmldb_field Unsigned
$unsignedoptions = array (0 => 'signed', 1 => 'unsigned');
$select = html_writer::select($unsignedoptions, 'unsigned', $field->getUnsigned(), false);
$o.= ' <tr valign="top"><td><label for="menuunsigned" accesskey="u">Unsigned:</label></td>';
$o.= ' <td colspan="2">' . $select . '</td></tr>';
// xmldb_field NotNull
$notnulloptions = array (0 => 'null', 'not null');
$select = html_writer::select($notnulloptions, 'notnull', $field->getNotNull(), false);
Expand Down

0 comments on commit bcd284c

Please sign in to comment.