From 7e8ccf47fc42709af8b31eae15f6e34b3fb2d7c5 Mon Sep 17 00:00:00 2001 From: mattab Date: Sat, 24 May 2014 19:03:09 +1200 Subject: [PATCH] Remove second parameter to Filesystem::mkdir to prevent unexpected bugs. One function should do one thing only. --- core/CliMulti/Output.php | 3 ++- core/CliMulti/Process.php | 2 +- core/Filesystem.php | 10 ++-------- plugins/CoreAdminHome/CustomLogo.php | 2 +- plugins/CoreConsole/Commands/GeneratePlugin.php | 2 +- plugins/CoreConsole/Commands/GeneratePluginBase.php | 2 +- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/core/CliMulti/Output.php b/core/CliMulti/Output.php index e060bc49883..6b674355258 100644 --- a/core/CliMulti/Output.php +++ b/core/CliMulti/Output.php @@ -21,7 +21,8 @@ public function __construct($outputId) } $dir = CliMulti::getTmpPath(); - Filesystem::mkdir($dir, true); + Filesystem::mkdir($dir); + $this->tmpFile = $dir . '/' . $outputId . '.output'; } diff --git a/core/CliMulti/Process.php b/core/CliMulti/Process.php index 261065917ae..dec394af7bc 100644 --- a/core/CliMulti/Process.php +++ b/core/CliMulti/Process.php @@ -32,7 +32,7 @@ public function __construct($pid) } $pidDir = CliMulti::getTmpPath(); - Filesystem::mkdir($pidDir, true); + Filesystem::mkdir($pidDir); $this->isSupported = self::isSupported(); $this->pidFile = $pidDir . '/' . $pid . '.pid'; diff --git a/core/Filesystem.php b/core/Filesystem.php index 97ce97a4b44..2a4062931eb 100644 --- a/core/Filesystem.php +++ b/core/Filesystem.php @@ -74,11 +74,9 @@ public static function realpath($path) * _Note: This function does **not** create directories recursively._ * * @param string $path The path of the directory to create. - * @param bool $denyAccess Whether to deny browser access to this new folder by - * creating an **.htaccess** file. * @api */ - public static function mkdir($path, $denyAccess = true) + public static function mkdir($path) { if (!is_dir($path)) { // the mode in mkdir is modified by the current umask @@ -93,10 +91,6 @@ public static function mkdir($path, $denyAccess = true) // enough! we're not going to make the directory world-writeable } } - - if ($denyAccess) { - ServerFilesGenerator::createHtAccessDenyAll($path); - } } /** @@ -256,7 +250,7 @@ public static function copy($source, $dest, $excludePhp = false) public static function copyRecursive($source, $target, $excludePhp = false) { if (is_dir($source)) { - self::mkdir($target, false); + self::mkdir($target); $d = dir($source); while (false !== ($entry = $d->read())) { if ($entry == '.' || $entry == '..') { diff --git a/plugins/CoreAdminHome/CustomLogo.php b/plugins/CoreAdminHome/CustomLogo.php index 7f543973c33..1483e83ec60 100644 --- a/plugins/CoreAdminHome/CustomLogo.php +++ b/plugins/CoreAdminHome/CustomLogo.php @@ -88,7 +88,7 @@ public function isCustomLogoWritable() $directoryWritingTo = PIWIK_DOCUMENT_ROOT . '/' . dirname($pathUserLogo); // Create directory if not already created - Filesystem::mkdir($directoryWritingTo, $denyAccess = false); + Filesystem::mkdir($directoryWritingTo); $directoryWritable = is_writable($directoryWritingTo); $logoFilesWriteable = is_writeable(PIWIK_DOCUMENT_ROOT . '/' . $pathUserLogo) diff --git a/plugins/CoreConsole/Commands/GeneratePlugin.php b/plugins/CoreConsole/Commands/GeneratePlugin.php index 71d1ace3bcf..8f56ca12436 100644 --- a/plugins/CoreConsole/Commands/GeneratePlugin.php +++ b/plugins/CoreConsole/Commands/GeneratePlugin.php @@ -110,7 +110,7 @@ private function isTheme(InputInterface $input) protected function generatePluginFolder($pluginName) { $pluginPath = $this->getPluginPath($pluginName); - Filesystem::mkdir($pluginPath, true); + Filesystem::mkdir($pluginPath); } /** diff --git a/plugins/CoreConsole/Commands/GeneratePluginBase.php b/plugins/CoreConsole/Commands/GeneratePluginBase.php index bfc5cec350e..402b8310a10 100644 --- a/plugins/CoreConsole/Commands/GeneratePluginBase.php +++ b/plugins/CoreConsole/Commands/GeneratePluginBase.php @@ -29,7 +29,7 @@ private function createFolderWithinPluginIfNotExists($pluginName, $folder) $pluginPath = $this->getPluginPath($pluginName); if (!file_exists($pluginName . $folder)) { - Filesystem::mkdir($pluginPath . $folder, true); + Filesystem::mkdir($pluginPath . $folder); } }