/**
  * @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>');
 }
 /**
  * @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]);
         }
     }
 }
示例#3
0
 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');
     }
 }
 /**
  * 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]);
 }
示例#5
0
 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);
 }
 private function _tryToMirror($source, $dest)
 {
     try {
         $this->_fs->mirror($source, $dest);
     } catch (Exception $e) {
         //ignore
     }
 }
 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);
 }
示例#8
0
 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');
 }
示例#9
0
 /**
  * {@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);
 }
示例#10
0
 /**
  * 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;
 }
 /**
  * (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();
 }
示例#12
0
 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();
 }
示例#13
0
 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();
 }
 /**
  * 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));
 }
 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);
 }
 /**
  * Copies origin to target.
  *
  * @param string $originDir
  * @param string $targetDir
  *
  * @return string
  */
 private function hardCopy($originDir, $targetDir)
 {
     $this->filesystem->mkdir($targetDir, 0777);
     // We use a custom iterator to ignore VCS files
     $this->filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir));
     return self::METHOD_COPY;
 }
示例#17
0
 /**
  * @param string $originDir
  * @param string $targetDir
  */
 private function hardCopy($originDir, $targetDir)
 {
     $filesystem = new Filesystem();
     $filesystem->mkdir($targetDir, 0777);
     // We use a custom iterator to ignore VCS files
     $filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir));
 }
示例#18
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('webmozart-glob', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/Fixtures', $this->tempDir);
     TestStreamWrapper::register('globtest', __DIR__ . '/Fixtures');
 }
示例#19
0
 public function resolve($nameOrPath)
 {
     $path = null;
     // if this is an absolute path; load the template into the configuration
     // Please note that this _could_ override an existing template when
     // you have a template in a subfolder with the same name as a default
     // template; we have left this in on purpose to allow people to override
     // templates should they choose to.
     $configPath = rtrim($nameOrPath, DIRECTORY_SEPARATOR) . '/template.xml';
     if (file_exists($configPath) && is_readable($configPath)) {
         $path = rtrim($nameOrPath, DIRECTORY_SEPARATOR);
         $templateNamePart = basename($path);
         $cachePath = rtrim($this->templatePath, '/\\') . DIRECTORY_SEPARATOR . $templateNamePart;
         // move the files to a cache location and then change the path
         // variable to match the new location
         $filesystem = new Filesystem();
         $filesystem->mirror($path, $cachePath);
         $path = $cachePath;
     }
     // if we load a default template
     if ($path === null) {
         $path = rtrim($this->templatePath, '/\\') . DIRECTORY_SEPARATOR . $nameOrPath;
     }
     if (!file_exists($path) || !is_readable($path)) {
         throw new \InvalidArgumentException('The given template ' . $nameOrPath . ' could not be found or is not readable');
     }
     return $path;
 }
示例#20
0
 /**
  * {@inheritdoc}
  */
 public function download(PackageInterface $package, $path)
 {
     $url = $package->getDistUrl();
     $realUrl = realpath($url);
     if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
         throw new \RuntimeException(sprintf('Source path "%s" is not found for package %s', $url, $package->getName()));
     }
     if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
         throw new \RuntimeException(sprintf('Package %s cannot install to "%s" inside its source at "%s"', $package->getName(), realpath($path), $realUrl));
     }
     $fileSystem = new Filesystem();
     $this->filesystem->removeDirectory($path);
     $this->io->writeError(sprintf('  - Installing <info>%s</info> (<comment>%s</comment>)', $package->getName(), $package->getFullPrettyVersion()));
     try {
         if (Platform::isWindows()) {
             // Implement symlinks as NTFS junctions on Windows
             $this->filesystem->junction($realUrl, $path);
             $this->io->writeError(sprintf('    Junctioned from %s', $url));
         } else {
             $shortestPath = $this->filesystem->findShortestPath($path, $realUrl);
             $fileSystem->symlink($shortestPath, $path);
             $this->io->writeError(sprintf('    Symlinked from %s', $url));
         }
     } catch (IOException $e) {
         $fileSystem->mirror($realUrl, $path);
         $this->io->writeError(sprintf('    Mirrored from %s', $url));
     }
     $this->io->writeError('');
 }
