Example #1
0
 public static function prepareSharedFolders(array $paths = array())
 {
     if (empty($paths)) {
         return false;
     }
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $releaseRoot = dirname(dirname(dirname(dirname(__FILE__)))) . '/';
     // Current version root
     $root = dirname(dirname($releaseRoot));
     $sharedDirectory = $root . '/shared/';
     // Create the shared directory first (if it does not exists)
     if (!$fs->exists($sharedDirectory)) {
         $fs->mkdir($sharedDirectory, 0777);
     }
     foreach ($paths as $path) {
         $pathDirectory = $releaseRoot . $path;
         $sharedPathDirectory = $sharedDirectory . $path;
         if (!$fs->exists($sharedPathDirectory)) {
             $fs->mkdir($sharedPathDirectory, 0777);
         }
         $pathDirectoryTmp = $pathDirectory . '_tmp';
         // Symlink it per hand
         exec("ln -f -s {$sharedPathDirectory} {$pathDirectoryTmp}");
         exec("rm -rf {$pathDirectory}");
         exec("mv -Tf {$pathDirectoryTmp} {$pathDirectory}");
         //$fs->symlink($pathDirectory, $sharedPathDirectory, true);
     }
 }
Example #2
0
 public function registerBundles()
 {
     $bundles = array(new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle($this), new Nelmio\ApiDocBundle\NelmioApiDocBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new Oneup\UploaderBundle\OneupUploaderBundle(), new Liip\ImagineBundle\LiipImagineBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new FOS\ElasticaBundle\FOSElasticaBundle(), new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(), new Problematic\AclManagerBundle\ProblematicAclManagerBundle(), new JMS\DiExtraBundle\JMSDiExtraBundle($this), new JMS\AopBundle\JMSAopBundle(), new APY\DataGridBundle\APYDataGridBundle(), new PUGX\AutocompleterBundle\PUGXAutocompleterBundle(), new SC\DatetimepickerBundle\SCDatetimepickerBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(), new Prezent\Doctrine\TranslatableBundle\PrezentDoctrineTranslatableBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle(), new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), new Jb\Bundle\FileUploaderBundle\JbFileUploaderBundle(), new Okulbilisim\OjsToolsBundle\OkulbilisimOjsToolsBundle(), new Okulbilisim\FeedbackBundle\OkulbilisimFeedbackBundle(), new Ojs\CoreBundle\OjsCoreBundle(), new Ojs\SiteBundle\OjsSiteBundle(), new Ojs\AdminBundle\OjsAdminBundle(), new Ojs\SearchBundle\OjsSearchBundle(), new Ojs\ApiBundle\OjsApiBundle(), new Ojs\CliBundle\OjsCliBundle(), new Ojs\JournalBundle\OjsJournalBundle(), new Ojs\UserBundle\OjsUserBundle(), new Ojs\OAIBundle\OjsOAIBundle(), new Ojs\LocationBundle\OjsLocationBundle(), new Ojs\InstallerBundle\OjsInstallerBundle(), new Ojs\CmsBundle\OjsCmsBundle(), new FOS\UserBundle\FOSUserBundle(), new Ojs\AnalyticsBundle\OjsAnalyticsBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new JMS\TranslationBundle\JMSTranslationBundle());
     if (in_array($this->getEnvironment(), array('dev', 'test'))) {
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new h4cc\AliceFixturesBundle\h4ccAliceFixturesBundle();
     }
     $thirdPartyDir = __DIR__ . '/../thirdparty';
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     if ($fs->exists($thirdPartyDir)) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->files()->in($thirdPartyDir);
         foreach ($finder as $file) {
             /** @var \Symfony\Component\Finder\SplFileInfo $file */
             $bundleConfig = json_decode(file_get_contents($file->getRealpath()), true);
             if ($bundleConfig) {
                 if (isset($bundleConfig['extra']) && isset($bundleConfig['extra']['bundle-class'])) {
                     if (class_exists($bundleConfig['extra']['bundle-class'])) {
                         $bundles[] = new $bundleConfig['extra']['bundle-class']();
                     }
                 }
             }
         }
     }
     return $bundles;
 }
