Skip to content

Commit

Permalink
Font temp dir hardcoded inside temp dir. Create if does not exist. (C…
Browse files Browse the repository at this point in the history
…loses #152)
  • Loading branch information
finwe committed Mar 8, 2017
1 parent 16ff78b commit 4d00d2f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class Cache
public function __construct($basePath, $cleanupInterval = 3600)
{
if (!is_writable($basePath)) {
throw new \Mpdf\MpdfException(sprintf('Temporary files directory "%s" is not writable', $basePath));
if (is_writable(dirname($basePath))) {
mkdir($basePath, 0777, true);
} else {
throw new \Mpdf\MpdfException(sprintf('Temporary files directory "%s" is not writable', $basePath));
}
}

$this->basePath = $basePath;
Expand Down
1 change: 0 additions & 1 deletion src/Config/ConfigVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ public function __construct()

'fontDir' => __DIR__ . '/../../ttfonts',
'tempDir' => __DIR__ . '/../../tmp',
'fontTempDir' => __DIR__ . '/../../tmp/ttfontdata',

'hyphenationDictionaryFile' => __DIR__ . '/../../data/patterns/dictionary.txt',

Expand Down
2 changes: 1 addition & 1 deletion src/Mpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ public function __construct(array $config = [])
$this->tableOfContents = new TableOfContents($this, $this->sizeConvertor);

$this->cache = new Cache($config['tempDir']);
$this->fontCache = new FontCache(new Cache($config['fontTempDir']));
$this->fontCache = new FontCache(new Cache($config['tempDir'] . '/ttfontdata'));

$this->fontFileFinder = new FontFileFinder($config['fontDir']);

Expand Down
Empty file removed tmp/ttfontdata/.gitkeep
Empty file.

0 comments on commit 4d00d2f

Please sign in to comment.