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


PHP Filesystem::mirror方法代码示例

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


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

示例1: generateBehatTests

 /**
  * @param Bundle          $bundle
  * @param OutputInterface $output
  * @param array           $parameters
  */
 public function generateBehatTests(Bundle $bundle, OutputInterface $output, array $parameters)
 {
     $dirPath = sprintf("%s/Features", $bundle->getPath());
     $skeletonDir = sprintf("%s/Features", $this->fullSkeletonDir);
     // First copy all the content
     $this->filesystem->mirror($this->fullSkeletonDir, $bundle->getPath());
     // Now render the Context files to replace the namespace etc.
     if ($handle = opendir($skeletonDir . "/Context")) {
         while (false !== ($entry = readdir($handle))) {
             // Check to make sure we skip hidden folders
             // And we render the files ending in .php
             if (substr($entry, 0, 1) != '.' && substr($entry, -strlen(".php")) === ".php") {
                 $this->renderFile("/Features/Context/" . $entry, $dirPath . "/Context/" . $entry, $parameters);
             }
         }
         closedir($handle);
     }
     $featureContext = $dirPath . "/Context/FeatureContext.php";
     if ($this->filesystem->exists($featureContext)) {
         $contents = file_get_contents($featureContext);
         $contents = str_replace('-adminpwd-', $this->container->getParameter('kunstmaan_admin.admin_password'), $contents);
         file_put_contents($featureContext, $contents);
     }
     $output->writeln('Generating Behat Tests : <info>OK</info>');
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:30,代码来源:AdminTestsGenerator.php

示例2: execute

 /**
  * @override \ComponentManager\Step\Step
  *
  * @param \ComponentManager\Task\InstallTask $task
  */
 public function execute($task, LoggerInterface $logger)
 {
     $resolvedComponentVersions = $task->getResolvedComponentVersions();
     foreach ($resolvedComponentVersions as $resolvedComponentVersion) {
         $logger->info('Installing component', ['component' => $resolvedComponentVersion->getComponent()->getName(), 'packageRepository' => $resolvedComponentVersion->getPackageRepository()->getName(), 'version' => $resolvedComponentVersion->getVersion()->getVersion(), 'release' => $resolvedComponentVersion->getVersion()->getRelease()]);
         $projectLockFile = $this->project->getProjectLockFile();
         $component = $resolvedComponentVersion->getComponent();
         $packageSource = $this->project->getPackageSource($resolvedComponentVersion->getSpecification()->getPackageSource());
         $typeDirectory = $this->moodle->getPluginTypeDirectory($component->getPluginType());
         $targetDirectory = $this->platform->joinPaths([$typeDirectory, $component->getPluginName()]);
         $tempDirectory = $this->platform->createTempDirectory();
         $sourceDirectory = $packageSource->obtainPackage($tempDirectory, $resolvedComponentVersion, $this->filesystem, $logger);
         if ($resolvedComponentVersion->getFinalVersion() === null) {
             $logger->warning('Package source did not indicate final version; defaulting to desired version', ['version' => $resolvedComponentVersion->getVersion()->getVersion()]);
             $resolvedComponentVersion->setFinalVersion($resolvedComponentVersion->getVersion()->getVersion());
         }
         $logger->debug('Downloaded component source', ['packageSource' => $packageSource->getName(), 'sourceDirectory' => $sourceDirectory]);
         if ($this->filesystem->exists($targetDirectory)) {
             $logger->info('Component directory already exists; removing', ['targetDirectory' => $targetDirectory]);
             $this->filesystem->remove($targetDirectory);
         }
         $logger->info('Copying component source to Moodle directory', ['sourceDirectory' => $sourceDirectory, 'targetDirectory' => $targetDirectory]);
         $this->filesystem->mirror($sourceDirectory, $targetDirectory);
         $logger->info('Pinning component at installed final version', ['finalVersion' => $resolvedComponentVersion->getFinalVersion()]);
         $projectLockFile->addResolvedComponentVersion($resolvedComponentVersion);
         $logger->info('Cleaning up after component installation', ['tempDirectory' => $tempDirectory]);
         try {
             $this->filesystem->chmod([$tempDirectory], 0750, 00, true);
             $this->filesystem->remove([$tempDirectory]);
         } catch (IOException $e) {
             $logger->warning('Unable to clean up temporary directory', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'tempDirectory' => $tempDirectory]);
         }
     }
 }
开发者ID:lukecarrier,项目名称:moodle-componentmgr,代码行数:39,代码来源:InstallComponentsStep.php

