Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
MDL-30610 remove outdated block upgrade code
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Dec 23, 2011
1 parent 5ea41be commit 612d65d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 111 deletions.
35 changes: 1 addition & 34 deletions blocks/community/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,5 @@
function xmldb_block_community_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();

if ($oldversion < 2010042701) {

/// Define table block_community to be created
$table = new xmldb_table('block_community');

/// Adding fields to table block_community
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('coursename', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
$table->add_field('coursedescription', XMLDB_TYPE_TEXT, 'big', null, null, null, null);
$table->add_field('courseurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
$table->add_field('imageurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);

/// Adding keys to table block_community
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));

/// Conditionally launch create table for block_community
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}

/// community savepoint reached
upgrade_block_savepoint(true, 2010042701, 'community');
}

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

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

return true;
}
}
37 changes: 0 additions & 37 deletions blocks/html/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,5 @@
function xmldb_block_html_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();

if ($oldversion < 2010071900) {
$params = array();
$sql = "SELECT * FROM {block_instances} b WHERE b.blockname = :blockname";
$params['blockname'] = 'html';
$rs = $DB->get_recordset_sql($sql, $params);
foreach ($rs as $record) {
$config = unserialize(base64_decode($record->configdata));
if (!empty($config) && is_object($config)) {
if (!empty($config->text) && is_array($config->text)) {
// fix bad data
$data = clone($config);
$config->text = $data->text['text'];
$config->format = $data->text['format'];
$record->configdata = base64_encode(serialize($config));
$DB->update_record('block_instances', $record);
} else if (empty($config->format)) {
// add format parameter to 1.9
$config->format = FORMAT_HTML;
$record->configdata = base64_encode(serialize($config));
$DB->update_record('block_instances', $record);
}
}
}
$rs->close();

/// html block savepoint reached
upgrade_block_savepoint(true, 2010071900, 'html');
}

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

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

return true;
}
20 changes: 0 additions & 20 deletions blocks/navigation/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,6 @@
*/
function xmldb_block_navigation_upgrade($oldversion, $block) {
global $DB;
// Implemented at 2009082800

if ($oldversion < 2010091400) {

$sql = "SELECT bp.id FROM {block_instances} bi
LEFT JOIN {block_positions} bp ON bp.blockinstanceid=bi.id
WHERE bi.blockname='navigation' AND bp.visible=0";
$blockpositions = $DB->get_records_sql($sql);
if ($blockpositions) {
foreach ($blockpositions as $bp) {
$bp->visible = 1;
$DB->update_record('block_positions', $bp);
}
}

upgrade_block_savepoint(true, 2010091400, 'navigation');
}

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

// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
Expand Down
20 changes: 0 additions & 20 deletions blocks/settings/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,6 @@
*/
function xmldb_block_settings_upgrade($oldversion, $block) {
global $DB;
// Implemented at 2009082800

if ($oldversion < 2010091400) {

$sql = "SELECT bp.id FROM {block_instances} bi
LEFT JOIN {block_positions} bp ON bp.blockinstanceid=bi.id
WHERE bi.blockname='settings' AND bp.visible=0";
$blockpositions = $DB->get_records_sql($sql);
if ($blockpositions) {
foreach ($blockpositions as $bp) {
$bp->visible = 1;
$DB->update_record('block_positions', $bp);
}
}

upgrade_block_savepoint(true, 2010091400, 'settings');
}

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

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

0 comments on commit 612d65d

Please sign in to comment.