/** * @Route("/inbox", defaults={"_format"="json"}) */ public function dirAction(Request $request) { $dir = $request->query->get("dir", ""); $type = $request->query->get("type", "file"); $baseDir = realpath($this->container->getParameter('pumukit2.inbox')); /* if(0 !== strpos($dir, $baseDir)) { throw $this->createAccessDeniedException(); } */ $finder = new Finder(); $res = array(); if ("file" == $type) { $finder->depth('< 1')->followLinks()->in($dir); $finder->sortByName(); foreach ($finder as $f) { $res[] = array('path' => $f->getRealpath(), 'relativepath' => $f->getRelativePathname(), 'is_file' => $f->isFile(), 'hash' => hash('md5', $f->getRealpath()), 'content' => false); } } else { $finder->depth('< 1')->directories()->followLinks()->in($dir); $finder->sortByName(); foreach ($finder as $f) { if (0 !== count(glob("{$f}/*"))) { $contentFinder = new Finder(); $contentFinder->files()->in($f->getRealpath()); $res[] = array('path' => $f->getRealpath(), 'relativepath' => $f->getRelativePathname(), 'is_file' => $f->isFile(), 'hash' => hash('md5', $f->getRealpath()), 'content' => $contentFinder->count()); } } } return new JsonResponse($res); }
/** * @depends testDeleteGeneratedTransferObjectsShouldDeleteAllGeneratedTransferObjects * * @return void */ public function testGenerateTransferObjectsShouldGenerateTransferObjects() { $this->getFacade()->generateTransferObjects($this->getMessenger()); $finder = new Finder(); $finder->in($this->getConfig()->getClassTargetDirectory())->name('*Transfer.php'); $this->assertTrue($finder->count() > 0); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $path = $input->getArgument('path'); if (!file_exists($path)) { throw new FileNotFoundException($path); } /** @var EntityManager $em */ $em = $this->app['orm.em']; // Disable SQL Logger $em->getConnection()->getConfiguration()->setSQLLogger(null); if (!$input->getOption('append')) { $output->writeln('Purging database'); $em->getConnection()->executeUpdate("DELETE FROM address"); } if (is_dir($path)) { $finder = new Finder(); $finder->in($path)->name('/\\.csv/i'); $output->writeln('Loading CSV from ' . $path . ' (' . $finder->count() . ' files)'); /** @var SplFileInfo $file */ foreach ($finder as $file) { $this->loadFile($output, $file->getPathname()); } } else { $this->loadFile($output, $path); } return 0; }
private function processFile(SplFileInfo $path) { $relativeDirName = dirname(str_replace($this->inPath, '', $path->getPathname())); $filenameParts = explode('/', $relativeDirName); $pdfDir = array_pop($filenameParts); $restaurant = array_pop($filenameParts); $outDir = $this->outPath . '/' . $relativeDirName; if (!is_dir($outDir)) { mkdir($outDir, 0777, true); } $outFilename = $outDir . '/' . str_replace('.pdf', '-%03d.png', $path->getFilename()); $convertCommand = "gm convert -density 300 \"{$path->getPathname()}\" -resize '1280x1280>' +profile '*' +adjoin \"{$outFilename}\""; $this->output->writeln("Processing {$path->getPathname()}"); // convert directory exec($convertCommand); // create csv file $finder = new Finder(); $finder->files()->name('*.png')->in($outDir); /** @type SplFileInfo $file */ $index = 1; $this->output->writeln("-- " . $finder->count() . " images"); foreach ($finder as $file) { if (!isset($this->outCsv[$restaurant])) { $this->outCsv[$restaurant] = []; } $this->outCsv[$restaurant][] = ['restaurant' => $restaurant, 'pdf' => $path->getRelativePathname(), 'page' => $index, 'image' => $relativeDirName . '/' . $file->getFilename(), 'folder' => $relativeDirName]; $index++; } }
/** * Load a resource * * @param $name * @return array * @throws LogicException */ public function load($name) { if ($this->hasAddedPaths !== true) { throw new LogicException('You must call one of addPath() or addPaths() methods before load().'); } if ($cached = $this->get($name)) { return $cached; } $finder = new Finder(); $name = $this->ensureDefaultFormat($name); $finder->files()->in($this->paths)->name($name); if (!$finder->count()) { return false; } $paths = []; foreach ($finder as $file) { $paths[] = $file->getRealpath(); } $path = end($paths); $extension = pathinfo($path, PATHINFO_EXTENSION); $handler = $this->getHandler($extension); $resource = $handler->load($path); $this->data[$name] = $resource; return $resource; }
public function compile($path) { $this->output->write('Searching for files...'); $finder = new Finder(); $finder->files()->name('*.php')->in($path); $count = $finder->count(); $this->output->writeln(sprintf('%u file(s) found', $count)); $index = 0; $mappings = array(); foreach ($finder as $file) { $index++; $this->output->writeln(sprintf('Parsing file [%u/%u]: %s', $index, $count, $file)); $fileContent = file_get_contents($file); $tokenParser = new TokenParser($fileContent); $tokenParser->parse($fileContent); if (!$tokenParser->hasClass()) { $this->output->writeln('skipped!'); continue; } if (!class_exists($tokenParser->getFullClassName(), false)) { include $file; } $mappings = array_merge($mappings, $this->processClass($tokenParser->getFullClassName(), $path)); } return $mappings; }
public function indexAction(Request $request) { $form = $request->request->all(); $no_js = $request->query->get('no-js') || 0; $script = $no_js == 1 ? 0 : 1; $db_dir = $this->get('kernel')->getBundle('EUREKAG6KBundle', true)->getPath() . "/Resources/data/databases"; try { $this->datasources = new \SimpleXMLElement($db_dir . "/DataSources.xml", LIBXML_NOWARNING, true); $datasourcesCount = $this->datasources->DataSource->count(); } catch (\Exception $e) { $datasourcesCount = 0; } $userManager = $this->get('fos_user.user_manager'); $users = $userManager->findUsers(); $finder = new Finder(); $simu_dir = $this->get('kernel')->getBundle('EUREKAG6KBundle', true)->getPath() . "/Resources/data/simulators"; $finder->depth('== 0')->files()->name('*.xml')->in($simu_dir); $simulatorsCount = $finder->count(); $finder = new Finder(); $views_dir = $this->get('kernel')->getBundle('EUREKAG6KBundle', true)->getPath() . "/Resources/views"; $finder->depth('== 0')->ignoreVCS(true)->exclude(array('admin', 'base', 'Theme'))->directories()->in($views_dir); $viewsCount = $finder->count(); $hiddens = array(); $hiddens['script'] = $script; $silex = new Application(); $silex->register(new MobileDetectServiceProvider()); try { return $this->render('EUREKAG6KBundle:admin/pages:index.html.twig', array('ua' => $silex["mobile_detect"], 'path' => $request->getScheme() . '://' . $request->getHttpHost(), 'nav' => 'home', 'datasourcesCount' => $datasourcesCount, 'usersCount' => count($users), 'simulatorsCount' => $simulatorsCount, 'viewsCount' => $viewsCount, 'hiddens' => $hiddens)); } catch (\Exception $e) { echo $e->getMessage(); throw $this->createNotFoundException($this->get('translator')->trans("This template does not exist")); } }
public function patchFileExists($patchFileName, Finder $finder = null) { if (is_null($finder)) { $finder = $finder = new Finder(); } $finder->files()->in($this->patchDir)->name($patchFileName); return $finder->count() > 0; }
protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln($this->getDescription() . PHP_EOL); $target = $input->getArgument('target'); $sources = $this->createArrayBy($input->getOption('source')); $excludes = $this->createArrayBy($input->getOption('exclude')); $noComments = (bool) $input->getOption('nocomments'); $this->writer->setTarget($target); $this->finder->in($sources)->exclude($excludes); if ($notName = $input->getOption('notname')) { $this->finder->notName($notName); } $output->writeln(sprintf(Message::PROGRESS_FILTER, $this->finder->count())); $classMap = $this->filter->extractClassMapFrom($this->finder->getIterator()); $output->writeln(sprintf(Message::PROGRESS_WRITE, $target)); $this->writer->minify($classMap, $noComments); $output->writeln(PHP_EOL . Message::PROGRESS_DONE . PHP_EOL); }
/** * @return void */ public function execute() { if (is_dir(getcwd() . '/vendor')) { $finder = new Finder(); $finder->files()->depth(3)->in(getcwd() . '/vendor'); if ($finder->count() == 0) { $filesystem = new Filesystem(); $filesystem->recursiveRemoveDirectory(getcwd() . '/vendor'); } } }
/** * @param string $directory * * @return \Swift_Message[] */ private function getMessages($directory) { $finder = new Finder(); $finder->files()->name('*.message')->in($directory); Assert::notEq($finder->count(), 0, sprintf('No message files found in %s.', $directory)); $messages = []; /** @var SplFileInfo $file */ foreach ($finder as $file) { $messages[] = unserialize($file->getContents()); } return $messages; }
/** * @see Command */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var FormatterHelper $formatter */ $formatter = $this->getHelperSet()->get('formatter'); $path = $input->getArgument('path') ?: ''; $filesystem = new Filesystem(); if (!$filesystem->isAbsolutePath($path)) { $path = getcwd() . DIRECTORY_SEPARATOR . $path; } $path = rtrim(realpath($path), DIRECTORY_SEPARATOR); if (is_file($path)) { $files = new \ArrayIterator(array(new \SplFileInfo($path))); } else { $path .= DIRECTORY_SEPARATOR; $files = new Finder(); $files->files()->name('*.php')->ignoreDotFiles(true)->ignoreVCS(true)->exclude('vendor')->in($path); } $output->writeln(sprintf("\rChecking %s", $path)); $total = $files->count(); $parser = Factory::createParser(); $index = 1; /** @var \SplFileInfo $file */ foreach ($files as $file) { $output->write(sprintf("\rParsing file %s/%s", $index, $total)); $parser->parse($file); ++$index; } $output->writeln(PHP_EOL); $errorCollection = $parser->getErrorCollection(); $errorCount = count($errorCollection); if ($errorCount > 0) { $message = $formatter->formatBlock(sprintf('%s %s found on your code.', $errorCount, $errorCount > 1 ? 'errors were' : 'error was'), 'error', true); $output->writeln($message); $output->writeln(''); /** @var Error $error */ foreach ($errorCollection as $error) { $output->writeln(sprintf(' %s', $error->getMessage())); if ($error->getHelp()) { $output->writeln(sprintf(' > %s', $error->getHelp())); } $output->writeln(sprintf(' <fg=cyan>%s</fg=cyan> on line <fg=cyan>%s</fg=cyan>', str_replace($path, '', $error->getFilename()), $error->getLine())); $output->writeln(''); } return 1; } $message = $formatter->formatBlock('No error was found when checking your code.', 'info', false); $output->writeln($message); $output->writeln(''); $message = $formatter->formatBlock(array('Note:', '> As this tool only do a static analyze of your code, you cannot blindly rely on it.', '> The best way to ensure that your code can run on PHP 7 is still to run a complete test suite on the targeted version of PHP.'), 'comment', false); $output->writeln($message); $output->writeln(PHP_EOL); return 0; }
/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { if ($event->isMasterRequest() && $this->isCacheExpired()) { $lastUpdateTime = $this->storage->getLatestUpdatedAt(); if ($lastUpdateTime instanceof \DateTime) { $finder = new Finder(); $finder->files()->in($this->cacheDirectory . '/translations')->date('< ' . $lastUpdateTime->format('Y-m-d H:i:s')); if ($finder->count() > 0) { $this->translator->removeLocalesCacheFiles($this->managedLocales); } } } }
public function agenteAtivo($em) { $logger = $this->get('logger'); // Encontra agentes ativos $rootDir = $this->container->get('kernel')->getRootDir(); $webDir = $rootDir . "/../web/"; $downloadsDir = $webDir . "downloads/"; if (!is_dir($downloadsDir)) { mkdir($downloadsDir); } $cacicDir = $downloadsDir . "cacic/"; if (!is_dir($cacicDir)) { mkdir($cacicDir); } // Varre diretório do Cacic $finder = new Finder(); $finder->depth('== 0'); $finder->directories()->in($cacicDir); $tipo_so = $em->getRepository('CacicCommonBundle:TipoSo')->findAll(); $found = false; $platforms = 0; foreach ($finder as $version) { //$logger->debug("1111111111111111111111111111111 ".$version->getFileName()); if ($version->getFileName() == 'current') { $found = true; foreach ($tipo_so as $so) { $agentes_path = $version->getRealPath() . "/" . $so->getTipo(); $agentes = new Finder(); try { $agentes->files()->in($agentes_path); } catch (\InvalidArgumentException $e) { $logger->error($e->getMessage()); $platforms += 1; $this->get('session')->getFlashBag()->add('notice', '<p>Não foram encontrados agentes para a plataforma ' . $so->getTipo() . '. Por favor, faça upload dos agentes na interface.</p>'); continue; } if ($agentes->count() == 0) { $platforms += 1; $this->get('session')->getFlashBag()->add('notice', '<p>Não foram encontrados agentes para a plataforma ' . $so->getTipo() . '. Por favor, faça upload dos agentes na interface.</p>'); } } } } if (!$found) { $this->get('session')->getFlashBag()->add('notice', 'Não existe nenhum agente ativo. Por favor, faça upload dos agentes na interface.'); return sizeof($tipo_so); } else { return $platforms; } }
/** * @Route("s/", name="admin_file_home", defaults={"page" = 1}) * @Route("s/page-{page}", name="admin_file_home_page", requirements={"page" : "\d+"}) */ public function indexAction($page) { $page = $page < 1 ? 1 : $page; $itemsPerPage = 10; $finder = new Finder(); $finder->files()->in($this->getParameter('uploads_directory')); $iterator = iterator_to_array($finder->getIterator()); $total = $finder->count(); $totalPages = ceil($total / $itemsPerPage); if ($totalPages != 0 && $page > $totalPages) { throw new NotFoundHttpException('There are only ' . $totalPages . ' pages to show'); } $start = ($page - 1) * $itemsPerPage; return $this->render('/admin/file/admin_file_index.html.twig', ['files' => array_slice($iterator, $start, $itemsPerPage), 'total' => $total, 'totalPages' => $totalPages, 'page' => $page]); }
private static function _deleteOldWebVendors($webDir) { $finder = new Finder(); $finder->directories()->in($webDir . DIRECTORY_SEPARATOR . 'vendor')->depth(1); if ($finder->count()) { print "Deleting old vendors in web:\n"; foreach ($finder as $dir) { /** @var $name \SplFileInfo */ $name = $dir->getRelativePathname(); $fn = $webDir . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $name; print " {$name}\n"; @unlink($fn); @rmdir($fn); } } }
/** * @Route("/files/{fileName}/meta") * @Method("GET") */ public function GetFileMeta($fileName) { $finder = new Finder(); $finder->files()->name($fileName)->in('../data'); if ($finder->count() == 0) { //throw new FileNotFoundException($fileName); return new Response("File " . $fileName . " not found", Response::HTTP_NOT_FOUND); } $iterator = $finder->getIterator(); $iterator->rewind(); $file = $iterator->current(); $array = ["name" => $file->getFileName(), "extension" => $file->getExtension(), "size" => filesize($file), "type" => $file->getType()]; $response = new Response(json_encode($array)); $response->headers->set('Content-Type', 'application/json'); return $response; }
/** * @return void */ protected function listAllDumps() { $finder = new Finder(); $finder->files()->in($this->getDumpsPath()); if ($finder->count() === 0) { return $this->line($this->colors->getColoredString("\n" . 'You haven\'t saved any dumps.' . "\n", 'brown')); } $finder->sortByName(); $count = count($finder); $i = 0; foreach ($finder as $dump) { $i++; $fileName = $dump->getFilename(); if ($i === $count - 1) { $fileName .= "\n"; } $this->line($this->colors->getColoredString($fileName, 'brown')); } }
/** * lint the content of a directory, recursive if defined * @param string $dir path/to/dir * @return bool */ private function lintDir($dir) { $finder = new Finder(); $finder->files()->name('*.xml')->name('*.xml.dist')->in($dir); if (!$this->input->getOption(self::OPTION_RECURSIVE)) { $finder->depth(0); } $totalFiles = $finder->count(); $counter = 0; $ret = true; /** @var SplFileInfo $file */ foreach ($finder as $file) { $ret = $this->lintFile($file->getRealPath()) && $ret; if (++$counter % 30 == 0) { $this->output->writeln(sprintf(' (%s/%s %s%%)', $counter, $totalFiles, round($counter / $totalFiles * 100, 0))); } } return $ret; }
/** * Get the assets for each bundle * * @return multitype: */ public function getAssets() { //this is the app directory. //the console is in this directory $rootDir = $this->container->get('kernel')->getRootDir(); $appOverrideDir = '/Resources'; $resources = array(); $finder = new Finder(); $finder->files()->name('assetic_injector.json'); foreach ($this->container->get('kernel')->getBundles() as $bundle) { //the number of files found in the override path $finderCount = 0; //the bundle name $bundleName = $bundle->getName(); //the override path $overridePath = $rootDir . $appOverrideDir . '/' . $bundleName . '/config/'; //does the file exists in the app/Resources if (file_exists($overridePath)) { $finder->in($overridePath); $finderCount = $finder->count(); } //if no files were found if ($finderCount === 0) { if (file_exists($bundle->getPath() . '/Resources/config/')) { $finder->in($bundle->getPath() . '/Resources/config/'); } } } $injectArray = array(); foreach ($finder as $file) { $json = file_get_contents($file); if (is_array(json_decode($json, true))) { $injectArray = array_merge_recursive($injectArray, json_decode($json, true)); } } foreach ($injectArray as $engine => $assets) { $engine = $this->container->get('assetic_injector.' . $engine); $engine->compute($assets); $resources = array_merge_recursive($resources, $engine->getResources()); } return $resources; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('Building Phar archive'); $file = 'build/zip.phar.php'; if (file_exists($file)) { $output->writeln('Removing previous phar archive'); unlink($file); } $output->writeln('Buffering contents ...'); $phar = new \Phar($file, 0, 'zip.phar'); $phar->setSignatureAlgorithm(\Phar::SHA1); $phar->startBuffering(); $finder = new Finder(); $finder->in(array('app', 'src', 'vendor'))->files(array('*.php', '*.js')); $count = $finder->count(); $output->writeln(sprintf('Found %d entries', $count)); $step = $count / 100; $index = 0; $indexStep = 0; /** @var ProgressHelper $progress */ $progress = $this->getHelperSet()->get('progress'); $progress->setFormat(' [%bar%] %percent%%'); $progress->start($output, 100); /** @var SplFileInfo $file */ $basePath = realpath(__DIR__ . '/../../../../../'); foreach ($finder as $file) { $path = str_replace($basePath, '', $file->getRealPath()); $path = ltrim($path, DIRECTORY_SEPARATOR); $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); $phar->addFromString($path, $file->getContents()); if ($index++ % $step == 0 && $indexStep < 100) { $progress->advance(); $indexStep++; } } $phar->addFromString('index.php', file_get_contents($basePath . DIRECTORY_SEPARATOR . 'index.php')); $phar->setStub('<?php Phar::mapPhar("zip.phar"); define("PHAR_RUNNING", true); /*Phar::interceptFileFuncs();*/ require "phar://zip.phar/index.php"; __HALT_COMPILER();'); $phar->stopBuffering(); $progress->finish(); $output->writeln('Build complete. Phar archive has been deployed to build/zip.phar.php'); }
protected function listAllDumps() { $finder = new Finder(); $finder->files()->in($this->getDumpsPath()); if ($finder->count() > 0) { $this->line($this->colors->getColoredString("\n" . 'Please select one of the following dumps:' . "\n", 'white')); $finder->sortByName(); $count = count($finder); $i = 0; foreach ($finder as $dump) { $i++; if ($i != $count) { $this->line($this->colors->getColoredString($dump->getFilename(), 'brown')); } else { $this->line($this->colors->getColoredString($dump->getFilename() . "\n", 'brown')); } } } else { $this->line($this->colors->getColoredString("\n" . 'You haven\'t saved any dumps.' . "\n", 'brown')); } }
/** * {@inheritdoc} */ public function execute(InputInterface $input, OutputInterface $output) { $fs = new Filesystem(); $finder = new Finder(); if (!($directory = $input->getOption('directory'))) { $directory = $this->getContainer()->getParameter('kernel.logs_dir') . DIRECTORY_SEPARATOR . 'tracking'; } if (!$fs->exists($directory)) { $fs->mkdir($directory); $output->writeln('<info>Logs not found</info>'); return; } $finder->files()->notName($this->getIgnoredFilename())->notName('settings.ser')->in($directory); if (!$finder->count()) { $output->writeln('<info>Logs not found</info>'); return; } /** @var SplFileInfo $file */ foreach ($finder as $file) { $pathName = $file->getPathname(); $fileName = $file->getFilename(); $options = [ProcessorRegistry::TYPE_IMPORT => ['entityName' => $this->getContainer()->getParameter('oro_tracking.tracking_data.class'), 'processorAlias' => 'oro_tracking.processor.data', 'file' => $pathName]]; if ($this->isFileProcessed($options)) { $output->writeln(sprintf('<info>"%s" already processed</info>', $fileName)); continue; } $jobResult = $this->getJobExecutor()->executeJob(ProcessorRegistry::TYPE_IMPORT, 'import_log_to_database', $options); if ($jobResult->isSuccessful()) { $output->writeln(sprintf('<info>Successful</info>: "%s"', $fileName)); $fs->remove($pathName); } else { foreach ($jobResult->getFailureExceptions() as $exception) { $output->writeln(sprintf('<error>Error</error>: "%s".', $exception)); } } } }
/** * Finds directories in a given path * * @param $directory * @param $fileType * @param int $depth * @return Finder */ private function findFiles($directory, $fileType, $depth = 0) { $finder = new Finder(); $finder->ignoreDotFiles(true)->ignoreUnreadableDirs()->in($directory)->name($fileType)->depth($depth)->sortByName(); return $finder->count() > 0 ? $finder : false; }
$app->get('/', function () use($app) { return $app['twig']->render('pages/home.twig'); }); $app->get('/{desired_image_width}/{desired_image_height}/{custom_value}', function ($desired_image_width, $desired_image_height, $custom_value) use($app) { $public_folder = 'public/dummy-img'; $finder = new Finder(); switch ($custom_value) { case 'mani': $finder->name('*_mani.jpg'); break; case 'merda': $finder->name('*_merda.jpg'); break; } $finder->files()->in($public_folder); $rand_key = rand(0, $finder->count() - 1); $i = 0; $element = null; foreach ($finder as $file) { if ($i == $rand_key) { $element = $file; } $i++; } $source_path = $element->getRealpath(); /* * Add file validation code here */ list($source_width, $source_height, $source_type) = getimagesize($source_path); switch ($source_type) { case IMAGETYPE_GIF:
/** * Check for local extension composer.json files and import their PSR-4 settings. * * @param boolean $force * * @internal */ public function checkLocalAutoloader($force = false) { if (!$this->app['filesystem']->has('extensions://local/')) { return; } if (!$force && $this->app['filesystem']->has('app://cache/.local.autoload.built')) { return; } // If the composer.json file doesn't exist, we should create it now if (!$this->app['filesystem']->has('extensions://composer.json')) { $this->app['extend.action']['json']->updateJson(); } $finder = new Finder(); $finder->files()->in($this->basefolder . '/local')->followLinks()->name('composer.json')->depth('== 2'); if ($finder->count() > 0) { $this->setLocalExtensionPsr4($finder); } }
/** * @param Finder $finder * @param string $name */ private function assertThatAtLeastOneFileWasFound(Finder $finder, $name) { if (0 === $finder->count()) { throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (searched in the following directories: %s).', $name, implode(', ', $this->paths))); } }
/** * Remove empty composer extraction folder */ protected function removeEmptyFolders() { if (is_dir(getcwd() . '/vendor')) { $finder = new Finder(); $finder->files()->depth(3)->in(getcwd() . '/vendor'); if ($finder->count() == 0) { $filesystem = new Filesystem(); $filesystem->recursiveRemoveDirectory(getcwd() . '/vendor'); } } }
/** * @param \ArrayObject $project * @param $aliases */ public function maintenanceNginx(\ArrayObject $project, $aliases) { $this->prepareNginxDirectories($project); $serverName = $this->generateAliasLine($aliases, $this->app["config"]["webserver"]["engine"]); $this->processProvider->executeSudoCommand("rm -f " . $this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/nginx.d/05servername*"); $finder = new Finder(); $finder->files()->in($this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/nginx.d/")->name("01-base*"); if ($finder->count() == 0) { $this->fileSystemProvider->writeProtectedFile($this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/nginx.d/05servername", $serverName); } $configcontent = $this->processConfigFiles($project, $this->fileSystemProvider->getProjectNginxConfigs($project)); $this->fileSystemProvider->writeProtectedFile($this->app["config"]["nginx"]["sitesavailable"] . "/" . $project["name"] . ".conf", $configcontent); }
/** * Check for local extension composer.json files and import their PSR-4 settings. * * @param boolean $force * * @internal */ public function checkLocalAutoloader($force = false) { if (!$this->app['filesystem']->has('extensions://local/')) { return; } if (!$force && $this->app['filesystem']->has('app://cache/.local.autoload.built')) { return; } if (!$this->app['filesystem']->has('extensions://composer.json')) { $initjson = new BoltExtendJson($this->app['extend.manager']->getOptions()); $this->json = $initjson->updateJson($this->app); } $finder = new Finder(); $finder->files()->in($this->basefolder . '/local')->followLinks()->name('composer.json')->depth('== 2'); if ($finder->count() > 0) { $this->setLocalExtensionPsr4($finder); } }