當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。