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


PHP Filesystem::copyThenRemove方法代码示例

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


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

示例1: movePersistentDirectories

 protected function movePersistentDirectories($sourceDir, $targetDir)
 {
     foreach ($this->persistentDirs as $dir) {
         $source = $sourceDir . self::DS . $dir;
         $target = $targetDir . self::DS . $dir;
         if (file_exists($source)) {
             $this->emptyDir($target);
             $this->fs->copyThenRemove($source, $target);
         }
     }
 }
开发者ID:a13wes,项目名称:MRKT,代码行数:11,代码来源:Core.php

示例2: complete

 /**
  * Complete the setup task.
  *
  * @since 0.1.0
  *
  * @return void
  */
 public function complete()
 {
     $filesystem = new Filesystem();
     $templatesFolder = $this->getConfigKey('Folders', 'templates');
     $finder = new Finder();
     foreach ($finder->files()->in($templatesFolder) as $file) {
         $from = $file->getPathname();
         $to = $this->getTargetPath($from);
         $filesystem->ensureDirectoryExists(dirname($to));
         $filesystem->copyThenRemove($from, $to);
     }
 }
开发者ID:brightnucleus,项目名称:boilerplate,代码行数:19,代码来源:MoveTemplateFilesToRootFolder.php

示例3: installRubedoCoreSources

 /**
  * Install Rubedo Core sources
  *
  * @param string $actualRootDir Rubedo root dir for project
  * @param array  $removedFiles  List of old files to remove after installation
  */
 protected function installRubedoCoreSources($actualRootDir, $removedFiles)
 {
     if ($this->io->isVerbose()) {
         $this->io->write("Updating new code over existing installation.");
     }
     // Removing files / directories to ignore from installation from temporary dir
     $this->cleanTempDir();
     $this->fileSystem->copyThenRemove($this->rubedoRootDir, $actualRootDir);
     $this->rubedoRootDir = $actualRootDir;
     // Deleting files removed from the previous package release
     $this->deleteRemovedFiles($removedFiles);
 }
开发者ID:novactive,项目名称:rubedo-core-installer,代码行数:18,代码来源:CoreInstaller.php

示例4: complete

 /**
  * Renames the plugin file to {{package}}.php,
  * removes it, if the package is not of type wordpress-plugin
  */
 public function complete()
 {
     $fs = new Util\Filesystem();
     $base_dir = $this->getConfigKey('BaseDir');
     $type = $this->getConfigKey('Placeholders', 'type')['value'];
     $package = $this->getConfigKey('Placeholders', 'package_key')['value'];
     $plugin_file = "{$base_dir}/plugin.php";
     if ('wordpress-plugin' === $type) {
         $fs->copyThenRemove($plugin_file, "{$base_dir}/{$package}.php");
         return;
     }
     $this->io->write("Removing plugin file");
     $fs->remove($plugin_file);
 }
开发者ID:inpsyde,项目名称:boilerplate,代码行数:18,代码来源:SanitizePluginFile.php

示例5: complete

 /**
  * Renames the relevant license file to 'LICENSE' and removes
  * the one we don't use
  */
 public function complete()
 {
     $fs = new Util\Filesystem();
     $base_dir = $this->getConfigKey('BaseDir');
     $license = $this->getConfigKey('Placeholders', 'license')['value'];
     $license_files = ['MIT' => 'LICENSE.mit', 'GPL-2.0' => 'LICENSE.gpl2'];
     if (!isset($license_files[$license])) {
         throw new Exception\LogicException("No file found for license '{$license}'");
     }
     $license_file = "{$base_dir}/{$license_files[$license]}";
     $fs->copyThenRemove($license_file, "{$base_dir}/LICENSE");
     foreach ($license_files as $file) {
         $this->io->write(sprintf("Removing license file %s", basename($file)));
         $fs->remove($file);
     }
 }
开发者ID:inpsyde,项目名称:boilerplate,代码行数:20,代码来源:SanitizeLicenseFiles.php

