Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
post_helper | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get_max_post_id | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\posting; |
15 | |
16 | use phpbb\db\driver\driver_interface; |
17 | |
18 | class post_helper |
19 | { |
20 | /** |
21 | * @var driver_interface |
22 | */ |
23 | protected $db; |
24 | |
25 | public function __construct(driver_interface $db) |
26 | { |
27 | $this->db = $db; |
28 | } |
29 | |
30 | /** |
31 | * Get last post id |
32 | */ |
33 | public function get_max_post_id(): int |
34 | { |
35 | $sql = 'SELECT MAX(post_id) as max_post_id |
36 | FROM '. POSTS_TABLE; |
37 | $result = $this->db->sql_query($sql); |
38 | $max_post_id = (int) $this->db->sql_fetchfield('max_post_id'); |
39 | $this->db->sql_freeresult($result); |
40 | |
41 | return $max_post_id; |
42 | } |
43 | } |