comparison rm_cache.php @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:493bcb69166c
1 <?php
2 /*
3 Symfony cache created by apache cannot be deleted by the ssh user.
4 This script overcomes this problem and is used in bin/sync-servers
5 */
6
7 include "app/autoload.php";
8
9 use Symfony\Component\Filesystem\Filesystem;
10 use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
11
12 $fs = new Filesystem();
13
14 $env = "prod";
15 $cacheDir = dirname(__FILE__) . "/app/cache";
16
17 if (!$fs->exists($cacheDir . "/" . $env)) {
18 echo "$env cache did not exist.\n";
19 return;
20 }
21 try {
22 $fs->remove($cacheDir . "/" . $env);
23 echo "$env cache was successfully removed.\n";
24 } catch (Exception $e) {
25 echo "$env cache could not be removed: " . $e->getMessage() . "\n";
26 }