protected function setUp()
 {
     parent::setUp();
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($this->getAbsPath($this->buildName));
     $fs->remove($this->getAbsPath($this->buildName . '.sh'));
     ProcessUtil::runOk($this->cmd('amp cleanup'));
 }
Example #2
0
 public function __construct($environment, $debug)
 {
     if (!static::$runned) {
         $fileSystem = new Symfony\Component\Filesystem\Filesystem();
         $fileSystem->remove($this->getCacheDir());
         $fileSystem->remove($this->getLogDir());
         static::$runned = true;
     }
     parent::__construct($environment, $debug);
 }
 public function testBoot()
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fakeCacheDir = sys_get_temp_dir() . '/foo/bar/hello';
     $fs->remove($fakeCacheDir);
     $result = mkdir($fakeCacheDir, 0755, true);
     $this->assertTrue($result);
     $result = touch($fakeCacheDir . '/hi.txt');
     $this->assertTrue($result);
     $this->_mockContainerSupplier->shouldReceive('getServiceContainer')->once()->andReturn($this->_mockServiceContainer);
     $mockLogger = $this->mock(tubepress_api_log_LoggerInterface::_);
     $mockLogger->shouldReceive('debug')->atLeast(1);
     $mockLogger->shouldReceive('onBootComplete')->once();
     $this->_mockServiceContainer->shouldReceive('get')->once()->with(tubepress_api_log_LoggerInterface::_)->andReturn($mockLogger);
     $this->_bootSettings->shouldReceive('isClassLoaderEnabled')->once()->andReturn(true);
     $this->_bootSettings->shouldReceive('shouldClearCache')->once()->andReturn(true);
     $this->_bootSettings->shouldReceive('getPathToSystemCacheDirectory')->twice()->andReturn($fakeCacheDir);
     $this->_mockBootLogger->shouldReceive('flushTo')->once()->with($mockLogger);
     $this->_mockBootLogger->shouldReceive('onBootComplete')->once();
     $result = $this->_sut->getServiceContainer();
     $this->assertTrue(is_dir($fakeCacheDir));
     $this->assertSame($this->_mockServiceContainer, $result);
     $result = $this->_sut->getServiceContainer();
     $this->assertSame($this->_mockServiceContainer, $result);
 }
Example #4
0
 /**
  * Deletes the cache folder
  */
 public function nukeCache()
 {
     $this->clearSessionItems();
     $cacheDir = $this->factory->getSystemPath('cache', true);
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($cacheDir);
 }
Example #5
0
 /**
  * @Rest\Post("/publish", name="admin_json_editor_publish")
  * @Rest\View()
  *
  * @return
  */
 public function publishAction(Request $request)
 {
     $path = $this->root . '/Resources/translations/messages.' . $request->getLocale() . '.json';
     file_put_contents($path, file_get_contents('php://input'));
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($this->root . '/cache/prod/translations');
     return array();
 }
Example #6
0
 public static function prepareLogFiles(array $paths)
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     foreach ($paths as $path) {
         $fs->remove($path);
         $fs->touch($paths);
         $fs->chmod($path, 0777);
     }
 }
Example #7
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 #8
0
 /**
  * Removes the content of a directory (not the directory itself). Works recursively.
  *
  * @param string $path Path to a directory.
  */
 public static function removeContent($path)
 {
     if (!is_dir($path)) {
         return;
     }
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
     foreach ($iterator as $item) {
         if ($item->isDir() && Strings::endsWith($iterator->key(), ".git")) {
             self::possiblyFixGitPermissions($iterator->key());
         }
     }
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($iterator);
 }
