Skip to content

Commit

Permalink
incorrect context used in rss_client block upgrade code MDL-6707 - pa…
Browse files Browse the repository at this point in the history
…rt of the upgrade code is now rerun in existing installations - new upgrades should be ok, the cleanup of stale contexts and overrides will be done later as part on normal maintenance from cron
  • Loading branch information
skodak committed Oct 1, 2006
1 parent 3832682 commit a3627bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion blocks/rss_client/block_rss_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class block_rss_client extends block_base {

function init() {
$this->title = get_string('feedstitle', 'block_rss_client');
$this->version = 2006091100;
$this->version = 2006100101;
}

function preferred_width() {
Expand Down
13 changes: 9 additions & 4 deletions blocks/rss_client/db/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function rss_client_upgrade($oldversion) {


if ($oldversion < 2006091100) {

// We need a new field to store whether an RSS feed is shared or private.
table_column('block_rss_client', '', 'shared', 'integer');

// Admin feeds used to be displayed to everybody (shared feeds).
$admins = get_admins();
if (!empty($admins)) {
Expand All @@ -42,7 +42,12 @@ function rss_client_upgrade($oldversion) {
}
}
}

}

/// see MDL-6707 for more info about problem that was here

if ($oldversion < 2006100101) {

// Upgrade block to use the Roles System.
$block = get_record('block', 'name', 'rss_client');

Expand All @@ -65,7 +70,7 @@ function rss_client_upgrade($oldversion) {
}

foreach ($blockinstances as $bi) {
$context = get_context_instance(CONTEXT_MODULE, $bi->id);
$context = get_context_instance(CONTEXT_BLOCK, $bi->id);

if ($bi->pagetype == 'course-view' && $bi->pageid == SITEID) {

Expand Down
11 changes: 8 additions & 3 deletions blocks/rss_client/db/postgres7.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function rss_client_upgrade($oldversion) {


if ($oldversion < 2006091100) {

// We need a new field to store whether an RSS feed is shared or private.
table_column('block_rss_client', '', 'shared', 'integer');

// Admin feeds used to be displayed to everybody (shared feeds).
$admins = get_admins();
if (!empty($admins)) {
Expand All @@ -44,6 +44,11 @@ function rss_client_upgrade($oldversion) {
}
}
}
}

/// see MDL-6707 for more info about problem that was here

if ($oldversion < 2006100101) {

// Upgrade block to use the Roles System.
$block = get_record('block', 'name', 'rss_client');
Expand All @@ -67,7 +72,7 @@ function rss_client_upgrade($oldversion) {
}

foreach ($blockinstances as $bi) {
$context = get_context_instance(CONTEXT_MODULE, $bi->id);
$context = get_context_instance(CONTEXT_BLOCK, $bi->id);

if ($bi->pagetype == 'course-view' && $bi->pageid == SITEID) {

Expand Down

0 comments on commit a3627bb

Please sign in to comment.