From 23ba48c71f0d41bbe012d668349f6516dad527b4 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Sep 2025 09:56:46 -0400 Subject: Change how files are included (#7916) 1. `include`, `include_once`, `require` and `require_once` are expressions not functions, parentheses are not necessary. 2. to move up the directory tree, it's better to use the `dirname` function instead of relying on `/..`. --- app/Models/DatabaseDAO.php | 4 ++-- app/Models/Feed.php | 4 ++-- app/Models/Search.php | 2 +- app/Models/Share.php | 2 +- app/Models/UserDAO.php | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app/Models') diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 0062c23e8..8ec3ce3ca 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -21,7 +21,7 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { public const LENGTH_INDEX_UNICODE = 191; public function create(): string { - require_once(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); + require_once APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'; $db = FreshRSS_Context::systemConf()->db; try { @@ -280,7 +280,7 @@ SQL; $catDAO = FreshRSS_Factory::createCategoryDao(); $catDAO->resetDefaultCategoryName(); - include_once(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); + include_once APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'; if (!empty($GLOBALS['SQL_UPDATE_MINOR']) && is_string($GLOBALS['SQL_UPDATE_MINOR'])) { $sql = $GLOBALS['SQL_UPDATE_MINOR']; $isMariaDB = false; diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 26f85093e..f85db0f2f 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -177,7 +177,7 @@ class FreshRSS_Feed extends Minz_Model { $attributesOnly = $contents === null && $tmpPath === ''; - require_once(LIB_PATH . '/favicons.php'); + require_once LIB_PATH . '/favicons.php'; if (!$attributesOnly && !isImgMime(is_string($contents) ? $contents : '')) { throw new FreshRSS_UnsupportedImageFormat_Exception(); } @@ -401,7 +401,7 @@ class FreshRSS_Feed extends Minz_Model { } public function faviconPrepare(bool $force = false): void { - require_once(LIB_PATH . '/favicons.php'); + require_once LIB_PATH . '/favicons.php'; if ($this->customFavicon()) { return; } diff --git a/app/Models/Search.php b/app/Models/Search.php index 539fe2a12..e88f745ce 100644 --- a/app/Models/Search.php +++ b/app/Models/Search.php @@ -1,7 +1,7 @@ pdo->dbType() . '.php'); + require APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'; try { $sql = $GLOBALS['SQL_CREATE_TABLES']; @@ -31,7 +31,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { fwrite(STDERR, 'Deleting SQL data for user “' . $this->current_user . "”…\n"); } - require(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); + require APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'; $sql = $GLOBALS['SQL_DROP_TABLES']; if (!is_string($sql)) { throw new Exception('SQL_DROP_TABLES is not a string!'); -- cgit v1.2.3