function process() { global $config; $backend = Backend::createBackend($config['backend']); if (substr($this->getPath(), 0, 5) == 'sire/') { // Sire internal page $code = $this->internal(substr($this->getPath(), 5), $backend); $this->handleStatus($code); return; } // Regular request handling $file = File::createFile($backend, $this->getPath()); if ($file instanceof File) { $templates = new \League\Plates\Engine('template'); echo $templates->render('content', ['file' => $file]); } else { if ($file == 200) { // Asset fallback $backend->serveRaw($this->getPath()); } else { // Error handling $this->handleStatus($file); } } }
public function __construct($backenddefs) { parent::__construct($backenddefs); // If the directory doesn't exist, we need to clone the repo if (!is_dir($this->getDirectory())) { mkdir($this->getDirectory(), 0777, TRUE); $this->repo = new Repository($this->getDirectory()); $this->repo->cloneFrom($backenddefs['repo'], $this->getDirectory()); $this->repo->checkoutAllRemoteBranches(); } else { $this->repo = new Repository($this->getDirectory()); } }