本文整理汇总了PHP中Workflow::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::setConfig方法的具体用法?PHP Workflow::setConfig怎么用?PHP Workflow::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::setConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Curl
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;
示例2:
<?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;
示例3: PharData
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);