view rm_cache.php @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
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";
}