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


PHP View::getAbsolutePath方法代码示例

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


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

示例1: propagateChanges

 /**
  * propagate the registered changes to their parent folders
  *
  * @param int $time (optional) the mtime to set for the folders, if not set the current time is used
  */
 public function propagateChanges($time = null)
 {
     $changes = $this->getChanges();
     $this->changedFiles = [];
     if (!$time) {
         $time = time();
     }
     foreach ($changes as $change) {
         /**
          * @var \OC\Files\Storage\Storage $storage
          * @var string $internalPath
          */
         $absolutePath = $this->view->getAbsolutePath($change);
         $mount = $this->view->getMount($change);
         $storage = $mount->getStorage();
         $internalPath = $mount->getInternalPath($absolutePath);
         if ($storage) {
             $propagator = $storage->getPropagator();
             $propagatedEntries = $propagator->propagateChange($internalPath, $time);
             foreach ($propagatedEntries as $entry) {
                 $absolutePath = Filesystem::normalizePath($mount->getMountPoint() . '/' . $entry['path']);
                 $relativePath = $this->view->getRelativePath($absolutePath);
                 $this->emit('\\OC\\Files', 'propagate', [$relativePath, $entry]);
             }
         }
     }
 }
开发者ID:DaubaKao,项目名称:owncloud-core,代码行数:32,代码来源:changepropagator.php

示例2: renameHook

 public function renameHook($params)
 {
     $path1 = $params['oldpath'];
     $path2 = $params['newpath'];
     $fullPath1 = $this->baseView->getAbsolutePath($path1);
     $fullPath2 = $this->baseView->getAbsolutePath($path2);
     $mount1 = $this->baseView->getMount($path1);
     $mount2 = $this->baseView->getMount($path2);
     if ($mount1 instanceof SharedMount and $mount1->getInternalPath($fullPath1) !== '') {
         $this->propagateForOwner($mount1->getShare(), $mount1->getInternalPath($fullPath1), $mount1->getOwnerPropagator());
     }
     if ($mount1 !== $mount2 and $mount2 instanceof SharedMount and $mount2->getInternalPath($fullPath2) !== '') {
         $this->propagateForOwner($mount2->getShare(), $mount2->getInternalPath($fullPath2), $mount2->getOwnerPropagator());
     }
 }
开发者ID:brunomilet,项目名称:owncloud-core,代码行数:15,代码来源:changewatcher.php

示例3: testPropagateCrossStorage

 public function testPropagateCrossStorage()
 {
     $storage = new Temporary();
     $this->view->mkdir('/foo');
     Filesystem::mount($storage, [], $this->view->getAbsolutePath('/foo/submount'));
     $this->view->mkdir('/foo/submount/bar');
     $this->view->file_put_contents('/foo/submount/bar/sad.txt', 'qwerty');
     $oldInfo1 = $this->view->getFileInfo('/');
     $oldInfo2 = $this->view->getFileInfo('/foo');
     $oldInfo3 = $this->view->getFileInfo('/foo/submount');
     $oldInfo4 = $this->view->getFileInfo('/foo/submount/bar');
     $time = time() + 50;
     $this->propagator->addChange('/foo/submount/bar/sad.txt');
     $this->propagator->propagateChanges($time);
     $newInfo1 = $this->view->getFileInfo('/');
     $newInfo2 = $this->view->getFileInfo('/foo');
     $newInfo3 = $this->view->getFileInfo('/foo/submount');
     $newInfo4 = $this->view->getFileInfo('/foo/submount/bar');
     $this->assertEquals($newInfo1->getMTime(), $time);
     $this->assertEquals($newInfo2->getMTime(), $time);
     $this->assertEquals($newInfo3->getMTime(), $time);
     $this->assertEquals($newInfo4->getMTime(), $time);
     $this->assertNotSame($oldInfo1->getEtag(), $newInfo1->getEtag());
     $this->assertNotSame($oldInfo2->getEtag(), $newInfo2->getEtag());
     $this->assertNotSame($oldInfo3->getEtag(), $newInfo3->getEtag());
     $this->assertNotSame($oldInfo4->getEtag(), $newInfo3->getEtag());
 }
