public createDirectory ( string $path, string | null $commitMsg = null, integer | null $dirMode = null, boolean $recursive = true, string | null $author = null ) : string | ||
$path | string | The directory path |
$commitMsg | string | null | The commit message used when committing the changes |
$dirMode | integer | null | The mode for creating the intermediate directories |
$recursive | boolean | Create intermediate directories recursively if required |
$author | string | null | The author |
Résultat | string | The current commit hash |
public function createDirectory($path, $commitMsg = null, $dirMode = null, $recursive = true, $author = null)
{
$directory = $this->resolveFullPath($path);
$dirMode = $dirMode ?: $this->getDirectoryCreationMode();
if (file_exists($directory) || !mkdir($directory, (int) $dirMode, $recursive)) {
throw new \RuntimeException(sprintf('Cannot create "%s"', $directory));
}
$this->add(array($this->resolveLocalPath($directory)));
if ($commitMsg === null) {
$commitMsg = sprintf('%s created directory "%s"', __CLASS__, $path);
}
$this->commit($commitMsg, null, $author);
return $this->getCurrentCommit();
}