예제 #1
0
    test_sources();
    exit;
}
if ($argv[1] == "--reconfigure-all") {
    $GLOBALS["OUTPUT"] = true;
    build_localhosts();
    exit;
}
if ($argv[1] == "--authenticator") {
    $GLOBALS["OUTPUT"] = true;
    authenticator(true);
    exit;
}
if ($argv[1] == "--purge-cache") {
    $GLOBALS["OUTPUT"] = true;
    purge_cache($argv[2]);
    exit;
}
if ($argv[1] == "--purge-all-caches") {
    $GLOBALS["OUTPUT"] = true;
    purge_all_caches();
    exit;
}
if ($argv[1] == "--import-file") {
    $GLOBALS["OUTPUT"] = true;
    import_file();
    exit;
}
if ($argv[1] == "--import-bulk") {
    $GLOBALS["OUTPUT"] = true;
    import_bulk();
예제 #2
0
 function _clean_up()
 {
     parent::_clean_up();
     purge_cache();
     user::logout();
 }
예제 #3
0
파일: nginx.php 프로젝트: articatech/artica
    exit;
}
if (isset($_GET["replic-conf"])) {
    conf_save();
    exit;
}
if (isset($_GET["uncompress-nginx"])) {
    uncompress_nginx();
    exit;
}
if (isset($_GET["reconfigure-single"])) {
    reconfigure_single();
    exit;
}
if (isset($_GET["purge-cache"])) {
    purge_cache();
    exit;
}
if (isset($_GET["import-bulk"])) {
    import_bulk();
    exit;
}
if (isset($_GET["reconfigure-progress"])) {
    reconfigure_progress();
    exit;
}
if (isset($_GET["access-query"])) {
    events_all();
    exit;
}
if (isset($_GET["compile-single"])) {
<?php

// TODO: this header should not be required...
header('Content-Type: text/plain; charset=UTF-8');
// Only purge Cloudflare cache when the live environment's cache is cleared.
if ($_ENV['PANTHEON_ENVIRONMENT'] != 'live') {
    die;
}
// Retrieve Cloudflare config data
$config_file = $_SERVER['HOME'] . '/files/private/cloudflare_cache.json';
$config = json_decode(file_get_contents($_SERVER['HOME'] . '/files/private/cloudflare_cache.json'), 1);
if ($config == FALSE) {
    die('files/private/cloudflare_cache.json found. Aborting!');
}
purge_cache($config);
function purge_cache($config)
{
    $payload = json_encode(array('purge_everything' => TRUE));
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://api.cloudflare.com/client/v4/zones/' . $config['zone_id'] . '/purge_cache');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Auth-Email: ' . $config['email'], 'X-Auth-Key: ' . $config['api_key'], 'Content-Type: application/json'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
    print "\n==== Sending Request to Cloudflare ====\n";
    $result = curl_exec($ch);
    print "RESULT: {$result}";
    print "\n===== Request Complete! =====\n";
    curl_close($ch);
}