示例3: installAssets

 public static function installAssets($event)
 {
     $options = self::getOptions($event);
     $webDir = $options['bolt-web-dir'];
     $dirMode = $options['bolt-dir-mode'];
     if (is_string($dirMode)) {
         $dirMode = octdec($dirMode);
     }
     if (!is_dir($webDir)) {
         echo 'The bolt-web-dir (' . $webDir . ') specified in composer.json was not found in ' . getcwd() . ', can not install assets.' . PHP_EOL;
         return;
     }
     $targetDir = $webDir . '/bolt-public/';
     $filesystem = new Filesystem();
     $filesystem->remove($targetDir);
     $filesystem->mkdir($targetDir, $dirMode);
     //$filesystem->mkdir($targetDir, $dirMode);
     foreach (array('css', 'font', 'img', 'js', 'lib') as $dir) {
         $filesystem->mirror(__DIR__ . '/../../../view/' . $dir, $targetDir . '/view/' . $dir);
     }
     $filesystem->mirror(__DIR__ . '/../../../classes/upload', $targetDir . '/classes/upload');
     $filesystem->copy(__DIR__ . '/../../../classes/timthumb.php', $targetDir . '/classes/timthumb.php');
     if (!$filesystem->exists($webDir . '/files/')) {
         $filesystem->mirror(__DIR__ . '/../../../../files', $webDir . '/files');
     }
 }
开发者ID:viyancs,项目名称:bolt,代码行数:26,代码来源:ScriptHandler.php

示例4: dumpMocksTo

 /**
  * Copy all existing mocks onto a target directory.
  *
  * @param string $targetDir
  */
 public function dumpMocksTo($targetDir)
 {
     if (!$this->filesystem->exists($this->mocksDir)) {
         return;
     }
     $this->filesystem->mirror($this->mocksDir, $targetDir, null, ['override' => true, 'delete' => true]);
 }
开发者ID:mRoca,项目名称:MrocaRequestLogBundle,代码行数:12,代码来源:ResponseLogger.php

示例5: copyGeneratedFiles

 private function copyGeneratedFiles(OutputInterface $output, $directory, $tmpDirectory)
 {
     $output->writeln('Copying generated website');
     $finder = new Finder();
     $finder->files()->in($tmpDirectory)->ignoreVCS(true);
     $this->filesystem->remove($finder);
     $this->filesystem->mirror($directory, $tmpDirectory);
 }
开发者ID:jkhaled,项目名称:Couscous,代码行数:8,代码来源:Deployer.php

示例6: _tryToMirror

 private function _tryToMirror($source, $dest)
 {
     try {
         $this->_fs->mirror($source, $dest);
     } catch (Exception $e) {
         //ignore
     }
 }
开发者ID:tubepress,项目名称:tubepress,代码行数:8,代码来源:ActivationListener.php

示例7: setUp

 protected function setUp()
 {
     $this->moodleDir = sys_get_temp_dir() . '/moodle-plugin-ci/PHPUnitCommandTest' . time();
     $this->pluginDir = $this->moodleDir . '/local/travis';
     $fs = new Filesystem();
     $fs->mkdir($this->moodleDir);
     $fs->mirror(__DIR__ . '/../Fixture/moodle', $this->moodleDir);
     $fs->mirror(__DIR__ . '/../Fixture/moodle-local_travis', $this->pluginDir);
 }
开发者ID:stronk7,项目名称:moodle-plugin-ci,代码行数:9,代码来源:ValidateCommandTest.php

示例8: test_it_should_symlink_packages

 public function test_it_should_symlink_packages()
 {
     $tempDir = $this->createTempDir();
     $this->fs->mirror(__DIR__ . '/fixtures/symlink', $tempDir);
     $this->fs->dumpFile($tempDir . '/package-b/package-a/replace_with_symlink.path', $tempDir . '/package-a/');
     $this->conductor->symlinkPackages($tempDir);
     $link = $tempDir . '/package-b/package-a';
     $this->assertTrue(is_link($link), $link . ' should be a symlink');
     $this->assertEquals('../package-a/', readlink($link), 'It should have a relative symlink');
 }
开发者ID:mybuilder,项目名称:conductor,代码行数:10,代码来源:ConductorTest.php

示例9: execute

 /**
  * {@inheritDoc}
  *
  * @param InputInterface  $input  input
  * @param OutputInterface $output output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (strpos($this->rootDir, 'vendor') === false) {
         $srcDir = $this->rootDir . '/../vendor/libgraviton/swagger-ui/dist/';
     } else {
         $srcDir = $this->rootDir . '/../../../libgraviton/swagger-ui/dist/';
     }
     $destDir = $this->rootDir . '/../web/explorer/';
     $this->filesystem->mirror($srcDir, $destDir);
 }
开发者ID:alebon,项目名称:graviton,代码行数:18,代码来源:SwaggerCopyCommand.php

示例10: copy

 /**
  * Copies file or directory from source to destination.
  *
  * @param \Djordje\Filebrowser\Entity\FileInterface|string $source
  * @param string $destination
  * @return bool
  */
 public function copy($source, $destination)
 {
     $sourcePath = $this->getLocation($source);
     $destinationPath = $this->getLocation($destination);
     if ($this->isDir($source)) {
         $this->filesystem->mirror($sourcePath, $destinationPath);
     } else {
         $this->filesystem->copy($sourcePath, $destinationPath);
     }
     return true;
 }
