public function move() { $paths = $this->_extractHiddenPaths($this->request->request->all()); foreach ($paths as $path => $file) { if (trim($file)) { $processor = $this->_getProcessorByPath($path); $config = $processor->getConfig(); $tmp = $config['web'] . $config['dirtmp'] . $file; if (file_exists($tmp)) { UtilFilesystem::rename($tmp, $config['web'] . $config['dir'] . $file); UtilFilesystem::removeEmptyDirsToPath(dirname($tmp), $config['web'] . $config['dirtmp']); } } } }
public function delete($entity) { /* @var $entity User */ if ($path = $entity->getPath()) { $config = $this->getConfig(); $tmp = $config['web'] . $config['dirtmp'] . $path; if (file_exists($tmp)) { UtilFilesystem::removeFile($tmp); UtilFilesystem::removeEmptyDirsToPath(dirname($tmp), $config['web'] . $config['dirtmp']); } $tmp = $config['web'] . $config['dir'] . $path; if (file_exists($tmp)) { UtilFilesystem::removeFile($tmp); UtilFilesystem::removeEmptyDirsToPath(dirname($tmp), $config['web'] . $config['dir']); } } }