public static function clear($key) { // Clear cache by deleting requested file $filename = md5($key); $path = __DIR__ . self::$cache_root . $filename; $file = new FileManager($path); $file->delete(); }
/** * Remove entity. If entity has been removed, delete related file. * * @access public * @return boolean * @since 1.0.0-alpha * @version 1.0.0-alpha */ public function remove() { $bRemoved = parent::remove(); if ($bRemoved) { // set path to file $sPath = $this->getPath() . DS . $this->getNameWithExt(); // if it's an image, remove all its styles if (in_array($this->getExt(), ['jpg', 'jpeg', 'gif', 'png', 'tiff'])) { ImageStyles::removeStyledImgCache($sPath); } // remove file \FileManager::delete($sPath); } return $bRemoved; }
$oResponse->setData($oFtp->getContent(Request::getApiParam('path'))); $oResponse->flushJson(); } if (Request::getApiParam('mode') === 'rename') { $path = Request::getApiParam('path'); $newPath = Request::getApiParam('newPath'); $result = $oFtp->move($path, $newPath); if (!$result) { throw new Exception("Unknown error renaming this folder"); } $oResponse->setData($result); $oResponse->flushJson(); } if (Request::getApiParam('mode') === 'delete') { $path = Request::getApiParam('path'); $result = $oFtp->delete($path); if (!$result) { throw new Exception("Unknown error removing this item"); } $oResponse->setData($result); $oResponse->flushJson(); } if (Request::getApiParam('mode') === 'addfolder') { $path = Request::getApiParam('path'); $name = Request::getApiParam('name'); $result = $oFtp->mkdir($path . '/' . $name); if (!$result) { throw new Exception("Unknown error creating this folder"); } $oResponse->setData($result); $oResponse->flushJson();
httpredir(currentPage(array('rebuild'))); } if (Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT) && !empty($_FILES)) { if ($fm->upload()) { if (count($_FILES) > 1) { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_files_upload']); } else { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_upload']); } } else { $GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_upload']); } httpredir(currentPage()); } if (Admin::getInstance()->permissions('filemanager', CC_PERM_DELETE) && isset($_GET['delete'])) { if ($fm->delete($_GET['delete'])) { $GLOBALS['main']->setACPNotify($lang['filemanager']['notify_file_delete']); } else { $GLOBALS['main']->setACPWarning($lang['filemanager']['error_file_delete']); } httpredir(currentPage(array('delete'))); } $GLOBALS['smarty']->assign('UPLOAD_LIMIT', ini_get('post_max_size')); if (isset($_GET['fm-edit']) && is_numeric($_GET['fm-edit'])) { $page_content = $fm->editor($_GET['fm-edit']); } else { $GLOBALS['main']->addTabControl($lang['filemanager']['tab_files'], 'filemanager'); $GLOBALS['main']->addTabControl($lang['filemanager']['file_upload'], 'upload'); $GLOBALS['main']->addTabControl($lang['filemanager']['folder_create'], 'folder'); $GLOBALS['main']->addTabControl($lang['filemanager']['tab_rebuild'], false, currentPage(null, array('rebuild' => 'true'))); $page_content = $fm->admin($select_button);
protected function cleanupSourceFiles() { $fileManger = new FileManager($this->bookId); foreach ($this->sourceFiles as $sourceFile) { CakeLog::debug('[ImportBookManager::cleanupSourceFiles] Deleting source file ' . $sourceFile); $fileManger->delete($sourceFile); } }
$result = $item ? $oFtp->move($item, $finalPath) : false; if (!$result) { $errors[] = $item . ' to ' . $finalPath; } } if ($errors) { throw new Exception("Unknown error moving: \n\n" . implode(", \n", $errors)); } $oResponse->setData($result); $oResponse->flushJson(); } if (Request::getApiParam('action') === 'remove') { $items = Request::getApiParam('items'); $errors = array(); foreach ($items as $item) { $result = $item ? $oFtp->delete($item) : false; if (!$result) { $errors[] = $item; } } if ($errors) { throw new Exception("Unknown error deleting: \n\n" . implode(", \n", $errors)); } $oResponse->setData($result); $oResponse->flushJson(); } if (Request::getApiParam('action') === 'createFolder') { $newPath = Request::getApiParam('newPath'); $result = $oFtp->mkdir($newPath); if (!$result) { throw new Exception("Unknown error creating this folder");