开发者ID:djordje,项目名称:filebrowser,代码行数:18,代码来源:LocalFilesystem.php

示例11: up

 /**
  * (non-PHPdoc)
  * @see \Doctrine\DBAL\Migrations\AbstractMigration::up()
  */
 public function up(Schema $schema)
 {
     // copy images for example items
     $this->fs->mirror($this->source, $this->target);
     // create storage
     $storage = (new Storage())->setDescription('Storage on local computer')->setName('Local')->setPath(Filesystem::getUserHomeDir())->setType(Storage::TYPE_FOLDER);
     $this->em->persist($storage);
     // create items
     $this->persist($this->getItemOnePiece($storage));
     $this->persist($this->getItemFullmetalAlchemist($storage));
     $this->persist($this->getItemSpiritedAway($storage));
     $this->em->flush();
 }
开发者ID:anime-db,项目名称:demo-bundle,代码行数:17,代码来源:Version20141012160751.php

示例12: setUp

 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('puli-manager', __CLASS__);
     $this->tempRoot = $this->tempDir . '/root';
     $this->tempHome = $this->tempDir . '/home';
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempRoot);
     $filesystem->mirror(__DIR__ . '/Fixtures/home', $this->tempHome);
     TestPlugin::reset();
     putenv('PULI_HOME=' . $this->tempHome);
     // Make sure "HOME" is not set
     putenv('HOME');
     $this->puli = new Puli();
 }
开发者ID:kormik,项目名称:manager,代码行数:14,代码来源:PuliTest.php

示例13: setUp

 protected function setUp()
 {
     while (false === @mkdir($this->tempDir = sys_get_temp_dir() . '/puli-repo-manager/ManagerFactoryTest_temp' . rand(10000, 99999), 0777, true)) {
     }
     while (false === @mkdir($this->tempHome = sys_get_temp_dir() . '/puli-repo-manager/ManagerFactoryTest_home' . rand(10000, 99999), 0777, true)) {
     }
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures/root', $this->tempDir);
     $filesystem->mirror(__DIR__ . '/Fixtures/home', $this->tempHome);
     TestPlugin::reset();
     putenv('PULI_HOME=' . $this->tempHome);
     // Make sure "HOME" is not set
     putenv('HOME');
     $this->puli = new Puli();
 }
开发者ID:niklongstone,项目名称:manager,代码行数:15,代码来源:PuliTest.php

示例14: create

 /**
  * Create required directory structore for this azure deployment if not
  * exists already.
  *
  * @return void
  */
 public function create()
 {
     $filesystem = new Filesystem();
     if (!file_exists($this->configDir)) {
         $filesystem->mkdir($this->configDir, 0777);
         $filesystem->copy(__DIR__ . '/../Resources/role_template/ServiceConfiguration.cscfg', $this->configDir . '/ServiceConfiguration.cscfg');
         $filesystem->copy(__DIR__ . '/../Resources/role_template/ServiceDefinition.csdef', $this->configDir . '/ServiceDefinition.csdef');
         $filesystem->mirror(__DIR__ . '/../Resources/role_template/resources', $this->configDir . '/resources', null, array('copy_on_windows' => true));
         $filesystem->mirror(__DIR__ . '/../Resources/role_template/php', $this->configDir . '/php', null, array('copy_on_windows' => true));
     }
     if (!file_exists($this->binDir)) {
         $filesystem->mkdir($this->binDir, 0777);
     }
     $filesystem->mirror(__DIR__ . '/../Resources/role_template/bin', $this->binDir, null, array('copy_on_windows' => true));
 }
开发者ID:senthilkumar3282,项目名称:AzureDistributionBundle,代码行数:21,代码来源:AzureDeployment.php

示例15: setUp

 protected function setUp()
 {
     while (false === mkdir($this->tempDir = sys_get_temp_dir() . '/puli-repo-manager/RecursivePathsIteratorTest' . rand(10000, 99999), 0777, true)) {
     }
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures', $this->tempDir);
 }
开发者ID:niklongstone,项目名称:manager,代码行数:7,代码来源:RecursivePathsIteratorTest.php


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