PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/apps/Sandbox/scripts/clear.php

https://bitbucket.org/koriym/bear.package
PHP | 32 lines | 14 code | 3 blank | 15 comment | 1 complexity | 467567946d8c482a58dfdb8665f915ff MD5 | raw file
  1. <?php
  2. /**
  3. * Application clear script
  4. *
  5. * Clear:
  6. * apc code cache
  7. * apc user cache
  8. * smarty compile script
  9. * tmp files
  10. */
  11. // APC Cache
  12. if (function_exists('apc_clear_cache')) {
  13. apc_clear_cache('user');
  14. apc_clear_cache();
  15. }
  16. // tmp dir
  17. $tmpDir = dirname(__DIR__) . '/data/tmp';
  18. $rm = function ($dir) use (&$rm) {
  19. foreach (glob($dir . '/*') as $file) {
  20. is_dir($file) ? $rm($file) : unlink($file);
  21. @rmdir($file);
  22. }
  23. };
  24. $rm("{$tmpDir}/cache");
  25. array_map('unlink', glob("{$tmpDir}/smarty/template_c/*.tpl.php"));
  26. array_map('unlink', glob("{$tmpDir}/cache/*"));
  27. unset($rm);
  28. unset($tmpDir);