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


PHP Filesystem::rmdir方法代码示例

本文整理汇总了PHP中OC\Files\Filesystem::rmdir方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::rmdir方法的具体用法?PHP Filesystem::rmdir怎么用?PHP Filesystem::rmdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC\Files\Filesystem的用法示例。


在下文中一共展示了Filesystem::rmdir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: viewToNodeProvider

 public function viewToNodeProvider()
 {
     return [[function () {
         Filesystem::file_put_contents('test.txt', 'asd');
     }, 'preWrite'], [function () {
         Filesystem::file_put_contents('test.txt', 'asd');
     }, 'postWrite'], [function () {
         Filesystem::file_put_contents('test.txt', 'asd');
     }, 'preCreate'], [function () {
         Filesystem::file_put_contents('test.txt', 'asd');
     }, 'postCreate'], [function () {
         Filesystem::mkdir('test.txt');
     }, 'preCreate'], [function () {
         Filesystem::mkdir('test.txt');
     }, 'postCreate'], [function () {
         Filesystem::touch('test.txt');
     }, 'preTouch'], [function () {
         Filesystem::touch('test.txt');
     }, 'postTouch'], [function () {
         Filesystem::touch('test.txt');
     }, 'preCreate'], [function () {
         Filesystem::touch('test.txt');
     }, 'postCreate'], [function () {
         Filesystem::file_put_contents('test.txt', 'asd');
         Filesystem::unlink('test.txt');
     }, 'preDelete'], [function () {
         Filesystem::file_put_contents('test.txt', 'asd');
         Filesystem::unlink('test.txt');
     }, 'postDelete'], [function () {
         Filesystem::mkdir('test.txt');
         Filesystem::rmdir('test.txt');
     }, 'preDelete'], [function () {
         Filesystem::mkdir('test.txt');
         Filesystem::rmdir('test.txt');
     }, 'postDelete']];
 }
开发者ID:0x17de,项目名称:core,代码行数:36,代码来源:hookconnector.php

示例2: testDelete

 public function testDelete()
 {
     $textSize = strlen("dummy file data\n");
     $imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo.png');
     $rootCachedData = $this->cache->get('');
     $this->assertEquals(3 * $textSize + $imageSize, $rootCachedData['size']);
     $this->assertTrue($this->cache->inCache('foo.txt'));
     Filesystem::unlink('foo.txt');
     $this->assertFalse($this->cache->inCache('foo.txt'));
     $cachedData = $this->cache->get('');
     $this->assertEquals(2 * $textSize + $imageSize, $cachedData['size']);
     $this->assertInternalType('string', $rootCachedData['etag']);
     $this->assertInternalType('string', $cachedData['etag']);
     $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
     $this->assertGreaterThanOrEqual($rootCachedData['mtime'], $cachedData['mtime']);
     $rootCachedData = $cachedData;
     Filesystem::mkdir('bar_folder');
     $this->assertTrue($this->cache->inCache('bar_folder'));
     $cachedData = $this->cache->get('');
     $this->assertInternalType('string', $rootCachedData['etag']);
     $this->assertInternalType('string', $cachedData['etag']);
     $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
     $rootCachedData = $cachedData;
     Filesystem::rmdir('bar_folder');
     $this->assertFalse($this->cache->inCache('bar_folder'));
     $cachedData = $this->cache->get('');
     $this->assertInternalType('string', $rootCachedData['etag']);
     $this->assertInternalType('string', $cachedData['etag']);
     $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
     $this->assertGreaterThanOrEqual($rootCachedData['mtime'], $cachedData['mtime']);
 }
开发者ID:kebenxiaoming,项目名称:core,代码行数:31,代码来源:updaterlegacy.php

