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


PHP FilesystemInterface::rename方法代码示例

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


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

示例1: _move

 /**
  * Move file into another parent dir.
  * Return new file path or false.
  *
  * @param  string  $source  source file path
  * @param  string  $target  target dir path
  * @param  string  $name    file name
  * @return string|bool
  **/
 protected function _move($source, $target, $name)
 {
     $path = $this->_joinPath($target, $name);
     if ($this->fs->rename($source, $path)) {
         return $path;
     }
     return false;
 }
开发者ID:quepasso,项目名称:dashboard,代码行数:17,代码来源:ElFinderVolumeFlysystem.php

示例2: move

 /**
  * Move (rename) a file or directory.
  *
  * @param string $source
  * @param string $destination
  * @throws IoWriteException
  */
 public function move($source, $destination)
 {
     try {
         $this->fs->rename($source, $destination);
     } catch (Error $ex) {
         throw new IoWriteException("File {$source} could not be moved to {$destination}.", $ex);
     } catch (Exception $ex) {
         throw new IoWriteException("File {$source} could not be moved to {$destination}.", $ex);
     }
 }
开发者ID:khelle,项目名称:surume,代码行数:17,代码来源:Filesystem.php

示例3: migrateFile

 /**
  * Migrates a file to the new strategy if it's not present
  *
  * @internal
  * @param $path
  * @return void
  */
 public function migrateFile($path)
 {
     if ($this->getAdapterType() !== 'local' || $this->isEncoded($path)) {
         return;
     }
     $encodedPath = $this->strategy->encode($path);
     if ($this->filesystem->has($path) && !$this->filesystem->has($encodedPath)) {
         $this->filesystem->rename($path, $encodedPath);
     }
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:17,代码来源:MediaService.php

示例4: extract

 /** @inheritdoc */
 public function extract($zipBallPath, $to)
 {
     $absolutePathToZipBall = $this->filesystem->getAdapter()->applyPathPrefix($zipBallPath);
     if ($this->zip->open($absolutePathToZipBall) === true) {
         $absolutePathToExtract = $this->filesystem->getAdapter()->applyPathPrefix($to);
         $this->zip->extractTo($absolutePathToExtract);
         $this->zip->close();
         $zipCreatedFolder = Linq::from($this->filesystem->listContents($to))->single(function ($object) {
             return $object['type'] == 'dir';
         })['path'];
         foreach ($this->filesystem->listContents($zipCreatedFolder, true) as $object) {
             if ($object['type'] == "file") {
                 $segments = explode('/', $object['path']);
                 unset($segments[4]);
                 $this->filesystem->rename($object['path'], implode('/', $segments));
             }
         }
         $this->filesystem->deleteDir($zipCreatedFolder);
         return;
     }
     throw new ZipExtractionFailed($zipBall, $to);
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:23,代码来源:ZipExtractor.php

示例5: move

 /**
  * @override
  * @inheritDoc
  */
 public function move($source, $destination)
 {
     $ex = null;
     $status = false;
     try {
         $status = $this->fs->rename($source, $destination);
     } catch (Error $ex) {
     } catch (Exception $ex) {
     }
     if (!$status || $ex !== null) {
         throw new WriteException("File {$source} could not be moved to {$destination}.", $ex);
     }
 }
开发者ID:kraken-php,项目名称:framework,代码行数:17,代码来源:Filesystem.php

示例6: renameFile

 /**
  * Renames a file in this storage.
  *
  * @param string $fileIdentifier
  * @param string $newName The target path (including the file name!)
  * @return string The identifier of the file after renaming
  * @throws ExistingTargetFileNameException
  */
 public function renameFile($fileIdentifier, $newName)
 {
     // Makes sure the Path given as parameter is valid
     $newName = $this->sanitizeFileName($newName);
     $newIdentifier = $this->canonicalizeAndCheckFileIdentifier($newName);
     // The target should not exist already
     if ($this->fileExists($newIdentifier)) {
         throw new ExistingTargetFileNameException('The target file "' . $newIdentifier . '" already exists.', 1320291063);
     }
     $sourcePath = ltrim($fileIdentifier, '/');
     $targetPath = ltrim($newIdentifier, '/');
     $result = $this->filesystem->rename($sourcePath, $targetPath);
     if ($result === false) {
         throw new \RuntimeException('Renaming file ' . $sourcePath . ' to ' . $targetPath . ' failed.', 1320375115);
     }
     return $newIdentifier;
 }
开发者ID:cedricziel,项目名称:fal-flysystem,代码行数:25,代码来源:FlysystemDriver.php

示例7: move

 /**
  * Move a file to a new location.
  *
  * @param  string  $from
  * @param  string  $to
  * @return bool
  */
 public function move($from, $to)
 {
     return $this->driver->rename($from, $to);
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:11,代码来源:FilesystemAdapter.php

示例8: _move

 /**
  * Move file into another parent dir.
  * Return new file path or false.
  *
  * @param  string  $source  source file path
  * @param  string  $target  target dir path
  * @param  string  $name    file name
  * @return string|bool
  **/
 protected function _move($source, $target, $name)
 {
     $path = $this->_joinPath($target, $name);
     return $this->_resultPath($this->fs->rename($source, $path), $path);
 }
开发者ID:hectorgarcia83,项目名称:plataforma_eliana,代码行数:14,代码来源:Driver.php

示例9: rename

 /**
  * Rename a file.
  *
  * @param string $path    Path to the existing file.
  * @param string $newpath The new path of the file.
  *
  * @throws FileExistsException   Thrown if $newpath exists.
  * @throws FileNotFoundException Thrown if $path does not exist.
  *
  * @return bool True on success, false on failure.
  */
 public function rename($path, $newpath)
 {
     return $this->fileSystem->rename($path, $newpath);
 }
开发者ID:graze,项目名称:data-file,代码行数:15,代码来源:FilesystemWrapper.php


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