Commit a647f84c authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Check blog upload directory exists before reading it

parent 601e8fbf
......@@ -126,24 +126,26 @@ function xmldb_artefact_blog_upgrade($oldversion=0) {
if ($oldversion < 2009033100) {
$bloguploadbase = get_config('dataroot') . 'artefact/blog/uploads/';
if ($basedir = opendir($bloguploadbase)) {
while (false !== ($sessionupload = readdir($basedir))) {
if ($sessionupload != "." && $sessionupload != "..") {
$sessionupload = $bloguploadbase . $sessionupload;
$subdir = opendir($sessionupload);
if (is_dir($bloguploadbase)) {
if ($basedir = opendir($bloguploadbase)) {
while (false !== ($sessionupload = readdir($basedir))) {
if ($sessionupload != "." && $sessionupload != "..") {
$sessionupload = $bloguploadbase . $sessionupload;
$subdir = opendir($sessionupload);
while (false !== ($uploadfile = readdir($subdir))) {
if ($uploadfile != "." && $uploadfile != "..") {
$uploadfile = $sessionupload . '/' . $uploadfile;
unlink($uploadfile);
while (false !== ($uploadfile = readdir($subdir))) {
if ($uploadfile != "." && $uploadfile != "..") {
$uploadfile = $sessionupload . '/' . $uploadfile;
unlink($uploadfile);
}
}
closedir($subdir);
rmdir($sessionupload);
}
closedir($subdir);
rmdir($sessionupload);
}
}
@rmdir($bloguploadbase);
}
@rmdir($bloguploadbase);
}
return true;
......
Supports Markdown
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