aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/announce_global_permission.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/dev.php36
-rw-r--r--phpBB/phpbb/db/migration/data/v320/font_awesome_update.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/icons_alt.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/log_post_id.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/notifications_board.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php7
-rw-r--r--phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v320/v320a1.php44
-rw-r--r--phpBB/phpbb/db/migration/tool/module.php2
-rw-r--r--phpBB/phpbb/files/upload.php7
-rw-r--r--phpBB/phpbb/install/console/command/install/config/show.php2
-rw-r--r--phpBB/phpbb/install/console/command/install/install.php4
-rw-r--r--phpBB/phpbb/install/installer.php15
-rw-r--r--phpBB/phpbb/install/module/install_data/task/add_bots.php5
-rw-r--r--phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php2
-rw-r--r--phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php8
-rw-r--r--phpBB/phpbb/install/module/update_database/task/update.php2
-rw-r--r--phpBB/phpbb/textreparser/plugins/forum_description.php8
-rw-r--r--phpBB/phpbb/textreparser/plugins/forum_rules.php8
-rw-r--r--phpBB/phpbb/textreparser/plugins/group_description.php8
-rw-r--r--phpBB/phpbb/textreparser/plugins/pm_text.php8
-rw-r--r--phpBB/phpbb/textreparser/plugins/poll_title.php8
-rw-r--r--phpBB/phpbb/textreparser/plugins/post_text.php8
-rw-r--r--phpBB/phpbb/textreparser/plugins/user_signature.php8
-rw-r--r--phpBB/phpbb/textreparser/row_based_plugin.php22
27 files changed, 155 insertions, 91 deletions
diff --git a/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php
index de127e3745..726822bc71 100644
--- a/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php
+++ b/phpBB/phpbb/db/migration/data/v320/allowed_schemes_links.php
@@ -15,6 +15,13 @@ namespace phpbb\db\migration\data\v320;
class allowed_schemes_links extends \phpbb\db\migration\migration
{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
+ }
+
public function update_data()
{
return array(
diff --git a/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php b/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php
index fe30a1c1b8..7afecb884b 100644
--- a/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php
+++ b/phpBB/phpbb/db/migration/data/v320/announce_global_permission.php
@@ -29,7 +29,9 @@ class announce_global_permission extends \phpbb\db\migration\migration
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\rc2');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v320/dev.php b/phpBB/phpbb/db/migration/data/v320/dev.php
new file mode 100644
index 0000000000..ad2da3c1f4
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/dev.php
@@ -0,0 +1,36 @@
+<?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\db\migration\data\v320;
+
+class dev extends \phpbb\db\migration\container_aware_migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-dev', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v31x\v316',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-dev')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php b/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php
index 6ffaf18b4a..817b638037 100644
--- a/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php
+++ b/phpBB/phpbb/db/migration/data/v320/font_awesome_update.php
@@ -15,6 +15,13 @@ namespace phpbb\db\migration\data\v320;
class font_awesome_update extends \phpbb\db\migration\migration
{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
+ }
+
public function effectively_installed()
{
return isset($this->config['load_font_awesome_url']);
diff --git a/phpBB/phpbb/db/migration/data/v320/icons_alt.php b/phpBB/phpbb/db/migration/data/v320/icons_alt.php
index 7071ae78db..80132e579e 100644
--- a/phpBB/phpbb/db/migration/data/v320/icons_alt.php
+++ b/phpBB/phpbb/db/migration/data/v320/icons_alt.php
@@ -17,7 +17,9 @@ class icons_alt extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\dev');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v320/log_post_id.php b/phpBB/phpbb/db/migration/data/v320/log_post_id.php
index 0f155d543c..ead53c8138 100644
--- a/phpBB/phpbb/db/migration/data/v320/log_post_id.php
+++ b/phpBB/phpbb/db/migration/data/v320/log_post_id.php
@@ -17,7 +17,9 @@ class log_post_id extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\dev');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v320/notifications_board.php b/phpBB/phpbb/db/migration/data/v320/notifications_board.php
index fd9f1a2ad6..8a76ebab58 100644
--- a/phpBB/phpbb/db/migration/data/v320/notifications_board.php
+++ b/phpBB/phpbb/db/migration/data/v320/notifications_board.php
@@ -17,7 +17,9 @@ class notifications_board extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\notifications');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php
index 59208be4dc..c14d31f1c0 100644
--- a/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php
+++ b/phpBB/phpbb/db/migration/data/v320/remove_outdated_media.php
@@ -21,6 +21,13 @@ class remove_outdated_media extends \phpbb\db\migration\migration
ATTACHMENT_CATEGORY_QUICKTIME,
);
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
+ }
+
public function update_data()
{
return array(
diff --git a/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php b/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php
index 2898c708f8..1cb9070bf9 100644
--- a/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php
+++ b/phpBB/phpbb/db/migration/data/v320/remove_profilefield_wlm.php
@@ -17,7 +17,9 @@ class remove_profilefield_wlm extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('\phpbb\db\migration\data\v310\profilefield_wlm');
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ );
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v320/v320a1.php b/phpBB/phpbb/db/migration/data/v320/v320a1.php
new file mode 100644
index 0000000000..d7ecb36f90
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v320/v320a1.php
@@ -0,0 +1,44 @@
+<?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\db\migration\data\v320;
+
+class v320a1 extends \phpbb\db\migration\container_aware_migration
+{
+ public function effectively_installed()
+ {
+ return version_compare($this->config['version'], '3.2.0-a1', '>=');
+ }
+
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v320\dev',
+ '\phpbb\db\migration\data\v320\allowed_schemes_links',
+ '\phpbb\db\migration\data\v320\announce_global_permission',
+ '\phpbb\db\migration\data\v320\remove_profilefield_wlm',
+ '\phpbb\db\migration\data\v320\font_awesome_update',
+ '\phpbb\db\migration\data\v320\icons_alt',
+ '\phpbb\db\migration\data\v320\log_post_id',
+ '\phpbb\db\migration\data\v320\remove_outdated_media',
+ '\phpbb\db\migration\data\v320\notifications_board',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.2.0-dev')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index 69ac71abb7..a5ed62fd65 100644
--- a/phpBB/phpbb/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
@@ -262,7 +262,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
// Success
$module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']);
- $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name));
+ $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name));
// Move the module if requested above/below an existing one
if (isset($data['before']) && $data['before'])
diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php
index e011e714e5..a9bf74094d 100644
--- a/phpBB/phpbb/files/upload.php
+++ b/phpBB/phpbb/files/upload.php
@@ -65,9 +65,6 @@ class upload
/** @var request_interface Request class */
protected $request;
- /** @var string phpBB root path */
- protected $phpbb_root_path;
-
/**
* Init file upload class.
*
@@ -76,16 +73,14 @@ class upload
* @param language $language Language class
* @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper
* @param request_interface $request Request class
- * @param string $phpbb_root_path phpBB root path
*/
- public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path)
+ public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request)
{
$this->filesystem = $filesystem;
$this->factory = $factory;
$this->language = $language;
$this->php_ini = $php_ini;
$this->request = $request;
- $this->phpbb_root_path = $phpbb_root_path;
}
/**
diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php
index 4155440fc3..5d82d8d1ef 100644
--- a/phpBB/phpbb/install/console/command/install/config/show.php
+++ b/phpBB/phpbb/install/console/command/install/config/show.php
@@ -96,7 +96,7 @@ class show extends \phpbb\console\command\command
if (!is_file($config_file))
{
- $iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
+ $iohandler->add_error_message(array('MISSING_FILE', $config_file));
return;
}
diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php
index 81ad1039f6..d76182af92 100644
--- a/phpBB/phpbb/install/console/command/install/install.php
+++ b/phpBB/phpbb/install/console/command/install/install.php
@@ -116,7 +116,7 @@ class install extends \phpbb\console\command\command
if (!is_file($config_file))
{
- $iohandler->add_error_message(array('MISSING_FILE', array($config_file)));
+ $iohandler->add_error_message(array('MISSING_FILE', $config_file));
return 1;
}
@@ -127,7 +127,7 @@ class install extends \phpbb\console\command\command
}
catch (ParseException $e)
{
- $iohandler->add_error_message('INVALID_YAML_FILE');
+ $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file));
return 1;
}
diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php
index 77e0a896bc..a41b4cd6a6 100644
--- a/phpBB/phpbb/install/installer.php
+++ b/phpBB/phpbb/install/installer.php
@@ -13,6 +13,7 @@
namespace phpbb\install;
+use phpbb\cache\driver\driver_interface;
use phpbb\di\ordered_service_collection;
use phpbb\install\exception\installer_config_not_writable_exception;
use phpbb\install\exception\jump_to_restart_point_exception;
@@ -26,6 +27,11 @@ use phpbb\path_helper;
class installer
{
/**
+ * @var driver_interface
+ */
+ protected $cache;
+
+ /**
* @var config
*/
protected $install_config;
@@ -55,11 +61,13 @@ class installer
/**
* Constructor
*
- * @param config $config Installer config handler
- * @param path_helper $path_helper Path helper
+ * @param driver_interface $cache Cache service
+ * @param config $config Installer config handler
+ * @param path_helper $path_helper Path helper
*/
- public function __construct(config $config, path_helper $path_helper)
+ public function __construct(driver_interface $cache, config $config, path_helper $path_helper)
{
+ $this->cache = $cache;
$this->install_config = $config;
$this->installer_modules = null;
$this->web_root = $path_helper->get_web_root_path();
@@ -235,6 +243,7 @@ class installer
if ($install_finished || $fail_cleanup)
{
$this->install_config->clean_up_config_file();
+ $this->cache->purge();
}
else
{
diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php
index b45d3808db..2ee641ff63 100644
--- a/phpBB/phpbb/install/module/install_data/task/add_bots.php
+++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php
@@ -197,6 +197,11 @@ class add_bots extends \phpbb\install\task_base
'user_allow_pm' => 0,
);
+ if (!function_exists('user_add'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
+ }
+
$user_id = user_add($user_row);
if (!$user_id)
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php
index 41616e995a..ac305e8ab5 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_admin_data.php
@@ -70,7 +70,7 @@ class obtain_admin_data extends \phpbb\install\task_base implements \phpbb\insta
$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', '');
+ $board_email = $this->io_handler->get_input('board_email', '', true);
$admin_data_valid = $this->check_admin_data($admin_name, $admin_pass1, $admin_pass2, $board_email);
diff --git a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php
index 4e977981ce..6c54561d14 100644
--- a/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php
+++ b/phpBB/phpbb/install/module/obtain_data/task/obtain_board_data.php
@@ -76,8 +76,8 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta
{
// 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', '');
+ $board_name = $this->io_handler->get_input('board_name', '', true);
+ $board_desc = $this->io_handler->get_input('board_description', '', true);
// Check default lang
$langs = $this->language_helper->get_available_languages();
@@ -116,8 +116,8 @@ class obtain_board_data extends \phpbb\install\task_base implements \phpbb\insta
{
if ($use_request_data)
{
- $board_name = $this->io_handler->get_input('board_name', '');
- $board_desc = $this->io_handler->get_input('board_description', '');
+ $board_name = $this->io_handler->get_input('board_name', '', true);
+ $board_desc = $this->io_handler->get_input('board_description', '', true);
}
else
{
diff --git a/phpBB/phpbb/install/module/update_database/task/update.php b/phpBB/phpbb/install/module/update_database/task/update.php
index 2d640134a3..84ec6f73f5 100644
--- a/phpBB/phpbb/install/module/update_database/task/update.php
+++ b/phpBB/phpbb/install/module/update_database/task/update.php
@@ -172,7 +172,7 @@ class update extends task_base
{
$this->log->add(
'admin',
- $this->user->data['user_id'],
+ (isset($this->user->data['user_id'])) ? $this->user->data['user_id'] : ANONYMOUS,
$this->user->ip,
'LOG_UPDATE_DATABASE',
false,
diff --git a/phpBB/phpbb/textreparser/plugins/forum_description.php b/phpBB/phpbb/textreparser/plugins/forum_description.php
index 0302dc3082..b0f5a42452 100644
--- a/phpBB/phpbb/textreparser/plugins/forum_description.php
+++ b/phpBB/phpbb/textreparser/plugins/forum_description.php
@@ -27,12 +27,4 @@ class forum_description extends \phpbb\textreparser\row_based_plugin
'options' => 'forum_desc_options',
);
}
-
- /**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return FORUMS_TABLE;
- }
}
diff --git a/phpBB/phpbb/textreparser/plugins/forum_rules.php b/phpBB/phpbb/textreparser/plugins/forum_rules.php
index ce550225f2..d131d00707 100644
--- a/phpBB/phpbb/textreparser/plugins/forum_rules.php
+++ b/phpBB/phpbb/textreparser/plugins/forum_rules.php
@@ -27,12 +27,4 @@ class forum_rules extends \phpbb\textreparser\row_based_plugin
'options' => 'forum_rules_options',
);
}
-
- /**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return FORUMS_TABLE;
- }
}
diff --git a/phpBB/phpbb/textreparser/plugins/group_description.php b/phpBB/phpbb/textreparser/plugins/group_description.php
index 3346ccf25e..2c45c00474 100644
--- a/phpBB/phpbb/textreparser/plugins/group_description.php
+++ b/phpBB/phpbb/textreparser/plugins/group_description.php
@@ -27,12 +27,4 @@ class group_description extends \phpbb\textreparser\row_based_plugin
'options' => 'group_desc_options',
);
}
-
- /**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return GROUPS_TABLE;
- }
}
diff --git a/phpBB/phpbb/textreparser/plugins/pm_text.php b/phpBB/phpbb/textreparser/plugins/pm_text.php
index 4d06a2878b..867da624ee 100644
--- a/phpBB/phpbb/textreparser/plugins/pm_text.php
+++ b/phpBB/phpbb/textreparser/plugins/pm_text.php
@@ -29,12 +29,4 @@ class pm_text extends \phpbb\textreparser\row_based_plugin
'bbcode_uid' => 'bbcode_uid',
);
}
-
- /**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return PRIVMSGS_TABLE;
- }
}
diff --git a/phpBB/phpbb/textreparser/plugins/poll_title.php b/phpBB/phpbb/textreparser/plugins/poll_title.php
index 038ae0c366..76d30655c9 100644
--- a/phpBB/phpbb/textreparser/plugins/poll_title.php
+++ b/phpBB/phpbb/textreparser/plugins/poll_title.php
@@ -39,12 +39,4 @@ class poll_title extends \phpbb\textreparser\row_based_plugin
return $sql;
}
-
- /**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return TOPICS_TABLE;
- }
}
diff --git a/phpBB/phpbb/textreparser/plugins/post_text.php b/phpBB/phpbb/textreparser/plugins/post_text.php
index 4a07c98cea..1c98e86067 100644
--- a/phpBB/phpbb/textreparser/plugins/post_text.php
+++ b/phpBB/phpbb/textreparser/plugins/post_text.php
@@ -29,12 +29,4 @@ class post_text extends \phpbb\textreparser\row_based_plugin
'bbcode_uid' => 'bbcode_uid',
);
}
-
- /**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return POSTS_TABLE;
- }
}
diff --git a/phpBB/phpbb/textreparser/plugins/user_signature.php b/phpBB/phpbb/textreparser/plugins/user_signature.php
index f657a45d38..647d3a7b14 100644
--- a/phpBB/phpbb/textreparser/plugins/user_signature.php
+++ b/phpBB/phpbb/textreparser/plugins/user_signature.php
@@ -55,14 +55,6 @@ class user_signature extends \phpbb\textreparser\row_based_plugin
}
/**
- * {@inheritdoc}
- */
- public function get_table_name()
- {
- return USERS_TABLE;
- }
-
- /**
* Save the keyoptions var from \phpbb\user
*/
protected function save_keyoptions()
diff --git a/phpBB/phpbb/textreparser/row_based_plugin.php b/phpBB/phpbb/textreparser/row_based_plugin.php
index d3ca334591..2d32104493 100644
--- a/phpBB/phpbb/textreparser/row_based_plugin.php
+++ b/phpBB/phpbb/textreparser/row_based_plugin.php
@@ -21,13 +21,20 @@ abstract class row_based_plugin extends base
protected $db;
/**
+ * @var string
+ */
+ protected $table;
+
+ /**
* Constructor
*
* @param \phpbb\db\driver\driver_interface $db Database connection
+ * @param string $table
*/
- public function __construct(\phpbb\db\driver\driver_interface $db)
+ public function __construct(\phpbb\db\driver\driver_interface $db, $table)
{
$this->db = $db;
+ $this->table = $table;
}
/**
@@ -38,20 +45,13 @@ abstract class row_based_plugin extends base
abstract public function get_columns();
/**
- * Return the name of the table used by this plugin
- *
- * @return string
- */
- abstract public function get_table_name();
-
- /**
* {@inheritdoc}
*/
public function get_max_id()
{
$columns = $this->get_columns();
- $sql = 'SELECT MAX(' . $columns['id'] . ') AS max_id FROM ' . $this->get_table_name();
+ $sql = 'SELECT MAX(' . $columns['id'] . ') AS max_id FROM ' . $this->table;
$result = $this->db->sql_query($sql);
$max_id = (int) $this->db->sql_fetchfield('max_id');
$this->db->sql_freeresult($result);
@@ -96,7 +96,7 @@ abstract class row_based_plugin extends base
}
$sql = 'SELECT ' . implode(', ', $fields) . '
- FROM ' . $this->get_table_name() . '
+ FROM ' . $this->table . '
WHERE ' . $columns['id'] . ' BETWEEN ' . $min_id . ' AND ' . $max_id;
return $sql;
@@ -109,7 +109,7 @@ abstract class row_based_plugin extends base
{
$columns = $this->get_columns();
- $sql = 'UPDATE ' . $this->get_table_name() . '
+ $sql = 'UPDATE ' . $this->table . '
SET ' . $columns['text'] . " = '" . $this->db->sql_escape($record['text']) . "'
WHERE " . $columns['id'] . ' = ' . $record['id'];
$this->db->sql_query($sql);