示例#21
0
 /**
  * Executes a command via CLI
  *
  * @param Console\Input\InputInterface $input
  * @param Console\Output\OutputInterface $output
  *
  * @return int|null|void
  */
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $tempFolder = $input->getOption('temp-folder');
     $fs = new Filesystem();
     $version = $input->getArgument('version');
     $chamiloRoot = $input->getArgument('chamilo_root');
     if ($version == '111') {
         $file = $chamiloRoot . 'app/config/migrations.yml';
         require_once $chamiloRoot . 'app/Migrations/AbstractMigrationChamilo.php';
         $this->migrationFile = $file;
         return 1;
     }
     if ($version == '110') {
         $file = $chamiloRoot . 'app/config/migrations110.yml';
         $this->migrationFile = $file;
         return 1;
     }
     require_once $chamiloRoot . 'app/Migrations/AbstractMigrationChamilo.php';
     $migrationsFolder = $tempFolder . '/Migrations/';
     if (!$fs->exists($migrationsFolder)) {
         $fs->mkdir($migrationsFolder);
     }
     $migrations = array('name' => 'Chamilo Migrations', 'migrations_namespace' => 'Application\\Migrations\\Schema\\V111', 'table_name' => 'version', 'migrations_directory' => $migrationsFolder);
     $dumper = new Dumper();
     $yaml = $dumper->dump($migrations, 1);
     $file = $migrationsFolder . 'migrations.yml';
     file_put_contents($file, $yaml);
     $migrationPathSource = __DIR__ . '/../../../Chash/Migrations/';
     $fs->mirror($migrationPathSource, $migrationsFolder);
     // migrations_directory
     $output->writeln("<comment>Chash migrations.yml saved: {$file}</comment>");
     $this->migrationFile = $file;
 }
 /**
  * Copy all files in the source directory to the target directory.
  *
  * @param string $sourceDir The source directory where we need to look in
  * @param string $targetDir The target directory where we need to copy the files too
  * @param bool   $override  Whether to override an existing file or not
  */
 public function copyFiles($sourceDir, $targetDir, $override = false)
 {
     // Make sure the source -and target dir contain a trailing slash
     $sourceDir = rtrim($sourceDir, '/') . '/';
     $targetDir = rtrim($targetDir, '/') . '/';
     $this->filesystem->mirror($sourceDir, $targetDir, null, array('override' => $override));
 }
 public function fetchBlocks($productionDir, $slotDir, $slotName)
 {
     $slot = array('next' => '1', 'blocks' => array());
     if (null === $slotDir) {
         return $slot;
     }
     // Copies the active slot for a new contributor
     if (!is_dir($slotDir)) {
         $filesystem = new Filesystem();
         $filesystem->mirror($productionDir, $slotDir);
     }
     $file = $slotDir . '/slot.json';
     if (!file_exists($file)) {
         return $slot;
     }
     $this->isProduction = $productionDir === $slotDir;
     $found = array();
     $blocks = json_decode(FilesystemTools::readFile($file), true);
     foreach ($blocks["blocks"] as $blockName) {
         $block = $this->fetchBlock($slotDir, $slotName, $blockName);
         if (null === $block) {
             continue;
         }
         $found[] = $block;
     }
     return array('next' => $blocks["next"], 'blocks' => $found);
 }
示例#24
0
 /**
  * Install Bolt's default themes and files.
  *
  * This should be ran on "post-create-project-cmd" event.
  *
  * @param Event $event
  */
 public static function installThemesAndFiles(Event $event)
 {
     static::configureDirMode($event);
     $webDir = static::getWebDir($event);
     if ($webDir === null) {
         return;
     }
     $filesystem = new Filesystem();
     $root = __DIR__ . '/../../';
     $target = static::getDir($event, 'files');
     $event->getIO()->writeError(sprintf('Installing <info>files</info> to <info>%s</info>', $target));
     $filesystem->mirror($root . 'files', $target, null, ['override' => true]);
     $target = static::getDir($event, 'themebase');
     $event->getIO()->writeError(sprintf('Installing <info>themes</info> to <info>%s</info>', $target));
     $filesystem->mirror($root . 'theme', $target, null, ['override' => true]);
 }
 /**
  * @param $dir
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return bool
  */
 private function installPluginAssets($dir, InputInterface $input, OutputInterface $output)
 {
     // Create the specific assets directory otherwise symlink will fail.
     $assetsDir = $dir . '/assets/plugins/';
     $this->filesystem->mkdir($assetsDir, 0777);
     $plugins = $this->getContainer()->get('simplr.pluginmanager')->getActivePlugins();
     if (!empty($plugins)) {
         foreach ($plugins as $name => $configuration) {
             $activePluginPath = $this->getContainer()->get('simplr.pluginmanager')->getPathToPlugin($name);
             if (is_dir($originDir = $activePluginPath . '/Resources/public')) {
                 $targetDir = $assetsDir . strtolower($name);
                 $output->writeln(sprintf("Installing assets for plugin <comment>%s</comment> into <comment>%s</comment>", $name, $targetDir));
                 $this->filesystem->remove($targetDir);
                 if ($input->getOption('symlink')) {
                     if ($input->getOption('relative')) {
                         $relativeOriginDir = $this->filesystem->makePathRelative($originDir, realpath($assetsDir));
                     } else {
                         $relativeOriginDir = $originDir;
                     }
                     $this->filesystem->symlink($relativeOriginDir, $targetDir);
                 } else {
                     $this->filesystem->mkdir($targetDir, 0777);
                     // We use a custom iterator to ignore VCS files
                     $this->filesystem->mirror($originDir, $targetDir, Finder::create()->in($originDir));
                 }
             }
         }
     } else {
         $output->writeln('Installing assets for plugins... no plugins found!');
     }
     return true;
 }
 public static function postInstallUpdate()
 {
     $filesystem = new Filesystem();
     $baseDir = realpath(__DIR__ . '/../../../../../../../');
     $packageDir = realpath(__DIR__ . '/../../../../');
     echo "...\n";
     if (!$filesystem->exists($baseDir . '/web')) {
         echo "Creating web folder\n";
         $filesystem->mkdir($baseDir . '/web');
         $filesystem->mirror($packageDir . '/web', $baseDir . '/web');
     }
     echo "Creating config folder with example config.\n";
     $filesystem->mkdir($baseDir . '/config');
     $filesystem->copy($packageDir . '/config/config.example.yml', $baseDir . '/config/config.example.yml');
     $filesystem->copy($packageDir . '/config/modules.example.php', $baseDir . '/config/modules.example.php');
     $filesystem->copy($packageDir . '/config/repositories.example.php', $baseDir . '/config/repositories.example.php');
     echo "Creating cache folder, deleting eventually current cache files.\n";
     $filesystem->remove($baseDir . '/twig-cache');
     $filesystem->mkdir($baseDir . '/twig-cache');
     $filesystem->remove($baseDir . '/doctrine-cache');
     $filesystem->mkdir($baseDir . '/doctrine-cache');
     echo "Installing console.\n";
     $filesystem->mkdir($baseDir . '/console');
     $filesystem->copy($packageDir . '/console/console', $baseDir . '/console/console');
     echo "...\n";
     echo "Done.\n";
 }