Example #9
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // throw new \Exception('boo');
     $directory = realpath($input->getArgument('directory'));
     $directoryOutput = $input->getArgument('outputdirectory');
     /* @var $logger Psr\Log\LoggerInterface */
     $this->logger = $this->getContainer()->get('logger');
     $io = new SymfonyStyle($input, $output);
     $io->title('DDD Model Generation');
     $clean = $input->hasOption('clean');
     if ($clean) {
         $io->section('Clean output directoty');
         $fs = new \Symfony\Component\Filesystem\Filesystem();
         try {
             $fs->remove($directoryOutput);
         } catch (IOExceptionInterface $e) {
             $io->error($e->getMessage());
         }
         $io->text('clean of ' . $directoryOutput . ' completed');
     }
     if (is_dir($directory)) {
         $finder = new Finder();
         $finder->search($directory);
         foreach ($finder->getFindedFiles() as $file) {
             if (pathinfo($file, PATHINFO_FILENAME) == 'model.yml') {
                 $io->text('Analizzo model.yml in ' . pathinfo($file, PATHINFO_DIRNAME));
                 $dddGenerator = new DDDGenerator();
                 $dddGenerator->setLogger($this->logger);
                 $dddGenerator->analyze($file);
                 $dddGenerator->generate($directoryOutput);
             }
         }
         $io->section('Php-Cs-Fixer on generated files');
         $fixer = new \Symfony\CS\Console\Command\FixCommand();
         $input = new ArrayInput(['path' => $directoryOutput, '--level' => 'psr2', '--fixers' => 'eof_ending,strict_param,short_array_syntax,trailing_spaces,indentation,line_after_namespace,php_closing_tag']);
         $output = new BufferedOutput();
         $fixer->run($input, $output);
         $content = $output->fetch();
         $io->text($content);
         if (count($this->errors) == 0) {
             $io->success('Completed generation');
         } else {
             $io->error($this->errors);
         }
     } else {
         $io->caution('Directory ' . $directory . ' not valid');
     }
     // PER I WARNING RECUPERABILI
     //$io->note('Generate Class');
 }
Example #10
0
 private function clearCache()
 {
     try {
         $sf2Refresh = new \PrestaShopBundle\Service\Cache\Refresh();
         $sf2Refresh->addCacheClear();
         $sf2Refresh->execute();
     } catch (\Exception $exception) {
         $finder = new \Symfony\Component\Finder\Finder();
         $fs = new \Symfony\Component\Filesystem\Filesystem();
         foreach ($finder->in(_PS_ROOT_DIR_ . '/app/cache') as $file) {
             $fs->remove($file->getFilename());
         }
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dir = __DIR__ . '/../../../../';
     $projectHome = realpath($dir);
     $output->writeln($projectHome);
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->in($projectHome . '/Tekstove');
     $finder->name('*.php');
     $finder->path('/\\/Base\\//')->path('/\\/Map\\//');
     $this->handleFinder($finder, $output, $projectHome);
     $finderNewFiles = new \Symfony\Component\Finder\Finder();
     $finderNewFiles->in($projectHome . '/Tekstove');
     $finderNewFiles->name('*.php');
     $this->handleFinder($finderNewFiles, $output, $projectHome, false);
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($projectHome . '/Tekstove');
     $output->writeln('<info>Command result.</info>');
 }
Example #12
0
    }
    $database->insertSql($_SESSION['install']['database']);
    if (!file_exists(THELIA_ROOT . "/local/config/database.yml")) {
        $fs = new \Symfony\Component\Filesystem\Filesystem();
        $sampleConfigFile = THELIA_ROOT . "/local/config/database.yml.sample";
        $configFile = THELIA_ROOT . "/local/config/database.yml";
        $fs->copy($sampleConfigFile, $configFile, true);
        $configContent = file_get_contents($configFile);
        $configContent = str_replace("%DRIVER%", "mysql", $configContent);
        $configContent = str_replace("%USERNAME%", $_SESSION['install']['username'], $configContent);
        $configContent = str_replace("%PASSWORD%", $_SESSION['install']['password'], $configContent);
        $configContent = str_replace("%DSN%", sprintf("mysql:host=%s;dbname=%s;port=%s", $_SESSION['install']['host'], $_SESSION['install']['database'], $_SESSION['install']['port']), $configContent);
        file_put_contents($configFile, $configContent);
        // FA - no, as no further install will be possible
        // $fs->remove($sampleConfigFile);
        $fs->remove($thelia->getContainer()->getParameter("kernel.cache_dir"));
    }
}
$_SESSION['install']['step'] = $step;
// Retrieve the website url
$url = $_SERVER['PHP_SELF'];
$website_url = preg_replace("#/install/[a-z](.*)#", '', $url);
?>
<form action="end.php" method="POST" >
    <div class="well">
        <div class="form-group">
            <label for="admin_login"><?php 
