diff options
Diffstat (limited to 'phpBB/install/module/install_data')
| -rw-r--r-- | phpBB/install/module/install_data/module.php | 28 | ||||
| -rw-r--r-- | phpBB/install/module/install_data/task/add_bots.php | 240 | ||||
| -rw-r--r-- | phpBB/install/module/install_data/task/add_languages.php | 121 | ||||
| -rw-r--r-- | phpBB/install/module/install_data/task/add_modules.php | 468 |
4 files changed, 0 insertions, 857 deletions
diff --git a/phpBB/install/module/install_data/module.php b/phpBB/install/module/install_data/module.php deleted file mode 100644 index 77f1f73f1f..0000000000 --- a/phpBB/install/module/install_data/module.php +++ /dev/null @@ -1,28 +0,0 @@ -<?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'); - } -} diff --git a/phpBB/install/module/install_data/task/add_bots.php b/phpBB/install/module/install_data/task/add_bots.php deleted file mode 100644 index c31700e97f..0000000000 --- a/phpBB/install/module/install_data/task/add_bots.php +++ /dev/null @@ -1,240 +0,0 @@ -<?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'; - } -} diff --git a/phpBB/install/module/install_data/task/add_languages.php b/phpBB/install/module/install_data/task/add_languages.php deleted file mode 100644 index 7ffdf4f276..0000000000 --- a/phpBB/install/module/install_data/task/add_languages.php +++ /dev/null @@ -1,121 +0,0 @@ -<?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'; - } -} diff --git a/phpBB/install/module/install_data/task/add_modules.php b/phpBB/install/module/install_data/task/add_modules.php deleted file mode 100644 index 6a77f8973b..0000000000 --- a/phpBB/install/module/install_data/task/add_modules.php +++ /dev/null @@ -1,468 +0,0 @@ -<?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'; - } -} |