开发者ID:kebenxiaoming,项目名称:core,代码行数:27,代码来源:changepropagator.php

示例4: move

 /**
  * Moves a file from one location to another
  *
  * @param string $sourcePath The path to the file which should be moved
  * @param string $destinationPath The full destination path, so not just the destination parent node
  * @throws \Sabre\DAV\Exception\BadRequest
  * @throws \Sabre\DAV\Exception\ServiceUnavailable
  * @throws \Sabre\DAV\Exception\Forbidden
  * @return int
  */
 public function move($sourcePath, $destinationPath)
 {
     if (!$this->fileView) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
     }
     $targetNodeExists = $this->nodeExists($destinationPath);
     $sourceNode = $this->getNodeForPath($sourcePath);
     if ($sourceNode instanceof \Sabre\DAV\ICollection && $targetNodeExists) {
         throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists');
     }
     list($sourceDir, ) = \Sabre\HTTP\URLUtil::splitPath($sourcePath);
     list($destinationDir, ) = \Sabre\HTTP\URLUtil::splitPath($destinationPath);
     $isMovableMount = false;
     $sourceMount = $this->mountManager->find($this->fileView->getAbsolutePath($sourcePath));
     $internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
     if ($sourceMount instanceof MoveableMount && $internalPath === '') {
         $isMovableMount = true;
     }
     try {
         $sameFolder = $sourceDir === $destinationDir;
         // if we're overwriting or same folder
         if ($targetNodeExists || $sameFolder) {
             // note that renaming a share mount point is always allowed
             if (!$this->fileView->isUpdatable($destinationDir) && !$isMovableMount) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         } else {
             if (!$this->fileView->isCreatable($destinationDir)) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         }
         if (!$sameFolder) {
             // moving to a different folder, source will be gone, like a deletion
             // note that moving a share mount point is always allowed
             if (!$this->fileView->isDeletable($sourcePath) && !$isMovableMount) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         }
         $fileName = basename($destinationPath);
         try {
             $this->fileView->verifyPath($destinationDir, $fileName);
         } catch (\OCP\Files\InvalidPathException $ex) {
             throw new InvalidPath($ex->getMessage());
         }
         $renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
         if (!$renameOkay) {
             throw new \Sabre\DAV\Exception\Forbidden('');
         }
     } catch (StorageNotAvailableException $e) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
     } catch (ForbiddenException $ex) {
         throw new Forbidden($ex->getMessage(), $ex->getRetry());
     } catch (LockedException $e) {
         throw new FileLocked($e->getMessage(), $e->getCode(), $e);
     }
     $this->markDirty($sourceDir);
     $this->markDirty($destinationDir);
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:68,代码来源:objecttree.php

