You are here

protected function MarkdownCommands::createTempDir in Markdown 8.2

Creates a new temporary directory.

Return value

string|void The temporary directory path.

1 call to MarkdownCommands::createTempDir()
MarkdownCommands::versionHash in src/Commands/MarkdownCommands.php
Run the markdown:version-hash hook.

File

src/Commands/MarkdownCommands.php, line 133

Class

MarkdownCommands
Markdown commands for Drush 9+.

Namespace

Drupal\markdown\Commands

Code

protected function createTempDir() {
  $tempDir = 'temporary://markdown_' . REQUEST_TIME . Crypt::randomBytesBase64(10);
  if (!is_dir($tempDir) && $this->fileSystem
    ->prepareDirectory($tempDir, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
    $tempDir = $this->fileSystem
      ->realpath($tempDir);
    static::$tempDirs[] = $tempDir;
    return $tempDir;
  }
}