/** * Remove directories * * @return void */ protected function removeDirectories() { $dir = $this->object->getPath() . $this->object->getDirectory(); if (is_dir($dir)) { $data = glob($dir . '/*'); foreach ($data as $file) { unlink($file); } $tmpDir = $dir; while ($tmpDir != GC_MEDIA_PATH . '/files') { rmdir($tmpDir); $tmpDir = realpath(dirname($tmpDir)); } } }
/** * Remove directories * * @return mixed */ protected function removeDirectories() { $file = new File(); $file->load($this->property, $this->document); $dir = $file->getPath() . $file->getDirectory(); if (is_dir($dir)) { $data = glob($dir . '/*'); foreach ($data as $file) { unlink($file); } $tmpDir = $dir; while ($tmpDir != GC_MEDIA_PATH . '/files') { rmdir($tmpDir); $tmpDir = realpath(dirname($tmpDir)); } } }