示例#27
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $parentFolder = app_path('database/migrations');
     $allFolder = scandir($parentFolder);
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     if (!empty($allFolder)) {
         $_fileService->remove($_tmpPath);
         foreach ($allFolder as $folder) {
             if (is_dir($parentFolder . '/' . $folder) && $folder != '.' && $folder != '..') {
                 $_fileService->mirror($parentFolder . '/' . $folder, $_tmpPath);
             }
         }
         $this->info("Migrating...");
         $this->call('migrate', array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/')));
         // Delete all temp migration files
         $this->info("Cleaning temporary files");
         $_fileService->remove($_tmpPath);
         // Done
         $this->info("DONE!");
     }
 }
 public function onSiteInstalled()
 {
     $this->lazyFilesystemCleaner->register($this->masterPath);
     $this->filesystem->mirror($this->drupal->getSitePath(), $this->masterPath, null, ['override' => true, 'delete' => true]);
     // Take a copy of the database.
     $this->processRunner->run(ProcessBuilder::create()->setPrefix($this->binary)->add('sql-dump')->add('--result-file=' . $this->masterPath . '/db.sql')->add('--uri=' . $this->drupal->getUri())->add('--yes')->setWorkingDirectory($this->drupal->getPath())->setTimeout(null)->getProcess());
 }
示例#29
0
 /**
  * Generate a copy of a theme package.
  *
  * @param Request $request
  *
  * @throws PackageManagerException
  *
  * @return Response
  */
 public function generateTheme(Request $request)
 {
     $theme = $request->get('theme');
     $newName = $request->get('name');
     if (empty($theme)) {
         return new Response(Trans::__('No theme name found. Theme is not generated.'));
     }
     if (!$newName) {
         $newName = basename($theme);
     }
     $source = $this->resources()->getPath('extensions/vendor/' . $theme);
     $destination = $this->resources()->getPath('themebase/' . $newName);
     if (is_dir($source)) {
         try {
             $filesystem = new Filesystem();
             $filesystem->mkdir($destination);
             $filesystem->mirror($source, $destination);
             if (file_exists($destination . "/config.yml.dist")) {
                 $filesystem->copy($destination . "/config.yml.dist", $destination . "/config.yml");
             }
             return new Response(Trans::__('Theme successfully generated. You can now edit it directly from your theme folder.'));
         } catch (\Exception $e) {
             return new Response(Trans::__('We were unable to generate the theme. It is likely that your theme directory is not writable by Bolt. Check the permissions and try reinstalling.'));
         }
     }
     throw new PackageManagerException("Invalid theme source directory: {$source}");
 }
示例#30
0
 protected function setUp()
 {
     $this->tempDir = TestUtil::makeTempDir('webmozart-glob', __CLASS__);
     $filesystem = new Filesystem();
     $filesystem->mirror(__DIR__ . '/../Fixtures', $this->tempDir);
     $this->tempFile = tempnam(sys_get_temp_dir(), 'webmozart_GlobIteratorTest');
 }