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


PHP Filesystem::copy方法代码示例

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


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

示例1: doTestCopyHook

 /**
  * test rename operation
  */
 function doTestCopyHook($filename)
 {
     // check if keys exists
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keys/' . $filename . '/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keys/' . $filename . '/fileKey'));
     // make subfolder and sub-subfolder
     $this->rootView->mkdir('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder);
     $this->rootView->mkdir('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder . '/' . $this->folder);
     $this->assertTrue($this->rootView->is_dir('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder . '/' . $this->folder));
     // copy the file to the sub-subfolder
     \OC\Files\Filesystem::copy($filename, '/' . $this->folder . '/' . $this->folder . '/' . $filename);
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $filename));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder . '/' . $this->folder . '/' . $filename));
     // keys should be copied too
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keys/' . $filename . '/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keys/' . $filename . '/fileKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keys/' . $this->folder . '/' . $this->folder . '/' . $filename . '/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keys/' . $this->folder . '/' . $this->folder . '/' . $filename . '/fileKey'));
     // cleanup
     $this->rootView->unlink('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder);
     $this->rootView->unlink('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $filename);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:25,代码来源:hooks.php

示例2: testCopy

 public function testCopy()
 {
     \OC\Files\Filesystem::file_put_contents("test.txt", "test file");
     $t1 = time();
     // second version is two weeks older, this way we make sure that no
     // version will be expired
     $t2 = $t1 - 60 * 60 * 24 * 14;
     // create some versions
     $v1 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t1;
     $v2 = self::USERS_VERSIONS_ROOT . '/test.txt.v' . $t2;
     $v1Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t1;
     $v2Copied = self::USERS_VERSIONS_ROOT . '/test2.txt.v' . $t2;
     $this->rootView->file_put_contents($v1, 'version1');
     $this->rootView->file_put_contents($v2, 'version2');
     // execute copy hook of versions app
     \OC\Files\Filesystem::copy("test.txt", "test2.txt");
     $this->runCommands();
     $this->assertTrue($this->rootView->file_exists($v1));
     $this->assertTrue($this->rootView->file_exists($v2));
     $this->assertTrue($this->rootView->file_exists($v1Copied));
     $this->assertTrue($this->rootView->file_exists($v2Copied));
 }
开发者ID:nem0xff,项目名称:core,代码行数:22,代码来源:versions.php

示例3: copy

 /**
  * Copies a file or directory.
  *
  * This method must work recursively and delete the destination
  * if it exists
  *
  * @param string $source
  * @param string $destination
  * @return void
  */
 public function copy($source, $destination)
 {
     if (Filesystem::is_file($source)) {
         Filesystem::copy($source, $destination);
     } else {
         Filesystem::mkdir($destination);
         $dh = Filesystem::opendir($source);
         if (is_resource($dh)) {
             while (($subnode = readdir($dh)) !== false) {
                 if ($subnode == '.' || $subnode == '..') {
                     continue;
                 }
                 $this->copy($source . '/' . $subnode, $destination . '/' . $subnode);
             }
         }
     }
     list($destinationDir, ) = \Sabre_DAV_URLUtil::splitPath($destination);
     $this->markDirty($destinationDir);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:29,代码来源:objecttree.php

示例4: testCopyHook

 /**
  * test rename operation
  */
 function testCopyHook()
 {
     // save file with content
     $cryptedFile = file_put_contents('crypt:///' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->filename, $this->data);
     // test that data was successfully written
     $this->assertTrue(is_int($cryptedFile));
     // check if keys exists
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/share-keys/' . $this->filename . '.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keyfiles/' . $this->filename . '.key'));
     // make subfolder and sub-subfolder
     $this->rootView->mkdir('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder);
     $this->rootView->mkdir('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder . '/' . $this->folder);
     $this->assertTrue($this->rootView->is_dir('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder . '/' . $this->folder));
     // copy the file to the sub-subfolder
     \OC\Files\Filesystem::copy($this->filename, '/' . $this->folder . '/' . $this->folder . '/' . $this->filename);
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->filename));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder . '/' . $this->folder . '/' . $this->filename));
     // keys should be copied too
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/share-keys/' . $this->filename . '.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keyfiles/' . $this->filename . '.key'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/share-keys/' . $this->folder . '/' . $this->folder . '/' . $this->filename . '.' . self::TEST_ENCRYPTION_HOOKS_USER1 . '.shareKey'));
     $this->assertTrue($this->rootView->file_exists('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files_encryption/keyfiles/' . $this->folder . '/' . $this->folder . '/' . $this->filename . '.key'));
     // cleanup
     $this->rootView->unlink('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->folder);
     $this->rootView->unlink('/' . self::TEST_ENCRYPTION_HOOKS_USER1 . '/files/' . $this->filename);
 }
开发者ID:Combustible,项目名称:core,代码行数:29,代码来源:hooks.php

示例5: copy

 /**
  * @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
  */
 public static function copy($path1, $path2)
 {
     return \OC\Files\Filesystem::copy($path1, $path2);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:7,代码来源:filesystem.php

示例6: viewToNodeProviderCopyRename

 public function viewToNodeProviderCopyRename()
 {
     return [[function () {
         Filesystem::file_put_contents('source', 'asd');
         Filesystem::rename('source', 'target');
     }, 'preRename'], [function () {
         Filesystem::file_put_contents('source', 'asd');
         Filesystem::rename('source', 'target');
     }, 'postRename'], [function () {
         Filesystem::file_put_contents('source', 'asd');
         Filesystem::copy('source', 'target');
     }, 'preCopy'], [function () {
         Filesystem::file_put_contents('source', 'asd');
         Filesystem::copy('source', 'target');
     }, 'postCopy']];
 }
开发者ID:DaubaKao,项目名称:owncloud-core,代码行数:16,代码来源:hookconnector.php


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