public function symlinks() { /* fix symlinks */ $filename = ROOTPATH . '/application/config/symlinks.php'; if (file_exists($filename)) { $this->load->helper('file'); $links = (include $filename); foreach ($links as $public => $private) { relative_symlink($private, $public); } } }
public function add_symlink($asset) { ci()->load->helper('file'); $asset = trim($asset, '/'); $package_folder = $this->_find_package($asset); if (!$package_folder) { ci()->wallet->red('Couldn\'t find package folder "' . $this->internal . '/public/' . $asset . '".', '/admin/configure/packages'); return false; } $public_folder = ROOTPATH . '/public/' . $asset; /* let's make the public path if it's not there */ $drop_folder = dirname($public_folder); if (!is_dir($drop_folder)) { mkdir($drop_folder, 0777, true); } /* remove the link/file if it's there */ $this->remove_symlink($asset); if (!relative_symlink($package_folder, $public_folder)) { ci()->wallet->red('Couldn\'t create Link "' . $this->internal . '::' . $asset . '".', '/admin/configure/packages'); return false; } $config = (include $this->symlink_config); $config[str_replace(ROOTPATH, '', $public_folder)] = str_replace(ROOTPATH, '', $package_folder); array_cache($this->symlink_config, $config); return true; }