本文整理汇总了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);
}