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


PHP Filesystem::copy方法代码示例

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


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

示例1: copyFile

 /**
  * Copy file.
  *
  * @param string $filePath File path
  * @param File   $file     File object
  *
  * @throws FileExistsException
  *
  * @return bool True on success, false on failure.
  */
 public function copyFile($filePath, File $file)
 {
     try {
         return $this->filesystem->copy($filePath, $file->getDirectories() . DIRECTORY_SEPARATOR . $file->getFileName());
     } catch (FlysystemFileExistsException $e) {
         FileExistsException::fileExists();
     }
 }
开发者ID:da-vinci-studio,项目名称:file-bundle,代码行数:18,代码来源:Local.php

示例2: duplicate

 /**
  * Duplicate a file given it's URL
  *
  * @param  string $url
  * @return string
  */
 public function duplicate($url)
 {
     // Make the destination path
     $current_path = $this->helpers->path($url);
     $filename = basename($current_path);
     $dst_disk = $this->disks ? $this->disks->getFilesystem('dst') : $this->disk;
     $new_path = $this->storage->makeNestedAndUniquePath($filename, $dst_disk);
     // Copy, supporting alternative destination disks
     if ($this->disks) {
         $this->disks->copy('src://' . $current_path, 'dst://' . $new_path);
     } else {
         $this->disk->copy($current_path, $new_path);
     }
     // Return the Upchuck URL
     return $this->helpers->url($new_path);
 }
开发者ID:bkwld,项目名称:cloner,代码行数:22,代码来源:Upchuck.php

示例3: copy

 /**
  * {@inheritdoc}
  */
 public function copy($source, $target)
 {
     if ($this->file_exists($target)) {
         $this->unlink($target);
     }
     return $this->flysystem->copy($this->buildPath($source), $this->buildPath($target));
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:10,代码来源:Flysystem.php

示例4: testCopy

 public function testCopy()
 {
     $old = 'old.txt';
     $new = 'new.txt';
     $this->prophecy->has($old)->willReturn(true);
     $this->prophecy->has($new)->willReturn(false);
     $this->prophecy->copy($old, $new)->willReturn(true);
     $response = $this->filesystem->copy($old, $new);
     $this->assertTrue($response);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:10,代码来源:FilesystemTests.php

示例5: copy

 /**
  * @inheritdoc
  */
 public function copy($path, $newPath)
 {
     $innerPath = $this->getInnerPath($path);
     $newInnerPath = $this->getInnerPath($newPath);
     try {
         $return = $this->fileSystem->copy($innerPath, $newInnerPath);
     } catch (FileNotFoundException $e) {
         throw $this->exceptionWrapper($e, $path);
     } catch (FileExistsException $e) {
         throw $this->exceptionWrapper($e, $path);
     }
     if ($return !== false) {
         $this->invokePlugin("addPathToIndex", [$newPath, $newInnerPath], $this);
     }
     return $return;
 }
开发者ID:petrknap,项目名称:php-filestorage,代码行数:19,代码来源:FileSystem.php

示例6: testCopyFail

 public function testCopyFail()
 {
     $mock = Mockery::mock('League\\Flysystem\\AdapterInterface');
     $mock->shouldReceive('write')->andReturn(array('path' => 'path.txt'));
     $mock->shouldReceive('copy')->andReturn(false);
     $mock->shouldReceive('has')->with('path.txt')->andReturn(false, true);
     $mock->shouldReceive('has')->with('new.txt')->andReturn(false);
     $filesystem = new Filesystem($mock);
     $filesystem->write('path.txt', 'content');
     $this->assertFalse($filesystem->copy('path.txt', 'new.txt'));
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:11,代码来源:FilesystemTests.php

示例7: copy

 /**
  * Copy 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 copy($path, $newpath)
 {
     $result = parent::copy($path, $newpath);
     if ($result && ($resource = $this->get($newpath))) {
         return $this->dispatch(new SyncFile($resource));
     }
     return $result;
 }
开发者ID:ramcda,项目名称:files-module,代码行数:19,代码来源:AdapterFilesystem.php

示例8: upRoutes

 /**
  * Copies the App routes into their defined location in atuin directory.
  * 
  */
 protected function upRoutes()
 {
     $basePath = dirname(Yii::$app->getVendorPath());
     $filesystem = new Filesystem(new Adapter($basePath));
     // 1 - Move the routes into the route system in case we have those files
     $fileHelper = new yii\helpers\FileHelper();
     foreach ($this->arrRoutes as $type) {
         $path = $this->module->basePath . '/routes/' . $type . '/';
         if (is_dir($path)) {
             $files = $fileHelper->findFiles($path, ['only' => ['*.php'], 'recursive' => FALSE]);
             foreach ($files as $file) {
                 $fileName = str_replace($path, '', $file);
                 $from = str_replace($basePath, '', $file);
                 $to = '/atuin/routes/' . $type . '/app_' . $this->module->id . '_' . $fileName;
                 if (!$filesystem->has($to)) {
                     $filesystem->copy($from, $to);
                 }
             }
         }
     }
 }
开发者ID:AtuinCMS,项目名称:installation,代码行数:25,代码来源:AppConfigManagement.php

示例9: testCreateDir

 /**
  * 3.txt
  * 2.txt
  * test/1.txt.
  */
 public function testCreateDir()
 {
     $this->assertTrue($this->filesystem->createDir('test'));
     $this->assertTrue($this->filesystem->copy('2.txt', 'test/1.txt'));
 }
开发者ID:apollopy,项目名称:flysystem-aliyun-oss,代码行数:10,代码来源:AliyunOssAdapterTest.php

示例10: _copy

 /**
  * @inheritdoc
  */
 protected function _copy($source, $target, $name)
 {
     return $this->fs->copy($source, $this->_joinPath($target, $name));
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:7,代码来源:FlysystemDriver.php

示例11: copy

 /**
  * Copy a file
  *
  * @param   string $path
  * @param   string $newpath
  * @return  boolean
  */
 public function copy($path, $newpath)
 {
     try {
         return parent::copy($path, $newpath);
     } catch (\Exception $e) {
         $this->errors[] = $e->getMessage();
     }
     return false;
 }
开发者ID:romeoz,项目名称:rock-file,代码行数:16,代码来源:FileManager.php


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