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


PHP Finder::ignoreVCS方法代码示例

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


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

示例1: ensureProjectRoot

 protected function ensureProjectRoot()
 {
     if (!($this->rootDir = $this->input->getOption('project-root'))) {
         $this->rootDir = getcwd();
     }
     $this->rootDir = realpath($this->rootDir);
     $this->fs->mkdir($this->rootDir);
     $finder = new Finder();
     $finder->in($this->rootDir);
     $finder->depth(0);
     $finder->ignoreVCS(false);
     $rootFiles = [];
     /** @var SplFileInfo $splInfo */
     foreach ($finder as $splInfo) {
         $rootFiles[] = $splInfo->getFilename();
     }
     $requiredFiles = ['composer.json', 'composer.lock'];
     $requiredDirs = ['vendor'];
     foreach (array_merge($requiredFiles, $requiredDirs) as $file) {
         if (!in_array($file, $rootFiles)) {
             // possibly not root
             $this->output->writeln("<error>You should either run this script under your project root directory, or provide the '--project-root' option.</error>");
             $this->output->writeln("The project root directory should contain at least the following files and directories:");
             foreach ($requiredFiles as $requiredFile) {
                 $this->output->writeln("\t- <comment>{$requiredFile}</comment>");
             }
             foreach ($requiredDirs as $requiredDir) {
                 $this->output->writeln("\t- <comment>{$requiredDir}/</comment>");
             }
             exit(1);
         }
     }
 }
开发者ID:oasmobile,项目名称:php-slimapp,代码行数:33,代码来源:InitializeProjectCommand.php

示例2: getHookDestinations

 private function getHookDestinations($searchAt)
 {
     $finder = new Finder();
     foreach ($searchAt as $location) {
         $finder->in(__DIR__ . '/../../..' . $location);
     }
     return $finder->ignoreVCS(false)->ignoreDotFiles(false)->exclude('vendor')->path('/\\.git\\/hooks$/');
 }
开发者ID:epilgrim,项目名称:php-hooks,代码行数:8,代码来源:CreateSymlinks.php

示例3: get_files

 /**
  * Returns a Finder instance for the files that will be included in the
  * backup.
  *
  * By default we ignore unreadable files and directories as well as, common
  * version control folders / files, "Dot" files and anything matching the
  * exclude rules.
  *
  * @uses Finder
  * @return Finder The Finder iterator of all files to be included
  */
 public function get_files()
 {
     $finder = new Finder();
     $finder->followLinks(true);
     $finder->ignoreDotFiles(false);
     $finder->ignoreVCS(true);
     $finder->ignoreUnreadableDirs(true);
     // Skip unreadable files too
     $finder->filter(function (\SplFileInfo $file) {
         if (!$file->isReadable()) {
             return false;
         }
     });
     // Finder expects exclude rules to be in a regex format
     $exclude_rules = $this->excludes->get_excludes_for_regex();
     // Skips folders/files that match default exclude patterns
     foreach ($exclude_rules as $exclude) {
         $finder->notPath($exclude);
     }
     return $finder->in(Path::get_root());
 }
开发者ID:AcademicTechnologyCenter,项目名称:ATC-Quality-Tracking,代码行数:32,代码来源:class-backup-engine-file.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var ConsoleApplication $console */
     $console = $this->getApplication();
     $slimapp = $console->getSlimapp();
     $cacheDirs = [$slimapp->getConfigCachePath()];
     $httpCacheDirs = $slimapp->getHttpKernel()->getCacheDirectories();
     $cacheDirs = array_merge($cacheDirs, $httpCacheDirs);
     foreach ($cacheDirs as $dir) {
         $output->writeln(sprintf('<comment>removing cache in %s ...</comment>', $dir));
         $fs = new Filesystem();
         $finder = new Finder();
         $finder->in($dir);
         $finder->depth(0);
         $finder->ignoreVCS(false);
         /** @var SplFileInfo $splInfo */
         foreach ($finder as $splInfo) {
             $output->writeln(sprintf("removing file: %s", $splInfo->getPathname()), OutputInterface::VERBOSITY_VERBOSE);
             $fs->remove($splInfo->getPathname());
         }
         $output->writeln(sprintf('<info>done.</info>', $dir));
     }
 }
开发者ID:oasmobile,项目名称:php-slimapp,代码行数:23,代码来源:ClearCacheCommand.php

示例5: cleanCustom

 /**
  * @param OutputInterface $output
  * @return void
  */
 protected function cleanCustom(OutputInterface $output)
 {
     if (empty($this->options['custom'])) {
         return;
     }
     foreach ($this->options['custom'] as $options) {
         try {
             $finder = new Finder();
             $finder->ignoreDotFiles(false);
             $finder->ignoreVCS(false);
             $finder->ignoreUnreadableDirs(true);
             $in = [];
             if (!is_array($options['in'])) {
                 $options['in'] = [$options['in']];
             }
             foreach ($options['in'] as $dir) {
                 $in[] = $this->baseDir . $dir;
             }
             $finder->in($in);
             if (!empty($options['type'])) {
                 switch ($options['type']) {
                     case 'files':
                         $finder->files();
                         break;
                     case 'dirs':
                     case 'directories':
                         $finder->directories();
                         break;
                 }
             }
             if (!empty($options['notName'])) {
                 if (!is_array($options['notName'])) {
                     $options['notName'] = [$options['notName']];
                 }
                 foreach ($options['notName'] as $notName) {
                     $finder->notName($notName);
                 }
             }
             if (!empty($options['name'])) {
                 if (!is_array($options['name'])) {
                     $options['name'] = [$options['name']];
                 }
                 foreach ($options['name'] as $notName) {
                     $finder->name($notName);
                 }
             }
             if (!empty($options['depth'])) {
                 $finder->depth($options['depth']);
             }
             foreach ($finder as $file) {
                 $this->files[] = $file->getRealPath();
             }
         } catch (\Exception $e) {
             // ignore errors
         }
     }
 }
