Add Rebuild Entries job
This commit is contained in:
@@ -6,17 +6,17 @@ use XF\Service\AbstractService;
|
||||
|
||||
class BotService extends AbstractService
|
||||
{
|
||||
protected string $dbPath;
|
||||
protected ?string $dbPath;
|
||||
protected ?\PDO $pdo = null;
|
||||
|
||||
protected function setup()
|
||||
{
|
||||
$this->dbPath = \XF::config('discord_db_path');
|
||||
$this->dbPath = \XF::config('discord_db_path') ?? null;
|
||||
}
|
||||
|
||||
protected function getDb(): \PDO
|
||||
protected function getDb(): ?\PDO
|
||||
{
|
||||
if (!$this->pdo) {
|
||||
if (!$this->pdo && $this->dbPath) {
|
||||
$this->pdo = new \PDO("sqlite:" . $this->dbPath);
|
||||
$this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
$this->pdo->exec('PRAGMA journal_mode=WAL;');
|
||||
@@ -29,6 +29,8 @@ class BotService extends AbstractService
|
||||
{
|
||||
try {
|
||||
$db = $this->getDb();
|
||||
if( !$db )
|
||||
return false;
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO actions (action, data) VALUES (:action, :data)");
|
||||
return $stmt->execute([
|
||||
|
||||
Reference in New Issue
Block a user