bootstrap.php 832 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. error_reporting( E_ALL | E_STRICT );
  3. // change this, if your php files and data is outside of your webservers document root
  4. define('PATH', '..' . DIRECTORY_SEPARATOR);
  5. require PATH . 'lib/auto.php';
  6. class helper
  7. {
  8. public static function rmdir($path)
  9. {
  10. $path .= DIRECTORY_SEPARATOR;
  11. $dir = dir($path);
  12. while(false !== ($file = $dir->read())) {
  13. if($file != '.' && $file != '..') {
  14. if(is_dir($path . $file)) {
  15. self::rmdir($path . $file);
  16. } elseif(is_file($path . $file)) {
  17. if(!@unlink($path . $file)) {
  18. throw new Exception('Error deleting file "' . $path . $file . '".');
  19. }
  20. }
  21. }
  22. }
  23. $dir->close();
  24. if(!@rmdir($path)) {
  25. throw new Exception('Error deleting directory "' . $path . '".');
  26. }
  27. }
  28. }