clear_temp.php 816 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. $location = __DIR__ . '/../tests/temp';
  3. define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));
  4. set_include_path(implode(PATH_SEPARATOR, array(
  5. VENDOR_PATH,
  6. get_include_path(),
  7. )));
  8. $classLoaderFile = VENDOR_PATH . '/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
  9. if (!file_exists($classLoaderFile)) {
  10. die('cannot find vendor, run: php bin/vendors.php');
  11. }
  12. require_once $classLoaderFile;
  13. $classLoader = new Doctrine\Common\ClassLoader('Symfony');
  14. $classLoader->register();
  15. $finder = new Symfony\Component\Finder\Finder;
  16. $finder->files()
  17. ->name('*')
  18. ->in(__DIR__ . '/../tests/temp');
  19. foreach ($finder as $fileInfo) {
  20. if (!$fileInfo->isWritable()) {
  21. continue;
  22. }
  23. echo 'removing: ' . $fileInfo->getRealPath() . PHP_EOL;
  24. @unlink($fileInfo->getRealPath());
  25. }