Example #3
0
 /**
  * Copies a file. Uses Symfony's copy but actually honors the third parameter.
  *
  * @param string $origin
  * @param string $target
  * @param bool $override
  */
 public static function copy($origin, $target, $override = false)
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     if (!$override && $fs->exists($target)) {
         return;
     }
     $fs->copy($origin, $target, $override);
 }
 protected function moveFile($original, $destination)
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fileDir = dirname($destination);
     if (!$fs->exists($fileDir)) {
         $fs->mkdir($fileDir);
     }
     $fs->rename($original, $destination, true);
 }
 private function dumpLocal()
 {
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     if (!$filesystem->exists($this->databasePath)) {
         $this->result['status'] = 0;
         $this->result['message'] = "Defined Redis dump does not exist!";
         return $this->result;
     }
     $filesystem->copy($this->databasePath, $this->backupPath . $this->backupFilename);
     return true;
 }
Example #6
0
 /**
  * Get the path for the specified namespace
  *
  * @param array $paths
  * @param string $group
  * @param string $mode
  * @param bool $exists
  * @return string
  */
 protected function findInPaths(array $paths, $group, $mode = null, $exists = false)
 {
     $items = [];
     foreach ($paths as $path) {
         if ($this->fs->exists($file = "{$path}/{$group}.php")) {
             if ($exists) {
                 return true;
             }
             $items = array_merge_recursive($this->fs->getRequire($file), $items);
         }
         if ($mode and $this->fs->exists($file = "{$path}/{$mode}/{$group}.php")) {
             if ($exists) {
                 return true;
             }
             $items = array_merge_recursive($this->fs->getRequire($file), $items);
         }
     }
     return $items;
 }
Example #7
0
 public function registerBundles()
 {
     $bundles = array(new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle($this), new Nelmio\ApiDocBundle\NelmioApiDocBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new Oneup\UploaderBundle\OneupUploaderBundle(), new Liip\ImagineBundle\LiipImagineBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new FOS\ElasticaBundle\FOSElasticaBundle(), new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(), new Problematic\AclManagerBundle\ProblematicAclManagerBundle(), new JMS\AopBundle\JMSAopBundle(), new JMS\DiExtraBundle\JMSDiExtraBundle($this), new APY\DataGridBundle\APYDataGridBundle(), new SC\DatetimepickerBundle\SCDatetimepickerBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(), new Prezent\Doctrine\TranslatableBundle\PrezentDoctrineTranslatableBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle(), new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), new Jb\Bundle\FileUploaderBundle\JbFileUploaderBundle(), new Tetranz\Select2EntityBundle\TetranzSelect2EntityBundle(), new Presta\SitemapBundle\PrestaSitemapBundle(), new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), new Baskin\HistoryBundle\BaskinHistoryBundle(), new Ojs\CoreBundle\OjsCoreBundle(), new Ojs\SiteBundle\OjsSiteBundle(), new Ojs\AdminBundle\OjsAdminBundle(), new Ojs\ApiBundle\OjsApiBundle(), new Ojs\JournalBundle\OjsJournalBundle(), new Ojs\UserBundle\OjsUserBundle(), new Ojs\OAIBundle\OjsOAIBundle(), new Ojs\ExportBundle\OjsExportBundle(), new BulutYazilim\LocationBundle\BulutYazilimLocationBundle(), new FOS\UserBundle\FOSUserBundle(), new Ojs\AnalyticsBundle\OjsAnalyticsBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new JMS\TranslationBundle\JMSTranslationBundle(), new Ojs\ImportBundle\ImportBundle(), new \OpenJournalSoftware\BibtexBundle\OpenJournalSoftwareBibtexBundle(), new Exercise\HTMLPurifierBundle\ExerciseHTMLPurifierBundle(), new h4cc\AliceFixturesBundle\h4ccAliceFixturesBundle(), new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle());
     if (in_array($this->getEnvironment(), array('dev', 'test'))) {
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
         $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
     }
     $accessor = PropertyAccess::createPropertyAccessor();
     $thirdPartyDir = __DIR__ . '/../thirdparty';
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     if ($fs->exists($thirdPartyDir)) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->files()->in($thirdPartyDir);
         foreach ($finder as $file) {
             /** @var \Symfony\Component\Finder\SplFileInfo $file */
             $bundleConfig = json_decode(file_get_contents($file->getRealpath()), true);
             if ($bundleConfig) {
                 $class = $accessor->getValue($bundleConfig, '[extra][bundle-class]');
                 if ($class && class_exists($class)) {
                     $bundles[] = new $class();
                 }
                 $otherClasses = $accessor->getValue($bundleConfig, '[extra][other-bundle-classes]');
                 if (is_array($otherClasses)) {
                     foreach ($otherClasses as $otherClass) {
                         $otherClassInstance = new $otherClass();
                         if (!in_array($otherClassInstance, $bundles)) {
                             $bundles[] = $otherClassInstance;
                         }
                     }
                 }
             }
         }
     }
     return $bundles;
 }
