view rm_cache.php @ 1:f38015048f48 tip

Added GPL
author Daniel Wolff
date Sat, 13 Feb 2016 20:43:38 +0100
parents 493bcb69166c
children
line wrap: on
line source
<?php
/*
Symfony cache created by apache cannot be deleted by the ssh user.
This script overcomes this problem and is used in bin/sync-servers
*/

include "app/autoload.php";

use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;

$fs = new Filesystem();

$env = "prod";
$cacheDir = dirname(__FILE__) . "/app/cache";

if (!$fs->exists($cacheDir . "/" . $env)) {
	echo "$env cache did not exist.\n";
	return;
}
try {
	$fs->remove($cacheDir . "/" . $env);
	echo "$env cache was successfully removed.\n";
} catch (Exception $e) {
	echo "$env cache could not be removed: " . $e->getMessage() . "\n";
}