Skip to content

Commit

Permalink
Fixed issue: PHP7 not creating folders automatically on copy
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed May 25, 2018
1 parent 1a4b965 commit 0abd142
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions application/models/TemplateManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,16 @@ public function extendsFile($sFile)
if (!file_exists($this->path.$sFile) && !file_exists($this->viewPath.$sFile)) {

// Copy file from mother template to local directory
$sRfilePath = $this->getFilePath($sFile, $this);
$sLfilePath = (pathinfo($sFile, PATHINFO_EXTENSION) == 'twig') ? $this->viewPath.$sFile : $this->path.$sFile;
copy($sRfilePath, $sLfilePath);
$sSourceFilePath = $this->getFilePath($sFile, $this);
$sDestinationFilePath = (pathinfo($sFile, PATHINFO_EXTENSION) == 'twig') ? $this->viewPath.$sFile : $this->path.$sFile;

//PHP 7 seems not to create the folder on copy automatically.
@mkdir(dirname($sDestinationFilePath), 0775, true);

copy($sSourceFilePath, $sDestinationFilePath);

// If it's a css or js file from config... must update DB and XML too....
$sExt = pathinfo($sLfilePath, PATHINFO_EXTENSION);
$sExt = pathinfo($sDestinationFilePath, PATHINFO_EXTENSION);
if ($sExt == "css" || $sExt == "js") {

// Check if that CSS/JS file is in DB/XML
Expand Down

0 comments on commit 0abd142

Please sign in to comment.