2013-11-12 00:12:34 +01:00
|
|
|
#!/usr/bin/env php
|
2013-11-03 02:49:50 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
2014-05-27 20:18:06 +02:00
|
|
|
* This file is part of the phpBB Forum Software package.
|
|
|
|
*
|
|
|
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
|
|
|
*
|
|
|
|
* For full copyright and license information, please see
|
|
|
|
* the docs/CREDITS.txt file.
|
2013-11-03 02:49:50 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-07-15 00:38:07 +02:00
|
|
|
use Symfony\Component\Console\Input\ArgvInput;
|
|
|
|
|
2013-11-03 02:49:50 +01:00
|
|
|
if (php_sapi_name() != 'cli')
|
|
|
|
{
|
|
|
|
echo 'This program must be run from the command line.' . PHP_EOL;
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
define('IN_PHPBB', true);
|
2013-11-05 19:10:33 +01:00
|
|
|
$phpbb_root_path = __DIR__ . '/../';
|
2013-11-03 02:49:50 +01:00
|
|
|
$phpEx = substr(strrchr(__FILE__, '.'), 1);
|
|
|
|
require($phpbb_root_path . 'includes/startup.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
|
|
|
|
|
|
|
|
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
|
|
|
$phpbb_class_loader->register();
|
|
|
|
|
2014-06-29 00:33:31 +02:00
|
|
|
$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
|
|
|
|
extract($phpbb_config_php_file->get_all());
|
2014-06-27 20:41:16 +02:00
|
|
|
|
2014-06-27 21:35:53 +02:00
|
|
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
|
|
|
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
|
|
|
|
2014-06-29 00:35:46 +02:00
|
|
|
$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
|
2014-07-15 17:51:23 +02:00
|
|
|
$phpbb_container_builder->set_dump_container(false);
|
2014-07-15 00:38:07 +02:00
|
|
|
|
|
|
|
$input = new ArgvInput();
|
|
|
|
|
2014-07-15 19:21:41 +02:00
|
|
|
if ($input->hasParameterOption(array('--safe-mode')))
|
2014-07-15 00:38:07 +02:00
|
|
|
{
|
|
|
|
$phpbb_container_builder->set_use_extensions(false);
|
|
|
|
$phpbb_container_builder->set_dump_container(false);
|
|
|
|
}
|
2014-07-17 00:05:33 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
|
|
|
$phpbb_class_loader_ext->register();
|
|
|
|
phpbb_load_extensions_autoloaders($phpbb_root_path);
|
|
|
|
}
|
2014-06-27 20:41:16 +02:00
|
|
|
|
2014-06-29 00:29:08 +02:00
|
|
|
$phpbb_container = $phpbb_container_builder->get_container();
|
2014-05-02 19:01:56 +02:00
|
|
|
$phpbb_container->get('request')->enable_super_globals();
|
|
|
|
require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx);
|
2013-11-03 03:24:06 +01:00
|
|
|
|
2014-06-04 14:26:40 +02:00
|
|
|
$user = $phpbb_container->get('user');
|
|
|
|
$user->add_lang('acp/common');
|
2014-07-17 16:54:42 +02:00
|
|
|
$user->add_lang('cli');
|
2014-06-04 14:26:40 +02:00
|
|
|
|
|
|
|
$application = new \phpbb\console\application('phpBB Console', PHPBB_VERSION, $user);
|
2014-07-15 11:36:51 +02:00
|
|
|
$application->register_container_commands($phpbb_container->get('console.command_collection'));
|
2014-07-15 00:38:07 +02:00
|
|
|
$application->run($input);
|