mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
3d3fb9faec
3 changed files with 11 additions and 30 deletions
|
@ -73,6 +73,7 @@ services:
|
||||||
class: phpbb\textreparser\plugins\poll_option
|
class: phpbb\textreparser\plugins\poll_option
|
||||||
arguments:
|
arguments:
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
|
- '%tables.poll_options%'
|
||||||
calls:
|
calls:
|
||||||
- [set_name, [poll_option]]
|
- [set_name, [poll_option]]
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -13,51 +13,31 @@
|
||||||
|
|
||||||
namespace phpbb\textreparser\plugins;
|
namespace phpbb\textreparser\plugins;
|
||||||
|
|
||||||
class poll_option extends \phpbb\textreparser\base
|
class poll_option extends \phpbb\textreparser\row_based_plugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var \phpbb\db\driver\driver_interface
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected $db;
|
public function get_columns()
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param \phpbb\db\driver\driver_interface $db Database connection
|
|
||||||
*/
|
|
||||||
public function __construct(\phpbb\db\driver\driver_interface $db)
|
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
return [
|
||||||
|
'id' => 'topic_id',
|
||||||
|
'text' => 'poll_option_text',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function get_max_id()
|
protected function get_records_by_range_query($min_id, $max_id)
|
||||||
{
|
|
||||||
$sql = 'SELECT MAX(topic_id) AS max_id FROM ' . POLL_OPTIONS_TABLE;
|
|
||||||
$result = $this->db->sql_query($sql);
|
|
||||||
$max_id = (int) $this->db->sql_fetchfield('max_id');
|
|
||||||
$this->db->sql_freeresult($result);
|
|
||||||
|
|
||||||
return $max_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function get_records_by_range($min_id, $max_id)
|
|
||||||
{
|
{
|
||||||
$sql = 'SELECT o.topic_id, o.poll_option_id, o.poll_option_text AS text, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.bbcode_uid
|
$sql = 'SELECT o.topic_id, o.poll_option_id, o.poll_option_text AS text, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.bbcode_uid
|
||||||
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||||
WHERE o.topic_id BETWEEN ' . $min_id . ' AND ' . $max_id .'
|
WHERE o.topic_id BETWEEN ' . $min_id . ' AND ' . $max_id .'
|
||||||
AND t.topic_id = o.topic_id
|
AND t.topic_id = o.topic_id
|
||||||
AND p.post_id = t.topic_first_post_id';
|
AND p.post_id = t.topic_first_post_id';
|
||||||
$result = $this->db->sql_query($sql);
|
|
||||||
$records = $this->db->sql_fetchrowset($result);
|
|
||||||
$this->db->sql_freeresult($result);
|
|
||||||
|
|
||||||
return $records;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,7 @@ class phpbb_textreparser_poll_option_test extends phpbb_database_test_case
|
||||||
|
|
||||||
protected function get_reparser()
|
protected function get_reparser()
|
||||||
{
|
{
|
||||||
return new \phpbb\textreparser\plugins\poll_option($this->db);
|
return new \phpbb\textreparser\plugins\poll_option($this->db, POLL_OPTIONS_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function get_rows()
|
protected function get_rows()
|
||||||
|
|
Loading…
Add table
Reference in a new issue