mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge remote-tracking branch 'naderman/feature/extension-manager' into develop
* naderman/feature/extension-manager: (67 commits) [feature/extension-manager] Removing now unused acp_search code [feature/extension-manager] Split disabling extensions up into steps as well [feature/extension-manager] Add documentation on caching in ext finder [feature/extension-manager] Reference correct new module basenames in install [feature/extension-manager] Rename default methods to core methods on finder. [feature/extension-manager] Document what the class loader stores in cache [feature/extension-manager] Add docblock to cached paths map in class loader [feature/extension-manager] Clear up docs of extension related template changes [feature/extension-manager] Use "core files" instead of "global files" in docs [feature/extension-manager] Add docblocks to new search backend methods [feature/extension-manager] Add docblocks to new methods in functions_module [feature/extension-manager] Clarify comment on ext meta class instantiator [feature/extension-manager] Add more info on suffixes in extension finder [feature/extension-manager] Clarify is_dir parameter description [feature/extension-manager] Clarify class finding method docblock [feature/extension-manager] Correct default path comment & remove double strlen [feature/extension-manager] Fix "disbale" typo in comment [feature/extension-manager] Properly remove old ACP language loading code [feature/extension-manager] Support extensions in subdirectories of ext/ [feature/extension-manager] Add prefix to extension meta data / install classes ...
This commit is contained in:
@@ -104,14 +104,21 @@ if (!defined('LOGIN_ATTEMPT_TABLE'))
|
||||
{
|
||||
define('LOGIN_ATTEMPT_TABLE', $table_prefix . 'login_attempts');
|
||||
}
|
||||
if (!defined('EXT_TABLE'))
|
||||
{
|
||||
define('EXT_TABLE', $table_prefix . 'ext');
|
||||
}
|
||||
|
||||
$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
|
||||
$class_loader->register();
|
||||
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx");
|
||||
$phpbb_class_loader_ext->register();
|
||||
$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx");
|
||||
$phpbb_class_loader->register();
|
||||
|
||||
// set up caching
|
||||
$cache_factory = new phpbb_cache_factory($acm_type);
|
||||
$cache = $cache_factory->get_service();
|
||||
$class_loader->set_cache($cache->get_driver());
|
||||
$phpbb_class_loader_ext->set_cache($cache->get_driver());
|
||||
$phpbb_class_loader->set_cache($cache->get_driver());
|
||||
|
||||
$request = new phpbb_request();
|
||||
$user = new user();
|
||||
@@ -671,7 +678,13 @@ function _write_result($no_updates, $errored, $error_ary)
|
||||
|
||||
function _add_modules($modules_to_install)
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $db;
|
||||
global $phpbb_root_path, $phpEx, $db, $phpbb_extension_manager;
|
||||
|
||||
// modules require an extension manager
|
||||
if (empty($phpbb_extension_manager))
|
||||
{
|
||||
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx");
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
|
||||
|
||||
@@ -1048,6 +1061,18 @@ function database_update_info()
|
||||
|
||||
// Changes from 3.1.0-dev to 3.1.0-A1
|
||||
'3.1.0-dev' => array(
|
||||
'add_tables' => array(
|
||||
EXT_TABLE => array(
|
||||
'COLUMNS' => array(
|
||||
'ext_name' => array('VCHAR', ''),
|
||||
'ext_active' => array('BOOL', 0),
|
||||
'ext_state' => array('TEXT', ''),
|
||||
),
|
||||
'KEYS' => array(
|
||||
'ext_name' => array('UNIQUE', 'ext_name'),
|
||||
),
|
||||
),
|
||||
),
|
||||
'add_columns' => array(
|
||||
GROUPS_TABLE => array(
|
||||
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
|
||||
@@ -2095,8 +2120,49 @@ function change_database_data(&$no_updates, $version)
|
||||
|
||||
// Changes from 3.1.0-dev to 3.1.0-A1
|
||||
case '3.1.0-dev':
|
||||
set_config('load_jquery_cdn', 0);
|
||||
set_config('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');
|
||||
|
||||
// rename all module basenames to full classname
|
||||
$sql = 'SELECT module_id, module_basename, module_class
|
||||
FROM ' . MODULES_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$module_id = (int) $row['module_id'];
|
||||
unset($row['module_id']);
|
||||
|
||||
if (!empty($row['module_basename']) && !empty($row['module_class']))
|
||||
{
|
||||
// all the class names start with class name or with phpbb_ for auto loading
|
||||
if (strpos($row['module_basename'], $row['module_class'] . '_') !== 0 &&
|
||||
strpos($row['module_basename'], 'phpbb_') !== 0)
|
||||
{
|
||||
$row['module_basename'] = $row['module_class'] . '_' . $row['module_basename'];
|
||||
|
||||
$sql_update = $db->sql_build_array('UPDATE', $row);
|
||||
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . '
|
||||
SET ' . $sql_update . '
|
||||
WHERE module_id = ' . $module_id;
|
||||
_sql($sql, $errored, $error_ary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (substr($config['search_type'], 0, 6) !== 'phpbb_')
|
||||
{
|
||||
// try to guess the new auto loaded search class name
|
||||
// works for native and mysql fulltext
|
||||
set_config('search_type', 'phpbb_search_' . $config['search_type']);
|
||||
}
|
||||
|
||||
if (!isset($config['load_jquery_cdn']))
|
||||
{
|
||||
set_config('load_jquery_cdn', 0);
|
||||
set_config('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');
|
||||
}
|
||||
|
||||
if (!isset($config['use_system_cron']))
|
||||
{
|
||||
@@ -2163,14 +2229,14 @@ function change_database_data(&$no_updates, $version)
|
||||
// Install modules
|
||||
$modules_to_install = array(
|
||||
'position' => array(
|
||||
'base' => 'groups',
|
||||
'base' => 'acp_groups',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_GROUPS_POSITION',
|
||||
'auth' => 'acl_a_group',
|
||||
'cat' => 'ACP_GROUPS',
|
||||
),
|
||||
'manage' => array(
|
||||
'base' => 'attachments',
|
||||
'base' => 'acp_attachments',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_MANAGE_ATTACHMENTS',
|
||||
'auth' => 'acl_a_attach',
|
||||
@@ -2179,7 +2245,7 @@ function change_database_data(&$no_updates, $version)
|
||||
);
|
||||
|
||||
_add_modules($modules_to_install);
|
||||
|
||||
|
||||
$sql = 'DELETE FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'styles' AND module_mode = 'imageset'";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
@@ -82,13 +82,16 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||
require($phpbb_root_path . 'includes/functions_install.' . $phpEx);
|
||||
|
||||
$class_loader = new phpbb_class_loader($phpbb_root_path, '.' . $phpEx);
|
||||
$class_loader->register();
|
||||
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', ".$phpEx");
|
||||
$phpbb_class_loader_ext->register();
|
||||
$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'includes/', ".$phpEx");
|
||||
$phpbb_class_loader->register();
|
||||
|
||||
// set up caching
|
||||
$cache_factory = new phpbb_cache_factory('file');
|
||||
$cache = $cache_factory->get_service();
|
||||
$class_loader->set_cache($cache->get_driver());
|
||||
$phpbb_class_loader_ext->set_cache($cache->get_driver());
|
||||
$phpbb_class_loader->set_cache($cache->get_driver());
|
||||
|
||||
$request = new phpbb_request();
|
||||
|
||||
@@ -199,8 +202,10 @@ $config = new phpbb_config(array(
|
||||
'load_tplcompile' => '1'
|
||||
));
|
||||
|
||||
$template_locator = new phpbb_template_locator();
|
||||
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $template_locator);
|
||||
$phpbb_template_locator = new phpbb_template_locator();
|
||||
$phpbb_template_path_provider = new phpbb_template_path_provider();
|
||||
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_template_locator, $phpbb_template_path_provider);
|
||||
$template->set_ext_dir_prefix('adm/');
|
||||
$template->set_custom_template('../adm/style', 'admin');
|
||||
$template->assign_var('T_ASSETS_PATH', '../assets');
|
||||
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
|
||||
|
@@ -1445,7 +1445,7 @@ class install_install extends module
|
||||
set_config_count(null, null, null, $config);
|
||||
|
||||
$error = false;
|
||||
$search = new fulltext_native($error);
|
||||
$search = new phpbb_search_fulltext_native($error);
|
||||
|
||||
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
|
||||
FROM ' . POSTS_TABLE;
|
||||
@@ -1463,7 +1463,13 @@ class install_install extends module
|
||||
*/
|
||||
function add_modules($mode, $sub)
|
||||
{
|
||||
global $db, $lang, $phpbb_root_path, $phpEx;
|
||||
global $db, $lang, $phpbb_root_path, $phpEx, $phpbb_extension_manager;
|
||||
|
||||
// modules require an extension manager
|
||||
if (empty($phpbb_extension_manager))
|
||||
{
|
||||
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx");
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
|
||||
|
||||
@@ -1578,7 +1584,7 @@ class install_install extends module
|
||||
// Move main module 4 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'main'
|
||||
WHERE module_basename = 'acp_main'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = 'main'";
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -1590,7 +1596,7 @@ class install_install extends module
|
||||
// Move permissions intro screen module 4 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'permissions'
|
||||
WHERE module_basename = 'acp_permissions'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = 'intro'";
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -1602,7 +1608,7 @@ class install_install extends module
|
||||
// Move manage users screen module 5 up...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'users'
|
||||
WHERE module_basename = 'acp_users'
|
||||
AND module_class = 'acp'
|
||||
AND module_mode = 'overview'";
|
||||
$result = $db->sql_query($sql);
|
||||
@@ -1617,7 +1623,7 @@ class install_install extends module
|
||||
// Move attachment module 4 down...
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_basename = 'attachments'
|
||||
WHERE module_basename = 'ucp_attachments'
|
||||
AND module_class = 'ucp'
|
||||
AND module_mode = 'attachments'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
@@ -282,6 +282,15 @@ BEGIN
|
||||
END;;
|
||||
|
||||
|
||||
# Table: 'phpbb_ext'
|
||||
CREATE TABLE phpbb_ext (
|
||||
ext_name VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||
ext_active INTEGER DEFAULT 0 NOT NULL,
|
||||
ext_state BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL
|
||||
);;
|
||||
|
||||
CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext(ext_name);;
|
||||
|
||||
# Table: 'phpbb_extensions'
|
||||
CREATE TABLE phpbb_extensions (
|
||||
extension_id INTEGER NOT NULL,
|
||||
|
@@ -360,6 +360,20 @@ CREATE INDEX [save_time] ON [phpbb_drafts]([save_time]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_ext'
|
||||
*/
|
||||
CREATE TABLE [phpbb_ext] (
|
||||
[ext_name] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||
[ext_active] [int] DEFAULT (0) NOT NULL ,
|
||||
[ext_state] [varchar] (8000) DEFAULT ('') NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE UNIQUE INDEX [ext_name] ON [phpbb_ext]([ext_name]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_extensions'
|
||||
*/
|
||||
|
@@ -192,6 +192,15 @@ CREATE TABLE phpbb_drafts (
|
||||
);
|
||||
|
||||
|
||||
# Table: 'phpbb_ext'
|
||||
CREATE TABLE phpbb_ext (
|
||||
ext_name varbinary(255) DEFAULT '' NOT NULL,
|
||||
ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
ext_state blob NOT NULL,
|
||||
UNIQUE ext_name (ext_name)
|
||||
);
|
||||
|
||||
|
||||
# Table: 'phpbb_extensions'
|
||||
CREATE TABLE phpbb_extensions (
|
||||
extension_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
|
@@ -192,6 +192,15 @@ CREATE TABLE phpbb_drafts (
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
# Table: 'phpbb_ext'
|
||||
CREATE TABLE phpbb_ext (
|
||||
ext_name varchar(255) DEFAULT '' NOT NULL,
|
||||
ext_active tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
ext_state text NOT NULL,
|
||||
UNIQUE ext_name (ext_name)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
# Table: 'phpbb_extensions'
|
||||
CREATE TABLE phpbb_extensions (
|
||||
extension_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
|
@@ -409,6 +409,18 @@ END;
|
||||
/
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_ext'
|
||||
*/
|
||||
CREATE TABLE phpbb_ext (
|
||||
ext_name varchar2(255) DEFAULT '' ,
|
||||
ext_active number(1) DEFAULT '0' NOT NULL,
|
||||
ext_state clob DEFAULT '' ,
|
||||
CONSTRAINT u_phpbb_ext_name UNIQUE (ext_name)
|
||||
)
|
||||
/
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_extensions'
|
||||
*/
|
||||
|
@@ -314,6 +314,17 @@ CREATE TABLE phpbb_drafts (
|
||||
|
||||
CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_ext'
|
||||
*/
|
||||
CREATE TABLE phpbb_ext (
|
||||
ext_name varchar(255) DEFAULT '' NOT NULL,
|
||||
ext_active INT2 DEFAULT '0' NOT NULL CHECK (ext_active >= 0),
|
||||
ext_state varchar(8000) DEFAULT '' NOT NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_extensions'
|
||||
*/
|
||||
|
@@ -226,7 +226,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size'
|
||||
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', 'fulltext_native');
|
||||
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');
|
||||
|
@@ -187,6 +187,15 @@ CREATE TABLE phpbb_drafts (
|
||||
|
||||
CREATE INDEX phpbb_drafts_save_time ON phpbb_drafts (save_time);
|
||||
|
||||
# Table: 'phpbb_ext'
|
||||
CREATE TABLE phpbb_ext (
|
||||
ext_name varchar(255) NOT NULL DEFAULT '',
|
||||
ext_active INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
ext_state text(65535) NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX phpbb_ext_ext_name ON phpbb_ext (ext_name);
|
||||
|
||||
# Table: 'phpbb_extensions'
|
||||
CREATE TABLE phpbb_extensions (
|
||||
extension_id INTEGER PRIMARY KEY NOT NULL ,
|
||||
|
Reference in New Issue
Block a user