/** * Execute post commands. * * @var array */ public function postDeploy(array $commands) { foreach ($commands as $command) { $this->cli->out("Execute : <white>{$command}"); $output = $this->git->exec($command); $output = implode(' ', $output); $this->cli->out("Result : <white>{$output}"); } }
/** * Entry point for Problem Download API * * @param Request $r * @throws InvalidFilesystemOperationException * @throws InvalidDatabaseOperationException */ public static function apiDownload(Request $r) { self::authenticateRequest($r); // Validate request self::validateDownload($r); // Get HEAD revision to avoid race conditions. $gitDir = PROBLEMS_GIT_PATH . DIRECTORY_SEPARATOR . $r['problem']->alias; $git = new Git($gitDir); $head = trim($git->get(array('rev-parse', 'HEAD'))); // Set headers to auto-download file header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Type: application/zip'); header('Content-Disposition: attachment;filename=' . $r['problem']->alias . '_' . $head . '.zip'); header('Content-Transfer-Encoding: binary'); $git->exec(array('archive', '--format=zip', $head)); die; }