Skip to content
GitLab
Menu
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
04823343
Commit
04823343
authored
Jan 23, 2009
by
Richard Mansfield
Browse files
Fix for profile icon upgrade when no artefact/file directory exists
parent
25581f13
Changes
1
Show whitespace changes
Inline
Side-by-side
htdocs/lib/db/upgrade.php
View file @
04823343
...
...
@@ -619,6 +619,10 @@ function xmldb_core_upgrade($oldversion=0) {
if
(
$oldversion
<
2008101602
)
{
// Move artefact/internal/profileicons directory to artefact/file
$artefactdata
=
get_config
(
'dataroot'
)
.
'artefact/'
;
if
(
is_dir
(
$artefactdata
.
'internal/profileicons'
))
{
if
(
!
is_dir
(
$artefactdata
.
'file'
))
{
mkdir
(
$artefactdata
.
'file'
);
}
rename
(
$artefactdata
.
'internal/profileicons'
,
$artefactdata
.
'file/profileicons'
);
set_field
(
'artefact_installed_type'
,
'plugin'
,
'file'
,
'name'
,
'profileicon'
);
set_field
(
'artefact_config'
,
'plugin'
,
'file'
,
'field'
,
'profileiconwidth'
);
...
...
@@ -629,9 +633,14 @@ function xmldb_core_upgrade($oldversion=0) {
if
(
$profileicons
)
{
foreach
(
$profileicons
as
$a
)
{
$filesize
=
filesize
(
$artefactdata
.
'file/profileicons/originals/'
.
(
$a
%
256
)
.
'/'
.
$a
);
if
(
$filesize
)
{
$imagesize
=
getimagesize
(
$artefactdata
.
'file/profileicons/originals/'
.
(
$a
%
256
)
.
'/'
.
$a
);
insert_record
(
'artefact_file_files'
,
(
object
)
array
(
'artefact'
=>
$a
,
'fileid'
=>
$a
,
'size'
=>
$filesize
));
insert_record
(
'artefact_file_image'
,
(
object
)
array
(
'artefact'
=>
$a
,
'width'
=>
$imagesize
[
0
],
'height'
=>
$imagesize
[
1
]));
}
else
{
delete_records
(
'artefact'
,
'id'
,
$a
);
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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