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