Permalink
Browse files

ah!

  • Loading branch information...
1 parent d9b6393 commit 67b2053a7b626f42584a46aea6209882dd3adb0c @tlevine committed Apr 11, 2013
Showing with 10 additions and 6 deletions.
  1. +3 −0 readme.md
  2. +7 −6 rm.php
View
@@ -1,2 +1,5 @@
Some helpful things for
[NearlyFreeSpeech.NET](https://nearlyfreespeech.net)
+
+## Notes
+While upgrading Piwik, disable PHP safe mode.
View
13 rm.php
@@ -1,24 +1,25 @@
<?php
// Delete everything in a directory
-$DIR = 'tmp';
+$DIR = 'tmp/templates_c';
-function deleteDirectoryContents($dir) {
+function deleteDirectory($dir) {
if (!file_exists($dir)) return true;
if (!is_dir($dir) || is_link($dir)) return unlink($dir);
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') continue;
- if (!deleteDirectoryContents($dir . "/" . $item)) {
+ if (!deleteDirectory($dir . "/" . $item)) {
chmod($dir . "/" . $item, 0777);
- if (!deleteDirectoryContents($dir . "/" . $item)) return false;
+ if (!deleteDirectory($dir . "/" . $item)) return false;
};
}
+ return rmdir($dir);
}
-
if ($handle = opendir($DIR)) {
while (false !== ($entry = readdir($handle))) {
if ($entry == '.' || $entry == '..') { continue; }
- deleteDirectoryContents($DIR . '/' . $entry);
+ $e = $DIR . '/' . $entry;
+ if (deleteDirectory($e)) {echo "$e";}
}
closedir($handle);
}

0 comments on commit 67b2053

Please sign in to comment.