private function clear_caches()
 {
     $cache_service = AppContext::get_cache_service();
     $cache_service->clear_phpboost_cache();
     $cache_service->clear_syndication_cache();
     CLIOutput::writeln('Caches cleared');
 }
 public function execute(array $args)
 {
     $tests = $this->get_tests();
     foreach ($tests as $test) {
         CLIOutput::writeln($test);
     }
 }
 private function run_test($class_to_test)
 {
     $class_path = $this->get_class_to_test_path($class_to_test);
     CLIOutput::writeln('Running test ' . $class_to_test);
     include_once $class_path;
     $class = new ReflectionClass($class_to_test);
     PHPUnit_TextUI_TestRunner::run($class);
     CLIOutput::writeln();
 }
 public function execute(array $args)
 {
     try {
         SitemapXMLFileService::try_to_generate();
         CLIOutput::writeln('The sitemap.xml file has been successfully generated');
     } catch (IOException $e) {
         CLIOutput::writeln('The sitemap.xml couldn\'t be generated probably because it\'s unwritable.');
     }
 }
 private function dump($file_path, $tables)
 {
     Environment::try_to_increase_max_execution_time();
     $file = new File($file_path);
     $file_writer = new BufferedFileWriter($file);
     if ($tables == null) {
         PersistenceContext::get_dbms_utils()->dump_phpboost($file_writer, DBMSUtils::DUMP_STRUCTURE_AND_DATA);
     } else {
         PersistenceContext::get_dbms_utils()->dump_tables($file_writer, $tables, DBMSUtils::DUMP_STRUCTURE_AND_DATA);
     }
     CLIOutput::writeln('Tables dumped to file ' . $file_path);
 }
 private function clear()
 {
     $cache_service = AppContext::get_cache_service();
     CLIOutput::writeln('[clear] phpboost cache');
     $cache_service->clear_phpboost_cache();
     CLIOutput::writeln('[clear] templates cache');
     $cache_service->clear_template_cache();
     CLIOutput::writeln('[clear] syndication cache');
     $cache_service->clear_syndication_cache();
     CLIOutput::writeln('[clear] CSS cache');
     $cache_service->clear_css_cache();
     CLIOutput::writeln('cache has been successfully cleared');
 }
 private function do_launch()
 {
     if ($this->find_command()) {
         $this->execute_command();
     } else {
         if (empty($this->command)) {
             CLIOutput::writeln('no command specified');
         } else {
             CLIOutput::writeln('command ' . $this->command . ' does not exists');
         }
         $this->display_commands();
     }
 }
 public function execute(array $args)
 {
     $this->arg_reader = new CLIArgumentsReader($args);
     if ($this->arg_reader->has_arg('add')) {
         $server_environment_config = ServerEnvironmentConfig::load();
         $content = $server_environment_config->get_htaccess_manual_content();
         $content .= $this->arg_reader->get('add');
         $server_environment_config->set_htaccess_manual_content($content);
         ServerEnvironmentConfig::save();
         $this->regenerate_htaccess_file();
         CLIOutput::writeln('success');
     } else {
         $this->help(array());
     }
 }
 private function show_parameter($name, $value)
 {
     CLIOutput::writeln("\t" . $name . ' ' . $value);
 }
 private function display_short_description($command, $description)
 {
     CLIOutput::writeln("\t" . '- ' . $command . ': ' . $description);
 }
 private function print_command_help($command_name)
 {
     $command = $this->get_command($command_name);
     CLIOutput::writeln('Usage: phpboost ' . $this->name . ' ' . $command_name . ' <opts>');
     CLIOutput::writeln($command->help(array()));
 }
 public static function __static()
 {
     self::$err_output = new File('php://stderr');
 }
 private function create_phpboost_tables()
 {
     AppContext::get_cache_service()->clear_cache();
     try {
         $this->installation->create_phpboost_tables(DBFactory::MYSQL, $this->db_host, $this->db_port, $this->db_schema, $this->db_user, $this->db_password, $this->db_tables_prefix);
         return true;
     } catch (UnexistingDatabaseException $exception) {
         CLIOutput::writeln('Database ' . $this->db_schema . ' does not exist and attempt to create it failed. Create it and relaunch the installation');
     } catch (DBConnectionException $exception) {
         CLIOutput::writeln('Connection to database failed, check your connection parameters');
     } catch (IOException $exception) {
         CLIOutput::writeln('Can\'t write database configuration file informations to /kernel/db/config.php. ' . 'Check file or parent directory permissions.');
     }
     return false;
 }
 private function success_message()
 {
     CLIOutput::writeln('success');
 }