Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
protected function symlink($folder)
{
if (!$this->is_link($folder)) {
$private = static::get_application_path($this->folder).DS.$folder;
if (is_dir($private)) {
$public = DOCROOT.$folder.DS.'apps'.DS.$this->folder;
if (is_link($public)) {
unlink($public);
}
if (!symlink(Tools_File::relativePath(dirname($public), $private), $public)) {
if (!symlink($private, $public)) {
exec('cd '.dirname($public).'; ln -s '.$private.' '.$this->folder);
if (!is_link($public)) {
\Log::error('cd '.dirname($public).'; ln -s '.$private.' '.$this->folder);
throw new \Exception('Can\'t create symlink for "'.$folder.DS.'apps'.DS.$this->folder.'"');
}
}
}
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment