本文整理匯總了PHP中FileUtils::deletePhotoOnServer方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileUtils::deletePhotoOnServer方法的具體用法?PHP FileUtils::deletePhotoOnServer怎麽用?PHP FileUtils::deletePhotoOnServer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileUtils
的用法示例。
在下文中一共展示了FileUtils::deletePhotoOnServer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deletePhotoModel
function deletePhotoModel($photoId, $filename)
{
$responseDTO = new ResponseDTO(DELETE_PHOTO_FORM);
try {
$userLogged = SessionUtils::getUserLogged();
$defaultUserPhotoProfileId = $userLogged->getProfilePhoto()->getPhotoId();
$photoDAO = new PhotoDAO();
if ($photoId == $defaultUserPhotoProfileId) {
$uploadedPhoto = new PhotoDTO(1, DEFAULT_USER_PHOTOPROFILE_URL);
$updateProfilePhoto = $photoDAO->updateProfilePhoto($uploadedPhoto);
$userLogged = SessionUtils::getUserLogged();
$userLogged->setProfilePhoto($uploadedPhoto);
SessionUtils::setUserLogged($userLogged);
}
$deletedPhoto = $photoDAO->deletePhotoInAlbum($photoId);
$deletedPhoto = $photoDAO->deletePhoto($photoId);
if ($deletedPhoto != 1) {
$responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'eliminazione della foto");
$responseDTO->setSubElementId($photoId);
} else {
FileUtils::deletePhotoOnServer($filename);
$responseDTO->setResponseSucc("#photo" . $photoId);
}
return $responseDTO;
} catch (PDOException $pdoe) {
throw $pdoe;
} catch (UserNotAuthenticatedExceptionDTO $authExp) {
throw $authExp;
} catch (Exception $e) {
throw $e;
}
}
示例2: recursiveUserRemoveDir
public static function recursiveUserRemoveDir($filepath)
{
if (!file_exists($filepath)) {
return;
}
$files = scandir($filepath);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
$fileTBDeleted = $filepath . $file;
if (is_dir($fileTBDeleted)) {
FileUtils::recursiveRemoveDir($fileTBDeleted . '/');
} else {
if (is_file($fileTBDeleted)) {
FileUtils::deletePhotoOnServer($fileTBDeleted);
}
}
}
}
rmdir($filepath);
reset($files);
}