示例5: move

 /**
  * Moves a file from one location to another
  *
  * @param string $sourcePath The path to the file which should be moved
  * @param string $destinationPath The full destination path, so not just the destination parent node
  * @throws \Sabre\DAV\Exception\BadRequest
  * @throws \Sabre\DAV\Exception\ServiceUnavailable
  * @throws \Sabre\DAV\Exception\Forbidden
  * @return int
  */
 public function move($sourcePath, $destinationPath)
 {
     if (!$this->fileView) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
     }
     $targetNodeExists = $this->nodeExists($destinationPath);
     $sourceNode = $this->getNodeForPath($sourcePath);
     if ($sourceNode instanceof \Sabre\DAV\ICollection && $targetNodeExists) {
         throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode . ', target exists');
     }
     list($sourceDir, ) = \Sabre\DAV\URLUtil::splitPath($sourcePath);
     list($destinationDir, ) = \Sabre\DAV\URLUtil::splitPath($destinationPath);
     $isMovableMount = false;
     $sourceMount = $this->mountManager->find($this->fileView->getAbsolutePath($sourcePath));
     $internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
     if ($sourceMount instanceof MoveableMount && $internalPath === '') {
         $isMovableMount = true;
     }
     try {
         $sameFolder = $sourceDir === $destinationDir;
         // if we're overwriting or same folder
         if ($targetNodeExists || $sameFolder) {
             // note that renaming a share mount point is always allowed
             if (!$this->fileView->isUpdatable($destinationDir) && !$isMovableMount) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         } else {
             if (!$this->fileView->isCreatable($destinationDir)) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         }
         if (!$sameFolder) {
             // moving to a different folder, source will be gone, like a deletion
             // note that moving a share mount point is always allowed
             if (!$this->fileView->isDeletable($sourcePath) && !$isMovableMount) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         }
         $fileName = basename($destinationPath);
         if (!\OCP\Util::isValidFileName($fileName)) {
             throw new \Sabre\DAV\Exception\BadRequest();
         }
         $renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
         if (!$renameOkay) {
             throw new \Sabre\DAV\Exception\Forbidden('');
         }
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
     }
     // update properties
     $query = \OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?' . ' WHERE `userid` = ? AND `propertypath` = ?');
     $query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(), \OC\Files\Filesystem::normalizePath($sourcePath)));
     $this->markDirty($sourceDir);
     $this->markDirty($destinationDir);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:65,代码来源:objecttree.php

示例6: move

 /**
  * Moves a file from one location to another
  *
  * @param string $sourcePath The path to the file which should be moved
  * @param string $destinationPath The full destination path, so not just the destination parent node
  * @throws \Sabre\DAV\Exception\BadRequest
  * @throws \Sabre\DAV\Exception\ServiceUnavailable
  * @throws \Sabre\DAV\Exception\Forbidden
  * @return int
  */
 public function move($sourcePath, $destinationPath)
 {
     if (!$this->fileView) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
     }
     $sourceNode = $this->getNodeForPath($sourcePath);
     if ($sourceNode instanceof \Sabre\DAV\ICollection and $this->nodeExists($destinationPath)) {
         throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode . ', target exists');
     }
     list($sourceDir, ) = \Sabre\DAV\URLUtil::splitPath($sourcePath);
     list($destinationDir, ) = \Sabre\DAV\URLUtil::splitPath($destinationPath);
     $isMovableMount = false;
     $sourceMount = $this->mountManager->find($this->fileView->getAbsolutePath($sourcePath));
     $internalPath = $sourceMount->getInternalPath($this->fileView->getAbsolutePath($sourcePath));
     if ($sourceMount instanceof MoveableMount && $internalPath === '') {
         $isMovableMount = true;
     }
     try {
         // check update privileges
         if (!$this->fileView->isUpdatable($sourcePath) && !$isMovableMount) {
             throw new \Sabre\DAV\Exception\Forbidden();
         }
         if ($sourceDir !== $destinationDir) {
             if (!$this->fileView->isCreatable($destinationDir)) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
             if (!$this->fileView->isDeletable($sourcePath) && !$isMovableMount) {
                 throw new \Sabre\DAV\Exception\Forbidden();
             }
         }
         $fileName = basename($destinationPath);
         if (!\OCP\Util::isValidFileName($fileName)) {
             throw new \Sabre\DAV\Exception\BadRequest();
         }
         $renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
         if (!$renameOkay) {
             throw new \Sabre\DAV\Exception\Forbidden('');
         }
     } catch (\OCP\Files\StorageNotAvailableException $e) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
     }
     // update properties
     $query = \OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?' . ' WHERE `userid` = ? AND `propertypath` = ?');
     $query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(), \OC\Files\Filesystem::normalizePath($sourcePath)));
     $this->markDirty($sourceDir);
     $this->markDirty($destinationDir);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:57,代码来源:objecttree.php

