commit 4a2d3518fe1ec56efdc08ef43e079718fbb9922b Author: Hugh Davenport Date: Mon Sep 24 15:19:24 2012 +1200 Fix up old file permissions to remove executable Bug #1055232 In previous versions of mahara, all the user uploaded files had the executable bit set. This patch runs an upgrade script to remove this executable bit. Change-Id: If4a3f5876f34bd2d38ff9edcd96b234271c2d1f6 Signed-off-by: Hugh Davenport diff --git a/htdocs/artefact/file/db/upgrade.php b/htdocs/artefact/file/db/upgrade.php index 989a426..f37e4a8 100644 --- a/htdocs/artefact/file/db/upgrade.php +++ b/htdocs/artefact/file/db/upgrade.php @@ -401,5 +401,22 @@ function xmldb_artefact_file_upgrade($oldversion=0) { } } + if ($oldversion < 2012092400) { + $baseiter = new DirectoryIterator(get_config('dataroot') . 'artefact/file/originals/'); + foreach ($baseiter as $dir) { + if ($dir->isDot()) continue; + $dirpath = $dir->getPath() . '/' . $dir->getFilename(); + $fileiter = new DirectoryIterator($dirpath); + foreach ($fileiter as $file) { + if ($file->isDot()) continue; + if (!$file->isFile()) { + log_error("Something was wrong about the dataroot in artefact/file/originals/$dir. Unexpected folder $file"); + continue; + } + chmod($file->getPathname(), $file->getPerms() & 0666); + } + } + } + return $status; } diff --git a/htdocs/artefact/file/version.php b/htdocs/artefact/file/version.php index e1164f2..80c13ab 100644 --- a/htdocs/artefact/file/version.php +++ b/htdocs/artefact/file/version.php @@ -28,5 +28,5 @@ defined('INTERNAL') || die(); $config = new StdClass; -$config->version = 2012050400; +$config->version = 2012092400; $config->release = '1.2.1';