示例3: testPermissionUpgradeOnUserDeletedGroupShare

 /**
  * If the permissions on a group share are upgraded be sure to still respect 
  * removed shares by a member of that group
  */
 function testPermissionUpgradeOnUserDeletedGroupShare()
 {
     \OC_Group::createGroup('testGroup');
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER1, 'testGroup');
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER2, 'testGroup');
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER3, 'testGroup');
     $connection = \OC::$server->getDatabaseConnection();
     // Share item with group
     $fileinfo = $this->view->getFileInfo($this->folder);
     $share = $this->share(\OCP\Share::SHARE_TYPE_GROUP, $this->folder, self::TEST_FILES_SHARING_API_USER1, 'testGroup', \OCP\Constants::PERMISSION_READ);
     // Login as user 2 and verify the item exists
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
     $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
     $this->assertNotEmpty($result);
     $this->assertEquals(\OCP\Constants::PERMISSION_READ, $result->getPermissions());
     // Delete the share
     $this->assertTrue(\OC\Files\Filesystem::rmdir($this->folder));
     $this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
     // Verify we do not get a share
     $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
     $this->assertEquals(0, $result->getPermissions());
     // Login as user 1 again and change permissions
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $share->setPermissions(\OCP\Constants::PERMISSION_ALL);
     $share = $this->shareManager->updateShare($share);
     // Login as user 2 and verify
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
     $result = $this->shareManager->getShareById($share->getFullId(), self::TEST_FILES_SHARING_API_USER2);
     $this->assertEquals(0, $result->getPermissions());
     $this->shareManager->deleteShare($share);
     //cleanup
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER1, 'testGroup');
     \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER2, 'testGroup');
     \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER3, 'testGroup');
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:42,代码来源:sharedmount.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: rmdir

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

示例6: testPermissionUpgradeOnUserDeletedGroupShare

 /**
  * If the permissions on a group share are upgraded be sure to still respect 
  * removed shares by a member of that group
  */
 function testPermissionUpgradeOnUserDeletedGroupShare()
 {
     \OC_Group::createGroup('testGroup');
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER1, 'testGroup');
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER2, 'testGroup');
     \OC_Group::addToGroup(self::TEST_FILES_SHARING_API_USER3, 'testGroup');
     $connection = \OC::$server->getDatabaseConnection();
     // Share item with group
     $fileinfo = $this->view->getFileInfo($this->folder);
     $this->assertTrue(\OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, "testGroup", \OCP\Constants::PERMISSION_READ));
     // Login as user 2 and verify the item exists
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
     $result = \OCP\Share::getItemSharedWithBySource('folder', $fileinfo['fileid']);
     $this->assertNotEmpty($result);
     $this->assertEquals(\OCP\Constants::PERMISSION_READ, $result['permissions']);
     // Delete the share
     $this->assertTrue(\OC\Files\Filesystem::rmdir($this->folder));
     $this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
     // Verify we do not get a share
     $result = \OCP\Share::getItemSharedWithBySource('folder', $fileinfo['fileid']);
     $this->assertEmpty($result);
     // Verify that the permission is correct in the DB
     $qb = $connection->getQueryBuilder();
     $qb->select('*')->from('share')->where($qb->expr()->eq('file_source', $qb->createParameter('fileSource')))->andWhere($qb->expr()->eq('share_type', $qb->createParameter('shareType')))->setParameter(':fileSource', $fileinfo['fileid'])->setParameter(':shareType', 2);
     $res = $qb->execute()->fetchAll();
     $this->assertCount(1, $res);
     $this->assertEquals(0, $res[0]['permissions']);
     // Login as user 1 again and change permissions
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     $this->assertTrue(\OCP\Share::setPermissions('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, "testGroup", \OCP\Constants::PERMISSION_ALL));
     // Login as user 2 and verify
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     $this->assertFalse(\OC\Files\Filesystem::file_exists($this->folder));
     $result = \OCP\Share::getItemSharedWithBySource('folder', $fileinfo['fileid']);
     $this->assertEmpty($result);
     $connection = \OC::$server->getDatabaseConnection();
     $qb = $connection->getQueryBuilder();
     $qb->select('*')->from('share')->where($qb->expr()->eq('file_source', $qb->createParameter('fileSource')))->andWhere($qb->expr()->eq('share_type', $qb->createParameter('shareType')))->setParameter(':fileSource', $fileinfo['fileid'])->setParameter(':shareType', 2);
     $res = $qb->execute()->fetchAll();
     $this->assertCount(1, $res);
     $this->assertEquals(0, $res[0]['permissions']);
     //cleanup
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::unshare('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, 'testGroup');
     \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER1, 'testGroup');
     \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER2, 'testGroup');
     \OC_Group::removeFromGroup(self::TEST_FILES_SHARING_API_USER3, 'testGroup');
 }
开发者ID:sunblade,项目名称:core,代码行数:53,代码来源:sharedmount.php

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