echo $trans->trans('Administrator login :');
?>
</label>
            <input id="admin_login" class="form-control" type="text" name="admin_login" placeholder="admin" value="" required>
Example #13
0
<?php

$loader = (include __DIR__ . '/vendor/autoload.php');
$filesystem = new \Symfony\Component\Filesystem\Filesystem();
$filesystem->remove(implode(DIRECTORY_SEPARATOR, array(__DIR__, 'tests', 'build')));
$loader->add("Bootstrap", __DIR__ . '/tests/src/php/Bootstrap');
$loader->add("Command", __DIR__ . '/tests/src/php/Command');
$loader->add("Controller", __DIR__ . '/tests/src/php/Controller');
$loader->add("Build", __DIR__ . '/tests/build/php/Build');
Example #14
0
        $admin = new \Thelia\Model\Admin();
        $admin->setLogin($_POST['admin_login'])->setPassword($_POST['admin_password'])->setFirstname('admin')->setLastname('admin')->setLocale(empty($_POST['admin_locale']) ? 'en_US' : $_POST['admin_locale'])->setLocale($_POST['admin_email'])->save();
        \Thelia\Model\ConfigQuery::create()->filterByName('store_email')->update(array('Value' => $_POST['store_email']));
        \Thelia\Model\ConfigQuery::create()->filterByName('store_notification_emails')->update(array('Value' => $_POST['store_email']));
        \Thelia\Model\ConfigQuery::create()->filterByName('store_name')->update(array('Value' => $_POST['store_name']));
        \Thelia\Model\ConfigQuery::create()->filterByName('url_site')->update(array('Value' => $_POST['url_site']));
        $lang = \Thelia\Model\LangQuery::create()->findOneByLocale(empty($_POST['shop_locale']) ? "en_US" : $_POST['shop_locale']);
        if (null !== $lang) {
            $lang->toggleDefault();
        }
        $secret = \Thelia\Tools\TokenProvider::generateToken();
        \Thelia\Model\ConfigQuery::write('form.secret', $secret, 0, 0);
    }
    //clean up cache directories
    $fs = new \Symfony\Component\Filesystem\Filesystem();
    $fs->remove(THELIA_ROOT . '/cache/prod');
    $fs->remove(THELIA_ROOT . '/cache/dev');
    $fs->remove(THELIA_ROOT . '/cache/install');
    $request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
    $_SESSION['install']['step'] = $step;
    // Retrieve the website url
    $url = $_SERVER['PHP_SELF'];
    $website_url = preg_replace("#/install/[a-z](.*)#", '', $url);
    ?>
    <div class="well">
        <p class="lead text-center">
            <?php 
    echo $trans->trans('Thelia is now installed. Thank you !');
    ?>
        </p>
