mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/13740] Move installer files to phpbb/install directory
PHPBB3-13740
This commit is contained in:
240
phpBB/phpbb/install/controller/helper.php
Normal file
240
phpBB/phpbb/install/controller/helper.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* A duplicate of \phpbb\controller\helper
|
||||
*
|
||||
* This class is necessary because of controller\helper's legacy function calls
|
||||
* to page_header() page_footer() functions which has unavailable dependencies.
|
||||
*/
|
||||
class helper
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\language\language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language_file_helper
|
||||
*/
|
||||
protected $lang_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\navigation\navigation_provider
|
||||
*/
|
||||
protected $navigation_provider;
|
||||
|
||||
/**
|
||||
* @var \phpbb\template\template
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var \phpbb\path_helper
|
||||
*/
|
||||
protected $path_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\symfony_request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var \phpbb\routing\router
|
||||
*/
|
||||
protected $router;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_admin_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
public function __construct(\phpbb\language\language $language, \phpbb\language\language_file_helper $lang_helper, \phpbb\install\helper\navigation\navigation_provider $nav, \phpbb\template\template $template, \phpbb\path_helper $path_helper, \phpbb\symfony_request $request, \phpbb\routing\router $router, $phpbb_root_path)
|
||||
{
|
||||
$this->language = $language;
|
||||
$this->lang_helper = $lang_helper;
|
||||
$this->navigation_provider = $nav;
|
||||
$this->template = $template;
|
||||
$this->path_helper = $path_helper;
|
||||
$this->request = $request;
|
||||
$this->router = $router;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_root_path . 'adm/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Automate setting up the page and creating the response object.
|
||||
*
|
||||
* @param string $template_file The template handle to render
|
||||
* @param string $page_title The title of the page to output
|
||||
* @param int $status_code The status code to be sent to the page header
|
||||
*
|
||||
* @return Response object containing rendered page
|
||||
*/
|
||||
public function render($template_file, $page_title = '', $status_code = 200)
|
||||
{
|
||||
$this->page_header($page_title);
|
||||
|
||||
$this->template->set_filenames(array(
|
||||
'body' => $template_file,
|
||||
));
|
||||
|
||||
return new Response($this->template->assign_display('body'), $status_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default template variables
|
||||
*
|
||||
* @param string $page_title
|
||||
*/
|
||||
protected function page_header($page_title)
|
||||
{
|
||||
$this->template->assign_vars(array(
|
||||
'L_CHANGE' => $this->language->lang('CHANGE'),
|
||||
'L_COLON' => $this->language->lang('COLON'),
|
||||
'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'),
|
||||
'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'),
|
||||
'L_SKIP' => $this->language->lang('SKIP'),
|
||||
'PAGE_TITLE' => $this->language->lang($page_title),
|
||||
'T_IMAGE_PATH' => htmlspecialchars($this->phpbb_admin_path) . 'images/',
|
||||
'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . 'assets/javascript/jquery.min.js',
|
||||
'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . 'adm/style',
|
||||
'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . 'assets/',
|
||||
|
||||
'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'),
|
||||
'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right',
|
||||
'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left',
|
||||
'S_CONTENT_ENCODING' => 'UTF-8',
|
||||
|
||||
'S_USER_LANG' => $this->language->lang('USER_LANG'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->render_navigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render navigation
|
||||
*/
|
||||
protected function render_navigation()
|
||||
{
|
||||
// Get navigation items
|
||||
$nav_array = $this->navigation_provider->get();
|
||||
|
||||
// @todo Sort navs by order
|
||||
|
||||
$active_main_menu = $this->get_active_main_menu($nav_array);
|
||||
|
||||
// Pass navigation to template
|
||||
foreach ($nav_array as $key => $entry)
|
||||
{
|
||||
$this->template->assign_block_vars('t_block1', array(
|
||||
'L_TITLE' => $this->language->lang($entry['label']),
|
||||
'S_SELECTED' => ($active_main_menu === $key),
|
||||
'U_TITLE' => $this->route($entry['route']),
|
||||
));
|
||||
|
||||
if (is_array($entry[0]) && $active_main_menu === $key)
|
||||
{
|
||||
// @todo Sort navs by order
|
||||
|
||||
foreach ($entry[0] as $name => $sub_entry)
|
||||
{
|
||||
if (isset($sub_entry['stage']) && $sub_entry['stage'] === true)
|
||||
{
|
||||
$this->template->assign_block_vars('l_block2', array(
|
||||
'L_TITLE' => $this->language->lang($sub_entry['label']),
|
||||
'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true),
|
||||
'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true),
|
||||
'STAGE_NAME' => $name,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->template->assign_block_vars('l_block1', array(
|
||||
'L_TITLE' => $this->language->lang($sub_entry['label']),
|
||||
'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')),
|
||||
'U_TITLE' => $this->route($sub_entry['route']),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns path from route name
|
||||
*
|
||||
* @param string $route_name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function route($route_name)
|
||||
{
|
||||
$url = $this->router->generate($route_name);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render language select form
|
||||
*/
|
||||
protected function render_language_select()
|
||||
{
|
||||
$langs = $this->lang_helper->get_available_languages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the active main menu item
|
||||
*
|
||||
* @param array $nav_array
|
||||
*
|
||||
* @return string|bool Returns the name of the active main menu element, if the element not found, returns false
|
||||
*/
|
||||
protected function get_active_main_menu($nav_array)
|
||||
{
|
||||
$active_route = $this->request->get('_route');
|
||||
|
||||
foreach ($nav_array as $nav_name => $nav_options)
|
||||
{
|
||||
$current_menu = $nav_name;
|
||||
|
||||
if (isset($nav_options['route']) && $nav_options['route'] === $active_route)
|
||||
{
|
||||
return $nav_name;
|
||||
}
|
||||
|
||||
if (is_array($nav_options[0]))
|
||||
{
|
||||
foreach ($nav_options[0] as $sub_menus)
|
||||
{
|
||||
if (isset($sub_menus['route']) &&$sub_menus['route'] === $active_route)
|
||||
{
|
||||
return $current_menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
185
phpBB/phpbb/install/controller/install.php
Normal file
185
phpBB/phpbb/install/controller/install.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\controller;
|
||||
|
||||
use phpbb\install\helper\config;
|
||||
use phpbb\install\helper\navigation\navigation_provider;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use phpbb\install\helper\iohandler\factory;
|
||||
use phpbb\install\controller\helper;
|
||||
use phpbb\template\template;
|
||||
use phpbb\request\request_interface;
|
||||
use phpbb\install\installer;
|
||||
use phpbb\language\language;
|
||||
|
||||
/**
|
||||
* Controller for installing phpBB
|
||||
*/
|
||||
class install
|
||||
{
|
||||
/**
|
||||
* @var helper
|
||||
*/
|
||||
protected $controller_helper;
|
||||
|
||||
/**
|
||||
* @var config
|
||||
*/
|
||||
protected $installer_config;
|
||||
|
||||
/**
|
||||
* @var factory
|
||||
*/
|
||||
protected $iohandler_factory;
|
||||
|
||||
/**
|
||||
* @var navigation_provider
|
||||
*/
|
||||
protected $menu_provider;
|
||||
|
||||
/**
|
||||
* @var language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var template
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var request_interface
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var installer
|
||||
*/
|
||||
protected $installer;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param helper $helper
|
||||
* @param config $install_config
|
||||
* @param factory $factory
|
||||
* @param navigation_provider $nav_provider
|
||||
* @param language $language
|
||||
* @param request_interface $request
|
||||
* @param installer $installer
|
||||
*/
|
||||
public function __construct(helper $helper, config $install_config, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer)
|
||||
{
|
||||
$this->controller_helper = $helper;
|
||||
$this->installer_config = $install_config;
|
||||
$this->iohandler_factory = $factory;
|
||||
$this->menu_provider = $nav_provider;
|
||||
$this->language = $language;
|
||||
$this->template = $template;
|
||||
$this->request = $request;
|
||||
$this->installer = $installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller logic
|
||||
*
|
||||
* @return Response|StreamedResponse
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// @todo check that phpBB is not already installed
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'),
|
||||
));
|
||||
|
||||
// Set up input-output handler
|
||||
if ($this->request->is_ajax())
|
||||
{
|
||||
$this->iohandler_factory->set_environment('ajax');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->iohandler_factory->set_environment('nojs');
|
||||
}
|
||||
|
||||
// Set the appropriate input-output handler
|
||||
$this->installer->set_iohandler($this->iohandler_factory->get());
|
||||
|
||||
// Set up navigation
|
||||
$nav_data = $this->installer_config->get_navigation_data();
|
||||
/** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
|
||||
$iohandler = $this->iohandler_factory->get();
|
||||
|
||||
// Set active navigation stage
|
||||
if (isset($nav_data['active']) && is_array($nav_data['active']))
|
||||
{
|
||||
$iohandler->set_active_stage_menu($nav_data['active']);
|
||||
$this->menu_provider->set_nav_property($nav_data['active'], array(
|
||||
'selected' => true,
|
||||
'completed' => false,
|
||||
));
|
||||
}
|
||||
|
||||
// Set finished navigation stages
|
||||
if (isset($nav_data['finished']) && is_array($nav_data['finished']))
|
||||
{
|
||||
foreach ($nav_data['finished'] as $finished_stage)
|
||||
{
|
||||
$iohandler->set_finished_stage_menu($finished_stage);
|
||||
$this->menu_provider->set_nav_property($finished_stage, array(
|
||||
'selected' => false,
|
||||
'completed' => true,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->request->is_ajax())
|
||||
{
|
||||
$installer = $this->installer;
|
||||
$response = new StreamedResponse();
|
||||
$response->setCallback(function() use ($installer) {
|
||||
$installer->run();
|
||||
});
|
||||
|
||||
return $response;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Determine whether the installation was started or not
|
||||
if (true)
|
||||
{
|
||||
// Set active stage
|
||||
$this->menu_provider->set_nav_property(
|
||||
array('install', 0, 'introduction'),
|
||||
array(
|
||||
'selected' => true,
|
||||
'completed' => false,
|
||||
)
|
||||
);
|
||||
|
||||
// If not, let's render the welcome page
|
||||
$this->template->assign_vars(array(
|
||||
'SHOW_INSTALL_START_FORM' => true,
|
||||
'TITLE' => $this->language->lang('INSTALL_INTRO'),
|
||||
'CONTENT' => $this->language->lang('INSTALL_INTRO_BODY'),
|
||||
));
|
||||
return $this->controller_helper->render('installer_install.html', 'INSTALL');
|
||||
}
|
||||
|
||||
// @todo: implement no js controller logic
|
||||
}
|
||||
}
|
||||
}
|
79
phpBB/phpbb/install/controller/installer_index.php
Normal file
79
phpBB/phpbb/install/controller/installer_index.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\controller;
|
||||
|
||||
class installer_index
|
||||
{
|
||||
/**
|
||||
* @var helper
|
||||
*/
|
||||
protected $helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var \phpbb\template\template
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param helper $helper
|
||||
* @param \phpbb\language\language $language
|
||||
* @param \phpbb\template\template $template
|
||||
* @param string $phpbb_root_path
|
||||
*/
|
||||
public function __construct(helper $helper, \phpbb\language\language $language, \phpbb\template\template $template, $phpbb_root_path)
|
||||
{
|
||||
$this->helper = $helper;
|
||||
$this->language = $language;
|
||||
$this->template = $template;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
}
|
||||
|
||||
public function handle($mode)
|
||||
{
|
||||
switch ($mode)
|
||||
{
|
||||
case "intro":
|
||||
$title = $this->language->lang('INTRODUCTION_TITLE');
|
||||
$body = $this->language->lang('INTRODUCTION_BODY');
|
||||
break;
|
||||
case "support":
|
||||
$title = $this->language->lang('SUPPORT_TITLE');
|
||||
$body = $this->language->lang('SUPPORT_BODY');
|
||||
break;
|
||||
case "license":
|
||||
$title = $this->language->lang('LICENSE_TITLE');
|
||||
$body = implode("<br/>\n", file($this->phpbb_root_path . 'docs/LICENSE.txt'));
|
||||
break;
|
||||
}
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'TITLE' => $title,
|
||||
'BODY' => $body,
|
||||
));
|
||||
|
||||
return $this->helper->render('install_main.html', $title);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
/**
|
||||
* This exception should be thrown when
|
||||
*/
|
||||
class cannot_build_container_exception extends installer_exception
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
/**
|
||||
* Exception for the event when installer config is not writable to disk
|
||||
*/
|
||||
class installer_config_not_writable_exception extends installer_exception
|
||||
{
|
||||
|
||||
}
|
22
phpBB/phpbb/install/exception/installer_exception.php
Normal file
22
phpBB/phpbb/install/exception/installer_exception.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
/**
|
||||
* Installer's base exception
|
||||
*/
|
||||
class installer_exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
22
phpBB/phpbb/install/exception/invalid_dbms_exception.php
Normal file
22
phpBB/phpbb/install/exception/invalid_dbms_exception.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
/**
|
||||
* This exception should be thrown when
|
||||
*/
|
||||
class invalid_dbms_exception extends installer_exception
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
class invalid_service_name_exception extends installer_exception
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $params;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $error;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $error The name of the missing installer module
|
||||
* @param array $params Additional values for message translation
|
||||
*/
|
||||
public function __construct($error, $params = array())
|
||||
{
|
||||
$this->error = $error;
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language entry's name for the error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_error()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns parameters for the language entry, if there is any
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_params()
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true, if there are any parameters set
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has_params()
|
||||
{
|
||||
return (sizeof($this->params) !== 0);
|
||||
}
|
||||
}
|
42
phpBB/phpbb/install/exception/module_not_found_exception.php
Normal file
42
phpBB/phpbb/install/exception/module_not_found_exception.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
class module_not_found_exception extends installer_exception
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $module_service_name;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $module_service_name The name of the missing installer module
|
||||
*/
|
||||
public function __construct($module_service_name)
|
||||
{
|
||||
$this->module_service_name = $module_service_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the missing installer module's service name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_module_service_name()
|
||||
{
|
||||
return $this->module_service_name;
|
||||
}
|
||||
}
|
42
phpBB/phpbb/install/exception/task_not_found_exception.php
Normal file
42
phpBB/phpbb/install/exception/task_not_found_exception.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
class task_not_found_exception extends installer_exception
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $task_service_name;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $task_service_name The name of the missing installer module
|
||||
*/
|
||||
public function __construct($task_service_name)
|
||||
{
|
||||
$this->task_service_name = $task_service_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the missing installer task's service name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_task_service_name()
|
||||
{
|
||||
return $this->task_service_name;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\exception;
|
||||
|
||||
/**
|
||||
* This exception should be thrown when user interaction is inevitable
|
||||
*
|
||||
* Note: Please note that the output should already be setup for the user
|
||||
* when you use throw this exception
|
||||
*/
|
||||
class user_interaction_required_exception extends installer_exception
|
||||
{
|
||||
|
||||
}
|
351
phpBB/phpbb/install/helper/config.php
Normal file
351
phpBB/phpbb/install/helper/config.php
Normal file
@@ -0,0 +1,351 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper;
|
||||
|
||||
use phpbb\install\exception\installer_config_not_writable_exception;
|
||||
|
||||
/**
|
||||
* Stores common settings and installation status
|
||||
*/
|
||||
class config
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\filesystem\filesystem_interface
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* Array which contains config settings for the installer
|
||||
*
|
||||
* The array will also store all the user input, as well as any
|
||||
* data that is passed to other tasks by a task.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $installer_config;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $install_config_file;
|
||||
|
||||
/**
|
||||
* @var \phpbb\php\ini
|
||||
*/
|
||||
protected $php_ini;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* Array containing progress information
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $progress_data;
|
||||
|
||||
/**
|
||||
* Array containing system information
|
||||
*
|
||||
* The array contains run time and memory limitations.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $system_data;
|
||||
|
||||
/**
|
||||
* Array containing navigation bar information
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $navigation_data;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, \phpbb\php\ini $php_ini, $phpbb_root_path)
|
||||
{
|
||||
$this->filesystem = $filesystem;
|
||||
$this->php_ini = $php_ini;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
|
||||
// Set up data arrays
|
||||
$this->navigation_data = array();
|
||||
$this->installer_config = array();
|
||||
$this->system_data = array();
|
||||
$this->progress_data = array(
|
||||
'last_task_module_index' => 0,
|
||||
'last_task_module_name' => '', // Stores the service name of the latest finished module
|
||||
'last_task_index' => 0,
|
||||
'last_task_name' => '', // Stores the service name of the latest finished task
|
||||
'max_task_progress' => 0,
|
||||
'current_task_progress' => 0,
|
||||
);
|
||||
|
||||
$this->install_config_file = $this->phpbb_root_path . 'store/install_config.php';
|
||||
|
||||
$this->setup_system_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data for a specified parameter
|
||||
*
|
||||
* @param string $param_name Name of the parameter to return
|
||||
* @param mixed $default Default value to return when the specified data
|
||||
* does not exist.
|
||||
*
|
||||
* @return mixed value of the specified parameter or the default value if the data
|
||||
* cannot be recovered.
|
||||
*/
|
||||
public function get($param_name, $default = false)
|
||||
{
|
||||
return (isset($this->installer_config[$param_name])) ? $this->installer_config[$param_name] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a parameter in installer_config
|
||||
*
|
||||
* @param string $param_name Name of the parameter
|
||||
* @param mixed $value Values to set the parameter
|
||||
*/
|
||||
public function set($param_name, $value)
|
||||
{
|
||||
$this->installer_config = array_merge($this->installer_config, array(
|
||||
$param_name => $value,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns system parameter
|
||||
*
|
||||
* @param string $param_name Name of the parameter
|
||||
*
|
||||
* @return mixed Returns system parameter if it is defined, false otherwise
|
||||
*/
|
||||
public function system_get($param_name)
|
||||
{
|
||||
return (isset($this->system_data[$param_name])) ? $this->system_data[$param_name] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns remaining time until the run time limit
|
||||
*
|
||||
* @return int Remaining time until the run time limit in seconds
|
||||
*/
|
||||
public function get_time_remaining()
|
||||
{
|
||||
return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns remaining memory available for PHP
|
||||
*
|
||||
* @return int Remaining memory until reaching the limit
|
||||
*/
|
||||
public function get_memory_remaining()
|
||||
{
|
||||
if (function_exists('memory_get_usage'))
|
||||
{
|
||||
return ($this->system_data['memory_limit'] - memory_get_usage());
|
||||
}
|
||||
|
||||
// If we cannot get the information then just return a positive number (and cross fingers)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the latest executed task
|
||||
*
|
||||
* @param string $task_service_name Name of the installer task service
|
||||
* @param int $task_index Index of the task in the task list array
|
||||
*/
|
||||
public function set_finished_task($task_service_name, $task_index)
|
||||
{
|
||||
$this->progress_data['last_task_name'] = $task_service_name;
|
||||
$this->progress_data['last_task_index'] = $task_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active module
|
||||
*
|
||||
* @param string $module_service_name Name of the installer module service
|
||||
* @param int $module_index Index of the module in the module list array
|
||||
*/
|
||||
public function set_active_module($module_service_name, $module_index)
|
||||
{
|
||||
$this->progress_data['last_task_module_name'] = $module_service_name;
|
||||
$this->progress_data['last_task_module_index'] = $module_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for progress data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_progress_data()
|
||||
{
|
||||
return $this->progress_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recovers install configuration from file
|
||||
*/
|
||||
public function load_config()
|
||||
{
|
||||
if (!$this->filesystem->exists($this->install_config_file))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$file_content = @file_get_contents($this->install_config_file);
|
||||
$serialized_data = trim(substr($file_content, 8));
|
||||
$unserialized_data = unserialize($serialized_data);
|
||||
|
||||
$this->installer_config = $unserialized_data['installer_config'];
|
||||
$this->progress_data = $unserialized_data['progress_data'];
|
||||
$this->navigation_data = $unserialized_data['navigation_data'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps install configuration to disk
|
||||
*/
|
||||
public function save_config()
|
||||
{
|
||||
// Create array to save
|
||||
$save_array = array(
|
||||
'installer_config' => $this->installer_config,
|
||||
'progress_data' => $this->progress_data,
|
||||
'navigation_data' => $this->navigation_data,
|
||||
);
|
||||
|
||||
// Create file content
|
||||
$file_content = '<?php // ';
|
||||
$file_content .= serialize($save_array);
|
||||
$file_content .= "\n";
|
||||
|
||||
// Dump file_content to disk
|
||||
$fp = @fopen($this->install_config_file, 'w');
|
||||
if (!$fp)
|
||||
{
|
||||
throw new installer_config_not_writable_exception();
|
||||
}
|
||||
|
||||
fwrite($fp, $file_content);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the task progress
|
||||
*
|
||||
* @param int $increment_by The amount to increment by
|
||||
*/
|
||||
public function increment_current_task_progress($increment_by = 1)
|
||||
{
|
||||
$this->progress_data['current_task_progress'] += $increment_by;
|
||||
|
||||
if ($this->progress_data['current_task_progress'] > $this->progress_data['max_task_progress'])
|
||||
{
|
||||
$this->progress_data['current_task_progress'] = $this->progress_data['max_task_progress'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the task progress to a specific number
|
||||
*
|
||||
* @param int $task_progress The task progress number to be set
|
||||
*/
|
||||
public function set_current_task_progress($task_progress)
|
||||
{
|
||||
$this->progress_data['current_task_progress'] = $task_progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of tasks belonging to the installer in the current mode.
|
||||
*
|
||||
* @param int $task_progress_count Number of tasks
|
||||
*/
|
||||
public function set_task_progress_count($task_progress_count)
|
||||
{
|
||||
$this->progress_data['max_task_progress'] = $task_progress_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of the current task being executed
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_current_task_progress()
|
||||
{
|
||||
return $this->progress_data['current_task_progress'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of tasks belonging to the installer in the current mode.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_task_progress_count()
|
||||
{
|
||||
return $this->progress_data['max_task_progress'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks stage as completed in the navigation bar
|
||||
*
|
||||
* @param array $nav_path Array to the navigation elem
|
||||
*/
|
||||
public function set_finished_navigation_stage($nav_path)
|
||||
{
|
||||
$this->navigation_data['finished'][] = $nav_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks stage as active in the navigation bar
|
||||
*
|
||||
* @param array $nav_path Array to the navigation elem
|
||||
*/
|
||||
public function set_active_navigation_stage($nav_path)
|
||||
{
|
||||
$this->navigation_data['active'] = $nav_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns navigation data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_navigation_data()
|
||||
{
|
||||
return $this->navigation_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filling up system_data array
|
||||
*/
|
||||
protected function setup_system_data()
|
||||
{
|
||||
// Query maximum runtime from php.ini
|
||||
$execution_time = $this->php_ini->get_int('max_execution_time');
|
||||
$execution_time = min(15, $execution_time / 2);
|
||||
$this->system_data['max_execution_time'] = $execution_time;
|
||||
|
||||
// Set start time
|
||||
$this->system_data['start_time'] = time();
|
||||
|
||||
// Get memory limit
|
||||
$this->system_data['memory_limit'] = $this->php_ini->get_bytes('memory_limit');
|
||||
}
|
||||
}
|
149
phpBB/phpbb/install/helper/container_factory.php
Normal file
149
phpBB/phpbb/install/helper/container_factory.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper;
|
||||
|
||||
use phpbb\install\exception\cannot_build_container_exception;
|
||||
|
||||
class container_factory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* @var \phpbb\request\request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* The full phpBB container
|
||||
*
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\request\request $request Request interface
|
||||
* @param string $phpbb_root_path Path to phpBB's root
|
||||
* @param string $php_ext Extension of PHP files
|
||||
*/
|
||||
public function __construct(\phpbb\request\request $request, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->container = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Container getter
|
||||
*
|
||||
* @param null|string $service_name Name of the service to return
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\ContainerInterface|Object phpBB's dependency injection container
|
||||
* or the service specified in $service_name
|
||||
*
|
||||
* @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built
|
||||
* @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException If the service is not defined
|
||||
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException When a circular reference is detected
|
||||
* @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException When the service is not defined
|
||||
*/
|
||||
public function get($service_name = null)
|
||||
{
|
||||
// Check if container was built, if not try to build it
|
||||
if ($this->container === null)
|
||||
{
|
||||
// Check whether container can be built
|
||||
// We need config.php for that so let's check if it has been set up yet
|
||||
if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext))
|
||||
{
|
||||
$this->build_container();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new cannot_build_container_exception();
|
||||
}
|
||||
}
|
||||
|
||||
return ($service_name === null) ? $this->container : $this->container->get($service_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the specified parameter from the container
|
||||
*
|
||||
* @param string $param_name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_parameter($param_name)
|
||||
{
|
||||
return $this->container->getParameter($param_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build dependency injection container
|
||||
*/
|
||||
protected function build_container()
|
||||
{
|
||||
// If the container has been already built just return.
|
||||
// Although this should never happen
|
||||
if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext);
|
||||
$phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext);
|
||||
|
||||
// For BC with functions that we need during install
|
||||
global $phpbb_container;
|
||||
|
||||
$disable_super_globals = $this->request->super_globals_disabled();
|
||||
|
||||
// This is needed because container_builder::get_env_parameters() uses $_SERVER
|
||||
if ($disable_super_globals)
|
||||
{
|
||||
$this->request->enable_super_globals();
|
||||
}
|
||||
|
||||
$this->container = $phpbb_container = $phpbb_container_builder
|
||||
->with_config($phpbb_config_php_file)
|
||||
->without_cache()
|
||||
->without_compiled_container()
|
||||
->get_container();
|
||||
|
||||
// Setting request is required for the compatibility globals as those are generated from
|
||||
// this container
|
||||
$this->container->register('request')->setSynthetic(true);
|
||||
$this->container->set('request', $this->request);
|
||||
$this->container->compile();
|
||||
|
||||
// Restore super globals to previous state
|
||||
if ($disable_super_globals)
|
||||
{
|
||||
$this->request->disable_super_globals();
|
||||
}
|
||||
|
||||
// Get compatibilty globals
|
||||
require ($this->phpbb_root_path . 'includes/compatibility_globals.' . $this->php_ext);
|
||||
}
|
||||
}
|
459
phpBB/phpbb/install/helper/database.php
Normal file
459
phpBB/phpbb/install/helper/database.php
Normal file
@@ -0,0 +1,459 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper;
|
||||
|
||||
use phpbb\install\exception\invalid_dbms_exception;
|
||||
|
||||
/**
|
||||
* Database related general functionality for installer
|
||||
*/
|
||||
class database
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\filesystem\filesystem_interface
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $supported_dbms;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem interface
|
||||
* @param string $phpbb_root_path Path to phpBB's root
|
||||
*/
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
|
||||
{
|
||||
$this->filesystem = $filesystem;
|
||||
|
||||
// DBMS supported by phpBB
|
||||
$this->supported_dbms = array(
|
||||
// Note: php 5.5 alpha 2 deprecated mysql.
|
||||
// Keep mysqli before mysql in this list.
|
||||
'mysqli' => array(
|
||||
'LABEL' => 'MySQL with MySQLi Extension',
|
||||
'SCHEMA' => 'mysql_41',
|
||||
'MODULE' => 'mysqli',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'phpbb\db\driver\mysqli',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
'mysql' => array(
|
||||
'LABEL' => 'MySQL',
|
||||
'SCHEMA' => 'mysql',
|
||||
'MODULE' => 'mysql',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'phpbb\db\driver\mysql',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
'mssql' => array(
|
||||
'LABEL' => 'MS SQL Server 2000+',
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'mssql',
|
||||
'DELIM' => 'GO',
|
||||
'DRIVER' => 'phpbb\db\driver\mssql',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
'mssql_odbc'=> array(
|
||||
'LABEL' => 'MS SQL Server [ ODBC ]',
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'odbc',
|
||||
'DELIM' => 'GO',
|
||||
'DRIVER' => 'phpbb\db\driver\mssql_odbc',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
'mssqlnative' => array(
|
||||
'LABEL' => 'MS SQL Server 2005+ [ Native ]',
|
||||
'SCHEMA' => 'mssql',
|
||||
'MODULE' => 'sqlsrv',
|
||||
'DELIM' => 'GO',
|
||||
'DRIVER' => 'phpbb\db\driver\mssqlnative',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
'oracle' => array(
|
||||
'LABEL' => 'Oracle',
|
||||
'SCHEMA' => 'oracle',
|
||||
'MODULE' => 'oci8',
|
||||
'DELIM' => '/',
|
||||
'DRIVER' => 'phpbb\db\driver\oracle',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
'postgres' => array(
|
||||
'LABEL' => 'PostgreSQL 8.3+',
|
||||
'SCHEMA' => 'postgres',
|
||||
'MODULE' => 'pgsql',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'phpbb\db\driver\postgres',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => true,
|
||||
),
|
||||
'sqlite' => array(
|
||||
'LABEL' => 'SQLite',
|
||||
'SCHEMA' => 'sqlite',
|
||||
'MODULE' => 'sqlite',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'phpbb\db\driver\sqlite',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
'sqlite3' => array(
|
||||
'LABEL' => 'SQLite3',
|
||||
'SCHEMA' => 'sqlite',
|
||||
'MODULE' => 'sqlite3',
|
||||
'DELIM' => ';',
|
||||
'DRIVER' => 'phpbb\db\driver\sqlite3',
|
||||
'AVAILABLE' => true,
|
||||
'2.0.x' => false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of available DBMS supported by phpBB
|
||||
*
|
||||
* If a DBMS is specified it will only return data for that DBMS
|
||||
* and will load its extension if necessary.
|
||||
*
|
||||
* @param mixed $dbms name of the DBMS that's info is required or false for all DBMS info
|
||||
* @param bool $return_unavailable set it to true if you expect unavailable but supported DBMS
|
||||
* returned as well
|
||||
* @param bool $only_20x_options set it to true if you only want to recover 2.0.x options
|
||||
*
|
||||
* @return array Array of available and supported DBMS
|
||||
*/
|
||||
public function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false)
|
||||
{
|
||||
$available_dbms = $this->supported_dbms;
|
||||
|
||||
if ($dbms)
|
||||
{
|
||||
if (isset($this->supported_dbms[$dbms]))
|
||||
{
|
||||
$available_dbms = array($dbms => $this->supported_dbms[$dbms]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
$any_dbms_available = false;
|
||||
foreach ($available_dbms as $db_name => $db_array)
|
||||
{
|
||||
if ($only_20x_options && !$db_array['2.0.x'])
|
||||
{
|
||||
if ($return_unavailable)
|
||||
{
|
||||
$available_dbms[$db_name]['AVAILABLE'] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($available_dbms[$db_name]);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$dll = $db_array['MODULE'];
|
||||
if (!@extension_loaded($dll))
|
||||
{
|
||||
if ($return_unavailable)
|
||||
{
|
||||
$available_dbms[$db_name]['AVAILABLE'] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($available_dbms[$db_name]);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$any_dbms_available = true;
|
||||
}
|
||||
|
||||
if ($return_unavailable)
|
||||
{
|
||||
$available_dbms['ANY_DB_SUPPORT'] = $any_dbms_available;
|
||||
}
|
||||
|
||||
return $available_dbms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes "/* style" as well as "# style" comments from $input.
|
||||
*
|
||||
* @param string $sql_query Input string
|
||||
*
|
||||
* @return string Input string with comments removed
|
||||
*/
|
||||
public function remove_comments($sql_query)
|
||||
{
|
||||
// Remove /* */ comments (http://ostermiller.org/findcomment.html)
|
||||
$sql_query = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql_query);
|
||||
|
||||
// Remove # style comments
|
||||
$sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query));
|
||||
|
||||
return $sql_query;
|
||||
}
|
||||
|
||||
/**
|
||||
* split_sql_file() will split an uploaded sql file into single sql statements.
|
||||
*
|
||||
* Note: expects trim() to have already been run on $sql.
|
||||
*
|
||||
* @param string $sql SQL statements
|
||||
* @param string $delimiter Delimiter between sql statements
|
||||
*
|
||||
* @return array Array of sql statements
|
||||
*/
|
||||
public function split_sql_file($sql, $delimiter)
|
||||
{
|
||||
$sql = str_replace("\r" , '', $sql);
|
||||
$data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
|
||||
|
||||
$data = array_map('trim', $data);
|
||||
|
||||
// The empty case
|
||||
$end_data = end($data);
|
||||
|
||||
if (empty($end_data))
|
||||
{
|
||||
unset($data[key($data)]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates table prefix
|
||||
*
|
||||
* @param string $dbms The selected dbms
|
||||
* @param string $table_prefix The table prefix to validate
|
||||
*
|
||||
* @return bool|array true if table prefix is valid, array of errors otherwise
|
||||
*
|
||||
* @throws \phpbb\install\exception\invalid_dbms_exception When $dbms is not a valid
|
||||
*/
|
||||
public function validate_table_prefix($dbms, $table_prefix)
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
if (!preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $table_prefix))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_INVALID_PREFIX',
|
||||
);
|
||||
}
|
||||
|
||||
// Do dbms specific checks
|
||||
$dbms_info = $this->get_available_dbms($dbms);
|
||||
switch ($dbms_info[$dbms]['SCHEMA'])
|
||||
{
|
||||
case 'mysql':
|
||||
case 'mysql_41':
|
||||
$prefix_length = 36;
|
||||
break;
|
||||
case 'mssql':
|
||||
$prefix_length = 90;
|
||||
break;
|
||||
case 'oracle':
|
||||
$prefix_length = 6;
|
||||
break;
|
||||
case 'postgres':
|
||||
$prefix_length = 36;
|
||||
break;
|
||||
case 'sqlite':
|
||||
$prefix_length = 200;
|
||||
break;
|
||||
default:
|
||||
throw new invalid_dbms_exception();
|
||||
break;
|
||||
}
|
||||
|
||||
// Check the prefix length to ensure that index names are not too long
|
||||
if (strlen($table_prefix) > $prefix_length)
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => array('INST_ERR_PREFIX_TOO_LONG', $prefix_length),
|
||||
);
|
||||
}
|
||||
|
||||
return (empty($errors)) ? true : $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user provided database parameters are correct
|
||||
*
|
||||
* This function checks the database connection data and also checks for
|
||||
* any other problems that could cause an error during the installation
|
||||
* such as if there is any database table names conflicting.
|
||||
*
|
||||
* Note: The function assumes that $table_prefix has been already validated
|
||||
* with validate_table_prefix().
|
||||
*
|
||||
* @param string $dbms Selected database type
|
||||
* @param string $dbhost Database host address
|
||||
* @param int $dbport Database port number
|
||||
* @param string $dbuser Database username
|
||||
* @param string $dbpass Database password
|
||||
* @param string $dbname Database name
|
||||
* @param string $table_prefix Database table prefix
|
||||
*
|
||||
* @return array|bool Returns true if test is successful, array of errors otherwise
|
||||
*/
|
||||
public function check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix)
|
||||
{
|
||||
$dbms_info = $this->get_available_dbms($dbms);
|
||||
$dbms_info = $dbms_info[$dbms];
|
||||
$errors = array();
|
||||
|
||||
// Instantiate it and set return on error true
|
||||
/** @var \phpbb\db\driver\driver_interface $db */
|
||||
$db = new $dbms_info['DRIVER'];
|
||||
$db->sql_return_on_error(true);
|
||||
|
||||
// Check that we actually have a database name before going any further
|
||||
if (!in_array($dbms_info['SCHEMA'], array('sqlite', 'oracle')) && $dbname === '')
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_NAME',
|
||||
);
|
||||
}
|
||||
|
||||
// Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
|
||||
if ($dbms_info['SCHEMA'] === 'sqlite'
|
||||
&& stripos($this->filesystem->realpath($dbhost), $this->filesystem->realpath($this->phpbb_root_path) === 0))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' =>'INST_ERR_DB_FORUM_PATH',
|
||||
);
|
||||
}
|
||||
|
||||
// Try to connect to db
|
||||
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, false, true)))
|
||||
{
|
||||
$db_error = $db->sql_error();
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_CONNECT',
|
||||
'description' => ($db_error['message']) ? utf8_convert_message($db_error['message']) : 'INST_ERR_DB_NO_ERROR',
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check if there is any table name collisions
|
||||
$temp_prefix = strtolower($table_prefix);
|
||||
$table_ary = array(
|
||||
$temp_prefix . 'attachments',
|
||||
$temp_prefix . 'config',
|
||||
$temp_prefix . 'sessions',
|
||||
$temp_prefix . 'topics',
|
||||
$temp_prefix . 'users',
|
||||
);
|
||||
|
||||
$db_tools_factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $db_tools_factory->get($db);
|
||||
$tables = $db_tools->sql_list_tables();
|
||||
$tables = array_map('strtolower', $tables);
|
||||
$table_intersect = array_intersect($tables, $table_ary);
|
||||
|
||||
if (sizeof($table_intersect))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_PREFIX',
|
||||
);
|
||||
}
|
||||
|
||||
// Check if database version is supported
|
||||
switch ($dbms)
|
||||
{
|
||||
case 'mysqli':
|
||||
if (version_compare(mysqli_get_server_info($db->get_db_connect_id()), '4.1.3', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_MYSQLI',
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'sqlite':
|
||||
if (version_compare(sqlite_libversion(), '2.8.2', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_SQLITE',
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'sqlite3':
|
||||
$version = \SQLite3::version();
|
||||
if (version_compare($version['versionString'], '3.6.15', '<'))
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_SQLITE3',
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'oracle':
|
||||
$sql = "SELECT *
|
||||
FROM NLS_DATABASE_PARAMETERS
|
||||
WHERE PARAMETER = 'NLS_RDBMS_VERSION'
|
||||
OR PARAMETER = 'NLS_CHARACTERSET'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$stats[$row['parameter']] = $row['value'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8')
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_ORACLE',
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'postgres':
|
||||
$sql = "SHOW server_encoding;";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
|
||||
{
|
||||
$errors[] = array(
|
||||
'title' => 'INST_ERR_DB_NO_POSTGRES',
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (empty($errors)) ? true : $errors;
|
||||
}
|
||||
}
|
272
phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
Normal file
272
phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
Normal file
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\iohandler;
|
||||
|
||||
/**
|
||||
* Input-Output handler for the AJAX frontend
|
||||
*/
|
||||
class ajax_iohandler extends iohandler_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\request\request_interface
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var \phpbb\template\template
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $form;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $request_client_refresh;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $nav_data;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\request\request_interface $request HTTP request interface
|
||||
* @param \phpbb\template\template $template Template engine
|
||||
*/
|
||||
public function __construct(\phpbb\request\request_interface $request, \phpbb\template\template $template)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->form = '';
|
||||
$this->nav_data = array();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_input($name, $default, $multibyte = false)
|
||||
{
|
||||
return $this->request->variable($name, $default, $multibyte);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_server_variable($name, $default = '')
|
||||
{
|
||||
return $this->request->server($name, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_header_variable($name, $default = '')
|
||||
{
|
||||
return $this->request->header($name, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function is_secure()
|
||||
{
|
||||
return $this->request->is_secure();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add_user_form_group($title, $form)
|
||||
{
|
||||
//
|
||||
// This code is pretty ugly... but works
|
||||
//
|
||||
|
||||
$this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form));
|
||||
|
||||
$this->template->assign_block_vars('options', array(
|
||||
'LEGEND' => $this->language->lang($title),
|
||||
'S_LEGEND' => true,
|
||||
));
|
||||
|
||||
foreach ($form as $input_name => $input_options)
|
||||
{
|
||||
if (!isset($input_options['type']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$tpl_ary = array();
|
||||
|
||||
$tpl_ary['TYPE'] = $input_options['type'];
|
||||
$tpl_ary['TITLE'] = $this->language->lang($input_options['label']);
|
||||
$tpl_ary['KEY'] = $input_name;
|
||||
$tpl_ary['S_EXPLAIN'] = false;
|
||||
|
||||
if (isset($input_options['default']))
|
||||
{
|
||||
$default = $input_options['default'];
|
||||
$default = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', array($this, 'lang_replace_callback'), $default);
|
||||
$tpl_ary['DEFAULT'] = $default;
|
||||
}
|
||||
|
||||
if (isset($input_options['description']))
|
||||
{
|
||||
$tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']);
|
||||
$tpl_ary['S_EXPLAIN'] = true;
|
||||
}
|
||||
|
||||
if (in_array($input_options['type'], array('select', 'radio')))
|
||||
{
|
||||
for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++)
|
||||
{
|
||||
if (isset($input_options['options'][$i]['label']))
|
||||
{
|
||||
$input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']);
|
||||
}
|
||||
}
|
||||
|
||||
$tpl_ary['OPTIONS'] = $input_options['options'];
|
||||
}
|
||||
|
||||
$this->template->assign_block_vars('options', $tpl_ary);
|
||||
}
|
||||
|
||||
$this->template->set_filenames(array(
|
||||
'form_install' => 'installer_form.html',
|
||||
));
|
||||
|
||||
$this->form = $this->template->assign_display('form_install');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send_response()
|
||||
{
|
||||
$json_data_array = $this->prepare_json_array();
|
||||
$json_data = json_encode($json_data_array);
|
||||
|
||||
// Try to push content to the browser
|
||||
print (str_pad(' ', 4096) . "\n");
|
||||
print ($json_data . "\n\n");
|
||||
flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares iohandler's data to be sent out to the client.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function prepare_json_array()
|
||||
{
|
||||
$json_array = array(
|
||||
'errors' => $this->errors,
|
||||
'warnings' => $this->warnings,
|
||||
'logs' => $this->logs,
|
||||
);
|
||||
|
||||
if (!empty($this->form))
|
||||
{
|
||||
$json_array['form'] = $this->form;
|
||||
$this->form = '';
|
||||
}
|
||||
|
||||
// If current task name is set, we push progress message to the client side
|
||||
if (!empty($this->current_task_name))
|
||||
{
|
||||
$json_array['progress'] = array(
|
||||
'task_name' => $this->current_task_name,
|
||||
'task_num' => $this->current_task_progress,
|
||||
'task_count' => $this->task_progress_count,
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($this->nav_data))
|
||||
{
|
||||
$json_array['nav'] = $this->nav_data;
|
||||
}
|
||||
|
||||
$this->errors = array();
|
||||
$this->warnings = array();
|
||||
$this->logs = array();
|
||||
$this->nav_data = array();
|
||||
|
||||
if ($this->request_client_refresh)
|
||||
{
|
||||
$json_array['refresh'] = true;
|
||||
$this->request_client_refresh = false;
|
||||
}
|
||||
|
||||
return $json_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_progress($task_lang_key, $task_number)
|
||||
{
|
||||
parent::set_progress($task_lang_key, $task_number);
|
||||
$this->send_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function request_refresh()
|
||||
{
|
||||
$this->request_client_refresh = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_active_stage_menu($menu_path)
|
||||
{
|
||||
$this->nav_data['active'] = $menu_path[sizeof($menu_path) - 1];
|
||||
$this->send_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_finished_stage_menu($menu_path)
|
||||
{
|
||||
$this->nav_data['finished'][] = $menu_path[sizeof($menu_path) - 1];
|
||||
$this->send_response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function for language replacing
|
||||
*
|
||||
* @param array $matches
|
||||
* @return string
|
||||
*/
|
||||
public function lang_replace_callback($matches)
|
||||
{
|
||||
if (!empty($matches[1]))
|
||||
{
|
||||
return $this->language->lang($matches[1]);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\iohandler\exception;
|
||||
|
||||
class iohandler_not_implemented_exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
76
phpBB/phpbb/install/helper/iohandler/factory.php
Normal file
76
phpBB/phpbb/install/helper/iohandler/factory.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\iohandler;
|
||||
|
||||
use phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception;
|
||||
|
||||
/**
|
||||
* Input-output handler factory
|
||||
*/
|
||||
class factory
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $environment;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container Dependency injection container
|
||||
*/
|
||||
public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->environment = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $environment The name of the input-output handler to use
|
||||
*/
|
||||
public function set_environment($environment)
|
||||
{
|
||||
$this->environment = $environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory getter for iohandler
|
||||
*
|
||||
* @return \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*
|
||||
* @throws \phpbb\install\helper\iohandler\exception\iohandler_not_implemented_exception
|
||||
* When the specified iohandler_interface does not exists
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
switch ($this->environment)
|
||||
{
|
||||
case 'ajax':
|
||||
return $this->container->get('installer.helper.iohandler_ajax');
|
||||
break;
|
||||
case 'nojs':
|
||||
// @todo replace this
|
||||
return $this->container->get('installer.helper.iohandler_ajax');
|
||||
break;
|
||||
default:
|
||||
throw new iohandler_not_implemented_exception();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
158
phpBB/phpbb/install/helper/iohandler/iohandler_base.php
Normal file
158
phpBB/phpbb/install/helper/iohandler/iohandler_base.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\iohandler;
|
||||
|
||||
/**
|
||||
* Base class for installer input-output handlers
|
||||
*/
|
||||
abstract class iohandler_base implements iohandler_interface
|
||||
{
|
||||
/**
|
||||
* Array of errors
|
||||
*
|
||||
* Errors should be added, when the installation cannot continue without
|
||||
* user interaction. If the aim is to notify the user about something, please
|
||||
* use a warning instead.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $errors;
|
||||
|
||||
/**
|
||||
* Array of warnings
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $warnings;
|
||||
|
||||
/**
|
||||
* Array of logs
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $logs;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $task_progress_count;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $current_task_progress;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $current_task_name;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->errors = array();
|
||||
$this->warnings = array();
|
||||
$this->logs = array();
|
||||
|
||||
$this->task_progress_count = 0;
|
||||
$this->current_task_progress = 0;
|
||||
$this->current_task_name = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language service
|
||||
*
|
||||
* @param \phpbb\language\language $language
|
||||
*/
|
||||
public function set_language(\phpbb\language\language $language)
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add_error_message($error_title, $error_description = false)
|
||||
{
|
||||
$this->errors[] = $this->translate_message($error_title, $error_description);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add_warning_message($warning_title, $warning_description = false)
|
||||
{
|
||||
$this->warnings[] = $this->translate_message($warning_title, $warning_description);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add_log_message($log_title, $log_description = false)
|
||||
{
|
||||
$this->logs[] = $this->translate_message($log_title, $log_description);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_task_count($task_count)
|
||||
{
|
||||
$this->task_progress_count = $task_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set_progress($task_lang_key, $task_number)
|
||||
{
|
||||
if (!empty($task_lang_key))
|
||||
{
|
||||
$this->current_task_name = $this->language->lang($task_lang_key);
|
||||
$this->current_task_progress = $task_number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Localize message.
|
||||
*
|
||||
* Note: When an array is passed into the parameters below, it will be
|
||||
* resolved as printf($param[0], $param[1], ...).
|
||||
*
|
||||
* @param array|string $title Title of the message
|
||||
* @param array|string|bool $description Description of the message
|
||||
*
|
||||
* @return array Localized message in an array
|
||||
*/
|
||||
protected function translate_message($title, $description)
|
||||
{
|
||||
$message_array = array();
|
||||
|
||||
$message_array['title'] = call_user_func_array(array($this->language, 'lang'), (array) $title);
|
||||
|
||||
if ($description !== false)
|
||||
{
|
||||
$message_array['description'] = call_user_func_array(array($this->language, 'lang'), (array) $description);
|
||||
}
|
||||
|
||||
return $message_array;
|
||||
}
|
||||
}
|
145
phpBB/phpbb/install/helper/iohandler/iohandler_interface.php
Normal file
145
phpBB/phpbb/install/helper/iohandler/iohandler_interface.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\iohandler;
|
||||
|
||||
/**
|
||||
* Input-Output handler interface for the installer
|
||||
*/
|
||||
interface iohandler_interface
|
||||
{
|
||||
/**
|
||||
* Renders or returns response message
|
||||
*/
|
||||
public function send_response();
|
||||
|
||||
/**
|
||||
* Returns input variable
|
||||
*
|
||||
* @param string $name Name of the input variable to obtain
|
||||
* @param mixed $default A default value that is returned if the variable was not set.
|
||||
* This function will always return a value of the same type as the default.
|
||||
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
||||
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
||||
*
|
||||
* @return mixed Value of the input variable
|
||||
*/
|
||||
public function get_input($name, $default, $multibyte = false);
|
||||
|
||||
/**
|
||||
* Returns server variable
|
||||
*
|
||||
* This function should work the same as request_interterface::server().
|
||||
*
|
||||
* @param string $name Name of the server variable
|
||||
* @param mixed $default Default value to return when the requested variable does not exist
|
||||
*
|
||||
* @return mixed Value of the server variable
|
||||
*/
|
||||
public function get_server_variable($name, $default = '');
|
||||
|
||||
/**
|
||||
* Wrapper function for request_interterface::header()
|
||||
*
|
||||
* @param string $name Name of the request header variable
|
||||
* @param mixed $default Default value to return when the requested variable does not exist
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_header_variable($name, $default = '');
|
||||
|
||||
/**
|
||||
* Returns true if the connection is encrypted
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_secure();
|
||||
|
||||
/**
|
||||
* Adds an error message to the rendering queue
|
||||
*
|
||||
* Note: When an array is passed into the parameters below, it will be
|
||||
* resolved as printf($param[0], $param[1], ...).
|
||||
*
|
||||
* @param string|array $error_title Title of the error message.
|
||||
* @param string|bool|array $error_description Description of the error (and possibly guidelines to resolve it),
|
||||
* or false if the error description is not available.
|
||||
*/
|
||||
public function add_error_message($error_title, $error_description = false);
|
||||
|
||||
/**
|
||||
* Adds a warning message to the rendering queue
|
||||
*
|
||||
* Note: When an array is passed into the parameters below, it will be
|
||||
* resolved as printf($param[0], $param[1], ...).
|
||||
*
|
||||
* @param string|array $warning_title Title of the warning message
|
||||
* @param string|bool|array $warning_description Description of the warning (and possibly guidelines to resolve it),
|
||||
* or false if the error description is not available
|
||||
*/
|
||||
public function add_warning_message($warning_title, $warning_description = false);
|
||||
|
||||
/**
|
||||
* Adds a log message to the rendering queue
|
||||
*
|
||||
* Note: When an array is passed into the parameters below, it will be
|
||||
* resolved as printf($param[0], $param[1], ...).
|
||||
*
|
||||
* @param string|array $log_title Title of the log message
|
||||
* @param string|bool|array $log_description Description of the log (and possibly guidelines to resolve it),
|
||||
* or false if the error description is not available
|
||||
*/
|
||||
public function add_log_message($log_title, $log_description = false);
|
||||
|
||||
/**
|
||||
* Adds a requested data group to the rendering queue
|
||||
*
|
||||
* @param string $title Language variable with the title of the form
|
||||
* @param array $form An array describing the required data (options etc)
|
||||
*/
|
||||
public function add_user_form_group($title, $form);
|
||||
|
||||
/**
|
||||
* Sets the number of tasks belonging to the installer in the current mode.
|
||||
*
|
||||
* @param int $task_count Number of tasks
|
||||
*/
|
||||
public function set_task_count($task_count);
|
||||
|
||||
/**
|
||||
* Sets the progress information
|
||||
*
|
||||
* @param string $task_lang_key Language key for the name of the task
|
||||
* @param int $task_number Position of the current task in the task queue
|
||||
*/
|
||||
public function set_progress($task_lang_key, $task_number);
|
||||
|
||||
/**
|
||||
* Sends refresh request to the client
|
||||
*/
|
||||
public function request_refresh();
|
||||
|
||||
/**
|
||||
* Marks stage as active in the navigation bar
|
||||
*
|
||||
* @param array $menu_path Array to the navigation elem
|
||||
*/
|
||||
public function set_active_stage_menu($menu_path);
|
||||
|
||||
/**
|
||||
* Marks stage as completed in the navigation bar
|
||||
*
|
||||
* @param array $menu_path Array to the navigation elem
|
||||
*/
|
||||
public function set_finished_stage_menu($menu_path);
|
||||
}
|
50
phpBB/phpbb/install/helper/navigation/install_navigation.php
Normal file
50
phpBB/phpbb/install/helper/navigation/install_navigation.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\navigation;
|
||||
|
||||
class install_navigation implements navigation_interface
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
return array(
|
||||
'install' => array(
|
||||
'label' => 'INSTALL',
|
||||
'route' => 'phpbb_installer_install',
|
||||
'order' => 1,
|
||||
array(
|
||||
'introduction' => array(
|
||||
'label' => 'INTRODUCTION_TITLE',
|
||||
'stage' => true,
|
||||
'order' => 0,
|
||||
),
|
||||
'requirements' => array(
|
||||
'label' => 'STAGE_REQUIREMENTS',
|
||||
'stage' => true,
|
||||
'order' => 1,
|
||||
),
|
||||
'obtain_data' => array(
|
||||
'label' => 'STAGE_OBTAIN_DATA',
|
||||
'stage' => true,
|
||||
'order' => 2,
|
||||
),
|
||||
'install' => array(
|
||||
'label' => 'STAGE_INSTALL',
|
||||
'stage' => true,
|
||||
'order' => 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
45
phpBB/phpbb/install/helper/navigation/main_navigation.php
Normal file
45
phpBB/phpbb/install/helper/navigation/main_navigation.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\navigation;
|
||||
|
||||
class main_navigation implements navigation_interface
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
return array(
|
||||
'overview' => array(
|
||||
'label' => 'MENU_OVERVIEW',
|
||||
'route' => 'phpbb_installer_index',
|
||||
'order' => 0,
|
||||
array(
|
||||
'introduction' => array(
|
||||
'label' => 'MENU_INTRO',
|
||||
'route' => 'phpbb_installer_index',
|
||||
'order' => 0,
|
||||
),
|
||||
'support' => array(
|
||||
'label' => 'MENU_SUPPORT',
|
||||
'route' => 'phpbb_installer_support',
|
||||
'order' => 1,
|
||||
),
|
||||
'license' => array(
|
||||
'label' => 'MENU_LICENSE',
|
||||
'route' => 'phpbb_installer_license',
|
||||
'order' => 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\navigation;
|
||||
|
||||
/**
|
||||
* Interface for installer's navigation defining services
|
||||
*/
|
||||
interface navigation_interface
|
||||
{
|
||||
/**
|
||||
* Returns an array with the navigation items
|
||||
*
|
||||
* The returned array should have the following format:
|
||||
* <code>
|
||||
* array(
|
||||
* 'parent_nav_name' => array(
|
||||
* 'nav_name' => array(
|
||||
* 'label' => 'MY_MENU',
|
||||
* 'route' => 'phpbb_route_name',
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* </code>
|
||||
*
|
||||
* Navigation item setting options:
|
||||
* - label: The language variable name
|
||||
* - route: Name of the route which it is belongs to
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get();
|
||||
}
|
115
phpBB/phpbb/install/helper/navigation/navigation_provider.php
Normal file
115
phpBB/phpbb/install/helper/navigation/navigation_provider.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\helper\navigation;
|
||||
|
||||
use phpbb\di\service_collection;
|
||||
|
||||
/**
|
||||
* Installers navigation provider
|
||||
*/
|
||||
class navigation_provider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $menu_collection;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param service_collection $plugins
|
||||
*/
|
||||
public function __construct(service_collection $plugins)
|
||||
{
|
||||
$this->menu_collection = array();
|
||||
|
||||
foreach ($plugins as $plugin => $plugin_instance)
|
||||
{
|
||||
$this->register($plugin_instance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns navigation array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this->menu_collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a navigation provider's navigation items
|
||||
*
|
||||
* @param navigation_interface $navigation
|
||||
*/
|
||||
public function register(navigation_interface $navigation)
|
||||
{
|
||||
$nav_arry = $navigation->get();
|
||||
$this->merge($nav_arry, $this->menu_collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a property in the navigation array
|
||||
*
|
||||
* @param array $nav_element Array to the navigation elem
|
||||
* @param array $property_array Array with the properties to set
|
||||
*/
|
||||
public function set_nav_property($nav_element, $property_array)
|
||||
{
|
||||
$array_pointer = array();
|
||||
$array_root_pointer = &$array_pointer;
|
||||
foreach ($nav_element as $array_path)
|
||||
{
|
||||
$array_pointer[$array_path] = array();
|
||||
$array_pointer = &$array_pointer[$array_path];
|
||||
}
|
||||
|
||||
$array_pointer = $property_array;
|
||||
|
||||
$this->merge($array_root_pointer, $this->menu_collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive array merge
|
||||
*
|
||||
* This function is necessary to be able to replace the options of
|
||||
* already set navigation items.
|
||||
*
|
||||
* @param array $array_to_merge
|
||||
* @param array $array_to_merge_into
|
||||
*/
|
||||
private function merge(&$array_to_merge, &$array_to_merge_into)
|
||||
{
|
||||
foreach ($array_to_merge as $key => $value)
|
||||
{
|
||||
if (isset($array_to_merge_into[$key]))
|
||||
{
|
||||
if (is_array($array_to_merge_into[$key]) && is_array($value))
|
||||
{
|
||||
$this->merge($value, $array_to_merge_into[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$array_to_merge_into[$key] = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$array_to_merge_into[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
286
phpBB/phpbb/install/installer.php
Normal file
286
phpBB/phpbb/install/installer.php
Normal file
@@ -0,0 +1,286 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install;
|
||||
|
||||
use phpbb\install\exception\installer_config_not_writable_exception;
|
||||
use phpbb\install\exception\invalid_service_name_exception;
|
||||
use phpbb\install\exception\module_not_found_exception;
|
||||
use phpbb\install\exception\task_not_found_exception;
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
use phpbb\install\helper\config;
|
||||
use phpbb\install\helper\iohandler\iohandler_interface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
|
||||
class installer
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $installer_modules;
|
||||
|
||||
/**
|
||||
* @var iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* Stores the number of steps that a given module has
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $module_step_count;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param config $config Installer config handler
|
||||
* @param ContainerInterface $container Dependency injection container
|
||||
*/
|
||||
public function __construct(config $config, ContainerInterface $container)
|
||||
{
|
||||
$this->install_config = $config;
|
||||
$this->container = $container;
|
||||
$this->installer_modules = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets modules to execute
|
||||
*
|
||||
* Note: The installer will run modules in the order they are set in
|
||||
* the array.
|
||||
*
|
||||
* @param array $modules Array of module service names
|
||||
*/
|
||||
public function set_modules($modules)
|
||||
{
|
||||
$modules = (array) $modules;
|
||||
|
||||
$this->installer_modules = $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets input-output handler objects
|
||||
*
|
||||
* @param iohandler_interface $iohandler
|
||||
*/
|
||||
public function set_iohandler(iohandler_interface $iohandler)
|
||||
{
|
||||
$this->iohandler = $iohandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run phpBB installer
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Load install progress
|
||||
$this->install_config->load_config();
|
||||
|
||||
// Recover install progress
|
||||
$module_index = $this->recover_progress();
|
||||
|
||||
// Variable used to check if the install process have been finished
|
||||
$install_finished = false;
|
||||
|
||||
// Flag used by exception handling, whether or not we need to flush output buffer once again
|
||||
$flush_messages = false;
|
||||
|
||||
// We are installing something, so the introduction stage can go now...
|
||||
$this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction'));
|
||||
$this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction'));
|
||||
|
||||
try
|
||||
{
|
||||
if ($this->install_config->get_task_progress_count() === 0)
|
||||
{
|
||||
// Count all tasks in the current installer modules
|
||||
$step_count = 0;
|
||||
foreach ($this->installer_modules as $index => $name)
|
||||
{
|
||||
try
|
||||
{
|
||||
/** @var \phpbb\install\module_interface $module */
|
||||
$module = $this->container->get($name);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
throw new module_not_found_exception($name);
|
||||
}
|
||||
|
||||
$module_step_count = $module->get_step_count();
|
||||
$step_count += $module_step_count;
|
||||
$this->module_step_count[$index] = $module_step_count;
|
||||
}
|
||||
|
||||
// Set task count
|
||||
$this->install_config->set_task_progress_count($step_count);
|
||||
}
|
||||
|
||||
// Set up progress information
|
||||
$this->iohandler->set_task_count(
|
||||
$this->install_config->get_task_progress_count()
|
||||
);
|
||||
|
||||
// Run until there are available resources
|
||||
while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0)
|
||||
{
|
||||
// Check if module exists, if not the install is completed
|
||||
if (!isset($this->installer_modules[$module_index]))
|
||||
{
|
||||
$install_finished = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Log progress
|
||||
$module_service_name = $this->installer_modules[$module_index];
|
||||
$this->install_config->set_active_module($module_service_name, $module_index);
|
||||
|
||||
// Get module from container
|
||||
try
|
||||
{
|
||||
/** @var \phpbb\install\module_interface $module */
|
||||
$module = $this->container->get($module_service_name);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
throw new module_not_found_exception($module_service_name);
|
||||
}
|
||||
|
||||
$module_index++;
|
||||
|
||||
// Check if module should be executed
|
||||
if (!$module->is_essential() && !$module->check_requirements())
|
||||
{
|
||||
$this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path());
|
||||
$this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path());
|
||||
|
||||
$this->iohandler->add_log_message(array(
|
||||
'SKIP_MODULE',
|
||||
$module_service_name,
|
||||
));
|
||||
$this->install_config->increment_current_task_progress($this->module_step_count[$module_index - 1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the correct stage in the navigation bar
|
||||
$this->install_config->set_active_navigation_stage($module->get_navigation_stage_path());
|
||||
$this->iohandler->set_active_stage_menu($module->get_navigation_stage_path());
|
||||
|
||||
$module->run();
|
||||
|
||||
$this->install_config->set_finished_navigation_stage($module->get_navigation_stage_path());
|
||||
$this->iohandler->set_finished_stage_menu($module->get_navigation_stage_path());
|
||||
|
||||
// Clear task progress
|
||||
$this->install_config->set_finished_task('', 0);
|
||||
}
|
||||
|
||||
if ($install_finished)
|
||||
{
|
||||
// Send install finished message
|
||||
$this->iohandler->set_progress('INSTALLER_FINISHED', $this->install_config->get_task_progress_count());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->iohandler->request_refresh();
|
||||
}
|
||||
}
|
||||
catch (user_interaction_required_exception $e)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
catch (module_not_found_exception $e)
|
||||
{
|
||||
$this->iohandler->add_error_message('MODULE_NOT_FOUND', array(
|
||||
'MODULE_NOT_FOUND_DESCRIPTION',
|
||||
$e->get_module_service_name(),
|
||||
));
|
||||
$flush_messages = true;
|
||||
}
|
||||
catch (task_not_found_exception $e)
|
||||
{
|
||||
$this->iohandler->add_error_message('TASK_NOT_FOUND', array(
|
||||
'TASK_NOT_FOUND_DESCRIPTION',
|
||||
$e->get_task_service_name(),
|
||||
));
|
||||
$flush_messages = true;
|
||||
}
|
||||
catch (invalid_service_name_exception $e)
|
||||
{
|
||||
if ($e->has_params())
|
||||
{
|
||||
$msg = $e->get_params();
|
||||
array_unshift($msg, $e->get_error());
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = $e->get_error();
|
||||
}
|
||||
|
||||
$this->iohandler->add_error_message($msg);
|
||||
$flush_messages = true;
|
||||
}
|
||||
|
||||
if ($flush_messages)
|
||||
{
|
||||
$this->iohandler->send_response();
|
||||
}
|
||||
|
||||
// Save install progress
|
||||
try
|
||||
{
|
||||
$this->install_config->save_config();
|
||||
}
|
||||
catch (installer_config_not_writable_exception $e)
|
||||
{
|
||||
// It is allowed to fail this test during requirements testing
|
||||
$progress_data = $this->install_config->get_progress_data();
|
||||
|
||||
if ($progress_data['last_task_module_name'] !== 'installer.module.requirements_install')
|
||||
{
|
||||
$this->iohandler->add_error_message('INSTALLER_CONFIG_NOT_WRITABLE');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recover install progress
|
||||
*
|
||||
* @return int Index of the next installer module to execute
|
||||
*/
|
||||
protected function recover_progress()
|
||||
{
|
||||
$progress_array = $this->install_config->get_progress_data();
|
||||
$module_service = $progress_array['last_task_module_name'];
|
||||
$module_index = $progress_array['last_task_module_index'];
|
||||
|
||||
if ($this->installer_modules[$module_index] === $module_service)
|
||||
{
|
||||
return $module_index;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
28
phpBB/phpbb/install/module/install_data/module.php
Normal file
28
phpBB/phpbb/install/module/install_data/module.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_data;
|
||||
|
||||
/**
|
||||
* Installer module for recovering and installing default data installation
|
||||
*/
|
||||
class module extends \phpbb\install\module_base
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_navigation_stage_path()
|
||||
{
|
||||
return array('install', 0, 'install');
|
||||
}
|
||||
}
|
240
phpBB/phpbb/install/module/install_data/task/add_bots.php
Normal file
240
phpBB/phpbb/install/module/install_data/task/add_bots.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_data\task;
|
||||
|
||||
class add_bots extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $bot_list;
|
||||
|
||||
/**
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $io_handler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $install_config Installer's config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Input-output handler for the installer
|
||||
* @param \phpbb\install\helper\container_factory $container Installer's DI container
|
||||
* @param \phpbb\language\language $language Language provider
|
||||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $php_ext PHP extension
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $install_config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
\phpbb\install\helper\container_factory $container,
|
||||
\phpbb\language\language $language,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
parent::__construct(true);
|
||||
|
||||
$this->db = $container->get('dbal.conn');
|
||||
$this->install_config = $install_config;
|
||||
$this->io_handler = $iohandler;
|
||||
$this->language = $language;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
||||
/**
|
||||
* A list of the web-crawlers/bots we recognise by default
|
||||
*
|
||||
* Candidates but not included:
|
||||
* 'Accoona [Bot]' 'Accoona-AI-Agent/'
|
||||
* 'ASPseek [Crawler]' 'ASPseek/'
|
||||
* 'Boitho [Crawler]' 'boitho.com-dc/'
|
||||
* 'Bunnybot [Bot]' 'powered by www.buncat.de'
|
||||
* 'Cosmix [Bot]' 'cfetch/'
|
||||
* 'Crawler Search [Crawler]' '.Crawler-Search.de'
|
||||
* 'Findexa [Crawler]' 'Findexa Crawler ('
|
||||
* 'GBSpider [Spider]' 'GBSpider v'
|
||||
* 'genie [Bot]' 'genieBot ('
|
||||
* 'Hogsearch [Bot]' 'oegp v. 1.3.0'
|
||||
* 'Insuranco [Bot]' 'InsurancoBot'
|
||||
* 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler'
|
||||
* 'ISC Systems [Bot]' 'ISC Systems iRc Search'
|
||||
* 'Jyxobot [Bot]' 'Jyxobot/'
|
||||
* 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/'
|
||||
* 'LinkWalker' 'LinkWalker'
|
||||
* 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html'
|
||||
* 'Naver [Bot]' 'nhnbot@naver.com)'
|
||||
* 'NetResearchServer' 'NetResearchServer/'
|
||||
* 'Nimble [Crawler]' 'NimbleCrawler'
|
||||
* 'Ocelli [Bot]' 'Ocelli/'
|
||||
* 'Onsearch [Bot]' 'onCHECK-Robot'
|
||||
* 'Orange [Spider]' 'OrangeSpider'
|
||||
* 'Sproose [Bot]' 'http://www.sproose.com/bot'
|
||||
* 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)'
|
||||
* 'Tbot [Bot]' 'Tbot/'
|
||||
* 'Thumbshots [Capture]' 'thumbshots-de-Bot'
|
||||
* 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/'
|
||||
* 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)'
|
||||
* 'WissenOnline [Bot]' 'WissenOnline-Bot'
|
||||
* 'WWWeasel [Bot]' 'WWWeasel Robot v'
|
||||
* 'Xaldon [Spider]' 'Xaldon WebSpider'
|
||||
*/
|
||||
$this->bot_list = array(
|
||||
'AdsBot [Google]' => array('AdsBot-Google', ''),
|
||||
'Alexa [Bot]' => array('ia_archiver', ''),
|
||||
'Alta Vista [Bot]' => array('Scooter/', ''),
|
||||
'Ask Jeeves [Bot]' => array('Ask Jeeves', ''),
|
||||
'Baidu [Spider]' => array('Baiduspider', ''),
|
||||
'Bing [Bot]' => array('bingbot/', ''),
|
||||
'Exabot [Bot]' => array('Exabot', ''),
|
||||
'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''),
|
||||
'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''),
|
||||
'Francis [Bot]' => array('http://www.neomo.de/', ''),
|
||||
'Gigabot [Bot]' => array('Gigabot/', ''),
|
||||
'Google Adsense [Bot]' => array('Mediapartners-Google', ''),
|
||||
'Google Desktop' => array('Google Desktop', ''),
|
||||
'Google Feedfetcher' => array('Feedfetcher-Google', ''),
|
||||
'Google [Bot]' => array('Googlebot', ''),
|
||||
'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''),
|
||||
'Heritrix [Crawler]' => array('heritrix/1.', ''),
|
||||
'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''),
|
||||
'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''),
|
||||
'ichiro [Crawler]' => array('ichiro/', ''),
|
||||
'Majestic-12 [Bot]' => array('MJ12bot/', ''),
|
||||
'Metager [Bot]' => array('MetagerBot/', ''),
|
||||
'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''),
|
||||
'MSN [Bot]' => array('msnbot/', ''),
|
||||
'MSNbot Media' => array('msnbot-media/', ''),
|
||||
'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''),
|
||||
'Online link [Validator]' => array('online link validator', ''),
|
||||
'psbot [Picsearch]' => array('psbot/0', ''),
|
||||
'Sensis [Crawler]' => array('Sensis Web Crawler', ''),
|
||||
'SEO Crawler' => array('SEO search Crawler/', ''),
|
||||
'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''),
|
||||
'SEOSearch [Crawler]' => array('SEOsearch/', ''),
|
||||
'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
|
||||
'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
|
||||
'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''),
|
||||
'TurnitinBot [Bot]' => array('TurnitinBot/', ''),
|
||||
'Voyager [Bot]' => array('voyager/', ''),
|
||||
'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''),
|
||||
'W3C [Linkcheck]' => array('W3C-checklink/', ''),
|
||||
'W3C [Validator]' => array('W3C_Validator', ''),
|
||||
'YaCy [Bot]' => array('yacybot', ''),
|
||||
'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
|
||||
'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
|
||||
'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
|
||||
'YahooSeeker [Bot]' => array('YahooSeeker/', ''),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->db->sql_return_on_error(true);
|
||||
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name = 'BOTS'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$group_id = (int) $this->db->sql_fetchfield('group_id');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!$group_id)
|
||||
{
|
||||
// If we reach this point then something has gone very wrong
|
||||
$this->io_handler->add_error_message('NO_GROUP');
|
||||
}
|
||||
|
||||
foreach ($this->bot_list as $bot_name => $bot_ary)
|
||||
{
|
||||
$user_row = array(
|
||||
'user_type' => USER_IGNORE,
|
||||
'group_id' => $group_id,
|
||||
'username' => $bot_name,
|
||||
'user_regdate' => time(),
|
||||
'user_password' => '',
|
||||
'user_colour' => '9E8DA7',
|
||||
'user_email' => '',
|
||||
'user_lang' => $this->install_config->get('default_lang'),
|
||||
'user_style' => 1,
|
||||
'user_timezone' => 'UTC',
|
||||
'user_dateformat' => $this->language->lang('default_dateformat'),
|
||||
'user_allow_massemail' => 0,
|
||||
'user_allow_pm' => 0,
|
||||
);
|
||||
|
||||
$user_id = user_add($user_row);
|
||||
|
||||
if (!$user_id)
|
||||
{
|
||||
// If we can't insert this user then continue to the next one to avoid inconsistent data
|
||||
$this->io_handler->add_error_message('CONV_ERROR_INSERT_BOT');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||
'bot_active' => 1,
|
||||
'bot_name' => (string) $bot_name,
|
||||
'user_id' => (int) $user_id,
|
||||
'bot_agent' => (string) $bot_ary[0],
|
||||
'bot_ip' => (string) $bot_ary[1],
|
||||
));
|
||||
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_ADD_BOTS';
|
||||
}
|
||||
}
|
121
phpBB/phpbb/install/module/install_data/task/add_languages.php
Normal file
121
phpBB/phpbb/install/module/install_data/task/add_languages.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_data\task;
|
||||
|
||||
class add_languages extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language_file_helper
|
||||
*/
|
||||
protected $language_helper;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
* @param \phpbb\install\helper\container_factory $container Installer's DI container
|
||||
* @param \phpbb\language\language_file_helper $language_helper Language file helper service
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
\phpbb\install\helper\container_factory $container,
|
||||
\phpbb\language\language_file_helper $language_helper)
|
||||
{
|
||||
$this->db = $container->get('dbal.conn');
|
||||
$this->iohandler = $iohandler;
|
||||
$this->language_helper = $language_helper;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->db->sql_return_on_error(true);
|
||||
|
||||
$languages = $this->language_helper->get_available_languages();
|
||||
$installed_languages = array();
|
||||
|
||||
foreach ($languages as $lang_info)
|
||||
{
|
||||
$lang_pack = array(
|
||||
'lang_iso' => $lang_info['iso'],
|
||||
'lang_dir' => $lang_info['iso'],
|
||||
'lang_english_name' => htmlspecialchars($lang_info['name']),
|
||||
'lang_local_name' => htmlspecialchars($lang_info['local_name'], ENT_COMPAT, 'UTF-8'),
|
||||
'lang_author' => htmlspecialchars($lang_info['author'], ENT_COMPAT, 'UTF-8'),
|
||||
);
|
||||
|
||||
$this->db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $this->db->sql_build_array('INSERT', $lang_pack));
|
||||
|
||||
$installed_languages[] = (int) $this->db->sql_nextid();
|
||||
if ($this->db->get_sql_error_triggered())
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message($error['message']);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE;
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
foreach ($installed_languages as $lang_id)
|
||||
{
|
||||
$insert_buffer->insert(array(
|
||||
'field_id' => $row['field_id'],
|
||||
'lang_id' => $lang_id,
|
||||
|
||||
// Remove phpbb_ from field name
|
||||
'lang_name' => strtoupper(substr($row['field_name'], 6)),
|
||||
'lang_explain' => '',
|
||||
'lang_default_value' => '',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$insert_buffer->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_ADD_LANGUAGES';
|
||||
}
|
||||
}
|
468
phpBB/phpbb/install/module/install_data/task/add_modules.php
Normal file
468
phpBB/phpbb/install/module/install_data/task/add_modules.php
Normal file
@@ -0,0 +1,468 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_data\task;
|
||||
|
||||
class add_modules extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var \phpbb\extension\manager
|
||||
*/
|
||||
protected $extension_manager;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\module\module_manager
|
||||
*/
|
||||
protected $module_manager;
|
||||
|
||||
/**
|
||||
* Define the module structure so that we can populate the database without
|
||||
* needing to hard-code module_id values
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $module_categories;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $module_categories_basenames;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $module_extras;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
* @param \phpbb\install\helper\container_factory $container Installer's DI container
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
\phpbb\install\helper\container_factory $container)
|
||||
{
|
||||
$this->db = $container->get('dbal.conn');
|
||||
$this->extension_manager = $container->get('ext.manager');
|
||||
$this->iohandler = $iohandler;
|
||||
$this->module_manager = $container->get('module.manager');
|
||||
|
||||
parent::__construct(true);
|
||||
|
||||
$this->module_categories = array(
|
||||
'acp' => array(
|
||||
'ACP_CAT_GENERAL' => array(
|
||||
'ACP_QUICK_ACCESS',
|
||||
'ACP_BOARD_CONFIGURATION',
|
||||
'ACP_CLIENT_COMMUNICATION',
|
||||
'ACP_SERVER_CONFIGURATION',
|
||||
),
|
||||
'ACP_CAT_FORUMS' => array(
|
||||
'ACP_MANAGE_FORUMS',
|
||||
'ACP_FORUM_BASED_PERMISSIONS',
|
||||
),
|
||||
'ACP_CAT_POSTING' => array(
|
||||
'ACP_MESSAGES',
|
||||
'ACP_ATTACHMENTS',
|
||||
),
|
||||
'ACP_CAT_USERGROUP' => array(
|
||||
'ACP_CAT_USERS',
|
||||
'ACP_GROUPS',
|
||||
'ACP_USER_SECURITY',
|
||||
),
|
||||
'ACP_CAT_PERMISSIONS' => array(
|
||||
'ACP_GLOBAL_PERMISSIONS',
|
||||
'ACP_FORUM_BASED_PERMISSIONS',
|
||||
'ACP_PERMISSION_ROLES',
|
||||
'ACP_PERMISSION_MASKS',
|
||||
),
|
||||
'ACP_CAT_CUSTOMISE' => array(
|
||||
'ACP_STYLE_MANAGEMENT',
|
||||
'ACP_EXTENSION_MANAGEMENT',
|
||||
'ACP_LANGUAGE',
|
||||
),
|
||||
'ACP_CAT_MAINTENANCE' => array(
|
||||
'ACP_FORUM_LOGS',
|
||||
'ACP_CAT_DATABASE',
|
||||
),
|
||||
'ACP_CAT_SYSTEM' => array(
|
||||
'ACP_AUTOMATION',
|
||||
'ACP_GENERAL_TASKS',
|
||||
'ACP_MODULE_MANAGEMENT',
|
||||
),
|
||||
'ACP_CAT_DOT_MODS' => null,
|
||||
),
|
||||
'mcp' => array(
|
||||
'MCP_MAIN' => null,
|
||||
'MCP_QUEUE' => null,
|
||||
'MCP_REPORTS' => null,
|
||||
'MCP_NOTES' => null,
|
||||
'MCP_WARN' => null,
|
||||
'MCP_LOGS' => null,
|
||||
'MCP_BAN' => null,
|
||||
),
|
||||
'ucp' => array(
|
||||
'UCP_MAIN' => null,
|
||||
'UCP_PROFILE' => null,
|
||||
'UCP_PREFS' => null,
|
||||
'UCP_PM' => null,
|
||||
'UCP_USERGROUPS' => null,
|
||||
'UCP_ZEBRA' => null,
|
||||
),
|
||||
);
|
||||
|
||||
$this->module_categories_basenames = array(
|
||||
'UCP_PM' => 'ucp_pm',
|
||||
);
|
||||
|
||||
$this->module_extras = array(
|
||||
'acp' => array(
|
||||
'ACP_QUICK_ACCESS' => array(
|
||||
'ACP_MANAGE_USERS',
|
||||
'ACP_GROUPS_MANAGE',
|
||||
'ACP_MANAGE_FORUMS',
|
||||
'ACP_MOD_LOGS',
|
||||
'ACP_BOTS',
|
||||
'ACP_PHP_INFO',
|
||||
),
|
||||
'ACP_FORUM_BASED_PERMISSIONS' => array(
|
||||
'ACP_FORUM_PERMISSIONS',
|
||||
'ACP_FORUM_PERMISSIONS_COPY',
|
||||
'ACP_FORUM_MODERATORS',
|
||||
'ACP_USERS_FORUM_PERMISSIONS',
|
||||
'ACP_GROUPS_FORUM_PERMISSIONS',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->db->sql_return_on_error(true);
|
||||
|
||||
$module_classes = array('acp', 'mcp', 'ucp');
|
||||
foreach ($module_classes as $module_class)
|
||||
{
|
||||
$categories = array();
|
||||
|
||||
foreach ($this->module_categories[$module_class] as $cat_name => $subs)
|
||||
{
|
||||
// Check if this sub-category has a basename. If it has, use it.
|
||||
$basename = (isset($this->module_categories_basenames[$cat_name])) ? $this->module_categories_basenames[$cat_name] : '';
|
||||
|
||||
$module_data = array(
|
||||
'module_basename' => $basename,
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => 0,
|
||||
'module_class' => $module_class,
|
||||
'module_langname' => $cat_name,
|
||||
'module_mode' => '',
|
||||
'module_auth' => '',
|
||||
);
|
||||
|
||||
$this->module_manager->update_module_data($module_data);
|
||||
|
||||
// Check for last sql error happened
|
||||
if ($this->db->get_sql_error_triggered())
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
|
||||
$categories[$cat_name]['id'] = (int)$module_data['module_id'];
|
||||
$categories[$cat_name]['parent_id'] = 0;
|
||||
|
||||
if (is_array($subs))
|
||||
{
|
||||
foreach ($subs as $level2_name)
|
||||
{
|
||||
// Check if this sub-category has a basename. If it has, use it.
|
||||
$basename = (isset($this->module_categories_basenames[$level2_name])) ? $this->module_categories_basenames[$level2_name] : '';
|
||||
|
||||
$module_data = array(
|
||||
'module_basename' => $basename,
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => (int)$categories[$cat_name]['id'],
|
||||
'module_class' => $module_class,
|
||||
'module_langname' => $level2_name,
|
||||
'module_mode' => '',
|
||||
'module_auth' => '',
|
||||
);
|
||||
|
||||
$this->module_manager->update_module_data($module_data);
|
||||
|
||||
// Check for last sql error happened
|
||||
if ($this->db->get_sql_error_triggered())
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
|
||||
$categories[$level2_name]['id'] = (int)$module_data['module_id'];
|
||||
$categories[$level2_name]['parent_id'] = (int)$categories[$cat_name]['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the modules we want to add... returned sorted by name
|
||||
$module_info = $this->module_manager->get_module_infos($module_class);
|
||||
|
||||
foreach ($module_info as $module_basename => $fileinfo)
|
||||
{
|
||||
foreach ($fileinfo['modes'] as $module_mode => $row)
|
||||
{
|
||||
foreach ($row['cat'] as $cat_name)
|
||||
{
|
||||
if (!isset($categories[$cat_name]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$module_data = array(
|
||||
'module_basename' => $module_basename,
|
||||
'module_enabled' => 1,
|
||||
'module_display' => (isset($row['display'])) ? (int) $row['display'] : 1,
|
||||
'parent_id' => (int) $categories[$cat_name]['id'],
|
||||
'module_class' => $module_class,
|
||||
'module_langname' => $row['title'],
|
||||
'module_mode' => $module_mode,
|
||||
'module_auth' => $row['auth'],
|
||||
);
|
||||
|
||||
$this->module_manager->update_module_data($module_data);
|
||||
|
||||
// Check for last sql error happened
|
||||
if ($this->db->get_sql_error_triggered())
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move some of the modules around since the code above will put them in the wrong place
|
||||
if ($module_class === 'acp')
|
||||
{
|
||||
// Move main module 4 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'acp_main'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = 'main'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'acp', 'move_up', 4);
|
||||
|
||||
// Move permissions intro screen module 4 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'acp_permissions'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = 'intro'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'acp', 'move_up', 4);
|
||||
|
||||
// Move manage users screen module 5 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'acp_users'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = 'overview'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'acp', 'move_up', 5);
|
||||
|
||||
// Move extension management module 1 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = 'ACP_EXTENSION_MANAGEMENT'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = ''
|
||||
AND module_basename = ''";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'acp', 'move_up', 1);
|
||||
}
|
||||
|
||||
if ($module_class == 'mcp')
|
||||
{
|
||||
// Move pm report details module 3 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'mcp_pm_reports'
|
||||
AND module_class = 'mcp'
|
||||
AND module_mode = 'pm_report_details'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'mcp', 'move_down', 3);
|
||||
|
||||
// Move closed pm reports module 3 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'mcp_pm_reports'
|
||||
AND module_class = 'mcp'
|
||||
AND module_mode = 'pm_reports_closed'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'mcp', 'move_down', 3);
|
||||
|
||||
// Move open pm reports module 3 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'mcp_pm_reports'
|
||||
AND module_class = 'mcp'
|
||||
AND module_mode = 'pm_reports'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'mcp', 'move_down', 3);
|
||||
}
|
||||
|
||||
if ($module_class == 'ucp')
|
||||
{
|
||||
// Move attachment module 4 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'ucp_attachments'
|
||||
AND module_class = 'ucp'
|
||||
AND module_mode = 'attachments'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'ucp', 'move_down', 4);
|
||||
|
||||
// Move notification options module 4 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'ucp_notifications'
|
||||
AND module_class = 'ucp'
|
||||
AND module_mode = 'notification_options'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'ucp', 'move_down', 4);
|
||||
|
||||
// Move OAuth module 5 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'ucp_auth_link'
|
||||
AND module_class = 'ucp'
|
||||
AND module_mode = 'auth_link'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->module_manager->move_module_by($row, 'ucp', 'move_down', 5);
|
||||
}
|
||||
|
||||
// And now for the special ones
|
||||
// (these are modules which appear in multiple categories and thus get added manually
|
||||
// to some for more control)
|
||||
if (isset($this->module_extras[$module_class]))
|
||||
{
|
||||
foreach ($this->module_extras[$module_class] as $cat_name => $mods)
|
||||
{
|
||||
$sql = 'SELECT module_id, left_id, right_id
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = '" . $this->db->sql_escape($cat_name) . "'
|
||||
AND module_class = '" . $this->db->sql_escape($module_class) . "'";
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$row2 = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
foreach ($mods as $mod_name)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = '" . $this->db->sql_escape($mod_name) . "'
|
||||
AND module_class = '" . $this->db->sql_escape($module_class) . "'
|
||||
AND module_basename <> ''";
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$module_data = array(
|
||||
'module_basename' => $row['module_basename'],
|
||||
'module_enabled' => (int) $row['module_enabled'],
|
||||
'module_display' => (int) $row['module_display'],
|
||||
'parent_id' => (int) $row2['module_id'],
|
||||
'module_class' => $row['module_class'],
|
||||
'module_langname' => $row['module_langname'],
|
||||
'module_mode' => $row['module_mode'],
|
||||
'module_auth' => $row['module_auth'],
|
||||
);
|
||||
|
||||
$this->module_manager->update_module_data($module_data);
|
||||
|
||||
// Check for last sql error happened
|
||||
if ($this->db->get_sql_error_triggered())
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->module_manager->remove_cache_file($module_class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_ADD_MODULES';
|
||||
}
|
||||
}
|
28
phpBB/phpbb/install/module/install_database/module.php
Normal file
28
phpBB/phpbb/install/module/install_database/module.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_database;
|
||||
|
||||
/**
|
||||
* Installer module for database installation
|
||||
*/
|
||||
class module extends \phpbb\install\module_base
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_navigation_stage_path()
|
||||
{
|
||||
return array('install', 0, 'install');
|
||||
}
|
||||
}
|
@@ -0,0 +1,341 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_database\task;
|
||||
|
||||
/**
|
||||
* Create database schema
|
||||
*/
|
||||
class add_config_settings extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var \phpbb\filesystem\filesystem_interface
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* @var \phpbb\passwords\manager
|
||||
*/
|
||||
protected $password_manager;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $config_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $user_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $topics_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $forums_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $posts_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $moderator_cache_table;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service
|
||||
* @param \phpbb\install\helper\config $install_config Installer's config helper
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
* @param \phpbb\install\helper\container_factory $container Installer's DI container
|
||||
* @param \phpbb\language\language $language Language service
|
||||
* @param string $phpbb_root_path Path to phpBB's root
|
||||
*/
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem,
|
||||
\phpbb\install\helper\config $install_config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
\phpbb\install\helper\container_factory $container,
|
||||
\phpbb\language\language $language,
|
||||
$phpbb_root_path)
|
||||
{
|
||||
$this->db = $container->get('dbal.conn');
|
||||
$this->filesystem = $filesystem;
|
||||
$this->install_config = $install_config;
|
||||
$this->iohandler = $iohandler;
|
||||
$this->language = $language;
|
||||
$this->password_manager = $container->get('passwords.manager');
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
|
||||
// Table names
|
||||
$this->config_table = $container->get_parameter('tables.config');
|
||||
$this->forums_table = $container->get_parameter('tables.forums');
|
||||
$this->topics_table = $container->get_parameter('tables.topics');
|
||||
$this->user_table = $container->get_parameter('tables.users');
|
||||
$this->moderator_cache_table = $container->get_parameter('tables.moderator_cache');
|
||||
$this->posts_table = $container->get_parameter('tables.posts');
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->db->sql_return_on_error(true);
|
||||
|
||||
$server_name = $this->install_config->get('server_name');
|
||||
$cookie_domain = $this->install_config->get('cookie_domain');
|
||||
$current_time = time();
|
||||
$user_ip = phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR'));
|
||||
$user_ip = ($user_ip === false) ? '' : $user_ip;
|
||||
$referer = $this->iohandler->get_server_variable('REFERER');
|
||||
|
||||
// Set default config and post data, this applies to all DB's
|
||||
$sql_ary = array(
|
||||
'INSERT INTO ' . $this->config_table . " (config_name, config_value)
|
||||
VALUES ('board_startdate', '$current_time')",
|
||||
|
||||
'INSERT INTO ' . $this->config_table . " (config_name, config_value)
|
||||
VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('img_imagick')) . "'
|
||||
WHERE config_name = 'img_imagick'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "'
|
||||
WHERE config_name = 'server_name'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_port')) . "'
|
||||
WHERE config_name = 'server_port'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "'
|
||||
WHERE config_name = 'board_email'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "'
|
||||
WHERE config_name = 'board_contact'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($cookie_domain) . "'
|
||||
WHERE config_name = 'cookie_domain'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "'
|
||||
WHERE config_name = 'default_dateformat'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('email_enable')) . "'
|
||||
WHERE config_name = 'email_enable'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_delivery')) . "'
|
||||
WHERE config_name = 'smtp_delivery'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "'
|
||||
WHERE config_name = 'smtp_host'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "'
|
||||
WHERE config_name = 'smtp_auth_method'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_user')) . "'
|
||||
WHERE config_name = 'smtp_username'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_pass')) . "'
|
||||
WHERE config_name = 'smtp_password'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('cookie_secure')) . "'
|
||||
WHERE config_name = 'cookie_secure'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('force_server_vars')) . "'
|
||||
WHERE config_name = 'force_server_vars'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('script_path')) . "'
|
||||
WHERE config_name = 'script_path'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_protocol')) . "'
|
||||
WHERE config_name = 'server_protocol'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
|
||||
WHERE config_name = 'newest_username'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . md5(mt_rand()) . "'
|
||||
WHERE config_name = 'avatar_salt'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . md5(mt_rand()) . "'
|
||||
WHERE config_name = 'plupload_salt'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_name')) . "'
|
||||
WHERE config_name = 'sitename'",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_description')) . "'
|
||||
WHERE config_name = 'site_desc'",
|
||||
|
||||
'UPDATE ' . $this->user_table . "
|
||||
SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',
|
||||
user_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "',
|
||||
user_ip = '" . $this->db->sql_escape($user_ip) . "',
|
||||
user_lang = '" . $this->db->sql_escape($this->install_config->get('language')) . "',
|
||||
user_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "',
|
||||
user_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "',
|
||||
user_email_hash = " . $this->db->sql_escape(phpbb_email_hash($this->install_config->get('board_email'))) . ",
|
||||
username_clean = '" . $this->db->sql_escape(utf8_clean_string($this->install_config->get('admin_name'))) . "'
|
||||
WHERE username = 'Admin'",
|
||||
|
||||
'UPDATE ' . $this->moderator_cache_table . "
|
||||
SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
|
||||
WHERE username = 'Admin'",
|
||||
|
||||
'UPDATE ' . $this->forums_table . "
|
||||
SET forum_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
|
||||
WHERE forum_last_poster_name = 'Admin'",
|
||||
|
||||
'UPDATE ' . $this->topics_table . "
|
||||
SET topic_first_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "',
|
||||
topic_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "'
|
||||
WHERE topic_first_poster_name = 'Admin'
|
||||
OR topic_last_poster_name = 'Admin'",
|
||||
|
||||
'UPDATE ' . $this->user_table . "
|
||||
SET user_regdate = $current_time",
|
||||
|
||||
'UPDATE ' . $this->posts_table . "
|
||||
SET post_time = $current_time, poster_ip = '" . $this->db->sql_escape($user_ip) . "'",
|
||||
|
||||
'UPDATE ' . $this->topics_table . "
|
||||
SET topic_time = $current_time, topic_last_post_time = $current_time",
|
||||
|
||||
'UPDATE ' . $this->forums_table . "
|
||||
SET forum_last_post_time = $current_time",
|
||||
|
||||
'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($this->db->sql_server_info(true)) . "'
|
||||
WHERE config_name = 'dbms_version'",
|
||||
);
|
||||
|
||||
if (@extension_loaded('gd'))
|
||||
{
|
||||
$sql_ary[] = 'UPDATE ' . $this->config_table . "
|
||||
SET config_value = 'core.captcha.plugins.gd'
|
||||
WHERE config_name = 'captcha_plugin'";
|
||||
|
||||
$sql_ary[] = 'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '1'
|
||||
WHERE config_name = 'captcha_gd'";
|
||||
}
|
||||
|
||||
$ref = substr($referer, strpos($referer, '://') + 3);
|
||||
if (!(stripos($ref, $server_name) === 0))
|
||||
{
|
||||
$sql_ary[] = 'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '0'
|
||||
WHERE config_name = 'referer_validation'";
|
||||
}
|
||||
|
||||
// We set a (semi-)unique cookie name to bypass login issues related to the cookie name.
|
||||
$cookie_name = 'phpbb3_';
|
||||
$rand_str = md5(mt_rand());
|
||||
$rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35));
|
||||
$rand_str = substr($rand_str, 0, 5);
|
||||
$cookie_name .= strtolower($rand_str);
|
||||
|
||||
$sql_ary[] = 'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '" . $this->db->sql_escape($cookie_name) . "'
|
||||
WHERE config_name = 'cookie_name'";
|
||||
|
||||
// Disable avatars if upload directory is not writable
|
||||
if (!$this->filesystem->is_writable($this->phpbb_root_path . 'images/avatars/upload/'))
|
||||
{
|
||||
$sql_ary[] = 'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '0'
|
||||
WHERE config_name = 'allow_avatar'";
|
||||
|
||||
$sql_ary[] = 'UPDATE ' . $this->config_table . "
|
||||
SET config_value = '0'
|
||||
WHERE config_name = 'allow_avatar_upload'";
|
||||
}
|
||||
|
||||
foreach ($sql_ary as $sql)
|
||||
{
|
||||
if (!$this->db->sql_query($sql))
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_ADD_CONFIG_SETTINGS';
|
||||
}
|
||||
}
|
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_database\task;
|
||||
|
||||
/**
|
||||
* Create database schema
|
||||
*/
|
||||
class add_default_data extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\database
|
||||
*/
|
||||
protected $database_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\database $db_helper Installer's database helper
|
||||
* @param \phpbb\install\helper\config $config Installer config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
* @param \phpbb\install\helper\container_factory $container Installer's DI container
|
||||
* @param \phpbb\language\language $language Language service
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\database $db_helper,
|
||||
\phpbb\install\helper\config $config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
\phpbb\install\helper\container_factory $container,
|
||||
\phpbb\language\language $language)
|
||||
{
|
||||
$dbms = $db_helper->get_available_dbms($config->get('dbms'));
|
||||
$dbms = $dbms[$config->get('dbms')]['DRIVER'];
|
||||
|
||||
$this->db = $container->get('dbal.conn'); //new $dbms();
|
||||
$this->database_helper = $db_helper;
|
||||
$this->config = $config;
|
||||
$this->iohandler = $iohandler;
|
||||
$this->language = $language;
|
||||
|
||||
parent::__construct(true);
|
||||
|
||||
// Connect to DB
|
||||
//$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->db->sql_return_on_error(true);
|
||||
|
||||
$table_prefix = $this->config->get('table_prefix');
|
||||
$dbms = $this->config->get('dbms');
|
||||
$dbms_info = $this->database_helper->get_available_dbms($dbms);
|
||||
|
||||
// Get schema data from file
|
||||
$sql_query = @file_get_contents('schemas/schema_data.sql');
|
||||
|
||||
// Clean up SQL
|
||||
$sql_query = $this->replace_dbms_specific_sql($sql_query);
|
||||
$sql_query = preg_replace('# phpbb_([^\s]*) #i', ' ' . $table_prefix . '\1 ', $sql_query);
|
||||
$sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', array($this, 'lang_replace_callback'), $sql_query);
|
||||
$sql_query = $this->database_helper->remove_comments($sql_query);
|
||||
$sql_query = $this->database_helper->split_sql_file($sql_query, $dbms_info[$dbms]['DELIM']);
|
||||
|
||||
foreach ($sql_query as $sql)
|
||||
{
|
||||
if (!$this->db->sql_query($sql))
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process DB specific SQL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function replace_dbms_specific_sql($query)
|
||||
{
|
||||
if ($this->db instanceof \phpbb\db\driver\mssql_base || $this->db instanceof \phpbb\db\driver\mssql)
|
||||
{
|
||||
$query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $query);
|
||||
}
|
||||
else if ($this->db instanceof \phpbb\db\driver\postgres)
|
||||
{
|
||||
$query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $query);
|
||||
}
|
||||
else if ($this->db instanceof \phpbb\db\driver\mysql_base)
|
||||
{
|
||||
$query = str_replace('\\', '\\\\', $query);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function for language replacing
|
||||
*
|
||||
* @param array $matches
|
||||
* @return string
|
||||
*/
|
||||
public function lang_replace_callback($matches)
|
||||
{
|
||||
if (!empty($matches[1]))
|
||||
{
|
||||
return $this->db->sql_escape($this->language->lang($matches[1]));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_ADD_DEFAULT_DATA';
|
||||
}
|
||||
}
|
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_database\task;
|
||||
|
||||
/**
|
||||
* Create database schema
|
||||
*/
|
||||
class create_schema extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var \phpbb\db\tools\tools_interface
|
||||
*/
|
||||
protected $db_tools;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\database
|
||||
*/
|
||||
protected $database_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\filesystem\filesystem_interface
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $config Installer's config provider
|
||||
* @param \phpbb\install\helper\database $db_helper Installer's database helper
|
||||
* @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
* @param string $phpbb_root_path Path phpBB's root
|
||||
* @param string $php_ext Extension of PHP files
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $config,
|
||||
\phpbb\install\helper\database $db_helper,
|
||||
\phpbb\filesystem\filesystem_interface $filesystem,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
$dbms = $db_helper->get_available_dbms($config->get('dbms'));
|
||||
$dbms = $dbms[$config->get('dbms')]['DRIVER'];
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
|
||||
$this->db = new $dbms();
|
||||
$this->config = $config;
|
||||
$this->db_tools = $factory->get($this->db);
|
||||
$this->database_helper = $db_helper;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->iohandler = $iohandler;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
||||
parent::__construct(true);
|
||||
|
||||
// Connect to DB
|
||||
$this->db->sql_connect($config->get('dbhost'), $config->get('dbuser'), $config->get('dbpasswd'), $config->get('dbname'), $config->get('dbport'), false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->db->sql_return_on_error(true);
|
||||
|
||||
$dbms = $this->config->get('dbms');
|
||||
$dbms_info = $this->database_helper->get_available_dbms($dbms);
|
||||
$schema_name = $dbms_info[$dbms]['SCHEMA'];
|
||||
$delimiter = $dbms_info[$dbms]['DELIM'];
|
||||
$table_prefix = $this->config->get('table_prefix');
|
||||
|
||||
if ($dbms === 'mysql')
|
||||
{
|
||||
if (version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
|
||||
{
|
||||
$schema_name .= '_41';
|
||||
}
|
||||
else
|
||||
{
|
||||
$schema_name .= '_40';
|
||||
}
|
||||
}
|
||||
|
||||
$db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql';
|
||||
|
||||
// Load database vendor specific code if there is any
|
||||
if ($this->filesystem->exists($db_schema_path))
|
||||
{
|
||||
$sql_query = @file_get_contents($db_schema_path);
|
||||
$sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query);
|
||||
$sql_query = $this->database_helper->remove_comments($sql_query);
|
||||
$sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter);
|
||||
|
||||
foreach ($sql_query as $sql)
|
||||
{
|
||||
if (!$this->db->sql_query($sql))
|
||||
{
|
||||
$error = $this->db->sql_error($this->db->get_sql_error_sql());
|
||||
$this->iohandler->add_error_message('INST_ERR_DB', $error['message']);
|
||||
}
|
||||
}
|
||||
|
||||
unset($sql_query);
|
||||
}
|
||||
|
||||
$change_prefix = false;
|
||||
|
||||
// Generate database schema
|
||||
if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json'))
|
||||
{
|
||||
$db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json');
|
||||
$db_table_schema = json_decode($db_table_schema, true);
|
||||
$change_prefix = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
global $table_prefix;
|
||||
|
||||
$table_prefix = $this->config->get('table_prefix');
|
||||
|
||||
if (!defined('CONFIG_TABLE'))
|
||||
{
|
||||
// We need to include the constants file for the table constants
|
||||
// when we generate the schema from the migration files.
|
||||
include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext);
|
||||
}
|
||||
|
||||
$finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, null, $this->php_ext);
|
||||
$migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes();
|
||||
$factory = new \phpbb\db\tools\factory();
|
||||
$db_tools = $factory->get($this->db, true);
|
||||
$schema_generator = new \phpbb\db\migration\schema_generator(
|
||||
$migrator_classes,
|
||||
new \phpbb\config\config(array()),
|
||||
$this->db,
|
||||
$db_tools,
|
||||
$this->phpbb_root_path,
|
||||
$this->php_ext,
|
||||
$table_prefix
|
||||
);
|
||||
$db_table_schema = $schema_generator->get_schema();
|
||||
}
|
||||
|
||||
if (!defined('CONFIG_TABLE'))
|
||||
{
|
||||
// CONFIG_TABLE is required by sql_create_index() to check the
|
||||
// length of index names. However table_prefix is not defined
|
||||
// here yet, so we need to create the constant ourselves.
|
||||
define('CONFIG_TABLE', $table_prefix . 'config');
|
||||
}
|
||||
|
||||
foreach ($db_table_schema as $table_name => $table_data)
|
||||
{
|
||||
$this->db_tools->sql_create_table(
|
||||
( ($change_prefix) ? ($table_prefix . substr($table_name, 6)) : $table_name ),
|
||||
$table_data
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_CREATE_DATABASE_SCHEMA';
|
||||
}
|
||||
}
|
28
phpBB/phpbb/install/module/install_filesystem/module.php
Normal file
28
phpBB/phpbb/install/module/install_filesystem/module.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_filesystem;
|
||||
|
||||
/**
|
||||
* Installer module for filesystem installation
|
||||
*/
|
||||
class module extends \phpbb\install\module_base
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_navigation_stage_path()
|
||||
{
|
||||
return array('install', 0, 'install');
|
||||
}
|
||||
}
|
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_filesystem\task;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
/**
|
||||
* Dumps config file
|
||||
*/
|
||||
class create_config_file extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\filesystem\filesystem_interface
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\database
|
||||
*/
|
||||
protected $db_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\filesystem\filesystem_interface $filesystem
|
||||
* @param \phpbb\install\helper\config $install_config
|
||||
* @param \phpbb\install\helper\database $db_helper
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler
|
||||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem,
|
||||
\phpbb\install\helper\config $install_config,
|
||||
\phpbb\install\helper\database $db_helper,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
$this->install_config = $install_config;
|
||||
$this->db_helper = $db_helper;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->iohandler = $iohandler;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$config_written = true;
|
||||
|
||||
// Create config.php
|
||||
$path_to_config = $this->phpbb_root_path . 'config.' . $this->php_ext;
|
||||
|
||||
$fp = @fopen($path_to_config, 'w');
|
||||
if (!$fp)
|
||||
{
|
||||
$config_written = false;
|
||||
}
|
||||
|
||||
$config_content = $this->get_config_data();
|
||||
|
||||
if (!@fwrite($fp, $config_content))
|
||||
{
|
||||
$config_written = false;
|
||||
}
|
||||
|
||||
@fclose($fp);
|
||||
|
||||
// chmod config.php to be only readable
|
||||
if ($config_written)
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->filesystem->phpbb_chmod($path_to_config, \phpbb\filesystem\filesystem_interface::CHMOD_READ);
|
||||
}
|
||||
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
||||
{
|
||||
// Do nothing, the user will get a notice later
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->iohandler->add_error_message('UNABLE_TO_WRITE_CONFIG_FILE');
|
||||
$this->iohandler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
|
||||
// Create a lock file to indicate that there is an install in progress
|
||||
$fp = @fopen($this->phpbb_root_path . 'cache/install_lock', 'wb');
|
||||
if ($fp === false)
|
||||
{
|
||||
// We were unable to create the lock file - abort
|
||||
$this->iohandler->add_error_message('UNABLE_TO_WRITE_LOCK');
|
||||
$this->iohandler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
@fclose($fp);
|
||||
|
||||
try
|
||||
{
|
||||
$this->filesystem->phpbb_chmod($this->phpbb_root_path . 'cache/install_lock', 0777);
|
||||
}
|
||||
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
||||
{
|
||||
// Do nothing, the user will get a notice later
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content which should be dumped to config.php
|
||||
*
|
||||
* @param bool $debug If the debug constants should be enabled by default or not
|
||||
* @param bool $debug_container If the container should be compiled on
|
||||
* every page load or not
|
||||
* @param bool $debug_test If the DEBUG_TEST constant should be added
|
||||
* NOTE: Only for use within the testing framework
|
||||
*
|
||||
* @return string content to be written to the config file
|
||||
*/
|
||||
protected function get_config_data($debug = false, $debug_container = false, $debug_test = false)
|
||||
{
|
||||
$config_content = "<?php\n";
|
||||
$config_content .= "// phpBB 3.2.x auto-generated configuration file\n// Do not change anything in this file!\n";
|
||||
|
||||
$dbms = $this->install_config->get('dbms');
|
||||
$db_driver = $this->db_helper->get_available_dbms($dbms);
|
||||
$db_driver = $db_driver[$dbms]['DRIVER'];
|
||||
|
||||
$config_data_array = array(
|
||||
'dbms' => $db_driver,
|
||||
'dbhost' => $this->install_config->get('dbhost'),
|
||||
'dbport' => $this->install_config->get('dbport'),
|
||||
'dbname' => $this->install_config->get('dbname'),
|
||||
'dbuser' => $this->install_config->get('dbuser'),
|
||||
'dbpasswd' => $this->install_config->get('dbpasswd'),
|
||||
'table_prefix' => $this->install_config->get('table_prefix'),
|
||||
|
||||
'phpbb_adm_relative_path' => 'adm/',
|
||||
|
||||
'acm_type' => 'phpbb\cache\driver\file',
|
||||
);
|
||||
|
||||
foreach ($config_data_array as $key => $value)
|
||||
{
|
||||
$config_content .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n";
|
||||
}
|
||||
|
||||
$config_content .= "\n@define('PHPBB_INSTALLED', true);\n";
|
||||
$config_content .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n";
|
||||
|
||||
if ($debug_test)
|
||||
{
|
||||
$config_content .= "@define('PHPBB_ENVIRONMENT', 'test');\n";
|
||||
}
|
||||
else if ($debug)
|
||||
{
|
||||
$config_content .= "@define('PHPBB_ENVIRONMENT', 'development');\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$config_content .= "@define('PHPBB_ENVIRONMENT', 'production');\n";
|
||||
}
|
||||
|
||||
if ($debug_container)
|
||||
{
|
||||
$config_content .= "@define('DEBUG_CONTAINER', true);\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$config_content .= "// @define('DEBUG_CONTAINER', true);\n";
|
||||
}
|
||||
|
||||
if ($debug_test)
|
||||
{
|
||||
$config_content .= "@define('DEBUG_TEST', true);\n";
|
||||
|
||||
// Mandatory for the functional tests, will be removed by PHPBB3-12623
|
||||
$config_content .= "@define('DEBUG', true);\n";
|
||||
}
|
||||
|
||||
return $config_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_CREATE_CONFIG_FILE';
|
||||
}
|
||||
}
|
28
phpBB/phpbb/install/module/install_finish/module.php
Normal file
28
phpBB/phpbb/install/module/install_finish/module.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_finish;
|
||||
|
||||
/**
|
||||
* Installer module for filesystem installation
|
||||
*/
|
||||
class module extends \phpbb\install\module_base
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_navigation_stage_path()
|
||||
{
|
||||
return array('install', 0, 'install');
|
||||
}
|
||||
}
|
129
phpBB/phpbb/install/module/install_finish/task/notify_user.php
Normal file
129
phpBB/phpbb/install/module/install_finish/task/notify_user.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_finish\task;
|
||||
|
||||
/**
|
||||
* Logs installation and sends an email to the admin
|
||||
*/
|
||||
class notify_user extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\auth\auth
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* @var \phpbb\config\db
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\log\log_interface
|
||||
*/
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* @var \phpbb\user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\container_factory $container
|
||||
* @param \phpbb\install\helper\config $install_config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler
|
||||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->install_config = $install_config;
|
||||
$this->iohandler = $iohandler;
|
||||
|
||||
$this->auth = $container->get('auth');
|
||||
$this->config = $container->get('config');
|
||||
$this->log = $container->get('log');
|
||||
$this->user = $container->get('user');
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// @todo
|
||||
//$this->user->setup('common');
|
||||
|
||||
//$this->user->session_begin();
|
||||
//$this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_pass1'), false, true, true);
|
||||
|
||||
if ($this->config['email_enable'])
|
||||
{
|
||||
include ($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
|
||||
|
||||
$messenger = new \messenger(false);
|
||||
$messenger->template('installed', $this->install_config->get('language'));
|
||||
$messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
|
||||
$messenger->anti_abuse_headers($this->config, $this->user);
|
||||
$messenger->assign_vars(array(
|
||||
'USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')),
|
||||
'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd')))
|
||||
);
|
||||
$messenger->send(NOTIFY_EMAIL);
|
||||
}
|
||||
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version']));
|
||||
|
||||
@unlink($this->phpbb_root_path . 'cache/install_lock');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_NOTIFY_USER';
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\install_finish\task;
|
||||
|
||||
/**
|
||||
* Populates migrations
|
||||
*/
|
||||
class populate_migrations extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\extension\manager
|
||||
*/
|
||||
protected $extension_manager;
|
||||
|
||||
/**
|
||||
* @var \phpbb\db\migrator
|
||||
*/
|
||||
protected $migrator;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\container_factory $container phpBB's DI contianer
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\container_factory $container)
|
||||
{
|
||||
$this->extension_manager = $container->get('ext.manager');
|
||||
$this->migrator = $container->get('migrator');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$finder = $this->extension_manager->get_finder();
|
||||
|
||||
$migrations = $finder
|
||||
->core_path('phpbb/db/migration/data/')
|
||||
->get_classes();
|
||||
$this->migrator->populate_migrations($migrations);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_POPULATE_MIGRATIONS';
|
||||
}
|
||||
}
|
33
phpBB/phpbb/install/module/obtain_data/module.php
Normal file
33
phpBB/phpbb/install/module/obtain_data/module.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data;
|
||||
|
||||
class module extends \phpbb\install\module_base
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_navigation_stage_path()
|
||||
{
|
||||
return array('install', 0, 'obtain_data');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data\task;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
/**
|
||||
* This class requests and validates admin account data from the user
|
||||
*/
|
||||
class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\install\task_interface
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $io_handler;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $install_config Installer's config helper
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $install_config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler)
|
||||
{
|
||||
$this->install_config = $install_config;
|
||||
$this->io_handler = $iohandler;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Check if data is sent
|
||||
if ($this->io_handler->get_input('submit_admin', false))
|
||||
{
|
||||
$this->process_form();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request_form_data();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process form data
|
||||
*/
|
||||
protected function process_form()
|
||||
{
|
||||
// Admin data
|
||||
$admin_name = $this->io_handler->get_input('admin_name', '', true);
|
||||
$admin_pass1 = $this->io_handler->get_input('admin_pass1', '', true);
|
||||
$admin_pass2 = $this->io_handler->get_input('admin_pass2', '', true);
|
||||
$board_email = $this->io_handler->get_input('board_email', '');
|
||||
|
||||
$admin_data_valid = $this->check_admin_data($admin_name, $admin_pass1, $admin_pass2, $board_email);
|
||||
|
||||
if ($admin_data_valid)
|
||||
{
|
||||
$this->install_config->set('admin_name', $admin_name);
|
||||
$this->install_config->set('admin_passwd', $admin_pass1);
|
||||
$this->install_config->set('board_email', $board_email);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request_form_data(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request data from the user
|
||||
*
|
||||
* @param bool $use_request_data Whether to use submited data
|
||||
*
|
||||
* @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data
|
||||
*/
|
||||
protected function request_form_data($use_request_data = false)
|
||||
{
|
||||
if ($use_request_data)
|
||||
{
|
||||
$admin_username = $this->io_handler->get_input('admin_name', '', true);
|
||||
$admin_email = $this->io_handler->get_input('board_email', '', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$admin_username = '';
|
||||
$admin_email = '';
|
||||
}
|
||||
|
||||
$admin_form = array(
|
||||
'admin_name' => array(
|
||||
'label' => 'ADMIN_USERNAME',
|
||||
'description' => 'ADMIN_USERNAME_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $admin_username,
|
||||
),
|
||||
'board_email' => array(
|
||||
'label' => 'CONTACT_EMAIL',
|
||||
'type' => 'email',
|
||||
'default' => $admin_email,
|
||||
),
|
||||
'admin_pass1' => array(
|
||||
'label' => 'ADMIN_PASSWORD',
|
||||
'description' => 'ADMIN_PASSWORD_EXPLAIN',
|
||||
'type' => 'password',
|
||||
),
|
||||
'admin_pass2' => array(
|
||||
'label' => 'ADMIN_PASSWORD_CONFIRM',
|
||||
'type' => 'password',
|
||||
),
|
||||
'submit_admin' => array(
|
||||
'label' => 'SUBMIT',
|
||||
'type' => 'submit',
|
||||
),
|
||||
);
|
||||
|
||||
$this->io_handler->add_user_form_group('ADMIN_CONFIG', $admin_form);
|
||||
|
||||
// Require user interaction
|
||||
$this->io_handler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check admin data
|
||||
*
|
||||
* @param string $username Admin username
|
||||
* @param string $pass1 Admin password
|
||||
* @param string $pass2 Admin password confirmation
|
||||
* @param string $email Admin e-mail address
|
||||
*
|
||||
* @return bool True if data is valid, false otherwise
|
||||
*/
|
||||
protected function check_admin_data($username, $pass1, $pass2, $email)
|
||||
{
|
||||
$data_valid = true;
|
||||
|
||||
// Check if none of admin data is empty
|
||||
if (in_array('', array($username, $pass1, $pass2, $email)))
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_MISSING_DATA');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
if (utf8_strlen($username) < 3)
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_USER_TOO_SHORT');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
if (utf8_strlen($username) > 20)
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_USER_TOO_LONG');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
if ($pass1 !== $pass2 && $pass1 !== '')
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_PASSWORD_MISMATCH');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
// Test against the default password rules
|
||||
if (utf8_strlen($pass1) < 6)
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_PASSWORD_TOO_SHORT');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
if (utf8_strlen($pass1) > 30)
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_PASSWORD_TOO_LONG');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email))
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_EMAIL_INVALID');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
return $data_valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data\task;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
/**
|
||||
* This class obtains default data from the user related to board (Board name, Board descritpion, etc...)
|
||||
*/
|
||||
class obtain_board_data extends \phpbb\install\task_base implements \phpbb\install\task_interface
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $io_handler;
|
||||
|
||||
/**
|
||||
* @var \phpbb\language\language_file_helper
|
||||
*/
|
||||
protected $language_helper;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $config Installer's config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
* @param \phpbb\language\language_file_helper $lang_helper Language file helper
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler,
|
||||
\phpbb\language\language_file_helper $lang_helper)
|
||||
{
|
||||
$this->install_config = $config;
|
||||
$this->io_handler = $iohandler;
|
||||
$this->language_helper = $lang_helper;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Check if data is sent
|
||||
if ($this->io_handler->get_input('submit_board', false))
|
||||
{
|
||||
$this->process_form();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request_form_data();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process form data
|
||||
*/
|
||||
protected function process_form()
|
||||
{
|
||||
// Board data
|
||||
$default_lang = $this->io_handler->get_input('default_lang', '');
|
||||
$board_name = $this->io_handler->get_input('board_name', '');
|
||||
$board_desc = $this->io_handler->get_input('board_description', '');
|
||||
|
||||
// Check default lang
|
||||
$langs = $this->language_helper->get_available_languages();
|
||||
$lang_valid = false;
|
||||
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
if ($lang['iso'] === $default_lang)
|
||||
{
|
||||
$lang_valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->install_config->set('board_name', $board_name);
|
||||
$this->install_config->set('board_description', $board_desc);
|
||||
|
||||
if ($lang_valid)
|
||||
{
|
||||
$this->install_config->set('default_lang', $default_lang);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request_form_data(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request data from the user
|
||||
*
|
||||
* @param bool $use_request_data Whether to use submited data
|
||||
*
|
||||
* @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data
|
||||
*/
|
||||
protected function request_form_data($use_request_data = false)
|
||||
{
|
||||
if ($use_request_data)
|
||||
{
|
||||
$board_name = $this->io_handler->get_input('board_name', '');
|
||||
$board_desc = $this->io_handler->get_input('board_description', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
$board_name = '{L_CONFIG_SITENAME}';
|
||||
$board_desc = '{L_CONFIG_SITE_DESC}';
|
||||
}
|
||||
|
||||
// Use language because we only check this to be valid
|
||||
$default_lang = $this->install_config->get('language', '');
|
||||
|
||||
$langs = $this->language_helper->get_available_languages();
|
||||
$lang_options = array();
|
||||
|
||||
foreach ($langs as $lang)
|
||||
{
|
||||
$lang_options[] = array(
|
||||
'value' => $lang['iso'],
|
||||
'label' => $lang['local_name'],
|
||||
'selected' => ($default_lang === $lang['iso']),
|
||||
);
|
||||
}
|
||||
|
||||
$board_form = array(
|
||||
'default_lang' => array(
|
||||
'label' => 'DEFAULT_LANGUAGE',
|
||||
'type' => 'select',
|
||||
'options' => $lang_options,
|
||||
),
|
||||
'board_name' => array(
|
||||
'label' => 'BOARD_NAME',
|
||||
'type' => 'text',
|
||||
'default' => $board_name,
|
||||
),
|
||||
'board_description' => array(
|
||||
'label' => 'BOARD_DESCRIPTION',
|
||||
'type' => 'text',
|
||||
'default' => $board_desc,
|
||||
),
|
||||
'submit_board' => array(
|
||||
'label' => 'SUBMIT',
|
||||
'type' => 'submit',
|
||||
),
|
||||
);
|
||||
|
||||
$this->io_handler->add_user_form_group('BOARD_CONFIG', $board_form);
|
||||
|
||||
$this->io_handler->send_response();
|
||||
throw new user_interaction_required_exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data\task;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
/**
|
||||
* This class requests and validates database information from the user
|
||||
*/
|
||||
class obtain_database_data extends \phpbb\install\task_base implements \phpbb\install\task_interface
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\database
|
||||
*/
|
||||
protected $database_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $io_handler;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\database $database_helper Installer's database helper
|
||||
* @param \phpbb\install\helper\config $install_config Installer's config helper
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\database $database_helper,
|
||||
\phpbb\install\helper\config $install_config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler)
|
||||
{
|
||||
$this->database_helper = $database_helper;
|
||||
$this->install_config = $install_config;
|
||||
$this->io_handler = $iohandler;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Check if data is sent
|
||||
if ($this->io_handler->get_input('submit_database', false))
|
||||
{
|
||||
$this->process_form();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request_form_data();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process form data
|
||||
*/
|
||||
protected function process_form()
|
||||
{
|
||||
// Collect database data
|
||||
$dbms = $this->io_handler->get_input('dbms', '');
|
||||
$dbhost = $this->io_handler->get_input('dbhost', '');
|
||||
$dbport = $this->io_handler->get_input('dbport', '');
|
||||
$dbuser = $this->io_handler->get_input('dbuser', '');
|
||||
$dbpasswd = $this->io_handler->get_input('dbpasswd', '', true);
|
||||
$dbname = $this->io_handler->get_input('dbname', '');
|
||||
$table_prefix = $this->io_handler->get_input('table_prefix', '');
|
||||
|
||||
// Check database data
|
||||
$user_data_vaild = $this->check_database_data($dbms, $dbhost, $dbport, $dbuser, $dbpasswd, $dbname, $table_prefix);
|
||||
|
||||
// Save database data if it is correct
|
||||
if ($user_data_vaild)
|
||||
{
|
||||
$this->install_config->set('dbms', $dbms);
|
||||
$this->install_config->set('dbhost', $dbhost);
|
||||
$this->install_config->set('dbport', $dbport);
|
||||
$this->install_config->set('dbuser', $dbuser);
|
||||
$this->install_config->set('dbpasswd', $dbpasswd);
|
||||
$this->install_config->set('dbname', $dbname);
|
||||
$this->install_config->set('table_prefix', $table_prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->request_form_data(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request data from the user
|
||||
*
|
||||
* @param bool $use_request_data Whether to use submited data
|
||||
*
|
||||
* @throws \phpbb\install\exception\user_interaction_required_exception When the user is required to provide data
|
||||
*/
|
||||
protected function request_form_data($use_request_data = false)
|
||||
{
|
||||
if ($use_request_data)
|
||||
{
|
||||
$dbms = $this->io_handler->get_input('dbms', '');
|
||||
$dbhost = $this->io_handler->get_input('dbhost', '');
|
||||
$dbport = $this->io_handler->get_input('dbport', '');
|
||||
$dbuser = $this->io_handler->get_input('dbuser', '');
|
||||
$dbname = $this->io_handler->get_input('dbname', '');
|
||||
$table_prefix = $this->io_handler->get_input('table_prefix', 'phpbb_');
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbms = '';
|
||||
$dbhost = '';
|
||||
$dbport = '';
|
||||
$dbuser = '';
|
||||
$dbname = '';
|
||||
$table_prefix = 'phpbb_';
|
||||
}
|
||||
|
||||
$dbms_select = array();
|
||||
foreach ($this->database_helper->get_available_dbms() as $dbms_key => $dbms_array)
|
||||
{
|
||||
$dbms_select[] = array(
|
||||
'value' => $dbms_key,
|
||||
'label' => 'DB_OPTION_' . strtoupper($dbms_key),
|
||||
'selected' => ($dbms_key === $dbms),
|
||||
);
|
||||
}
|
||||
|
||||
$database_form = array(
|
||||
'dbms' => array(
|
||||
'label' => 'DBMS',
|
||||
'type' => 'select',
|
||||
'options' => $dbms_select,
|
||||
),
|
||||
'dbhost' => array(
|
||||
'label' => 'DB_HOST',
|
||||
'description' => 'DB_HOST_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $dbhost,
|
||||
),
|
||||
'dbport' => array(
|
||||
'label' => 'DB_PORT',
|
||||
'description' => 'DB_PORT_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $dbport,
|
||||
),
|
||||
'dbuser' => array(
|
||||
'label' => 'DB_USERNAME',
|
||||
'type' => 'text',
|
||||
'default' => $dbuser,
|
||||
),
|
||||
'dbpasswd' => array(
|
||||
'label' => 'DB_PASSWORD',
|
||||
'type' => 'password',
|
||||
),
|
||||
'dbname' => array(
|
||||
'label' => 'DB_NAME',
|
||||
'type' => 'text',
|
||||
'default' => $dbname,
|
||||
),
|
||||
'table_prefix' => array(
|
||||
'label' => 'TABLE_PREFIX',
|
||||
'description' => 'TABLE_PREFIX_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $table_prefix,
|
||||
),
|
||||
'submit_database' => array(
|
||||
'label' => 'SUBMIT',
|
||||
'type' => 'submit',
|
||||
),
|
||||
);
|
||||
|
||||
$this->io_handler->add_user_form_group('DB_CONFIG', $database_form);
|
||||
|
||||
// Require user interaction
|
||||
$this->io_handler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check database data
|
||||
*
|
||||
* @param string $dbms Selected database type
|
||||
* @param string $dbhost Database host address
|
||||
* @param int $dbport Database port number
|
||||
* @param string $dbuser Database username
|
||||
* @param string $dbpass Database password
|
||||
* @param string $dbname Database name
|
||||
* @param string $table_prefix Database table prefix
|
||||
*
|
||||
* @return bool True if database data is correct, false otherwise
|
||||
*/
|
||||
protected function check_database_data($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix)
|
||||
{
|
||||
$available_dbms = $this->database_helper->get_available_dbms();
|
||||
$data_valid = true;
|
||||
|
||||
// Check if PHP has the database extensions for the specified DBMS
|
||||
if (!isset($available_dbms[$dbms]))
|
||||
{
|
||||
$this->io_handler->add_error_message('INST_ERR_NO_DB');
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
// Validate table prefix
|
||||
$prefix_valid = $this->database_helper->validate_table_prefix($dbms, $table_prefix);
|
||||
if (is_array($prefix_valid))
|
||||
{
|
||||
foreach ($prefix_valid as $error)
|
||||
{
|
||||
$this->io_handler->add_error_message(
|
||||
$error['title'],
|
||||
(isset($error['description'])) ? $error['description'] : false
|
||||
);
|
||||
}
|
||||
|
||||
$data_valid = false;
|
||||
}
|
||||
|
||||
// Try to connect to database if all provided data is valid
|
||||
if ($data_valid)
|
||||
{
|
||||
$connect_test = $this->database_helper->check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix);
|
||||
if (is_array($connect_test))
|
||||
{
|
||||
foreach ($prefix_valid as $error)
|
||||
{
|
||||
$this->io_handler->add_error_message(
|
||||
$error['title'],
|
||||
(isset($error['description'])) ? $error['description'] : false
|
||||
);
|
||||
}
|
||||
|
||||
$data_valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $data_valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data\task;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
class obtain_email_data extends \phpbb\install\task_base implements \phpbb\install\task_interface
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $io_handler;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $config Installer's config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler)
|
||||
{
|
||||
$this->install_config = $config;
|
||||
$this->io_handler = $iohandler;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// E-mail data
|
||||
$email_enable = $this->io_handler->get_input('email_enable', true);
|
||||
$smtp_delivery = $this->io_handler->get_input('smtp_delivery', '');
|
||||
$smtp_host = $this->io_handler->get_input('smtp_host', '');
|
||||
$smtp_auth = $this->io_handler->get_input('smtp_auth', '');
|
||||
$smtp_user = $this->io_handler->get_input('smtp_user', '');
|
||||
$smtp_passwd = $this->io_handler->get_input('smtp_pass', '');
|
||||
|
||||
$auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
|
||||
|
||||
// Check if data is sent
|
||||
if ($this->io_handler->get_input('submit_email', false))
|
||||
{
|
||||
$this->install_config->set('email_enable', $email_enable);
|
||||
$this->install_config->set('smtp_delivery', $smtp_delivery);
|
||||
$this->install_config->set('smtp_host', $smtp_host);
|
||||
$this->install_config->set('smtp_auth', $smtp_auth);
|
||||
$this->install_config->set('smtp_user', $smtp_user);
|
||||
$this->install_config->set('smtp_pass', $smtp_passwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
$auth_options = array();
|
||||
foreach ($auth_methods as $method)
|
||||
{
|
||||
$auth_options[] = array(
|
||||
'value' => $method,
|
||||
'label' => 'SMTP_' . str_replace('-', '_', $method),
|
||||
'selected' => false,
|
||||
);
|
||||
}
|
||||
|
||||
$email_form = array(
|
||||
'email_enable' => array(
|
||||
'label' => 'ENABLE_EMAIL',
|
||||
'description' => 'COOKIE_SECURE_EXPLAIN',
|
||||
'type' => 'radio',
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => 1,
|
||||
'label' => 'ENABLE',
|
||||
'selected' => true,
|
||||
),
|
||||
array(
|
||||
'value' => 0,
|
||||
'label' => 'DISABLE',
|
||||
'selected' => false,
|
||||
),
|
||||
),
|
||||
),
|
||||
'smtp_delivery' => array(
|
||||
'label' => 'USE_SMTP',
|
||||
'description' => 'USE_SMTP_EXPLAIN',
|
||||
'type' => 'radio',
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => 0,
|
||||
'label' => 'NO',
|
||||
'selected' => true,
|
||||
),
|
||||
array(
|
||||
'value' => 1,
|
||||
'label' => 'YES',
|
||||
'selected' => false,
|
||||
),
|
||||
),
|
||||
),
|
||||
'smtp_host' => array(
|
||||
'label' => 'SMTP_SERVER',
|
||||
'description' => 'SMTP_SERVER_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $smtp_host,
|
||||
),
|
||||
'smtp_auth' => array(
|
||||
'label' => 'SMTP_AUTH_METHOD',
|
||||
'type' => 'select',
|
||||
'options' => $auth_options,
|
||||
),
|
||||
'smtp_user' => array(
|
||||
'label' => 'SMTP_USERNAME',
|
||||
'description' => 'SMTP_USERNAME_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $smtp_user,
|
||||
),
|
||||
'smtp_pass' => array(
|
||||
'label' => 'SMTP_PASSWORD',
|
||||
'description' => 'SMTP_PASSWORD_EXPLAIN',
|
||||
'type' => 'password',
|
||||
),
|
||||
'submit_email' => array(
|
||||
'label' => 'SUBMIT',
|
||||
'type' => 'submit',
|
||||
),
|
||||
);
|
||||
|
||||
$this->io_handler->add_user_form_group('EMAIL_CONFIG', $email_form);
|
||||
|
||||
$this->io_handler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data\task;
|
||||
|
||||
class obtain_imagick_path extends \phpbb\install\task_base implements \phpbb\install\task_interface
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $config Installer's config
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Can we find Imagemagick anywhere on the system?
|
||||
$exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : '';
|
||||
|
||||
$magic_home = getenv('MAGICK_HOME');
|
||||
$img_imagick = '';
|
||||
if (empty($magic_home))
|
||||
{
|
||||
$locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/');
|
||||
$path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH'))));
|
||||
|
||||
$locations = array_merge($path_locations, $locations);
|
||||
foreach ($locations as $location)
|
||||
{
|
||||
// The path might not end properly, fudge it
|
||||
if (substr($location, -1, 1) !== '/')
|
||||
{
|
||||
$location .= '/';
|
||||
}
|
||||
|
||||
if (@file_exists($location) && @is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000)
|
||||
{
|
||||
$img_imagick = str_replace('\\', '/', $location);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$img_imagick = str_replace('\\', '/', $magic_home);
|
||||
}
|
||||
|
||||
$this->config->set('img_imagick', $img_imagick);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\obtain_data\task;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
/**
|
||||
* This class requests and saves some information about the server
|
||||
*/
|
||||
class obtain_server_data extends \phpbb\install\task_base implements \phpbb\install\task_interface
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $io_handler;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\config $config Installer's config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\config $config,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $iohandler)
|
||||
{
|
||||
$this->install_config = $config;
|
||||
$this->io_handler = $iohandler;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$cookie_secure = $this->io_handler->is_secure();
|
||||
$server_protocol = ($this->io_handler->is_secure()) ? 'https://' : 'http://';
|
||||
$server_port = $this->io_handler->get_server_variable('SERVER_PORT', 0);
|
||||
|
||||
// HTTP_HOST is having the correct browser url in most cases...
|
||||
$server_name = strtolower(htmlspecialchars_decode($this->io_handler->get_header_variable(
|
||||
'Host',
|
||||
$this->io_handler->get_server_variable('SERVER_NAME')
|
||||
)));
|
||||
|
||||
// HTTP HOST can carry a port number...
|
||||
if (strpos($server_name, ':') !== false)
|
||||
{
|
||||
$server_name = substr($server_name, 0, strpos($server_name, ':'));
|
||||
}
|
||||
|
||||
$script_path = htmlspecialchars_decode($this->io_handler->get_server_variable('PHP_SELF'));
|
||||
|
||||
if (!$script_path)
|
||||
{
|
||||
$script_path = htmlspecialchars_decode($this->io_handler->get_server_variable('REQUEST_URI'));
|
||||
}
|
||||
|
||||
$script_path = str_replace(array('\\', '//'), '/', $script_path);
|
||||
$script_path = trim(dirname(dirname($script_path)));
|
||||
|
||||
// Server data
|
||||
$cookie_secure = $this->io_handler->get_input('cookie_secure', $cookie_secure);
|
||||
$server_protocol = $this->io_handler->get_input('server_protocol', $server_protocol);
|
||||
$force_server_vars = $this->io_handler->get_input('force_server_vars', 0);
|
||||
$server_name = $this->io_handler->get_input('server_name', $server_name);
|
||||
$server_port = $this->io_handler->get_input('server_port', $server_port);
|
||||
$script_path = $this->io_handler->get_input('script_path', $script_path);
|
||||
|
||||
// Clean up script path
|
||||
if ($script_path !== '/')
|
||||
{
|
||||
// Adjust destination path (no trailing slash)
|
||||
if (substr($script_path, -1) === '/')
|
||||
{
|
||||
$script_path = substr($script_path, 0, -1);
|
||||
}
|
||||
|
||||
$script_path = str_replace(array('../', './'), '', $script_path);
|
||||
|
||||
if ($script_path[0] !== '/')
|
||||
{
|
||||
$script_path = '/' . $script_path;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if data is sent
|
||||
if ($this->io_handler->get_input('submit_server', false))
|
||||
{
|
||||
$this->install_config->set('cookie_secure', $cookie_secure);
|
||||
$this->install_config->set('server_protocol', $server_protocol);
|
||||
$this->install_config->set('force_server_vars', $force_server_vars);
|
||||
$this->install_config->set('server_name', $server_name);
|
||||
$this->install_config->set('server_port', $server_port);
|
||||
$this->install_config->set('script_path', $script_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Render form
|
||||
$server_form = array(
|
||||
'cookie_secure' => array(
|
||||
'label' => 'COOKIE_SECURE',
|
||||
'description' => 'COOKIE_SECURE_EXPLAIN',
|
||||
'type' => 'radio',
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => 0,
|
||||
'label' => 'NO',
|
||||
'selected' => (!$cookie_secure),
|
||||
),
|
||||
array(
|
||||
'value' => 1,
|
||||
'label' => 'YES',
|
||||
'selected' => ($cookie_secure),
|
||||
),
|
||||
),
|
||||
),
|
||||
'force_server_vars' => array(
|
||||
'label' => 'FORCE_SERVER_VARS',
|
||||
'description' => 'FORCE_SERVER_VARS_EXPLAIN',
|
||||
'type' => 'radio',
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => 0,
|
||||
'label' => 'NO',
|
||||
'selected' => true,
|
||||
),
|
||||
array(
|
||||
'value' => 1,
|
||||
'label' => 'YES',
|
||||
'selected' => false,
|
||||
),
|
||||
),
|
||||
),
|
||||
'server_protocol' => array(
|
||||
'label' => 'SERVER_PROTOCOL',
|
||||
'description' => 'SERVER_PROTOCOL_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $server_protocol,
|
||||
),
|
||||
'server_name' => array(
|
||||
'label' => 'SERVER_NAME',
|
||||
'description' => 'SERVER_NAME_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $server_name,
|
||||
),
|
||||
'server_port' => array(
|
||||
'label' => 'SERVER_PORT',
|
||||
'description' => 'SERVER_PORT_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $server_port,
|
||||
),
|
||||
'script_path' => array(
|
||||
'label' => 'SCRIPT_PATH',
|
||||
'description' => 'SCRIPT_PATH_EXPLAIN',
|
||||
'type' => 'text',
|
||||
'default' => $script_path,
|
||||
),
|
||||
'submit_server' => array(
|
||||
'label' => 'SUBMIT',
|
||||
'type' => 'submit',
|
||||
)
|
||||
);
|
||||
|
||||
$this->io_handler->add_user_form_group('SERVER_CONFIG', $server_form);
|
||||
|
||||
$this->io_handler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
97
phpBB/phpbb/install/module/requirements/module.php
Normal file
97
phpBB/phpbb/install/module/requirements/module.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\requirements;
|
||||
|
||||
use phpbb\install\exception\user_interaction_required_exception;
|
||||
|
||||
class module extends \phpbb\install\module_base
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$tests_passed = true;
|
||||
|
||||
// Recover install progress
|
||||
$task_index = 0;
|
||||
|
||||
// Run until there are available resources
|
||||
while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0)
|
||||
{
|
||||
// Check if task exists
|
||||
if (!isset($this->task_collection[$task_index]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Recover task to be executed
|
||||
try
|
||||
{
|
||||
/** @var \phpbb\install\task_interface $task */
|
||||
$task = $this->container->get($this->task_collection[$task_index]);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
throw new task_not_found_exception($this->task_collection[$task_index]);
|
||||
}
|
||||
|
||||
// Iterate to the next task
|
||||
$task_index++;
|
||||
|
||||
// Check if we can run the task
|
||||
if (!$task->is_essential() && !$task->check_requirements())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$test_result = $task->run();
|
||||
$tests_passed = ($tests_passed) ? $test_result : false;
|
||||
}
|
||||
|
||||
// Check if tests have failed
|
||||
if (!$tests_passed)
|
||||
{
|
||||
// If requirements are not met, exit form installer
|
||||
// Set up UI for retesting
|
||||
$this->iohandler->add_user_form_group('', array(
|
||||
'install' => array(
|
||||
'label' => 'RETEST_REQUIREMENTS',
|
||||
'type' => 'submit',
|
||||
),
|
||||
));
|
||||
|
||||
// Send the response and quit
|
||||
$this->iohandler->send_response();
|
||||
throw new user_interaction_required_exception();
|
||||
}
|
||||
|
||||
// Log install progress
|
||||
$current_task_index = $task_index - 1;
|
||||
$this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_navigation_stage_path()
|
||||
{
|
||||
return array('install', 0, 'requirements');
|
||||
}
|
||||
}
|
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\requirements\task;
|
||||
|
||||
/**
|
||||
* Checks filesystem requirements
|
||||
*/
|
||||
class check_filesystem extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\filesystem\filesystem_interface
|
||||
*/
|
||||
protected $filesystem;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $files_to_check;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $tests_passed;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\filesystem\filesystem_interface $filesystem filesystem handler
|
||||
* @parma \phpbb\install\helper\iohandler\iohandler_interface $response response helper
|
||||
* @param string $phpbb_root_path relative path to phpBB's root
|
||||
* @param string $php_ext extension of php files
|
||||
*/
|
||||
public function __construct(\phpbb\filesystem\filesystem_interface $filesystem,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $response,
|
||||
$phpbb_root_path,
|
||||
$php_ext)
|
||||
{
|
||||
parent::__construct(true);
|
||||
|
||||
$this->filesystem = $filesystem;
|
||||
$this->response = $response;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
|
||||
$this->tests_passed = false;
|
||||
|
||||
// Files/Directories to check
|
||||
// All file/directory names must be relative to phpBB's root path
|
||||
$this->files_to_check = array(
|
||||
array(
|
||||
'path' => 'cache/',
|
||||
'failable' => false,
|
||||
'is_file' => false,
|
||||
),
|
||||
array(
|
||||
'path' => 'store/',
|
||||
'failable' => false,
|
||||
'is_file' => false,
|
||||
),
|
||||
array(
|
||||
'path' => 'files/',
|
||||
'failable' => false,
|
||||
'is_file' => false,
|
||||
),
|
||||
array(
|
||||
'path' => 'images/avatars/upload/',
|
||||
'failable' => true,
|
||||
'is_file' => false,
|
||||
),
|
||||
array(
|
||||
'path' => "config.$php_ext",
|
||||
'failable' => false,
|
||||
'is_file' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->tests_passed = true;
|
||||
|
||||
// Check files/directories to be writable
|
||||
foreach ($this->files_to_check as $file)
|
||||
{
|
||||
if ($file['is_file'])
|
||||
{
|
||||
$this->check_file($file['path'], $file['failable']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->check_dir($file['path'], $file['failable']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->tests_passed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->tests_passed
|
||||
*
|
||||
* @param bool $is_passed
|
||||
*/
|
||||
protected function set_test_passed($is_passed)
|
||||
{
|
||||
// If one test failed, tests_passed should be false
|
||||
$this->tests_passed = (!$this->tests_passed) ? false : $is_passed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a file is readable and writable
|
||||
*
|
||||
* @param string $file Filename
|
||||
* @param bool $failable Whether failing test should interrupt installation process
|
||||
*/
|
||||
protected function check_file($file, $failable = false)
|
||||
{
|
||||
$path = $this->phpbb_root_path . $file;
|
||||
$exists = $writable = true;
|
||||
|
||||
// Try to create file if it does not exists
|
||||
if (!file_exists($path))
|
||||
{
|
||||
$fp = @fopen($path, 'w');
|
||||
@fclose($fp);
|
||||
try
|
||||
{
|
||||
$this->filesystem->phpbb_chmod($path,
|
||||
\phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE
|
||||
);
|
||||
$exists = true;
|
||||
}
|
||||
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($path))
|
||||
{
|
||||
if (!$this->filesystem->is_writable($path))
|
||||
{
|
||||
$writable = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = $writable = false;
|
||||
}
|
||||
|
||||
$this->set_test_passed(($exists && $writable) || $failable);
|
||||
|
||||
if (!($exists && $writable))
|
||||
{
|
||||
$title = ($exists) ? 'FILE_NOT_WRITABLE' : 'FILE_NOT_EXISTS';
|
||||
$description = array($title . '_EXPLAIN', $file);
|
||||
|
||||
if ($failable)
|
||||
{
|
||||
$this->response->add_warning_message($title, $description);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response->add_error_message($title, $description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a directory is readable and writable
|
||||
*
|
||||
* @param string $dir Filename
|
||||
* @param bool $failable Whether failing test should abort the installation process
|
||||
*/
|
||||
protected function check_dir($dir, $failable = false)
|
||||
{
|
||||
$path = $this->phpbb_root_path . $dir;
|
||||
$exists = $writable = false;
|
||||
|
||||
// Try to create the directory if it does not exist
|
||||
if (!file_exists($path))
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->filesystem->mkdir($path, 0777);
|
||||
$this->filesystem->phpbb_chmod($path,
|
||||
\phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE
|
||||
);
|
||||
$exists = true;
|
||||
}
|
||||
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
// Now really check
|
||||
if (file_exists($path) && is_dir($path))
|
||||
{
|
||||
try
|
||||
{
|
||||
$exists = true;
|
||||
$this->filesystem->phpbb_chmod($path,
|
||||
\phpbb\filesystem\filesystem_interface::CHMOD_READ | \phpbb\filesystem\filesystem_interface::CHMOD_WRITE
|
||||
);
|
||||
}
|
||||
catch (\phpbb\filesystem\exception\filesystem_exception $e)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->filesystem->is_writable($path))
|
||||
{
|
||||
$writable = true;
|
||||
}
|
||||
|
||||
$this->set_test_passed(($exists && $writable) || $failable);
|
||||
|
||||
if (!($exists && $writable))
|
||||
{
|
||||
$title = ($exists) ? 'DIRECTORY_NOT_WRITABLE' : 'DIRECTORY_NOT_EXISTS';
|
||||
$description = array($title . '_EXPLAIN', $dir);
|
||||
|
||||
if ($failable)
|
||||
{
|
||||
$this->response->add_warning_message($title, $description);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response->add_error_message($title, $description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install\module\requirements\task;
|
||||
|
||||
/**
|
||||
* Installer task that checks if the server meats phpBB requirements
|
||||
*/
|
||||
class check_server_environment extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\database
|
||||
*/
|
||||
protected $database_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\install\helper\iohandler\iohandler_interface
|
||||
*/
|
||||
protected $response_helper;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $tests_passed;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\database $database_helper
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $response
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\database $database_helper,
|
||||
\phpbb\install\helper\iohandler\iohandler_interface $response)
|
||||
{
|
||||
$this->database_helper = $database_helper;
|
||||
$this->response_helper = $response;
|
||||
$this->tests_passed = true;
|
||||
|
||||
parent::__construct(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
// Check requirements
|
||||
// The error messages should be set in the check_ functions
|
||||
//
|
||||
|
||||
// Check PHP version
|
||||
$this->check_php_version();
|
||||
|
||||
// Check for getimagesize()
|
||||
$this->check_image_size();
|
||||
|
||||
// Check for PCRE support
|
||||
$this->check_pcre();
|
||||
|
||||
// Check for JSON support
|
||||
$this->check_json();
|
||||
|
||||
// Check for dbms support
|
||||
$this->check_available_dbms();
|
||||
|
||||
return $this->tests_passed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets $this->tests_passed
|
||||
*
|
||||
* @param bool $is_passed
|
||||
*/
|
||||
protected function set_test_passed($is_passed)
|
||||
{
|
||||
// If one test failed, tests_passed should be false
|
||||
$this->tests_passed = (!$this->tests_passed) ? false : $is_passed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the requirements for PHP version is met
|
||||
*/
|
||||
protected function check_php_version()
|
||||
{
|
||||
$php_version = PHP_VERSION;
|
||||
|
||||
if (version_compare($php_version, '5.3.9') < 0)
|
||||
{
|
||||
$this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN');
|
||||
|
||||
$this->set_test_passed(false);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set_test_passed(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the installed PHP has getimagesize() available
|
||||
*/
|
||||
protected function check_image_size()
|
||||
{
|
||||
if (!@function_exists('getimagesize'))
|
||||
{
|
||||
$this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN');
|
||||
|
||||
$this->set_test_passed(false);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->set_test_passed(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the installed PHP supports PCRE
|
||||
*/
|
||||
protected function check_pcre()
|
||||
{
|
||||
if (@preg_match('//u', ''))
|
||||
{
|
||||
$this->set_test_passed(true);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN');
|
||||
|
||||
$this->set_test_passed(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether PHP's JSON extension is available or not
|
||||
*/
|
||||
protected function check_json()
|
||||
{
|
||||
if (@extension_loaded('json'))
|
||||
{
|
||||
$this->set_test_passed(true);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN');
|
||||
|
||||
$this->set_test_passed(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if any supported DBMS is available
|
||||
*/
|
||||
protected function check_available_dbms()
|
||||
{
|
||||
$available_dbms = $this->database_helper->get_available_dbms(false, true);
|
||||
|
||||
if ($available_dbms['ANY_DB_SUPPORT'])
|
||||
{
|
||||
$this->set_test_passed(true);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN');
|
||||
|
||||
$this->set_test_passed(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public function get_step_count()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
252
phpBB/phpbb/install/module_base.php
Normal file
252
phpBB/phpbb/install/module_base.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install;
|
||||
|
||||
use phpbb\install\exception\invalid_service_name_exception;
|
||||
use phpbb\install\exception\task_not_found_exception;
|
||||
use phpbb\install\helper\iohandler\iohandler_interface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use phpbb\install\helper\config;
|
||||
|
||||
/**
|
||||
* Base class for installer module
|
||||
*/
|
||||
abstract class module_base implements module_interface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* @var config
|
||||
*/
|
||||
protected $install_config;
|
||||
|
||||
/**
|
||||
* @var iohandler_interface
|
||||
*/
|
||||
protected $iohandler;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_essential;
|
||||
|
||||
/**
|
||||
* Array of tasks for installer module
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $task_collection;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $allow_progress_bar;
|
||||
|
||||
/**
|
||||
* Installer module constructor
|
||||
*
|
||||
* @param array $tasks array of installer tasks for installer module
|
||||
* @param bool $essential flag indicating whether the module is essential or not
|
||||
* @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module
|
||||
*/
|
||||
public function __construct(array $tasks, $essential = true, $allow_progress_bar = true)
|
||||
{
|
||||
$this->task_collection = $tasks;
|
||||
$this->is_essential = $essential;
|
||||
$this->allow_progress_bar = $allow_progress_bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dependency getter
|
||||
*
|
||||
* @param ContainerInterface $container
|
||||
* @param config $config
|
||||
* @param iohandler_interface $iohandler
|
||||
*/
|
||||
public function setup(ContainerInterface $container, config $config, iohandler_interface $iohandler)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->install_config = $config;
|
||||
$this->iohandler = $iohandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function is_essential()
|
||||
{
|
||||
return $this->is_essential;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Overwrite this method if your task is non-essential!
|
||||
*/
|
||||
public function check_requirements()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Recover install progress
|
||||
$task_index = $this->recover_progress();
|
||||
|
||||
// Run until there are available resources
|
||||
while ($this->install_config->get_time_remaining() > 0 && $this->install_config->get_memory_remaining() > 0)
|
||||
{
|
||||
// Check if task exists
|
||||
if (!isset($this->task_collection[$task_index]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Recover task to be executed
|
||||
try
|
||||
{
|
||||
/** @var \phpbb\install\task_interface $task */
|
||||
$task = $this->container->get($this->task_collection[$task_index]);
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
throw new task_not_found_exception($this->task_collection[$task_index]);
|
||||
}
|
||||
|
||||
// Send progress information
|
||||
if ($this->allow_progress_bar)
|
||||
{
|
||||
$this->iohandler->set_progress(
|
||||
$task->get_task_lang_name(),
|
||||
$this->install_config->get_current_task_progress()
|
||||
);
|
||||
}
|
||||
|
||||
// Iterate to the next task
|
||||
$task_index++;
|
||||
|
||||
// Check if we can run the task
|
||||
if (!$task->is_essential() && !$task->check_requirements())
|
||||
{
|
||||
$this->iohandler->add_log_message(array(
|
||||
'SKIP_TASK',
|
||||
$this->task_collection[$task_index],
|
||||
));
|
||||
$class_name = $this->get_class_from_service_name($this->task_collection[$task_index - 1]);
|
||||
$this->install_config->increment_current_task_progress($class_name::get_step_count());
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->allow_progress_bar)
|
||||
{
|
||||
$this->install_config->increment_current_task_progress();
|
||||
}
|
||||
|
||||
$task->run();
|
||||
|
||||
// Send progress information
|
||||
if ($this->allow_progress_bar)
|
||||
{
|
||||
$this->iohandler->set_progress(
|
||||
$task->get_task_lang_name(),
|
||||
$this->install_config->get_current_task_progress()
|
||||
);
|
||||
}
|
||||
|
||||
$this->iohandler->send_response();
|
||||
|
||||
// Log install progress
|
||||
$current_task_index = $task_index - 1;
|
||||
$this->install_config->set_finished_task($this->task_collection[$current_task_index], $current_task_index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next task's index
|
||||
*
|
||||
* @return int index of the array element of the next task
|
||||
*/
|
||||
protected function recover_progress()
|
||||
{
|
||||
$progress_array = $this->install_config->get_progress_data();
|
||||
$last_finished_task_name = $progress_array['last_task_name'];
|
||||
$last_finished_task_index = $progress_array['last_task_index'];
|
||||
|
||||
// Check if the data is relevant to this module
|
||||
if (isset($this->task_collection[$last_finished_task_index]))
|
||||
{
|
||||
if ($this->task_collection[$last_finished_task_index] === $last_finished_task_name)
|
||||
{
|
||||
// Return the task index of the next task
|
||||
return $last_finished_task_index + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// As of now if the progress has not been resolved we assume that it is because
|
||||
// the task progress belongs to the previous module,
|
||||
// so just default to the first task
|
||||
// @todo make module aware of it's service name that way this can be improved
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_step_count()
|
||||
{
|
||||
$step_count = 0;
|
||||
|
||||
foreach ($this->task_collection as $task_service_name)
|
||||
{
|
||||
$class_name = $this->get_class_from_service_name($task_service_name);
|
||||
$step_count += $class_name::get_step_count();
|
||||
}
|
||||
|
||||
return $step_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the class form the service name
|
||||
*
|
||||
* @param string $task_service_name Name of the service
|
||||
*
|
||||
* @return string Name of the class
|
||||
*
|
||||
* @throws invalid_service_name_exception When the service name does not meet the requirements described in task_interface
|
||||
*/
|
||||
protected function get_class_from_service_name($task_service_name)
|
||||
{
|
||||
$task_service_name_parts = explode('.', $task_service_name);
|
||||
|
||||
if ($task_service_name_parts[0] !== 'installer')
|
||||
{
|
||||
throw new invalid_service_name_exception('TASK_SERVICE_INSTALLER_MISSING');
|
||||
}
|
||||
|
||||
$class_name = '\\phpbb\\install\\module\\' . $task_service_name_parts[1] . '\\task\\' . $task_service_name_parts[2];
|
||||
if (!class_exists($class_name))
|
||||
{
|
||||
throw new invalid_service_name_exception('TASK_CLASS_NOT_FOUND', array($task_service_name, $class_name));
|
||||
}
|
||||
|
||||
return $class_name;
|
||||
}
|
||||
}
|
63
phpBB/phpbb/install/module_interface.php
Normal file
63
phpBB/phpbb/install/module_interface.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install;
|
||||
|
||||
/**
|
||||
* Interface for installer modules
|
||||
*
|
||||
* An installer module is a task collection which executes installer tasks.
|
||||
*/
|
||||
interface module_interface
|
||||
{
|
||||
/**
|
||||
* Checks if the execution of the module is essential to install phpBB or it can be skipped
|
||||
*
|
||||
* Note: Please note that all the non-essential modules have to implement check_requirements()
|
||||
* method.
|
||||
*
|
||||
* @return bool true if the module is essential, false otherwise
|
||||
*/
|
||||
public function is_essential();
|
||||
|
||||
/**
|
||||
* Checks requirements for the tasks
|
||||
*
|
||||
* Note: Only need to be implemented for non-essential tasks, as essential tasks
|
||||
* requirements should be checked in the requirements install module.
|
||||
*
|
||||
* @return bool true if the task's requirements are met
|
||||
*/
|
||||
public function check_requirements();
|
||||
|
||||
/**
|
||||
* Executes the task
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run();
|
||||
|
||||
/**
|
||||
* Returns the number of tasks in the module
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_step_count();
|
||||
|
||||
/**
|
||||
* Returns an array to the correct navigation stage
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_navigation_stage_path();
|
||||
}
|
10
phpBB/phpbb/install/schemas/index.htm
Normal file
10
phpBB/phpbb/install/schemas/index.htm
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000">
|
||||
|
||||
</body>
|
||||
</html>
|
37
phpBB/phpbb/install/schemas/oracle_schema.sql
Normal file
37
phpBB/phpbb/install/schemas/oracle_schema.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
This first section is optional, however its probably the best method
|
||||
of running phpBB on Oracle. If you already have a tablespace and user created
|
||||
for phpBB you can leave this section commented out!
|
||||
|
||||
The first set of statements create a phpBB tablespace and a phpBB user,
|
||||
make sure you change the password of the phpBB user before you run this script!!
|
||||
*/
|
||||
|
||||
/*
|
||||
CREATE TABLESPACE "PHPBB"
|
||||
LOGGING
|
||||
DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora'
|
||||
SIZE 10M
|
||||
AUTOEXTEND ON NEXT 10M
|
||||
MAXSIZE 100M;
|
||||
|
||||
CREATE USER "PHPBB"
|
||||
PROFILE "DEFAULT"
|
||||
IDENTIFIED BY "phpbb_password"
|
||||
DEFAULT TABLESPACE "PHPBB"
|
||||
QUOTA UNLIMITED ON "PHPBB"
|
||||
ACCOUNT UNLOCK;
|
||||
|
||||
GRANT ANALYZE ANY TO "PHPBB";
|
||||
GRANT CREATE SEQUENCE TO "PHPBB";
|
||||
GRANT CREATE SESSION TO "PHPBB";
|
||||
GRANT CREATE TABLE TO "PHPBB";
|
||||
GRANT CREATE TRIGGER TO "PHPBB";
|
||||
GRANT CREATE VIEW TO "PHPBB";
|
||||
GRANT "CONNECT" TO "PHPBB";
|
||||
|
||||
COMMIT;
|
||||
DISCONNECT;
|
||||
|
||||
CONNECT phpbb/phpbb_password;
|
||||
*/
|
80
phpBB/phpbb/install/schemas/postgres_schema.sql
Normal file
80
phpBB/phpbb/install/schemas/postgres_schema.sql
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
BEGIN;
|
||||
|
||||
/*
|
||||
Domain definition
|
||||
*/
|
||||
CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
|
||||
|
||||
/*
|
||||
Operation Functions
|
||||
*/
|
||||
CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
|
||||
CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
|
||||
CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
|
||||
CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
|
||||
CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
|
||||
CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
|
||||
|
||||
/*
|
||||
Operators
|
||||
*/
|
||||
CREATE OPERATOR <(
|
||||
PROCEDURE = _varchar_ci_less_than,
|
||||
LEFTARG = varchar_ci,
|
||||
RIGHTARG = varchar_ci,
|
||||
COMMUTATOR = >,
|
||||
NEGATOR = >=,
|
||||
RESTRICT = scalarltsel,
|
||||
JOIN = scalarltjoinsel);
|
||||
|
||||
CREATE OPERATOR <=(
|
||||
PROCEDURE = _varchar_ci_less_equal,
|
||||
LEFTARG = varchar_ci,
|
||||
RIGHTARG = varchar_ci,
|
||||
COMMUTATOR = >=,
|
||||
NEGATOR = >,
|
||||
RESTRICT = scalarltsel,
|
||||
JOIN = scalarltjoinsel);
|
||||
|
||||
CREATE OPERATOR >(
|
||||
PROCEDURE = _varchar_ci_greater_than,
|
||||
LEFTARG = varchar_ci,
|
||||
RIGHTARG = varchar_ci,
|
||||
COMMUTATOR = <,
|
||||
NEGATOR = <=,
|
||||
RESTRICT = scalargtsel,
|
||||
JOIN = scalargtjoinsel);
|
||||
|
||||
CREATE OPERATOR >=(
|
||||
PROCEDURE = _varchar_ci_greater_equals,
|
||||
LEFTARG = varchar_ci,
|
||||
RIGHTARG = varchar_ci,
|
||||
COMMUTATOR = <=,
|
||||
NEGATOR = <,
|
||||
RESTRICT = scalargtsel,
|
||||
JOIN = scalargtjoinsel);
|
||||
|
||||
CREATE OPERATOR <>(
|
||||
PROCEDURE = _varchar_ci_not_equal,
|
||||
LEFTARG = varchar_ci,
|
||||
RIGHTARG = varchar_ci,
|
||||
COMMUTATOR = <>,
|
||||
NEGATOR = =,
|
||||
RESTRICT = neqsel,
|
||||
JOIN = neqjoinsel);
|
||||
|
||||
CREATE OPERATOR =(
|
||||
PROCEDURE = _varchar_ci_equal,
|
||||
LEFTARG = varchar_ci,
|
||||
RIGHTARG = varchar_ci,
|
||||
COMMUTATOR = =,
|
||||
NEGATOR = <>,
|
||||
RESTRICT = eqsel,
|
||||
JOIN = eqjoinsel,
|
||||
HASHES,
|
||||
MERGES,
|
||||
SORT1= <);
|
||||
|
||||
COMMIT;
|
||||
|
821
phpBB/phpbb/install/schemas/schema_data.sql
Normal file
821
phpBB/phpbb/install/schemas/schema_data.sql
Normal file
@@ -0,0 +1,821 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
# POSTGRES BEGIN #
|
||||
|
||||
# -- Config
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('active_sessions', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_attachments', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_autologin', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_gravatar', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_local', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_upload', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_avatar_remote_upload', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bbcode', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_birthdays', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_bookmarks', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_cdn', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_emailreuse', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_password_reset', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_forum_notify', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_live_searches', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_mass_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars', 'USERNAME_CHARS_ANY');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_report', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_img', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_links', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_smilies', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_smilies', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_topic_notify', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('assets_version', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('attachment_quota', '52428800');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_bbcode_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_flash_pm', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_img_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_method', 'db');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('auth_smilies_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_filesize', '6144');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_gallery_path', 'images/avatars/gallery');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_height', '90');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_max_width', '90');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_height', '20');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_min_width', '20');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_path', 'images/avatars/upload');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('avatar_salt', 'phpbb_avatar');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact', 'contact@yourdomain.tld');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_contact_name', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_disable_msg', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email', 'address@yourdomain.tld');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_sig', '{L_CONFIG_BOARD_EMAIL_SIG}');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_hide_emails', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_index_text', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_timezone', 'UTC');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('browser_check', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_interval', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_type', 'd');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cache_gc', '7200');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'core.captcha.plugins.nogd');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foreground_noise', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_3d_noise', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_fonts', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('confirm_refresh', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('contact_admin_form_enable', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_domain', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_name', 'phpbb3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_path', '/');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cookie_secure', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_enable', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('database_gc', '604800');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('dbms_version', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat', 'D M d, Y g:i a');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_unstable', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_mod_rewrite', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_http_auth', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit_post', '15');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit_topic', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_forums', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_forum', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topic', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topics_new', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topics_active', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_item_statistics', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval', '15');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('force_server_vars', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_mintime', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_sid_guests', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('forward_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('forwarded_for_check', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('full_folder_action', '2');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_max_word_len', '254');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_min_word_len', '4');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_common_thres', '5');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_load_upd', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_max_chars', '14');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_min_chars', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_max_word_len', '254');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_min_word_len', '4');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_postgres_ts_name', 'simple');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_sphinx_indexer_mem_limit', '512');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_sphinx_stopwords', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('hot_threshold', '25');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('icons_path', 'images/icons');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_create_thumbnail', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_display_inlined', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_imagick', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_height', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_link_width', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_height', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_thumb_width', '400');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_max_width', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('img_min_thumb_filesize', '12000');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_check', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_max', '50');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_time', '21600');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ip_login_limit_use_forwarded', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_enable', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_host', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_password', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_package_size', '20');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_port', '5222');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_use_ssl', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('jab_username', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_base_dn', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_email', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_password', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_port', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user_filter', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('legend_sort_groupname', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_birthdays', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_memberlist', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewprofile', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_cpf_viewtopic', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_lastread', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_db_track', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_jumpbox', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_moderators', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_notifications', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_guests', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_time', '5');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_onlinetrack', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_search', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_unreads_search', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_autologin_time', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize', '262144');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_filesize_pm', '262144');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_name_chars', '20');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_num_search_keywords', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_pass_chars', '100');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_poll_options', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_chars', '60000');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_font_size', '200');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_img_height', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_img_width', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_smilies', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_post_urls', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_quote_depth', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_reg_attempts', '5');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_chars', '255');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_font_size', '200');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_img_height', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_img_width', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_smilies', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_urls', '5');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_post_chars', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_post_limit', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_group_default', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', 'PASS_TYPE_ANY');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('plupload_salt', 'phpbb_plupload');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_recipients', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '60');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_expire_days', '30');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_gc', '86400');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('script_path', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size', '250');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', '\phpbb\search\fulltext_native');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_downloads', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_name', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_port', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('server_protocol', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_gc', '3600');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('session_length', '3600');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_desc', '{L_CONFIG_SITE_DESC}');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_home_url', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('site_home_text', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sitename', '{L_CONFIG_SITENAME}');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_path', 'images/smilies');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilies_per_page', '50');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_auth_method', 'PLAIN');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_delivery', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port', '25');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username', '');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_memberships', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_forums', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', '25');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.2.0-a1-dev');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400');
|
||||
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cache_last_gc', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('cron_lock', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('database_last_gc', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('last_queue_run', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_colour', 'AA0000', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_user_id', '2', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('newest_username', '', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_files', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_posts', '1', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_topics', '1', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('num_users', '1', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('plupload_last_gc', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('rand_seed_last_update', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('read_notification_last_gc', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_date', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('record_online_users', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_indexing_state', '', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('search_last_gc', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('session_last_gc', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('upload_dir_size', '0', 1);
|
||||
INSERT INTO phpbb_config (config_name, config_value, is_dynamic) VALUES ('warnings_last_gc', '0', 1);
|
||||
|
||||
# Config text
|
||||
INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info', '');
|
||||
INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_uid', '');
|
||||
INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_bitfield', '');
|
||||
INSERT INTO phpbb_config_text (config_name, config_value) VALUES ('contact_admin_info_flags', '7');
|
||||
|
||||
# -- Forum related auth options
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_announce', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_attach', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_bbcode', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_bump', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_delete', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_download', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_edit', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_email', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_flash', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_icons', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_ignoreflood', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_img', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_list', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_noapprove', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_poll', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_post', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_postcount', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_print', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_read', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_reply', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_report', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_search', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_sigs', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_smilies', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_sticky', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_subscribe', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_user_lock', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_vote', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_votechg', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_softdelete', 1);
|
||||
|
||||
# -- Moderator related auth options
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_approve', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_chgposter', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_delete', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_edit', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_info', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_lock', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_merge', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_softdelete', 1, 1);
|
||||
|
||||
# -- Global moderator auth option (not a local option)
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_warn', 0, 1);
|
||||
|
||||
# -- Admin related auth options
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_aauth', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_attach', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_authgroups', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_authusers', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_backup', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_ban', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_bbcode', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_board', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_bots', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_clearlogs', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_email', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_extensions', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_fauth', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forum', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forumadd', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_forumdel', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_group', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_groupadd', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_groupdel', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_icons', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_jabber', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_language', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_mauth', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_modules', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_names', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_phpinfo', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_profile', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_prune', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_ranks', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_reasons', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_roles', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_search', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_server', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_styles', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_switchperm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_uauth', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_user', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_userdel', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_viewauth', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_viewlogs', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_words', 1);
|
||||
|
||||
# -- User related auth options
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_attach', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgavatar', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgcensors', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgemail', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chggrp', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgname', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgprofileinfo', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm_group', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_attach', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_bbcode', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_delete', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_download', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_edit', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_emailpm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_flash', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_forward', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_img', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_printpm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_smilies', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_readpm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_savedrafts', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_search', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendemail', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendim', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendpm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sig', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_viewonline', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_viewprofile', 1);
|
||||
|
||||
|
||||
# -- standard auth roles
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_STANDARD', 'ROLE_DESCRIPTION_ADMIN_STANDARD', 'a_', 1);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_FORUM', 'ROLE_DESCRIPTION_ADMIN_FORUM', 'a_', 3);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_USERGROUP', 'ROLE_DESCRIPTION_ADMIN_USERGROUP', 'a_', 4);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_ADMIN_FULL', 'ROLE_DESCRIPTION_ADMIN_FULL', 'a_', 2);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_FULL', 'ROLE_DESCRIPTION_USER_FULL', 'u_', 3);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_STANDARD', 'ROLE_DESCRIPTION_USER_STANDARD', 'u_', 1);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_LIMITED', 'ROLE_DESCRIPTION_USER_LIMITED', 'u_', 2);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NOPM', 'ROLE_DESCRIPTION_USER_NOPM', 'u_', 4);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NOAVATAR', 'ROLE_DESCRIPTION_USER_NOAVATAR', 'u_', 5);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_FULL', 'ROLE_DESCRIPTION_MOD_FULL', 'm_', 3);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_STANDARD', 'ROLE_DESCRIPTION_MOD_STANDARD', 'm_', 1);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_SIMPLE', 'ROLE_DESCRIPTION_MOD_SIMPLE', 'm_', 2);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_MOD_QUEUE', 'ROLE_DESCRIPTION_MOD_QUEUE', 'm_', 4);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_FULL', 'ROLE_DESCRIPTION_FORUM_FULL', 'f_', 7);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_STANDARD', 'ROLE_DESCRIPTION_FORUM_STANDARD', 'f_', 5);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NOACCESS', 'ROLE_DESCRIPTION_FORUM_NOACCESS', 'f_', 1);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_READONLY', 'ROLE_DESCRIPTION_FORUM_READONLY', 'f_', 2);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_LIMITED', 'ROLE_DESCRIPTION_FORUM_LIMITED', 'f_', 3);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_BOT', 'ROLE_DESCRIPTION_FORUM_BOT', 'f_', 9);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_ONQUEUE', 'ROLE_DESCRIPTION_FORUM_ONQUEUE', 'f_', 8);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_POLLS', 'ROLE_DESCRIPTION_FORUM_POLLS', 'f_', 6);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_LIMITED_POLLS', 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS', 'f_', 4);
|
||||
|
||||
# 23
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', 6);
|
||||
|
||||
# 24
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10);
|
||||
|
||||
# -- phpbb_styles
|
||||
INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', 'kNg=', 0, '');
|
||||
|
||||
# -- Forums
|
||||
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, '');
|
||||
|
||||
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48);
|
||||
|
||||
# -- Users / Anonymous user
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', 0);
|
||||
|
||||
# -- username: Admin password: admin (change this or remove it once everything is working!)
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '');
|
||||
|
||||
# -- Groups
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 2, '', '', '', 0);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '', 0);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5);
|
||||
|
||||
# -- Teampage
|
||||
INSERT INTO phpbb_teampage (group_id, teampage_name, teampage_position, teampage_parent) VALUES (5, '', 1, 0);
|
||||
INSERT INTO phpbb_teampage (group_id, teampage_name, teampage_position, teampage_parent) VALUES (4, '', 2, 0);
|
||||
|
||||
# -- User -> Group
|
||||
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0);
|
||||
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (2, 2, 0, 0);
|
||||
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (4, 2, 0, 0);
|
||||
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (5, 2, 0, 1);
|
||||
|
||||
# -- Ranks
|
||||
INSERT INTO phpbb_ranks (rank_title, rank_min, rank_special, rank_image) VALUES ('{L_RANKS_SITE_ADMIN_TITLE}', 0, 1, '');
|
||||
|
||||
# -- Roles data
|
||||
|
||||
# Standard Admin (a_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 1, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option NOT IN ('a_switchperm', 'a_jabber', 'a_phpinfo', 'a_server', 'a_backup', 'a_styles', 'a_clearlogs', 'a_modules', 'a_language', 'a_email', 'a_bots', 'a_search', 'a_aauth', 'a_roles');
|
||||
|
||||
# Forum admin (a_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 2, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option IN ('a_', 'a_authgroups', 'a_authusers', 'a_fauth', 'a_forum', 'a_forumadd', 'a_forumdel', 'a_mauth', 'a_prune', 'a_uauth', 'a_viewauth', 'a_viewlogs');
|
||||
|
||||
# User and Groups Admin (a_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 3, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%' AND auth_option IN ('a_', 'a_authgroups', 'a_authusers', 'a_ban', 'a_group', 'a_groupadd', 'a_groupdel', 'a_ranks', 'a_uauth', 'a_user', 'a_viewauth', 'a_viewlogs');
|
||||
|
||||
# Full Admin (a_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 4, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'a_%';
|
||||
|
||||
# All Features (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 5, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%';
|
||||
|
||||
# Standard Features (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 6, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_flash', 'u_pm_forward');
|
||||
|
||||
# Limited Features (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 7, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# No Private Messages (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_', 'u_chgavatar', 'u_chgcensors', 'u_chgemail', 'u_chgpasswd', 'u_download', 'u_hideonline', 'u_sig', 'u_viewprofile');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_readpm', 'u_sendpm', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# No Avatar (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar');
|
||||
|
||||
# Full Moderator (m_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 10, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%';
|
||||
|
||||
# Standard Moderator (m_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 11, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option NOT IN ('m_ban', 'm_chgposter');
|
||||
|
||||
# Simple Moderator (m_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_edit', 'm_info', 'm_report');
|
||||
|
||||
# Queue Moderator (m_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 13, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_approve', 'm_edit');
|
||||
|
||||
# Full Access (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 14, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%';
|
||||
|
||||
# Standard Access (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 15, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_flash', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock');
|
||||
|
||||
# No Access (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 16, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option = 'f_';
|
||||
|
||||
# Read Only Access (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 17, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_search', 'f_subscribe', 'f_print');
|
||||
|
||||
# Limited Access (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 18, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg');
|
||||
|
||||
# Bot Access (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 19, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_', 'f_download', 'f_list', 'f_read', 'f_print');
|
||||
|
||||
# On Moderation Queue (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_poll', 'f_sticky', 'f_user_lock', 'f_votechg', 'f_noapprove');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 20, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
|
||||
|
||||
# Standard Access + Polls (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 21, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_flash', 'f_ignoreflood', 'f_sticky', 'f_user_lock');
|
||||
|
||||
# Limited Access + Polls (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
|
||||
|
||||
# New Member (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group', 'u_chgprofileinfo');
|
||||
|
||||
# New Member (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
|
||||
|
||||
|
||||
# Permissions
|
||||
|
||||
# GUESTS - u_download and u_search ability
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT 1, 0, auth_option_id, 0, 1 FROM phpbb_acl_options WHERE auth_option IN ('u_', 'u_download', 'u_search');
|
||||
|
||||
# Admin user - full user features
|
||||
INSERT INTO phpbb_acl_users (user_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 0, 0, 5, 0);
|
||||
|
||||
# ADMINISTRATOR Group - full user features
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 0, 0, 5, 0);
|
||||
|
||||
# ADMINISTRATOR Group - standard admin
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 0, 0, 1, 0);
|
||||
|
||||
# REGISTERED and REGISTERED_COPPA having standard user features
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 0, 0, 6, 0);
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (3, 0, 0, 6, 0);
|
||||
|
||||
# GLOBAL_MODERATORS having full user features
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (4, 0, 0, 5, 0);
|
||||
|
||||
# GLOBAL_MODERATORS having full global moderator access
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (4, 0, 0, 10, 0);
|
||||
|
||||
# Giving all groups read only access to the first category
|
||||
# since administrators and moderators are already within the registered users group we do not need to set them here
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (1, 1, 0, 17, 0);
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 1, 0, 17, 0);
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (3, 1, 0, 17, 0);
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 1, 0, 17, 0);
|
||||
|
||||
# Giving access to the first forum
|
||||
|
||||
# guests having read only access
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (1, 2, 0, 17, 0);
|
||||
|
||||
# registered and registered_coppa having standard access
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (2, 2, 0, 15, 0);
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (3, 2, 0, 15, 0);
|
||||
|
||||
# global moderators having standard access + polls
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (4, 2, 0, 21, 0);
|
||||
|
||||
# administrators having full forum and full moderator access
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 2, 0, 14, 0);
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (5, 2, 0, 10, 0);
|
||||
|
||||
# Bots having bot access
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 2, 0, 19, 0);
|
||||
|
||||
# NEW MEMBERS are not allowed to send private messages
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 0, 0, 23, 0);
|
||||
|
||||
# NEW MEMBERS on the queue
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 2, 0, 24, 0);
|
||||
|
||||
|
||||
# -- Demo Topic
|
||||
INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title, topic_visibility) VALUES ('{L_TOPICS_TOPIC_TITLE}', 2, 972086460, 0, 1, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, 972086460, '', 1);
|
||||
|
||||
# -- Demo Post
|
||||
INSERT INTO phpbb_posts (topic_id, forum_id, poster_id, icon_id, post_time, post_username, poster_ip, post_subject, post_text, post_checksum, bbcode_uid, post_visibility) VALUES (1, 2, 2, 0, 972086460, '', '127.0.0.1', '{L_TOPICS_TOPIC_TITLE}', '{L_DEFAULT_INSTALL_POST}', '5dd683b17f641daf84c040bfefc58ce9', '', 1);
|
||||
|
||||
# -- Admin posted to the demo topic
|
||||
INSERT INTO phpbb_topics_posted (user_id, topic_id, topic_posted) VALUES (2, 1, 1);
|
||||
|
||||
# -- Smilies
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':D', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 1);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-D', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 2);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':grin:', 'icon_e_biggrin.gif', '{L_SMILIES_VERY_HAPPY}', 15, 17, 3);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':)', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 4);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-)', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 5);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':smile:', 'icon_e_smile.gif', '{L_SMILIES_SMILE}', 15, 17, 6);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (';)', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 7);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (';-)', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 8);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':wink:', 'icon_e_wink.gif', '{L_SMILIES_WINK}', 15, 17, 9);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':(', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 10);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-(', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 11);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':sad:', 'icon_e_sad.gif', '{L_SMILIES_SAD}', 15, 17, 12);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':o', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 13);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-o', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 14);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':eek:', 'icon_e_surprised.gif', '{L_SMILIES_SURPRISED}', 15, 17, 15);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':shock:', 'icon_eek.gif', '{L_SMILIES_SHOCKED}', 15, 17, 16);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':?', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 17);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-?', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 18);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':???:', 'icon_e_confused.gif', '{L_SMILIES_CONFUSED}', 15, 17, 19);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES ('8-)', 'icon_cool.gif', '{L_SMILIES_COOL}', 15, 17, 20);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':cool:', 'icon_cool.gif', '{L_SMILIES_COOL}', 15, 17, 21);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':lol:', 'icon_lol.gif', '{L_SMILIES_LAUGHING}', 15, 17, 22);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':x', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 23);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-x', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 24);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':mad:', 'icon_mad.gif', '{L_SMILIES_MAD}', 15, 17, 25);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':P', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 26);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-P', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 27);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':razz:', 'icon_razz.gif', '{L_SMILIES_RAZZ}', 15, 17, 28);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':oops:', 'icon_redface.gif', '{L_SMILIES_EMARRASSED}', 15, 17, 29);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':cry:', 'icon_cry.gif', '{L_SMILIES_CRYING}', 15, 17, 30);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':evil:', 'icon_evil.gif', '{L_SMILIES_EVIL}', 15, 17, 31);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':twisted:', 'icon_twisted.gif', '{L_SMILIES_TWISTED_EVIL}', 15, 17, 32);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':roll:', 'icon_rolleyes.gif', '{L_SMILIES_ROLLING_EYES}', 15, 17, 33);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':!:', 'icon_exclaim.gif', '{L_SMILIES_EXCLAMATION}', 15, 17, 34);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':?:', 'icon_question.gif', '{L_SMILIES_QUESTION}', 15, 17, 35);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':idea:', 'icon_idea.gif', '{L_SMILIES_IDEA}', 15, 17, 36);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':arrow:', 'icon_arrow.gif', '{L_SMILIES_ARROW}', 15, 17, 37);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':|', 'icon_neutral.gif', '{L_SMILIES_NEUTRAL}', 15, 17, 38);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':-|', 'icon_neutral.gif', '{L_SMILIES_NEUTRAL}', 15, 17, 39);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':mrgreen:', 'icon_mrgreen.gif', '{L_SMILIES_MR_GREEN}', 15, 17, 40);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':geek:', 'icon_e_geek.gif', '{L_SMILIES_GEEK}', 17, 17, 41);
|
||||
INSERT INTO phpbb_smilies (code, smiley_url, emotion, smiley_width, smiley_height, smiley_order) VALUES (':ugeek:', 'icon_e_ugeek.gif', '{L_SMILIES_UBER_GEEK}', 17, 18, 42);
|
||||
|
||||
# -- icons
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/fire.gif', 16, 16, 1, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/redface.gif', 16, 16, 9, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/mrgreen.gif', 16, 16, 10, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/heart.gif', 16, 16, 4, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/star.gif', 16, 16, 2, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/radioactive.gif', 16, 16, 3, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('misc/thinking.gif', 16, 16, 5, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/info.gif', 16, 16, 8, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/question.gif', 16, 16, 6, 1);
|
||||
INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, display_on_posting) VALUES ('smile/alert.gif', 16, 16, 7, 1);
|
||||
|
||||
# -- reasons
|
||||
INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('warez', '{L_REPORT_WAREZ}', 1);
|
||||
INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('spam', '{L_REPORT_SPAM}', 2);
|
||||
INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('off_topic', '{L_REPORT_OFF_TOPIC}', 3);
|
||||
INSERT INTO phpbb_reports_reasons (reason_title, reason_description, reason_order) VALUES ('other', '{L_REPORT_OTHER}', 4);
|
||||
|
||||
# -- extension_groups
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('IMAGES', 1, 1, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('ARCHIVES', 0, 1, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('PLAIN_TEXT', 0, 0, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('DOCUMENTS', 0, 0, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('REAL_MEDIA', 3, 0, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('WINDOWS_MEDIA', 2, 0, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('FLASH_FILES', 5, 0, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('QUICKTIME_MEDIA', 6, 0, 1, '', 0, '');
|
||||
INSERT INTO phpbb_extension_groups (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize, allowed_forums) VALUES ('DOWNLOADABLE_FILES', 0, 0, 1, '', 0, '');
|
||||
|
||||
# -- extensions
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'gif');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'png');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'jpeg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'jpg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'tif');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'tiff');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (1, 'tga');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'gtar');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'gz');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'tar');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'zip');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'rar');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'ace');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'torrent');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'tgz');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, 'bz2');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (2, '7z');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'txt');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'c');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'h');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'cpp');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'hpp');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'diz');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'csv');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'ini');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'log');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'js');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (3, 'xml');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xls');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xlsx');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xlsm');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'xlsb');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'doc');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'docx');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'docm');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'dot');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'dotx');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'dotm');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'pdf');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ai');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ps');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ppt');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'pptx');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'pptm');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odp');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'ods');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'odt');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (4, 'rtf');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'rm');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (5, 'ram');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'wma');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (6, 'wmv');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (7, 'swf');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'mov');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'm4v');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'm4a');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'mp4');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, '3gp');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, '3g2');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (8, 'qt');
|
||||
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mpeg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mpg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
|
||||
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
|
||||
|
||||
# Add default profile fields
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_location', 'profilefields.type.string', 'phpbb_location', '20', '2', '100', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, '', '');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_website', 'profilefields.type.url', 'phpbb_website', '40', '12', '255', '', '', '', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 2, 1, 'VISIT_WEBSITE', '%s');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_interests', 'profilefields.type.text', 'phpbb_interests', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, '', '');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_occupation', 'profilefields.type.text', 'phpbb_occupation', '3|30', '2', '500', '', '', '.*', 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, '', '');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_aol', 'profilefields.type.string', 'phpbb_aol', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 5, 1, '', '');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', '');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'ymsgr:sendim?%s');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'http://facebook.com/%s/');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_skype', 'profilefields.type.string', 'phpbb_skype', '20', '6', '32', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 11, 1, 'VIEW_SKYPE_PROFILE', 'skype:%s?userinfo');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_youtube', 'profilefields.type.string', 'phpbb_youtube', '20', '3', '60', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 12, 1, 'VIEW_YOUTUBE_CHANNEL', 'http://youtube.com/user/%s');
|
||||
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_googleplus', 'profilefields.type.googleplus', 'phpbb_googleplus', '20', '3', '255', '', '', '[\w]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 13, 1, 'VIEW_GOOGLEPLUS_PROFILE', 'http://plus.google.com/%s');
|
||||
|
||||
# User Notification Options (for first user)
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.email');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, '');
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.email');
|
||||
|
||||
# POSTGRES COMMIT #
|
53
phpBB/phpbb/install/task_base.php
Normal file
53
phpBB/phpbb/install/task_base.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install;
|
||||
|
||||
/**
|
||||
* Base class for installer task
|
||||
*/
|
||||
abstract class task_base implements task_interface
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_essential;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param bool $essential
|
||||
*/
|
||||
public function __construct($essential = true)
|
||||
{
|
||||
$this->is_essential = $essential;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function is_essential()
|
||||
{
|
||||
return $this->is_essential;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Overwrite this method if your task is non-essential!
|
||||
*/
|
||||
public function check_requirements()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
65
phpBB/phpbb/install/task_interface.php
Normal file
65
phpBB/phpbb/install/task_interface.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\install;
|
||||
|
||||
/**
|
||||
* Interface for installer tasks
|
||||
*
|
||||
* Note: The task service ID must match up with the namespace and class name.
|
||||
* For example: if your task is located at \phpbb\install\module\module_name\task\task_name
|
||||
* then the service ID must be installer.module_name.task_name.
|
||||
*/
|
||||
interface task_interface
|
||||
{
|
||||
/**
|
||||
* Returns the number of steps the task contains
|
||||
*
|
||||
* This is a helper method to provide a better progress bar for the front-end.
|
||||
*
|
||||
* @return int The number of steps that the task contains
|
||||
*/
|
||||
static public function get_step_count();
|
||||
|
||||
/**
|
||||
* Checks if the task is essential to install phpBB or it can be skipped
|
||||
*
|
||||
* Note: Please note that all the non-essential modules have to implement check_requirements()
|
||||
* method.
|
||||
*
|
||||
* @return bool true if the task is essential, false otherwise
|
||||
*/
|
||||
public function is_essential();
|
||||
|
||||
/**
|
||||
* Checks requirements for the tasks
|
||||
*
|
||||
* Note: Only need to be implemented for non-essential tasks, as essential tasks
|
||||
* requirements should be checked in the requirements install module.
|
||||
*
|
||||
* @return bool true if the task's requirements are met
|
||||
*/
|
||||
public function check_requirements();
|
||||
|
||||
/**
|
||||
* Executes the task
|
||||
*/
|
||||
public function run();
|
||||
|
||||
/**
|
||||
* Returns the language key of the name of the task
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_task_lang_name();
|
||||
}
|
Reference in New Issue
Block a user