当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::isDeletable方法代码示例

本文整理汇总了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;
 }
开发者ID:amin-hedayati,项目名称:search_lucene,代码行数:27,代码来源:luceneresult.php

示例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)));
}
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:31,代码来源:delete.php

示例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();
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:18,代码来源:file.php

示例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);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:16,代码来源:directory.php

示例5: isDeletable

 /**
  * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
  */
 public static function isDeletable($path)
 {
     return \OC\Files\Filesystem::isDeletable($path);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:7,代码来源:filesystem.php

示例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;
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:22,代码来源:helper.php

示例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);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:13,代码来源:file.php

示例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');
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:31,代码来源:index.php

示例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);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:18,代码来源:directory.php


注:本文中的OC\Files\Filesystem::isDeletable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。