Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
0b109aa9
Commit
0b109aa9
authored
Sep 17, 2008
by
Richard Mansfield
Browse files
Don't try to install system user's profile twice
parent
20bfd0b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/db/upgrade.php
View file @
0b109aa9
...
...
@@ -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
));
}
}
}
...
...
htdocs/lib/user.php
View file @
0b109aa9
...
...
@@ -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
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment