aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2025-09-05 09:56:46 -0400
committerGravatar GitHub <noreply@github.com> 2025-09-05 15:56:46 +0200
commit23ba48c71f0d41bbe012d668349f6516dad527b4 (patch)
treeb5680e834c2b87becdded07e0555227ade9d7629 /app/Models
parent3d85eb19380021031e9d1193919ba516bbc99573 (diff)
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 `/..`.
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/DatabaseDAO.php4
-rw-r--r--app/Models/Feed.php4
-rw-r--r--app/Models/Search.php2
-rw-r--r--app/Models/Share.php2
-rw-r--r--app/Models/UserDAO.php4
5 files changed, 8 insertions, 8 deletions
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 @@
<?php
declare(strict_types=1);
-require_once(LIB_PATH . '/lib_date.php');
+require_once LIB_PATH . '/lib_date.php';
/**
* Contains a search from the search form.
diff --git a/app/Models/Share.php b/app/Models/Share.php
index 140ca0eca..d7ee3bde7 100644
--- a/app/Models/Share.php
+++ b/app/Models/Share.php
@@ -40,7 +40,7 @@ class FreshRSS_Share {
* @param string $filename the name of the file to load.
*/
public static function load(string $filename): void {
- $shares_from_file = @include($filename);
+ $shares_from_file = @include $filename;
if (!is_array($shares_from_file)) {
$shares_from_file = [];
}
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
index 4cbfa7412..89f8f2a77 100644
--- a/app/Models/UserDAO.php
+++ b/app/Models/UserDAO.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
class FreshRSS_UserDAO extends Minz_ModelPdo {
public function createUser(): bool {
- require(APP_PATH . '/SQL/install.sql.' . $this->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!');