Skip to content

Commit

Permalink
Remove second parameter to Filesystem::mkdir to prevent unexpected bugs.
Browse files Browse the repository at this point in the history
One function should do one thing only.
  • Loading branch information
mattab committed May 24, 2014
1 parent d827b2e commit 7e8ccf4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
3 changes: 2 additions & 1 deletion core/CliMulti/Output.php
Expand Up @@ -21,7 +21,8 @@ public function __construct($outputId)
}

$dir = CliMulti::getTmpPath();
Filesystem::mkdir($dir, true);
Filesystem::mkdir($dir);

$this->tmpFile = $dir . '/' . $outputId . '.output';
}

Expand Down
2 changes: 1 addition & 1 deletion core/CliMulti/Process.php
Expand Up @@ -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';
Expand Down
10 changes: 2 additions & 8 deletions core/Filesystem.php
Expand Up @@ -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
Expand All @@ -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);
}
}

/**
Expand Down Expand Up @@ -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 == '..') {
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreAdminHome/CustomLogo.php
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreConsole/Commands/GeneratePlugin.php
Expand Up @@ -110,7 +110,7 @@ private function isTheme(InputInterface $input)
protected function generatePluginFolder($pluginName)
{
$pluginPath = $this->getPluginPath($pluginName);
Filesystem::mkdir($pluginPath, true);
Filesystem::mkdir($pluginPath);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreConsole/Commands/GeneratePluginBase.php
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 7e8ccf4

Please sign in to comment.