开发者ID:mediamonks,项目名称:composer-vendor-cleaner,代码行数:61,代码来源:CleanCommand.php

示例6: testIgnoreVCS

 public function testIgnoreVCS()
 {
     $finder = new Finder();
     $this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false));
     $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar')), $finder->in(self::$tmpDir)->getIterator());
     $finder = new Finder();
     $finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false);
     $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar')), $finder->in(self::$tmpDir)->getIterator());
     $finder = new Finder();
     $this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false));
     $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar')), $finder->in(self::$tmpDir)->getIterator());
 }
开发者ID:navassouza,项目名称:symfony,代码行数:12,代码来源:FinderTest.php

示例7: installThemeFiles

 private function installThemeFiles(PackageInterface $package)
 {
     $theme = $this->findTheme($package);
     if (!$theme) {
         return;
     }
     $themeSource = $this->composer->getInstallationManager()->getInstallPath($package);
     $themeTarget = $theme['installation-path'];
     $this->filesystem->ensureDirectoryExists($themeTarget);
     $finder = new Finder();
     $files = $finder->ignoreVCS(true)->in($themeSource);
     foreach ($files as $file) {
         $targetPath = $themeTarget . DIRECTORY_SEPARATOR . $file->getRelativePathname();
         if ($file->isDir()) {
             $this->filesystem->ensureDirectoryExists($targetPath);
         } else {
             copy($file->getPathname(), $targetPath);
         }
     }
 }
开发者ID:sculpin,项目名称:sculpin-theme-composer-plugin,代码行数:20,代码来源:SculpinThemePlugin.php

示例8: getFixturesDirectories

 /**
  * @return Finder
  */
 public function getFixturesDirectories()
 {
     return $this->finder->ignoreVCS(true)->ignoreDotFiles(true)->depth('<= 5')->directories()->in($this->fixturesParentDirectory)->name('DataFixtures');
 }
开发者ID:WeavingTheWeb,项目名称:FrameworkExtraBundle,代码行数:7,代码来源:DatabaseManager.php

示例9: extract_package

 /**
  * Extract style package to demo board.
  *
  * @return null
  */
 public function extract_package()
 {
     $this->package->ensure_extracted();
     $package_root = $this->package->find_directory(array('files' => array('required' => 'style.cfg')));
     $style_root = $this->get_style_dir();
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     $filesystem->remove($style_root);
     // Only copy necessary files
     $finder = new Finder();
     $finder->ignoreVCS(false)->ignoreDotFiles(false)->files()->notName('/\\.(svg|png|jpe?g|gif|html|js|css|cfg)$/i')->in($this->package->get_temp_path());
     $filesystem->remove($finder);
     $filesystem->rename($this->package->get_temp_path() . '/' . $package_root, $style_root);
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:18,代码来源:manager.php

示例10: exportViewNode

 protected function exportViewNode($view, $node)
 {
     $this->node = $node;
     $fs = new Filesystem();
     $container = $this->get('kernel')->getContainer();
     $bundle = $this->get('kernel')->getBundle('EUREKAG6KBundle', true);
     $viewdir = $bundle->getPath() . "/Resources/views";
     $publicdir = $bundle->getPath() . "/Resources/public";
     $nodePath = $this->searchNodePath($viewdir, $publicdir, $view);
     $content = array();
     if ($nodePath != '') {
         $finder = new Finder();
         $finder->ignoreVCS(true)->files()->in($nodePath)->sortByName();
         foreach ($finder as $file) {
             $content[] = array('name' => $file->getRelativePathname(), 'data' => file_get_contents($file->getRealPath()), 'modtime' => $file->getMTime());
         }
     }
     $filename = $node == 1 ? $view . "-templates" : $view . "-assets";
     $zipcontent = $this->zip($content);
     $response = new Response();
     $response->headers->set('Cache-Control', 'private');
     $response->headers->set('Content-type', 'application/octet-stream');
     $response->headers->set('Content-Disposition', sprintf('attachment; filename="%s"', $filename . ".zip"));
     $response->headers->set('Content-length', strlen($zipcontent));
     $response->sendHeaders();
     $response->setContent($zipcontent);
     return $response;
 }
开发者ID:eureka2,项目名称:g6k,代码行数:28,代码来源:ViewsAdminController.php

示例11: ignoreVCS

 /**
  * @return Finder
  */
 public function ignoreVCS($ignoreVCS)
 {
     return parent::ignoreVCS($ignoreVCS);
 }
开发者ID:stopsopa,项目名称:utils,代码行数:7,代码来源:Finder.php


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