<?php

// Delete cache dir
$filesystem = new \Symfony\Component\Filesystem\Filesystem();
$cacheDir = __DIR__ . '/app/cache/test';
if ($filesystem->exists($cacheDir)) {
    $filesystem->remove($cacheDir);
}
require __DIR__ . '/../vendor/autoload.php';
Example #9
0
<?php

/**
 * tests bootstrap file making sure the 'test' cache gets cleared before we execute tests.
 */
if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) {
    $fs = new \Symfony\Component\Filesystem\Filesystem();
    $cacheDir = __DIR__ . '/cache/' . $_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'];
    if ($fs->exists($cacheDir)) {
        $fs->remove($cacheDir);
    }
}
require __DIR__ . '/bootstrap.php.cache';
Example #10
0
#!/usr/bin/php
<?php 
$config = ['git_urls' => ['https://github.com/symfony/Filesystem.git' => 'sf_filesystem/'], 'autoload_config' => ['sf_filesystem/' => 'Symfony\\Component\\Filesystem'], 'example' => function () {
    $filesystem = new Symfony\Component\Filesystem\Filesystem();
    $res = $filesystem->exists(__FILE__);
    var_dump($res);
}];
if ($return_config) {
    return $config;
}
require_once __DIR__ . '/_yf_autoloader.php';
new yf_autoloader($config);
Example #11
0
 /**
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::map
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::extendTwig
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genSchema
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genFixtures
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genFolders
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genModels
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genControllers
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genViews
  * @covers \Foote\Ginny\Package\Foote\Generator\LaravelGenerator::genTests
  */
 public function testVarious()
 {
     $input = $this->getInput();
     //create target path
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     $filesystem->remove($input->getFullTargetPath());
     $filesystem->mkdir($input->getFullTargetPath());
     //        $this->assertCount(2, scandir($input->getFullTargetPath()));
     # init generator
     $generator = new LaravelGenerator($input, new ConsoleOutput(ConsoleOutput::VERBOSITY_QUIET));
     $this->assertTrue($generator->twig->hasExtension('ui_extension'));
     $this->assertNotEmpty($generator->map->bundles);
     $generator->bundle = $generator->map->bundles->first();
     # generate folder structure
     $generator->genFolders();
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Controller/Admin'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/database/migrations'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/database/seeders'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Model'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/View/Admin/User'));
     # generate schema
     $this->assertCount(2, scandir($input->getFullTargetPath() . 'System/database/migrations/'));
     $generator->genSchema();
     $this->assertGreaterThan(2, count(scandir($input->getFullTargetPath() . 'System/database/migrations/')));
     # generate fixtures
     $this->assertCount(2, scandir($input->getFullTargetPath() . 'System/database/seeders'));
     $generator->genFixtures();
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/database/seeders/SystemUserSeeder.php'));
     # generate models
     $this->assertCount(2, scandir($input->getFullTargetPath() . 'System/Model'));
     $generator->genModels();
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Model/User.php'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Model/UserRole.php'));
     # generate controllers
     $this->assertCount(2, scandir($input->getFullTargetPath() . 'System/Controller/Admin'));
     $generator->genControllers();
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Controller/Admin/UsersController.php'));
     # generate views
     $this->assertCount(2, scandir($input->getFullTargetPath() . 'System/View/Admin/User'));
     $generator->genViews();
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/View/Admin/User/show.blade.php'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/View/Admin/User/create.blade.php'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/View/Admin/User/edit.blade.php'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/View/Admin/User/index.blade.php'));
     # generate tests
     $this->assertCount(2, scandir($input->getFullTargetPath() . 'System/Tests/Model'));
     $generator->genTests();
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Tests/Controller/Admin/UsersControllerTest.php'));
     $this->assertTrue($filesystem->exists($input->getFullTargetPath() . 'System/Tests/Model/UserTest.php'));
     $filesystem->remove($input->getFullTargetPath());
     $filesystem->mkdir($input->getFullTargetPath());
 }
