echo 'Successfully deleted cache'; break; case 'refresh-cache': $curl = new Curl(); foreach (explode(',', $parts[2]) as $url) { Workflow::requestCache($url, $curl, null, 0, false); } $curl->execute(); Workflow::cleanCache(); break; case 'activate-autoupdate': Workflow::setConfig('autoupdate', 1); echo 'Activated auto updating'; break; case 'deactivate-autoupdate': Workflow::setConfig('autoupdate', 0); echo 'Deactivated auto updating'; break; case 'update': $response = Workflow::request('http://gh01.de/alfred/github/github.alfredworkflow'); if (!$response) { echo 'Update failed'; exit; } $zip = __DIR__ . '/workflow.zip'; file_put_contents($zip, $response); exec('unzip -o workflow.zip'); unlink($zip); Workflow::deleteCache(); echo 'Successfully updated the GitHub Workflow'; break;
<?php if (preg_match('/\\.(?:png|jpg|jpeg|gif)$/', $_SERVER['REQUEST_URI'])) { return false; } require 'workflow.php'; Workflow::init(); if (!isset($_GET['access_token'])) { echo 'FAILURE (missing access_token parameter)!'; exit; } Workflow::setConfig('access_token', $_GET['access_token']); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>alfred-github-workflow</title> <style> * { margin: 0; padding: 0; } body { background: #999; font-family: 'Helvetica Neue', sans-serif; font-size: 14pt; } div { padding-top: 200px; width: 450px;
break; case 'logout': Workflow::deleteCookies(); Workflow::deleteCache(); echo 'Successfully logged out'; break; case 'delete-cache': Workflow::deleteCache(); echo 'Successfully deleted cache'; break; case 'activate-autoupdate': Workflow::setConfig('autoupdate', true); echo 'Activated auto updating'; break; case 'deactivate-autoupdate': Workflow::setConfig('autoupdate', false); echo 'Deactivated auto updating'; break; case 'update': $c = Workflow::request('http://gh01.de/alfred/github/github.alfredworkflow', $status); if ($status != 200) { echo 'Update failed'; exit; } $zip = __DIR__ . '/workflow.zip'; file_put_contents($zip, $c); $phar = new PharData($zip); foreach ($phar as $path => $file) { copy($path, __DIR__ . '/' . $file->getFilename()); } unlink($zip);