1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-03 21:15:42 +02:00
php-phpbb/phpBB/phpbb/post/post_helper.php
2022-12-11 17:16:44 +01:00

44 lines
816 B
PHP

<?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\post;
use phpbb\db\driver\driver_interface;
class post_helper
{
/**
* @var driver_interface
*/
protected $db;
public function __construct(driver_interface $db)
{
$this->db = $db;
}
/**
* Get last post id
*/
public function get_max_post_id(): int
{
$sql = 'SELECT MAX(post_id) as max_post_id
FROM '. POSTS_TABLE;
$result = $this->db->sql_query($sql);
$max_post_id = (int) $this->db->sql_fetchfield('max_post_id');
$this->db->sql_freeresult($result);
return $max_post_id;
}
}