Example #12
0
<?php

$fs = new \Symfony\Component\Filesystem\Filesystem();
$modules = ['Carousel', 'Cheque', 'Colissimo', 'HookAnalytics', 'HookSocial', 'Tinymce'];
foreach ($modules as $moduleCode) {
    $path = THELIA_MODULE_DIR . $moduleCode . DS . 'AdminIncludes';
    if ($fs->exists($path)) {
        try {
            $fs->remove($path);
        } catch (Exception $e) {
            $message = sprintf($this->trans('The update cannot delete the folder : "%s". Please delete this folder manually.'), $path);
            $this->log('warning', $message);
            $this->setMessage($message, 'warning');
        }
    }
}
 /**
  * Local datababe(s) backup
  */
 private function dumpLocal()
 {
     if ($this->databasePath == '') {
         $this->result['status'] = 0;
         $this->result['message'] = "You have to define database path!";
         return false;
     }
     //check if database exists, in other case return error
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     if (!$filesystem->exists($this->databasePath)) {
         $this->result['status'] = 0;
         $this->result['message'] = "Defined Couchdb does not exist!";
         return false;
     }
     //make a dump of our database
     $dumpDbCommand = "sqlite3 " . $this->databasePath . " '.dump' > " . $this->backupPath . $this->backupFilename;
     $dumpDb = new Process($dumpDbCommand);
     $dumpDb->run();
     //something bad happend, return error
     if (!$dumpDb->isSuccessful()) {
         $this->result['status'] = 0;
         $this->result['message'] = $couchDbConfig->getErrorOutput();
         return false;
     }
     return true;
 }
 private function createDirectory($directory)
 {
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     if (!$filesystem->exists($directory)) {
         $filesystem->mkdir($directory);
     }
 }
 /**
  * Local datababe(s) backup
  */
 private function dumpLocal()
 {
     //do some research on local to find location of databases
     $couchDbConfigCommand = 'couch-config --db-dir';
     $couchDbConfig = new Process($couchDbConfigCommand);
     $couchDbConfig->run();
     //we couldn't find path, just return error
     if (!$couchDbConfig->isSuccessful()) {
         $this->result['status'] = 0;
         $this->result['message'] = $couchDbConfig->getErrorOutput();
         return $this->result;
     }
     //set database local directory
     $this->databaseDir = trim($couchDbConfig->getOutput());
     $this->databaseDir = rtrim($this->databaseDir, "/") . "/";
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     //backup single database
     if ($this->database != '') {
         //check if database exists with extra check if extension wasnt set
         //in other case return error if everything fails
         if (!$filesystem->exists($this->databaseDir . $this->database)) {
             if (!$filesystem->exists($this->databaseDir . $this->database . ".couch")) {
                 $this->result['status'] = 0;
                 $this->result['message'] = "Defined Couchdb does not exist!";
                 return $this->result;
             } else {
                 $this->database = $this->database . ".couch";
             }
         }
         //copy our database to top backup path
         $filesystem->copy($this->databaseDir . $this->database, $this->backupPath . $this->backupFilename);
     } else {
         $filesystem->mkdir($this->backupPath . $this->backupFilename);
         $copyAllDatabasesCommand = 'cp -Ra ' . $this->databaseDir . '. ' . $this->backupPath . $this->backupFilename;
         $copyAllDatabases = new Process($copyAllDatabasesCommand);
         $copyAllDatabases->run();
         //if backup fails return error with some extra info
         if (!$copyAllDatabases->isSuccessful()) {
             $this->result['status'] = 0;
             $this->result['message'] = $copyAllDatabases->getErrorOutput();
             return false;
         }
     }
     return true;
 }