<?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 #16
0
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
print "<pre>Installing GitSync dependencies for the first time ...\n\n";
flush();
if (!file_exists(EXTRACT_DIRECTORY . '/vendor/autoload.php') == true) {
    if (ini_get('phar.readonly')) {
        print "Error: unable to proceed. Please set phar.readonly = 0 in php.ini and then reload this page.</pre>";
        exit;
    }
    $composerPhar = new Phar(__DIR__ . "/composer.phar");
    $composerPhar->extractTo(EXTRACT_DIRECTORY);
}
//This requires the phar to have been extracted successfully.
require_once EXTRACT_DIRECTORY . '/vendor/autoload.php';
//Use the Composer classes
use Composer\Console\Application;
//Create the commands
$input = new Symfony\Component\Console\Input\StringInput('install');
$output = new Symfony\Component\Console\Output\StreamOutput(fopen('php://output', 'w'));
//Create the application and run it with the commands
$application = new Application();
$application->add(new Composer\Command\InstallCommand());
$application->setAutoExit(false);
$application->run($input, $output);
print "Cleaning up ...\n\n";
flush();
$fs = new \Symfony\Component\Filesystem\Filesystem();
$fs->remove(EXTRACT_DIRECTORY);
print "Done. Please reload this page.</pre>";
flush();
exit;
Example #17
0
 protected function tearDown()
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($this->tmpdir);
 }
 private function _clearSystemCache()
 {
     if (!class_exists('\\Symfony\\Component\\Filesystem\\Filesystem', false)) {
         require TUBEPRESS_ROOT . '/vendor/symfony/filesystem/Filesystem.php';
         require TUBEPRESS_ROOT . '/vendor/symfony/filesystem/Exception/ExceptionInterface.php';
         require TUBEPRESS_ROOT . '/vendor/symfony/filesystem/Exception/IOExceptionInterface.php';
         require TUBEPRESS_ROOT . '/vendor/symfony/filesystem/Exception/IOException.php';
         require TUBEPRESS_ROOT . '/vendor/symfony/filesystem/Exception/FileNotFoundException.php';
     }
     $dir = $this->_bootSettings->getPathToSystemCacheDirectory();
     $filesystem = new \Symfony\Component\Filesystem\Filesystem();
     if ($this->_bootLogger->isEnabled()) {
         $this->_logDebug(sprintf('System cache clear requested. Attempting to recursively delete <code>%s</code>', $dir));
     }
     $filesystem->remove($dir);
     $filesystem->mkdir($dir, 0755);
 }
            }
        }
    }
    return true;
}
$output->writeln(<<<SONATA
                                       __
               _________  ____  _____ / / ______
              / ___/ __ \\/ __ \\/ __  / __/ __  /
             (__  ) /_/ / / / / /_/ / /_/ /_/ /
            /____/\\____/_/ /_/\\__,_/\\__/\\__,_/
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>');
Example #20
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');
        }
    }
}
Example #21
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 #22
0
}
function module_hook($module, $hook)
{
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
        return TRUE;
    } else {
        $file = __DIR__ . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $module . '.module';
        if (file_exists($file)) {
            require_once __DIR__ . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $module . '.module';
        }
    }
    return function_exists($function);
}
function module_invoke($module, $hook)
{
    $args = func_get_args();
    unset($args[0], $args[1]);
    if (module_hook($module, $hook)) {
        return call_user_func_array($module . '_' . $hook, $args);
    }
}
function conf_path()
{
    return 'sites/default';
}
$loader = (require __DIR__ . '/../vendor/autoload.php');
register_shutdown_function(function () {
    $fs = new \Symfony\Component\Filesystem\Filesystem();
    $fs->remove(DRUPONY_TEST_DIR);
});
Example #23
0
 * @param \Symfony\Component\Console\Output\ConsoleOutput $output
 *
 * @return boolean
 */
