Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to create config directories if non existant #3115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Options.php
Expand Up @@ -848,6 +848,9 @@ public function getDpi()
*/
public function setFontCache($fontCache)
{
if (!is_dir($fontCache) && !mkdir($fontCache)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the directory recursively (e.g., mkdir($dir, 0777, true))?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that would be definitely better, even if the 777 permission might be problematic somehow

trigger_error("Unable to create fontCache - a valid value should be specified.", E_USER_WARNING);
}
$this->fontCache = $fontCache;
return $this;
}
Expand All @@ -866,6 +869,9 @@ public function getFontCache()
*/
public function setFontDir($fontDir)
{
if (!is_dir($fontDir) && !mkdir($fontDir)) {
trigger_error("Unable to create fontDir - a valid value should be specified.", E_USER_WARNING);
}
$this->fontDir = $fontDir;
return $this;
}
Expand Down Expand Up @@ -1053,6 +1059,9 @@ public function getLogOutputFile()
*/
public function setTempDir($tempDir)
{
if (!is_dir($tempDir) && !mkdir($tempDir)) {
trigger_error("Unable to create tempDir - a valid value should be specified.", E_USER_WARNING);
}
$this->tempDir = $tempDir;
return $this;
}
Expand Down