From a41eae1ea770f06c0dd2721d89ee66867336a6f9 Mon Sep 17 00:00:00 2001 From: maxpozdeev Date: Fri, 24 Mar 2023 18:23:06 +0300 Subject: [PATCH] rename DBCore::defaultInstance() --- src/export.php | 2 +- src/feed.php | 2 +- src/includes/api/TasksController.php | 4 ++-- src/includes/class.dbcore.php | 2 +- src/index.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/export.php b/src/export.php index 091439f..d3cdca9 100644 --- a/src/export.php +++ b/src/export.php @@ -24,7 +24,7 @@ if (!$listData) { die("No list found."); } -$data = DBCore::defaultInstance()->getTasksByListId($listId, '', (int)$listData['sorting']); +$data = DBCore::default()->getTasksByListId($listId, '', (int)$listData['sorting']); if (_get('format') == 'ical') { printICal($listData, $data); diff --git a/src/feed.php b/src/feed.php index ebe2d61..369a461 100644 --- a/src/feed.php +++ b/src/feed.php @@ -64,7 +64,7 @@ printRss($data, $listData); function fillData(array &$data, int $listId, string $field, string $sqlWhere ) { - $tasks = DBCore::defaultInstance()->getTasksByListId($listId, $sqlWhere, "$field DESC", 100); + $tasks = DBCore::default()->getTasksByListId($listId, $sqlWhere, "$field DESC", 100); $lang = Lang::instance(); foreach ($tasks as $r) { diff --git a/src/includes/api/TasksController.php b/src/includes/api/TasksController.php index 9440e42..05c3218 100644 --- a/src/includes/api/TasksController.php +++ b/src/includes/api/TasksController.php @@ -191,7 +191,7 @@ class TasksController extends ApiController { checkWriteAccess(); $id = (int)$id; - if (!DBCore::defaultInstance()->taskExists($id)) { + if (!DBCore::default()->taskExists($id)) { $this->response->data = ['total' => 0]; return; } @@ -461,7 +461,7 @@ class TasksController extends ApiController { private function getTaskRowById(int $id): ?array { - $r = DBCore::defaultInstance()->getTaskById($id); + $r = DBCore::default()->getTaskById($id); if (!$r) { throw new Exception("Failed to fetch task data"); } diff --git a/src/includes/class.dbcore.php b/src/includes/class.dbcore.php index ef7581e..d1c5f63 100644 --- a/src/includes/class.dbcore.php +++ b/src/includes/class.dbcore.php @@ -44,7 +44,7 @@ class DBCore * @return DBCore * @throws Exception */ - public static function defaultInstance() : DBCore + public static function default() : DBCore { if (!isset(self::$defaultInstance)) { throw new Exception("DBCore defaultInstance is not initialized"); diff --git a/src/index.php b/src/index.php index 6e5d9f8..5b90d96 100644 --- a/src/index.php +++ b/src/index.php @@ -49,7 +49,7 @@ function parseRoute($queryString) redirectWithHashRoute($hash, $q); } else if (isset($q['task'])) { - $listId = (int)DBCore::defaultInstance()->getListIdByTaskId((int)$q['task']); + $listId = (int)DBCore::default()->getListIdByTaskId((int)$q['task']); if ($listId > 0) { $h = [ 'list', $listId, 'search', '#'. (int)$q['task']]; redirectWithHashRoute($h);