Ejemplo n.º 1
0
 public static function clearTemp()
 {
     try {
         $tempPath = Base_Constant_Server::getFirstTemp();
         if (!is_dir($tempPath)) {
             return;
         }
         $dirIterator = new RecursiveDirectoryIterator($tempPath);
         $iterator = new RecursiveIteratorIterator($dirIterator, RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($iterator as $path) {
             switch (true) {
                 case '.' == basename($path->__toString()):
                 case '..' == basename($path->__toString()):
                 case '...' == basename($path->__toString()):
                     break;
                 case $path->isDir():
                     rmdir($path->__toString());
                     break;
                 default:
                     unlink($path->__toString());
                     break;
             }
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 2
0
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }