Commit 0b109aa9 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't try to install system user's profile twice

parent 20bfd0b3
......@@ -1373,7 +1373,7 @@ function xmldb_core_upgrade($oldversion=0) {
// Delete all the empty profile views & recreate them from the
// site template.
$viewids = get_column('view', 'type', 'profile');
$viewids = get_column('view', 'id', 'type', 'profile');
if ($viewids) {
require_once(get_config('libroot') . 'view.php');
foreach ($viewids as $id) {
......@@ -1386,7 +1386,9 @@ function xmldb_core_upgrade($oldversion=0) {
if ($userids = get_column('usr', 'id')) {
foreach ($userids as $user) {
install_default_profile_view(array('id' => $user));
if ($user > 0) {
install_default_profile_view(array('id' => $user));
}
}
}
......
......@@ -1179,7 +1179,6 @@ function copy_views_for_user($userid, $templateids) {
if (!$templateids) {
return;
}
require_once(get_config('libroot') . 'view.php');
foreach ($templateids as $tid) {
copy_view_for_user($userid, $tid);
}
......@@ -1195,11 +1194,7 @@ function copy_views_for_user($userid, $templateids) {
function install_default_profile_view($eventdata) {
require_once(get_config('libroot') . 'view.php');
$viewid = get_field('view', 'id', 'owner', 0, 'type', 'profile');
if (!$viewid) {
$viewid = install_system_profile_view();
}
$viewid = install_system_profile_view();
$view = copy_view_for_user($eventdata['id'], $viewid);
$view->set_access(array(
array(
......@@ -1217,6 +1212,10 @@ function install_default_profile_view($eventdata) {
*
*/
function install_system_profile_view() {
$viewid = get_field('view', 'id', 'owner', 0, 'type', 'profile');
if ($viewid) {
return $viewid;
}
require_once(get_config('libroot') . 'view.php');
require_once(get_config('docroot') . 'blocktype/lib.php');
$view = new View(0, array(
......
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