Commit 183cce38 authored by Nigel McNie's avatar Nigel McNie

Data fixing upgrade: Add loggedin access to all views that should be copy-able.

parent ba013502
......@@ -786,6 +786,40 @@ function xmldb_core_upgrade($oldversion=0) {
reload_html_filters();
}
if ($oldversion < 2009021701) {
// Make sure that all views that can be copied have loggedin access
// This upgrade just fixes potentially corrupt data caused by running a
// beta version then upgrading it
if ($views = get_column('view', 'id', 'copynewuser', '1')) {
$views[] = 1;
require_once('view.php');
foreach ($views as $viewid) {
$view = new View($viewid);
$needsadding = true;
foreach ($view->get_access() as $item) {
if ($item['type'] == 'loggedin') {
// We're not checking that access dates are null (aka
// it can always be accessed), but the chance of people
// needing this upgrade are slim anyway
$needsadding = false;
break;
}
}
if ($needsadding) {
log_debug("Adding logged in access for view $viewid");
$access = $view->get_access();
$access[] = array(
'type' => 'loggedin',
'startdate' => null,
'stopdate' => null,
);
$view->set_access($access);
}
}
}
}
return $status;
}
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009021700;
$config->version = 2009021701;
$config->release = '1.1.0beta5dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment