Skip to content

Commit

Permalink
MDL-51580 upgrade: clean < 2.7.0 upgrade steps
Browse files Browse the repository at this point in the history
This just deletes all the upgrade steps previous to 2.7.0. Some
small adjustments, like adding missing MOODLE_INTERNAL or tweaking
globals can also be applied when needed.

Next commit will get rid of/deprecate all the upgradelib functions
not used anymore in codebase.
  • Loading branch information
stronk7 committed Feb 15, 2016
1 parent bf5c764 commit e8c82aa
Show file tree
Hide file tree
Showing 89 changed files with 192 additions and 8,669 deletions.
25 changes: 3 additions & 22 deletions admin/tool/customlang/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

function xmldb_tool_customlang_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;

$dbman = $DB->get_manager();


// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this

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

// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.


// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
function xmldb_tool_customlang_upgrade($oldversion) {
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
15 changes: 1 addition & 14 deletions admin/tool/log/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,7 @@
* @return bool always true
*/
function xmldb_tool_log_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;

$dbman = $DB->get_manager();

if ($oldversion < 2014040600) {
// Reset logging defaults in dev branches,
// in production upgrade the install.php is executed instead.
require_once(__DIR__ . '/install.php');
xmldb_tool_log_install();
upgrade_plugin_savepoint(true, 2014040600, 'tool', 'log');
}

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
15 changes: 3 additions & 12 deletions admin/tool/log/store/database/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

function xmldb_logstore_database_upgrade($oldversion) {

if ($oldversion < 2014041700) {
// Clean up old config.
unset_config('excludelevels', 'logstore_database');
unset_config('excludeactions', 'logstore_database');

// Savepoint reached.
upgrade_plugin_savepoint(true, 2014041700, 'logstore', 'database');
}
defined('MOODLE_INTERNAL') || die();

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
function xmldb_logstore_database_upgrade($oldversion) {
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
93 changes: 3 additions & 90 deletions admin/tool/log/store/standard/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,97 +22,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

function xmldb_logstore_standard_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();

if ($oldversion < 2014032000) {

// Define field anonymous to be added to logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$field = new xmldb_field('anonymous', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'relateduserid');

// Conditionally launch add field anonymous.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Standard savepoint reached.
upgrade_plugin_savepoint(true, 2014032000, 'logstore', 'standard');
}

if ($oldversion < 2014041500) {

// Define index contextid-component (not unique) to be dropped form logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('contextid-component', XMLDB_INDEX_NOTUNIQUE, array('contextid', 'component'));

// Conditionally launch drop index contextid-component.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Define index courseid (not unique) to be dropped form logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));

// Conditionally launch drop index courseid.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Define index eventname (not unique) to be dropped form logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('eventname', XMLDB_INDEX_NOTUNIQUE, array('eventname'));
defined('MOODLE_INTERNAL') || die();

// Conditionally launch drop index eventname.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Define index crud (not unique) to be dropped form logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('crud', XMLDB_INDEX_NOTUNIQUE, array('crud'));

// Conditionally launch drop index crud.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Define index edulevel (not unique) to be dropped form logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('edulevel', XMLDB_INDEX_NOTUNIQUE, array('edulevel'));

// Conditionally launch drop index edulevel.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Define index course-time (not unique) to be added to logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('course-time', XMLDB_INDEX_NOTUNIQUE, array('courseid', 'anonymous', 'timecreated'));

// Conditionally launch add index course-time.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}

// Define index user-module (not unique) to be added to logstore_standard_log.
$table = new xmldb_table('logstore_standard_log');
$index = new xmldb_index('user-module', XMLDB_INDEX_NOTUNIQUE, array('userid', 'contextlevel', 'contextinstanceid', 'crud', 'edulevel', 'timecreated'));

// Conditionally launch add index user-module.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}

// Standard savepoint reached.
upgrade_plugin_savepoint(true, 2014041500, 'logstore', 'standard');
}

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
function xmldb_logstore_standard_upgrade($oldversion) {
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
31 changes: 3 additions & 28 deletions auth/cas/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,19 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_auth_cas_upgrade($oldversion) {

// Moodle v2.5.0 release upgrade line
// Put any upgrade step following this

// MDL-39323 New setting in 2.5, make sure it's defined.
if ($oldversion < 2013052100) {
if (get_config('start_tls', 'auth/cas') === false) {
set_config('start_tls', 0, 'auth/cas');
}
upgrade_plugin_savepoint(true, 2013052100, 'auth', 'cas');
}

if ($oldversion < 2013091700) {
// The value of the phpCAS language constants has changed from
// 'langname' to 'CAS_Languages_Langname'.
if ($cas_language = get_config('auth/cas', 'language')) {
set_config('language', 'CAS_Languages_'.ucfirst($cas_language), 'auth/cas');
}

upgrade_plugin_savepoint(true, 2013091700, 'auth', 'cas');
}

// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
global $CFG, $DB;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2014111001) {
global $DB;
// From now on the default LDAP objectClass setting for AD has been changed, from 'user' to '(samaccounttype=805306368)'.
if (is_enabled_auth('cas')
&& ($DB->get_field('config_plugins', 'value', array('name' => 'user_type', 'plugin' => 'auth/cas')) === 'ad')
Expand Down
21 changes: 3 additions & 18 deletions auth/ldap/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,19 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_auth_ldap_upgrade($oldversion) {

// Moodle v2.5.0 release upgrade line
// Put any upgrade step following this

// MDL-39323 New setting in 2.5, make sure it's defined.
if ($oldversion < 2013052100) {
if (get_config('start_tls', 'auth/ldap') === false) {
set_config('start_tls', 0, 'auth/ldap');
}
upgrade_plugin_savepoint(true, 2013052100, 'auth', 'ldap');
}

// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
global $CFG, $DB;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2014111001) {
global $DB;
// From now on the default LDAP objectClass setting for AD has been changed, from 'user' to '(samaccounttype=805306368)'.
if (is_enabled_auth('ldap')
&& ($DB->get_field('config_plugins', 'value', array('name' => 'user_type', 'plugin' => 'auth/ldap')) === 'ad')
Expand Down
25 changes: 3 additions & 22 deletions auth/manual/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_auth_manual_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;

$dbman = $DB->get_manager();


// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.


// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
25 changes: 3 additions & 22 deletions auth/mnet/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_auth_mnet_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;

$dbman = $DB->get_manager();


// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.


// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
23 changes: 3 additions & 20 deletions blocks/community/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
*
* @param int $oldversion
* @param object $block
*/
function xmldb_block_community_upgrade($oldversion) {
global $CFG, $DB;

// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this


// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.


// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.

// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
global $CFG;

// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
Expand Down
Loading

0 comments on commit e8c82aa

Please sign in to comment.