diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rm_cache.php	Tue Feb 09 20:54:02 2016 +0100
@@ -0,0 +1,26 @@
+<?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";
+}