Commit 0eb040ae authored by Nigel McNie's avatar Nigel McNie
Browse files

Added an upgrade path to move the images stored on the filesysetm into a new...

Added an upgrade path to move the images stored on the filesysetm into a new directory structure, and set config variables regarding image height and width.

Also removed a newline at the end of the file that was triggering header output.
parent 1dffd6ee
......@@ -351,8 +351,34 @@ function xmldb_core_upgrade($oldversion=0) {
}
// Move files in dataroot into an 'originals' directory, and remove any
// cached images
if ($oldversion < 2007082202) {
require('file.php');
foreach(array('artefact/file', 'artefact/internal/profileicons') as $dir) {
$datadir = get_config('dataroot') . $dir;
check_dir_exists("$datadir/originals");
check_dir_exists("$datadir/resized");
foreach (new DirectoryIterator($datadir) as $folder) {
$name = $folder->getFilename();
if (preg_match('/^\d+$/', $name)) {
log_debug("$dir: Moving folder {$name} to ${datadir}/originals");
rename("{$datadir}/{$name}", "{$datadir}/originals/{$name}");
}
else if (preg_match('/^\d+x\d+$/', $name)) {
log_debug("$dir: Deleting folder {$name}");
rmdirr("{$datadir}/{$name}");
}
}
}
// Last part - setting config variables for max width/height for images
set_config('imagemaxwidth', 1024);
set_config('imagemaxheight', 1024);
}
return $status;
}
?>
?>
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