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


PHP Filesystem::getFileInfo方法代码示例

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


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

示例1: correctFolders

 /**
  * Correct the parent folders' ETags for all users shared the file at $target
  *
  * @param string $target
  */
 public static function correctFolders($target)
 {
     $uid = \OCP\User::getUser();
     $uidOwner = \OC\Files\Filesystem::getOwner($target);
     $info = \OC\Files\Filesystem::getFileInfo($target);
     // Correct Shared folders of other users shared with
     $users = \OCP\Share::getUsersItemShared('file', $info['fileid'], $uidOwner, true);
     if (!empty($users)) {
         while (!empty($users)) {
             $reshareUsers = array();
             foreach ($users as $user) {
                 if ($user !== $uidOwner) {
                     $etag = \OC\Files\Filesystem::getETag('');
                     \OCP\Config::setUserValue($user, 'files_sharing', 'etag', $etag);
                     // Look for reshares
                     $reshareUsers = array_merge($reshareUsers, \OCP\Share::getUsersItemShared('file', $info['fileid'], $user, true));
                 }
             }
             $users = $reshareUsers;
         }
         // Correct folders of shared file owner
         $target = substr($target, 8);
         if ($uidOwner !== $uid && ($source = \OC_Share_Backend_File::getSource($target))) {
             \OC\Files\Filesystem::initMountPoints($uidOwner);
             $source = '/' . $uidOwner . '/' . $source['path'];
             \OC\Files\Cache\Updater::correctFolder($source, $info['mtime']);
         }
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:34,代码来源:updater.php

示例2: getUidAndFilename

 /**
  * get the UID of the owner of the file and the path to the file relative to
  * owners files folder
  *
  * @param string $filename
  * @return array
  * @throws \OC\User\NoUserException
  */
 public static function getUidAndFilename($filename)
 {
     $uid = Filesystem::getOwner($filename);
     $userManager = \OC::$server->getUserManager();
     // if the user with the UID doesn't exists, e.g. because the UID points
     // to a remote user with a federated cloud ID we use the current logged-in
     // user. We need a valid local user to create the versions
     if (!$userManager->userExists($uid)) {
         $uid = User::getUser();
     }
     Filesystem::initMountPoints($uid);
     if ($uid != User::getUser()) {
         $info = Filesystem::getFileInfo($filename);
         $ownerView = new View('/' . $uid . '/files');
         try {
             $filename = $ownerView->getPath($info['fileid']);
             // make sure that the file name doesn't end with a trailing slash
             // can for example happen single files shared across servers
             $filename = rtrim($filename, '/');
         } catch (NotFoundException $e) {
             $filename = null;
         }
     }
     return [$uid, $filename];
 }
开发者ID:gvde,项目名称:core,代码行数:33,代码来源:storage.php

示例3: setUp

 protected function setUp()
 {
     $app = new Application();
     $this->container = $app->getContainer();
     $this->container['Config'] = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
     $this->container['AppName'] = 'files_sharing';
     $this->container['UserSession'] = $this->getMockBuilder('\\OC\\User\\Session')->disableOriginalConstructor()->getMock();
     $this->container['URLGenerator'] = $this->getMockBuilder('\\OC\\URLGenerator')->disableOriginalConstructor()->getMock();
     $this->urlGenerator = $this->container['URLGenerator'];
     $this->shareController = $this->container['ShareController'];
     // Store current user
     $this->oldUser = \OC_User::getUser();
     // Create a dummy user
     $this->user = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(12, ISecureRandom::CHAR_LOWER);
     \OC_User::createUser($this->user, $this->user);
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     Filesystem::tearDown();
     \OC_User::setUserId($this->user);
     \OC_Util::setupFS($this->user);
     // Create a dummy shared file
     $view = new View('/' . $this->user . '/files');
     $view->file_put_contents('file1.txt', 'I am such an awesome shared file!');
     $this->token = \OCP\Share::shareItem(Filesystem::getFileInfo('file1.txt')->getType(), Filesystem::getFileInfo('file1.txt')->getId(), \OCP\Share::SHARE_TYPE_LINK, 'IAmPasswordProtected!', 1);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:25,代码来源:sharecontroller.php

示例4: getEtags

	/**
	 * @param string[] $files
	 */
	private function getEtags($files) {
		$etags = array();
		foreach ($files as $file) {
			$info = Filesystem::getFileInfo($file);
			$etags[$file] = $info['etag'];
		}
		return $etags;
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:11,代码来源:etagtest.php

示例5: getUidAndFilename

 public static function getUidAndFilename($filename)
 {
     $uid = \OC\Files\Filesystem::getOwner($filename);
     \OC\Files\Filesystem::initMountPoints($uid);
     if ($uid != \OCP\User::getUser()) {
         $info = \OC\Files\Filesystem::getFileInfo($filename);
         $ownerView = new \OC\Files\View('/' . $uid . '/files');
         $filename = $ownerView->getPath($info['fileid']);
     }
     return array($uid, $filename);
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:11,代码来源:versions.php

示例6: get

 /**
  * @brief list bookshelf contents
  *
  * @return array of FileInfo[], sorted by time added
  */
 public static function get()
 {
     $files = array();
     if ($bookshelf = json_decode(Config::get('bookshelf', ''), true)) {
         arsort($bookshelf);
         while (list($id, $time) = each($bookshelf)) {
             array_push($files, \OC\Files\Filesystem::getFileInfo(\OC\Files\Filesystem::normalizePath(\OC\Files\Filesystem::getPath($id))));
         }
     }
     return $files;
 }
开发者ID:RavenB,项目名称:owncloud-apps,代码行数:16,代码来源:bookshelf.php

示例7: cleanupForDelete

 /**
  * Remove thumbnails and db entries for deleted files
  * @param array $params All parameters passed by hook
  */
 public static function cleanupForDelete($params)
 {
     // Get full thumbnail path
     $path = $params['path'];
     \OCA\OCLife\utilities::deleteThumb($path);
     // Now remove all entry in DB for this file
     // -- Verificare che qui esista l'entry del file nel DB!!! :-///
     $fileInfos = \OC\Files\Filesystem::getFileInfo($path);
     if ($fileInfos['fileid']) {
         $result = \OCA\OCLife\hTags::removeAllTagsForFile($fileInfos['fileid']);
     }
     return $result;
 }
开发者ID:Greenworker,项目名称:oclife,代码行数:17,代码来源:utilities.php

示例8: onDelete

 /**
  * @brief Cleanup session data on removing the document
  * @param array
  *
  * This function is connected to the delete signal of OC_Filesystem
  * to delete the related info from database
  */
 public static function onDelete($params)
 {
     $info = \OC\Files\Filesystem::getFileInfo($params['path']);
     $fileId = @$info['fileid'];
     if (!$fileId) {
         return;
     }
     $sessionObj = new Db_Session();
     $session = $sessionObj->loadBy('file_id', $fileId)->getData();
     if (!is_array($session) || !isset($session['es_id'])) {
         return;
     }
     Db_Session::cleanUp($session['es_id']);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:21,代码来源:storage.php

示例9: getUidAndFilename

 /**
  * @param string $filename
  * @return array
  * @throws \OC\User\NoUserException
  */
 public static function getUidAndFilename($filename)
 {
     $uid = \OC\Files\Filesystem::getOwner($filename);
     \OC\Files\Filesystem::initMountPoints($uid);
     if ($uid != \OCP\User::getUser()) {
         $info = \OC\Files\Filesystem::getFileInfo($filename);
         $ownerView = new \OC\Files\View('/' . $uid . '/files');
         try {
             $filename = $ownerView->getPath($info['fileid']);
         } catch (NotFoundException $e) {
             $filename = null;
         }
     }
     return [$uid, $filename];
 }
开发者ID:DanielTosello,项目名称:owncloud,代码行数:20,代码来源:storage.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->userBackend = new \Test\Util\User\Dummy();
     \OC::$server->getUserManager()->registerBackend($this->userBackend);
     $this->ownerUid = $this->getUniqueID('owner_');
     $this->recipientUid = $this->getUniqueID('recipient_');
     $this->userBackend->createUser($this->ownerUid, '');
     $this->userBackend->createUser($this->recipientUid, '');
     $this->loginAsUser($this->ownerUid);
     Filesystem::mkdir('/foo');
     Filesystem::file_put_contents('/foo/bar.txt', 'asd');
     $fileId = Filesystem::getFileInfo('/foo/bar.txt')->getId();
     \OCP\Share::shareItem('file', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->recipientUid, 31);
     $this->loginAsUser($this->recipientUid);
     $this->assertTrue(Filesystem::file_exists('bar.txt'));
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:17,代码来源:locking.php

示例11: onDelete

 /**
  * @brief Cleanup session data on removing the document
  * @param array
  *
  * This function is connected to the delete signal of OC_Filesystem
  * to delete the related info from database
  */
 public static function onDelete($params)
 {
     $info = \OC\Files\Filesystem::getFileInfo($params['path']);
     $fileId = @$info['fileid'];
     if (!$fileId) {
         return;
     }
     $session = new Db\Session();
     $session->loadBy('file_id', $fileId);
     if (!$session->getEsId()) {
         return;
     }
     $member = new Db\Member();
     $sessionMembers = $member->getCollectionBy('es_id', $session->getEsId());
     foreach ($sessionMembers as $memberData) {
         if (intval($memberData['status']) === Db\Member::MEMBER_STATUS_ACTIVE) {
             return;
         }
     }
     Db\Session::cleanUp($session->getEsId());
 }
开发者ID:ozcan,项目名称:richdocuments,代码行数:28,代码来源:storage.php

示例12: testUnshareChildren

 /**
  * @medium
  */
 function testUnshareChildren()
 {
     $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
     $this->share(\OCP\Share::SHARE_TYPE_USER, $this->folder, self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // one folder should be shared with the user
     $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_USER);
     $this->assertCount(1, $shares);
     // move shared folder to 'localDir'
     \OC\Files\Filesystem::mkdir('localDir');
     $result = \OC\Files\Filesystem::rename($this->folder, '/localDir/' . $this->folder);
     $this->assertTrue($result);
     \OC\Files\Filesystem::unlink('localDir');
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // after the parent directory was deleted the share should be unshared
     $shares = $this->shareManager->getSharedWith(self::TEST_FILES_SHARING_API_USER2, \OCP\Share::SHARE_TYPE_USER);
     $this->assertEmpty($shares);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     // the folder for the owner should still exists
     $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:24,代码来源:unsharechildren.php

示例13: testpreUnlink

 /**
  * @medium
  */
 function testpreUnlink()
 {
     $fileInfo2 = \OC\Files\Filesystem::getFileInfo($this->folder);
     $result = \OCP\Share::shareItem('folder', $fileInfo2->getId(), \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
     $this->assertTrue($result);
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // one folder should be shared with the user
     $sharedFolders = \OCP\Share::getItemsSharedWith('folder');
     $this->assertSame(1, count($sharedFolders));
     // move shared folder to 'localDir'
     \OC\Files\Filesystem::mkdir('localDir');
     $result = \OC\Files\Filesystem::rename($this->folder, '/localDir/' . $this->folder);
     $this->assertTrue($result);
     \OC\Files\Filesystem::unlink('localDir');
     self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
     // after the parent directory was deleted the share should be unshared
     $sharedFolders = \OCP\Share::getItemsSharedWith('folder');
     $this->assertTrue(empty($sharedFolders));
     self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
     // the folder for the owner should still exists
     $this->assertTrue(\OC\Files\Filesystem::file_exists($this->folder));
 }
开发者ID:samj1912,项目名称:repo,代码行数:25,代码来源:proxy.php

示例14: update

 /**
  * update keyfiles and share keys recursively
  *
  * @param int $fileSource file source id
  */
 private function update($fileSource)
 {
     $path = \OC\Files\Filesystem::getPath($fileSource);
     $info = \OC\Files\Filesystem::getFileInfo($path);
     $owner = \OC\Files\Filesystem::getOwner($path);
     $view = new \OC\Files\View('/' . $owner . '/files');
     $ownerPath = $view->getPath($info->getId());
     $absPath = '/' . $owner . '/files' . $ownerPath;
     $mount = $this->mountManager->find($path);
     $mountPoint = $mount->getMountPoint();
     // if a folder was shared, get a list of all (sub-)folders
     if ($this->view->is_dir($absPath)) {
         $allFiles = $this->util->getAllFiles($absPath, $mountPoint);
     } else {
         $allFiles = array($absPath);
     }
     $encryptionModule = $this->encryptionManager->getDefaultEncryptionModule();
     foreach ($allFiles as $path) {
         $usersSharing = $this->file->getAccessList($path);
         $encryptionModule->update($path, $this->uid, $usersSharing);
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:27,代码来源:update.php

示例15: testShareNotOwner

 /**
  * @expectedException \Exception
  */
 public function testShareNotOwner()
 {
     \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
     \OC\Files\Filesystem::file_put_contents('foo.txt', 'bar');
     $info = \OC\Files\Filesystem::getFileInfo('foo.txt');
     \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1);
     \OCP\Share::shareItem('file', $info->getId(), \OCP\Share::SHARE_TYPE_LINK, \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
 }
开发者ID:evanjt,项目名称:core,代码行数:11,代码来源:api.php


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