本文整理汇总了PHP中FileManager::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::delete方法的具体用法?PHP FileManager::delete怎么用?PHP FileManager::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear
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();
}
示例2: remove
/**
* 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;
}
示例3: Exception
$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();
示例4: httpredir
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);
示例5: cleanupSourceFiles
protected function cleanupSourceFiles()
{
$fileManger = new FileManager($this->bookId);
foreach ($this->sourceFiles as $sourceFile) {
CakeLog::debug('[ImportBookManager::cleanupSourceFiles] Deleting source file ' . $sourceFile);
$fileManger->delete($sourceFile);
}
}
示例6: Exception
$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");