示例7: calculateSize

 /**
  * get the size from a given root folder
  * @param \OC\Files\View $view file view on the root folder
  * @return integer size of the folder
  */
 private static function calculateSize($view)
 {
     $root = \OCP\Config::getSystemValue('datadirectory') . $view->getAbsolutePath('');
     if (!file_exists($root)) {
         return 0;
     }
     $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), \RecursiveIteratorIterator::CHILD_FIRST);
     $size = 0;
     /**
      * RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
      * This bug is fixed in PHP 5.5.9 or before
      * See #8376
      */
     $iterator->rewind();
     while ($iterator->valid()) {
         $path = $iterator->current();
         $relpath = substr($path, strlen($root) - 1);
         if (!$view->is_dir($relpath)) {
             $size += $view->filesize($relpath);
         }
         $iterator->next();
     }
     return $size;
 }
开发者ID:Combustible,项目名称:core,代码行数:29,代码来源:trashbin.php

示例8: extractMetadata

 /**
  * extract the metadata from a file
  *
  * uses getid3 to extract metadata.
  * if possible also adds content (currently only for plain text files)
  * hint: use OC\Files\Filesystem::getFileInfo($path) to get metadata for the last param
  *
  * @author Jörn Dreyer <jfd@butonic.de>
  *
  * @param Zend_Search_Lucene_Document $doc      to add the metadata to
  * @param string                      $path     path of the file to extract metadata from
  * @param string                      $mimetype depending on the mimetype different extractions are performed
  *
  * @return void
  */
 private static function extractMetadata(\Zend_Search_Lucene_Document $doc, $path, \OC\Files\View $view, $mimetype)
 {
     $file = $view->getLocalFile($path);
     if (is_dir($file)) {
         // Don't lose time analizing a directory for file-specific metadata
         return;
     }
     $getID3 = new \getID3();
     $getID3->encoding = 'UTF-8';
     $data = $getID3->analyze($file);
     // TODO index meta information from media files?
     //show me what you got
     /*foreach ($data as $key => $value) {
     			Util::writeLog('search_lucene',
     						'getid3 extracted '.$key.': '.$value,
     						Util::DEBUG);
     			if (is_array($value)) {
     				foreach ($value as $k => $v) {
     					Util::writeLog('search_lucene',
     							'  ' . $value .'-' .$k.': '.$v,
     							Util::DEBUG);
     				}
     			}
     		}*/
     if ('application/pdf' === $mimetype) {
         try {
             $zendpdf = \Zend_Pdf::parse($view->file_get_contents($path));
             //we currently only display the filename, so we only index metadata here
             if (isset($zendpdf->properties['Title'])) {
                 $doc->addField(\Zend_Search_Lucene_Field::UnStored('title', $zendpdf->properties['Title']));
             }
             if (isset($zendpdf->properties['Author'])) {
                 $doc->addField(\Zend_Search_Lucene_Field::UnStored('author', $zendpdf->properties['Author']));
             }
             if (isset($zendpdf->properties['Subject'])) {
                 $doc->addField(\Zend_Search_Lucene_Field::UnStored('subject', $zendpdf->properties['Subject']));
             }
             if (isset($zendpdf->properties['Keywords'])) {
                 $doc->addField(\Zend_Search_Lucene_Field::UnStored('keywords', $zendpdf->properties['Keywords']));
             }
             //TODO handle PDF 1.6 metadata Zend_Pdf::getMetadata()
             //do the content extraction
             $pdfParse = new \App_Search_Helper_PdfParser();
             $body = $pdfParse->pdf2txt($zendpdf->render());
         } catch (Exception $e) {
             Util::writeLog('search_lucene', $e->getMessage() . ' Trace:\\n' . $e->getTraceAsString(), Util::ERROR);
         }
     }
     if ($body != '') {
         $doc->addField(\Zend_Search_Lucene_Field::UnStored('body', $body));
     }
     if (isset($data['error'])) {
         Util::writeLog('search_lucene', 'failed to extract meta information for ' . $view->getAbsolutePath($path) . ': ' . $data['error']['0'], Util::WARN);
         return;
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:71,代码来源:indexer.php

示例9: getPropagatorPath

	protected function getPropagatorPath($path) {
		return $this->propagatorView->getRelativePath($this->view->getAbsolutePath($path));
	}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:3,代码来源:updater.php


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