示例6: install

 public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
 {
     $downloadPath = $this->getInstallPath($package);
     $fileSystem = new Filesystem();
     $actualLegacyDir = $this->innomaticLegacyDir;
     $this->innomaticLegacyDir = $this->generateTempDirName();
     if (!is_dir($downloadPath) || $fileSystem->isDirEmpty($downloadPath)) {
         if ($this->io->isVerbose()) {
             $this->io->write("Installing in temporary directory.");
         }
         parent::install($repo, $package);
         if ($this->io->isVerbose()) {
             $this->io->write("Copying to the Innomatic legacy directory.");
         }
         $fileSystem->copyThenRemove($this->innomaticLegacyDir . '/source/', $actualLegacyDir);
         $this->innomaticLegacyDir = $actualLegacyDir;
     }
 }
开发者ID:innomatic,项目名称:innomatic-legacy-installer,代码行数:18,代码来源:LegacyPlatformInstaller.php

示例7: updateCode

    /**
     * Same as install(): we need to insure there is no removal of actual eZ code.
     * updateCode is called by update()
     */
    public function updateCode( PackageInterface $initial, PackageInterface $target )
    {
        $actualLegacyDir = $this->ezpublishLegacyDir;
        $this->ezpublishLegacyDir = $this->generateTempDirName();
        if ( $this->io->isVerbose() )
        {
            $this->io->write( "Installing in temporary directory." );
        }

        $this->installCode( $target );

        $fileSystem = new Filesystem();
        if ( $this->io->isVerbose() )
        {
            $this->io->write( "Updating new code over existing installation." );
        }
        /// @todo the following function does not warn of any failures in copying stuff over. We should probably fix it...
        $fileSystem->copyThenRemove( $this->ezpublishLegacyDir, $actualLegacyDir );

        $this->ezpublishLegacyDir = $actualLegacyDir;
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:25,代码来源:LegacyKernelInstaller.php

示例8: onPostUpdate

 public function onPostUpdate(Event $event)
 {
     // Load global plugin configuration
     $globalCfg = $this->getGlobalConfig();
     if ($globalCfg) {
         $extra = self::get($globalCfg, 'extra', []);
         $myConfig = self::get($extra, self::EXTRA_KEY, []);
         if ($myConfig) {
             $this->info("Global configuration loaded");
         }
     } else {
         $myConfig = [];
     }
     // Merge project-specific configuration.
     // Ignore it if Composer is running in global mode.
     $package = $this->composer->getPackage();
     if ($package->getName() != '__root__') {
         $projCfg = self::get($package->getExtra(), self::EXTRA_KEY, []);
         $myConfig = array_merge_recursive($myConfig, $projCfg);
         $this->info("Project-specific configuration loaded");
     }
     // Setup
     $rules = array_unique(self::get($myConfig, self::RULES_KEY, []));
     $sharedDir = str_replace('~', getenv('HOME'), self::get($myConfig, self::SHARED_DIR_KEY, self::DEFAULT_SHARED_DIR));
     $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
     $rulesInfo = implode(', ', $rules);
     $this->info("Shared directory: <info>{$sharedDir}</info>");
     $this->info("Match packages: <info>{$rulesInfo}</info>");
     $fsUtil = new FilesystemUtil();
     $fs = new Filesystem();
     // Do useful work
     $count = 0;
     foreach ($packages as $package) {
         $srcDir = $this->getInstallPath($package);
         $packageName = $package->getName();
         if (self::globMatchAny($rules, $packageName) && !$fsUtil->isSymlinkedDirectory($srcDir)) {
             $destPath = "{$sharedDir}/{$packageName}";
             if (!file_exists($destPath)) {
                 $fsUtil->copyThenRemove($srcDir, $destPath);
                 $this->info("Moved <info>{$packageName}</info> to shared directory and symlinked to it");
             } else {
                 $fs->remove($srcDir);
                 $this->info("Symlinked to existing <info>{$packageName}</info> on shared directory");
             }
             $fs->symlink($destPath, $srcDir);
             ++$count;
         }
     }
     if (!$count) {
         $this->info("No packages matched");
     }
 }
开发者ID:php-kit,项目名称:composer-shared-packages-plugin,代码行数:52,代码来源:Plugin.php


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