function execute_commands($commands, $output)
{
    foreach ($commands as $command) {
        $output->writeln(sprintf('<info>Executing : </info> %s', $command));
        $p = new \Symfony\Component\Process\Process($command);
        $p->setTimeout(null);
        $p->run(function ($type, $data) use($output) {
            $output->write($data);
        });
        if (!$p->isSuccessful()) {
            return false;
        }
        $output->writeln("");
    }
    return true;
}
$output->writeln("<info>Resetting demo</info>");
$fs->remove(sprintf('%s/web/uploads/media', $rootDir));
$fs->mkdir(sprintf('%s/web/uploads/media', $rootDir));
$fs->copy(__DIR__ . '/src/Sonata/Bundle/DemoBundle/DataFixtures/data/robots.txt', __DIR__ . '/web/app/robots.txt', true);
$success = execute_commands(array('rm -rf app/cache/*', './sonata api cache:warmup --env=prod --no-debug', './sonata app cache:warmup --env=prod --no-debug', './sonata app cache:create-cache-class --env=prod --no-debug', './sonata app doctrine:database:drop --force', './sonata app doctrine:database:create', './sonata app doctrine:schema:update --force', './sonata app doctrine:fixtures:load --verbose --env=dev', './sonata app sonata:page:update-core-routes --site=all --no-debug', './sonata app sonata:page:create-snapshots --site=all --no-debug', './sonata app assets:install --symlink web', './sonata app sonata:admin:setup-acl', 'php -d memory_limit=1024M ./sonata app sonata:admin:generate-object-acl'), $output);
if (!$success) {
    $output->writeln('<info>An error occurs when running a command!</info>');
    exit(1);
}
$output->writeln('<info>Done!</info>');
exit(0);
Example #24
0
 static function bundle($namespace, $action)
 {
     $namespace = str_replace('/', '\\', $namespace);
     $bundles = \Service::getBundles();
     $namespace_slug = \Kodazzi\Tools\StringProcessor::slug($namespace);
     $bundles_activated = array();
     $action = strtolower($action);
     if (!in_array($action, array('new', 'delete', 'deactivate'))) {
         throw new Exception("El par&aacute;metro para el m&eacute;todo debe ser 'new' o 'delete'");
     }
     foreach ($bundles as $bundle) {
         $bundle_slug = \Kodazzi\Tools\StringProcessor::slug($bundle->getNameSpace());
         $bundles_activated[$bundle_slug] = trim($bundle->getNameSpace(), '\\');
     }
     if ($action == 'new') {
         if (!array_key_exists($namespace_slug, $bundles_activated)) {
             $bundles_activated[$namespace_slug] = trim($namespace, '\\');
         }
     } else {
         if ($action == 'delete' || $action == 'deactivate') {
             unset($bundles_activated[$namespace_slug]);
         }
     }
     // Crea la clase AppKernel
     $GenerateClass = \Service::get('generate_class');
     $GenerateClass->setTemplate('bundles.cf');
     $GenerateClass->create(Ki_APP . 'config/bundles.cf', array('bundles' => $bundles_activated));
     // Elimina el directorio del bundle
     if ($action == 'delete' && is_dir(Ki_BUNDLES . $namespace)) {
         $fs = new \Symfony\Component\Filesystem\Filesystem();
         $fs->remove(Ki_BUNDLES . $namespace);
     }
 }
Example #25
0
 /**
  * Remove files older than given rule
  * (both Access time and Modified time will be checked
  * and only if both matches removal will take place)
  *
  * @param array $inputArray
  * @return string
  */
 protected function removeFilesOlderThanGivenRule($inputArray)
 {
     $aFiles = $this->retrieveFilesOlderThanGivenRule($inputArray);
     if (is_array($aFiles)) {
         $filesystem = new \Symfony\Component\Filesystem\Filesystem();
         $filesystem->remove($aFiles);
         return $this->setArrayToJson($aFiles);
     }
     return $aFiles;
 }
 /**
  * @BeforeScenario
  */
 public function removeTmpDir()
 {
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     $fs->remove($this->placeholderValues['%tmp%']);
 }
Example #27
0
 /**
  * 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);
 }
Example #28
0
 protected function removeImages(array $images)
 {
     // Clean images to keep existing ones
     $images = array_diff(array_map('trim', $images), $this->existingImages);
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     foreach ($images as $image) {
         if (trim($image) && $image != 'DELETE') {
             $file = $this->getRootImageDir() . '/' . trim($image);
             if ($fs->exists($file)) {
                 $fs->remove($file);
                 $this->get('nyrodev_image')->removeCache($file);
             }
         }
     }
 }
Example #29
0
 /**
  * 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);
     $filesystem->rename($this->package->get_temp_path() . '/' . $package_root, $style_root);
 }