Example #16
0
File: config.php Project: sulu/sulu
<?php

/*
 * This file is part of Sulu.
 *
 * (c) MASSIVE ART WebServices GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
$filesystem = new \Symfony\Component\Filesystem\Filesystem();
$context = $container->getParameter('sulu.context');
$path = __DIR__ . DIRECTORY_SEPARATOR;
if (!$filesystem->exists($path . 'parameters.yml')) {
    $filesystem->copy($path . 'parameters.yml.dist', $path . 'parameters.yml');
}
$loader->import('parameters.yml');
$loader->import('context_' . $context . '.yml');
Example #17
0
 protected function getRootImageDir()
 {
     if (is_null($this->rootImageDir)) {
         $this->rootImageDir = $this->getParameter('kernel.root_dir') . '/../web/' . $this->getImageDir();
         $fs = new \Symfony\Component\Filesystem\Filesystem();
         if (!$fs->exists($this->rootImageDir)) {
             $fs->mkdir($this->rootImageDir);
         }
     }
     return $this->rootImageDir;
 }
              / ___/ __ \\/ __ \\/ __  / __/ __  /
             (__  ) /_/ / / / / /_/ / /_/ /_/ /
            /____/\\____/_/ /_/\\__,_/\\__/\\__,_/
SONATA
);
$output->writeln("");
$output->writeln("<info>Resetting demo, this can take a few minutes</info>");
$fs->remove(sprintf('%s/web/uploads/media', $rootDir));
$fs->mkdir(sprintf('%s/web/uploads/media', $rootDir));
// find out the default php runtime
$bin = sprintf("%s -d memory_limit=-1", defined('PHP_BINARY') ? PHP_BINARY : 'php');
if (extension_loaded('xdebug')) {
    $output->writeln("<error>WARNING, xdebug is enabled in the cli, this can drastically slowing down all PHP scripts</error>");
}
$success = execute_commands(array(array($bin . ' ./bin/sonata-check.php', 'Checking Sonata Project\'s requirements', false), array(function (OutputInterface $output) use($fs) {
    $fs->remove("app/cache/prod");
    $fs->remove("app/cache/dev");
    return true;
}, 'Deleting prod and dev cache folders', false), array(function (OutputInterface $output) use($fs) {
    return $fs->exists("app/config/parameters.yml");
}, 'Check for app/config/parameters.yml file', false), array($bin . ' ./app/console cache:create-cache-class --env=prod --no-debug', 'Creating the class cache', false), array($bin . ' ./app/console doctrine:database:drop --force', 'Dropping the database', true), array($bin . ' ./app/console doctrine:database:create', 'Creating the database', false), array($bin . ' ./app/console doctrine:schema:update --force', 'Creating the database\'s schema', false), array($bin . '  -d max_execution_time=600 ./app/console doctrine:fixtures:load --verbose --env=dev --no-debug', 'Loading fixtures', false), array($bin . ' ./app/console sonata:news:sync-comments-count', 'Sonata - News: updating comments count', false), array($bin . ' ./app/console sonata:page:update-core-routes --site=all --no-debug', 'Sonata - Page: updating core route', false), array($bin . ' ./app/console sonata:page:create-snapshots --site=all --no-debug', 'Sonata - Page: creating snapshots from pages', false), array($bin . ' ./app/console assets:install --symlink web', 'Configure assets', false), array($bin . ' ./app/console sonata:admin:setup-acl', 'Security: setting up ACL', false), array($bin . ' ./app/console sonata:admin:generate-object-acl', 'Security: generating object ACL', false)), $output);
if (!$success) {
    $output->writeln('<info>An error occurs when running a command!</info>');
    exit(1);
}
$output->writeln('');
$output->writeln('<info>What\'s next ?!</info>');
$output->writeln(sprintf(' - Configure your webserver to point to the %s/web folder.', realpath(__DIR__ . DIRECTORY_SEPARATOR . '..')));
$output->writeln(' - Review the documentation: https://sonata-project.org/bundles');
$output->writeln(' - Follow us on twitter: https://twitter.com/sonataproject');
exit(0);