本文整理汇总了PHP中OC\Files\Filesystem::isDeletable方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::isDeletable方法的具体用法?PHP Filesystem::isDeletable怎么用?PHP Filesystem::isDeletable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC\Files\Filesystem
的用法示例。
在下文中一共展示了Filesystem::isDeletable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPermissions
/**
* Determine permissions for a given file path
* @param string $path
* @return int
*/
function getPermissions($path)
{
// add read permissions
$permissions = \OCP\PERMISSION_READ;
// get directory
$fileInfo = pathinfo($path);
$dir = $fileInfo['dirname'] . '/';
// add update permissions
if (Filesystem::isUpdatable($dir)) {
$permissions |= \OCP\PERMISSION_UPDATE;
}
// add delete permissions
if (Filesystem::isDeletable($dir)) {
$permissions |= \OCP\PERMISSION_DELETE;
}
// add share permissions
if (Filesystem::isSharable($dir)) {
$permissions |= \OCP\PERMISSION_SHARE;
}
// return
return $permissions;
}
示例2: stripslashes
\OC::$session->close();
// Get data
$dir = stripslashes($_POST["dir"]);
$allFiles = isset($_POST["allfiles"]) ? $_POST["allfiles"] : false;
// delete all files in dir ?
if ($allFiles === 'true') {
$files = array();
$fileList = \OC\Files\Filesystem::getDirectoryContent($dir);
foreach ($fileList as $fileInfo) {
$files[] = $fileInfo['name'];
}
} else {
$files = isset($_POST["file"]) ? $_POST["file"] : $_POST["files"];
$files = json_decode($files);
}
$filesWithError = '';
$success = true;
//Now delete
foreach ($files as $file) {
if (\OC\Files\Filesystem::file_exists($dir . '/' . $file) && !(\OC\Files\Filesystem::isDeletable($dir . '/' . $file) && \OC\Files\Filesystem::unlink($dir . '/' . $file))) {
$filesWithError .= $file . "\n";
$success = false;
}
}
// get array with updated storage stats (e.g. max file size) after upload
$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir);
if ($success) {
OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats)));
} else {
OCP\JSON::error(array("data" => array_merge(array("message" => "Could not delete:\n" . $filesWithError), $storageStats)));
}
示例3: delete
/**
* Delete the current file
*
* @return void
* @throws Sabre_DAV_Exception_Forbidden
*/
public function delete()
{
if ($this->path === 'Shared') {
throw new \Sabre_DAV_Exception_Forbidden();
}
if (!\OC\Files\Filesystem::isDeletable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
\OC\Files\Filesystem::unlink($this->path);
// remove properties
$this->removeProperties();
}
示例4: delete
/**
* Deletes all files in this directory, and then itself
*
* @return void
* @throws Sabre_DAV_Exception_Forbidden
*/
public function delete()
{
if ($this->path === 'Shared') {
throw new \Sabre_DAV_Exception_Forbidden();
}
if (!\OC\Files\Filesystem::isDeletable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
\OC\Files\Filesystem::rmdir($this->path);
}
示例5: isDeletable
/**
* @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
*/
public static function isDeletable($path)
{
return \OC\Files\Filesystem::isDeletable($path);
}
示例6: getDirPermissions
/**
* Returns the numeric permissions for the given directory.
* @param string $dir directory without trailing slash
* @return numeric permissions
*/
public static function getDirPermissions($dir)
{
$permissions = \OCP\PERMISSION_READ;
if (\OC\Files\Filesystem::isCreatable($dir . '/')) {
$permissions |= \OCP\PERMISSION_CREATE;
}
if (\OC\Files\Filesystem::isUpdatable($dir . '/')) {
$permissions |= \OCP\PERMISSION_UPDATE;
}
if (\OC\Files\Filesystem::isDeletable($dir . '/')) {
$permissions |= \OCP\PERMISSION_DELETE;
}
if (\OC\Files\Filesystem::isSharable($dir . '/')) {
$permissions |= \OCP\PERMISSION_SHARE;
}
return $permissions;
}
示例7: delete
/**
* Delete the current file
*
* @return void
* @throws Sabre_DAV_Exception_Forbidden
*/
public function delete()
{
if (!\OC\Files\Filesystem::isDeletable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
\OC\Files\Filesystem::unlink($this->path);
}
示例8: array
$list = new OCP\Template('files', 'part.list', '');
$list->assign('files', $files);
$list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
$list->assign('disableSharing', false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
$permissions = OCP\PERMISSION_READ;
if (\OC\Files\Filesystem::isCreatable($dir . '/')) {
$permissions |= OCP\PERMISSION_CREATE;
}
if (\OC\Files\Filesystem::isUpdatable($dir . '/')) {
$permissions |= OCP\PERMISSION_UPDATE;
}
if (\OC\Files\Filesystem::isDeletable($dir . '/')) {
$permissions |= OCP\PERMISSION_DELETE;
}
if (\OC\Files\Filesystem::isSharable($dir . '/')) {
$permissions |= OCP\PERMISSION_SHARE;
}
if ($needUpgrade) {
OCP\Util::addscript('files', 'upgrade');
$tmpl = new OCP\Template('files', 'upgrade', 'user');
$tmpl->printPage();
} else {
// information about storage capacities
$storageInfo = OC_Helper::getStorageInfo();
$maxUploadFilesize = OCP\Util::maxUploadFilesize($dir);
OCP\Util::addscript('files', 'fileactions');
OCP\Util::addscript('files', 'files');
示例9: delete
/**
* Deletes all files in this directory, and then itself
*
* @return void
* @throws Sabre_DAV_Exception_Forbidden
*/
public function delete()
{
if (!\OC\Files\Filesystem::isDeletable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
if ($this->path != "/Shared") {
foreach ($this->getChildren() as $child) {
$child->delete();
}
\OC\Files\Filesystem::rmdir($this->path);
}
}