diff --git a/admin/cliupgrade.php b/admin/cliupgrade.php
index b75950d2fe4..522afe8bd1b 100644
--- a/admin/cliupgrade.php
+++ b/admin/cliupgrade.php
@@ -998,16 +998,9 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
}
upgrade_plugins('qtype', 'question/type', ''); // Don't return anywhere
- /// Upgrade blocks system if necessary
- /// first old *.php update and then the new upgrade.php script
- require_once("$CFG->dirroot/lib/blocklib.php");
- if ( $verbose > CLI_NO ) {
- print_heading(get_string('upgradingblocksdb','install'),'',1);
- }
- upgrade_blocks_db(''); // Don't return anywhere
-
/// Check all blocks and load (or upgrade them if necessary)
/// first old *.php update and then the new upgrade.php script
+ require_once("$CFG->dirroot/lib/blocklib.php");
if ( $verbose > CLI_NO ) {
print_heading(get_string('upgradingblocksplugin','install'),'',1);
}
diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php
index 0a7600edebf..3e05b77f2b4 100644
--- a/admin/settings/plugins.php
+++ b/admin/settings/plugins.php
@@ -45,7 +45,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
$ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks')));
$ADMIN->add('blocksettings', new admin_page_manageblocks());
$ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
- if (!empty($CFG->blocks_version) and $blocks = $DB->get_records('block')) {
+ if ($blocks = $DB->get_records('block')) {
$blockbyname = array();
foreach ($blocks as $block) {
diff --git a/blocks/db/install.xml b/blocks/db/install.xml
deleted file mode 100644
index fc6dab4cdef..00000000000
--- a/blocks/db/install.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/blocks/db/upgrade.php b/blocks/db/upgrade.php
deleted file mode 100644
index 467e0124fa1..00000000000
--- a/blocks/db/upgrade.php
+++ /dev/null
@@ -1,55 +0,0 @@
-get_manager();
- $result = true;
-
-/// And upgrade begins here. For each one, you'll need one
-/// block of code similar to the next one. Please, delete
-/// this comment lines once this file start handling proper
-/// upgrade code.
-
-/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
-/// $result = result of database_manager methods
-/// }
-
- if ($result && $oldversion < 2007081300) {
-
- /// Changing nullability of field configdata on table block_instance to null
- $table = new xmldb_table('block_instance');
- $field = new xmldb_field('configdata');
- $field->set_attributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'visible');
-
- /// Launch change of nullability for field configdata
- $result = $result && $dbman->change_field_notnull($table, $field);
- }
-
-
- return $result;
-}
-
-
-
-?>
diff --git a/blocks/version.php b/blocks/version.php
deleted file mode 100644
index 8a67e21c944..00000000000
--- a/blocks/version.php
+++ /dev/null
@@ -1,9 +0,0 @@
-
\ No newline at end of file
diff --git a/lib/adminlib.php b/lib/adminlib.php
index 165e3af497b..a0349fa36b7 100644
--- a/lib/adminlib.php
+++ b/lib/adminlib.php
@@ -159,6 +159,7 @@ function upgrade_db($version, $release) {
'filter_multilang_converted' => 1,
'backup_version' => 2008111700,
'backup_release' => '2.0 dev',
+ 'blocks_version' => 2007081300, // might be removed soon
));
// store main version
@@ -376,13 +377,9 @@ function upgrade_db($version, $release) {
/// It is important that this is done AFTER the quiz module has been upgraded
upgrade_plugins('qtype', 'question/type', $return_url); // Return here afterwards
-/// Upgrade blocks system if necessary
-/// first old *.php update and then the new upgrade.php script
- require_once("$CFG->dirroot/lib/blocklib.php");
- upgrade_blocks_db($return_url); // Return here afterwards
-
/// Check all blocks and load (or upgrade them if necessary)
/// first old *.php update and then the new upgrade.php script
+ require_once("$CFG->dirroot/lib/blocklib.php");
upgrade_blocks_plugins($return_url); // Return here afterwards
/// Check all enrolment plugins and upgrade if necessary
@@ -758,9 +755,6 @@ function get_db_directories() {
}
}
-/// Now, block system stuff (blocks/db)
- $dbdirs[] = $CFG->dirroot.'/blocks/db';
-
/// Now, blocks (blocks/xxx/db)
if ($plugins = get_list_of_plugins('blocks', 'db')) {
foreach ($plugins as $plugin) {
@@ -4718,7 +4712,7 @@ class admin_page_manageblocks extends admin_externalpage {
}
$found = false;
- if (!empty($CFG->blocks_version) and $blocks = $DB->get_records('block')) {
+ if ($blocks = $DB->get_records('block')) {
$textlib = textlib_get_instance();
foreach ($blocks as $block) {
if (strpos($block->name, $query) !== false) {
diff --git a/lib/blocklib.php b/lib/blocklib.php
index ad32e7a6bff..36fa5c7523c 100644
--- a/lib/blocklib.php
+++ b/lib/blocklib.php
@@ -1069,115 +1069,6 @@ function blocks_repopulate_page($page) {
return true;
}
-function upgrade_blocks_db($continueto) {
-/// This function upgrades the blocks tables, if necessary
-/// It's called from admin/index.php
-
- global $CFG, $interactive, $DB;
-
- require_once ($CFG->dirroot .'/blocks/version.php'); // Get code versions
-
- if (empty($CFG->blocks_version)) { // Blocks have never been installed.
- $strdatabaseupgrades = get_string('databaseupgrades');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- print_header($strdatabaseupgrades, $strdatabaseupgrades,
- build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '',
- upgrade_get_javascript(), false, ' ', ' ');
- }
- upgrade_log_start();
- print_heading('blocks');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
- /// Both old .sql files and new install.xml are supported
- /// but we priorize install.xml (XMLDB) if present
- $DB->get_manager()->install_from_xmldb_file($CFG->dirroot . '/blocks/db/install.xml'); //New method
- $status = true;
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
- if ($status) {
- if (set_config('blocks_version', $blocks_version)) {
- notify(get_string('databasesuccess'), 'notifysuccess');
- notify(get_string('databaseupgradeblocks', '', $blocks_version), 'notifysuccess');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- print_continue($continueto);
- print_footer('none');
- exit;
- } else if (CLI_UPGRADE && ($interactive > CLI_SEMI) ) {
- console_write('askcontinue');
- if (read_boolean()){
- return ;
- }else {
- console_write_error('','',false);
- }
- }
- } else {
- print_error('cannotupgradeblock');
- }
- } else {
- print_error('cannotsetupblock');
- }
- }
-
-/// Upgrading code starts here
- $newupgrade = false;
- if (is_readable($CFG->dirroot . '/blocks/db/upgrade.php')) {
- include_once($CFG->dirroot . '/blocks/db/upgrade.php'); // defines new upgrading function
- $newupgrade = true;
- }
-
- if ($blocks_version > $CFG->blocks_version) { // Upgrade tables
- $strdatabaseupgrades = get_string('databaseupgrades');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- print_header($strdatabaseupgrades, $strdatabaseupgrades,
- build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript());
- }
- upgrade_log_start();
-
- print_heading('blocks');
-
- /// Run de old and new upgrade functions for the module
- $newupgrade_function = 'xmldb_blocks_upgrade';
-
- /// Then, the new function if exists and the old one was ok
- $newupgrade_status = true;
- if ($newupgrade && function_exists($newupgrade_function)) {
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
- $newupgrade_status = $newupgrade_function($CFG->blocks_version);
- } else if ($newupgrade) {
- notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
- '/blocks/db/upgrade.php');
- }
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
- /// Now analyze upgrade results
- if ($newupgrade_status) { // No upgrading failed
- if (set_config('blocks_version', $blocks_version)) {
- notify(get_string('databasesuccess'), 'notifysuccess');
- notify(get_string('databaseupgradeblocks', '', $blocks_version), 'notifysuccess');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- print_continue($continueto);
- print_footer('none');
- exit;
- }
- } else {
- print_error('cannotupgradeblock');
- }
- } else {
- print_error('cannotupgradeblock');
- }
-
- } else if ($blocks_version < $CFG->blocks_version) {
- upgrade_log_start();
- notify('WARNING!!! The Blocks version you are using is OLDER than the version that made these databases!');
- }
- upgrade_log_finish();
-}
-
//This function finds all available blocks and install them
//into blocks table or do all the upgrade process if newer
function upgrade_blocks_plugins($continueto) {
diff --git a/lib/db/install.xml b/lib/db/install.xml
index 4d47acf30f5..41cd35ec05a 100644
--- a/lib/db/install.xml
+++ b/lib/db/install.xml
@@ -2069,7 +2069,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index abcd60cee8d..e30cb8b6a9c 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -1318,6 +1318,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint($result, 2009010801);
}
+ if ($result && $oldversion < 2009011000) {
+
+ /// Changing nullability of field configdata on table block_instance to null
+ $table = new xmldb_table('block_instance');
+ $field = new xmldb_field('configdata');
+ $field->set_attributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'visible');
+
+ /// Launch change of nullability for field configdata
+ $dbman->change_field_notnull($table, $field);
+
+ /// Main savepoint reached
+ upgrade_main_savepoint($result, 2009011000);
+ }
+
return $result;
}
diff --git a/version.php b/version.php
index 27aed79ad57..b19198b453c 100644
--- a/version.php
+++ b/version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2009010801; // YYYYMMDD = date of the last version bump
+ $version = 2009011000; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20090110)'; // Human-friendly version name