/** * Create the script for shared files. * * @param string $release_dir * @param string $shared_dir * * @return string */ private function shareFileCommands($release_dir, $shared_dir) { if (!$this->deployment->project->sharedFiles->count()) { return ''; } $parser = new ScriptParser(); $script = ''; foreach ($this->deployment->project->sharedFiles as $filecfg) { $pathinfo = pathinfo($filecfg->file); $template = 'File'; $file = $filecfg->file; if (substr($file, 0, 1) === '/') { $file = substr($file, 1); } if (substr($file, -1) === '/') { $template = 'Directory'; $file = substr($file, 0, -1); } if (isset($pathinfo['extension'])) { $filename = $pathinfo['filename'] . '.' . $pathinfo['extension']; } else { $filename = $pathinfo['filename']; } $script .= $parser->parseFile('deploy.Share' . $template, ['target_file' => $release_dir . '/' . $file, 'source_file' => $shared_dir . '/' . $filename]); } return PHP_EOL . $script; }