aboutsummaryrefslogtreecommitdiff
path: root/app
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
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')
-rw-r--r--app/Controllers/updateController.php6
-rw-r--r--app/Controllers/userController.php2
-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
-rwxr-xr-xapp/actualize_script.php2
-rw-r--r--app/install.php4
9 files changed, 15 insertions, 15 deletions
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index d97b18c70..ba343c81e 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -128,7 +128,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
Minz_Error::error(403);
}
- include_once(LIB_PATH . '/lib_install.php');
+ include_once LIB_PATH . '/lib_install.php';
invalidateHttpCache();
@@ -277,7 +277,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
if (self::isGit()) {
$res = !self::hasGitUpdate();
} else {
- require(UPDATE_FILENAME);
+ require UPDATE_FILENAME;
// @phpstan-ignore function.notFound
$res = do_post_update();
}
@@ -299,7 +299,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
if (self::isGit()) {
$res = self::gitPull();
} else {
- require(UPDATE_FILENAME);
+ require UPDATE_FILENAME;
if (Minz_Request::isPost()) {
// @phpstan-ignore function.notFound
save_info_update();
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index 67a97c45a..17879f3d0 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -288,7 +288,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
$customUserConfigPath = join_path(DATA_PATH, 'config-user.custom.php');
if (file_exists($customUserConfigPath)) {
- $customUserConfig = include($customUserConfigPath);
+ $customUserConfig = include $customUserConfigPath;
if (is_array($customUserConfig)) {
$userConfig = $customUserConfig;
}
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!');
diff --git a/app/actualize_script.php b/app/actualize_script.php
index d0ca72271..2be2a117a 100755
--- a/app/actualize_script.php
+++ b/app/actualize_script.php
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
-require(__DIR__ . '/../cli/_cli.php');
+require dirname(__DIR__) . '/cli/_cli.php';
session_cache_limiter('');
ob_implicit_flush(false);
diff --git a/app/install.php b/app/install.php
index 0e408db52..6c7647492 100644
--- a/app/install.php
+++ b/app/install.php
@@ -7,7 +7,7 @@ if (function_exists('opcache_reset')) {
header("Content-Security-Policy: default-src 'self'; frame-ancestors 'none'");
header('Referrer-Policy: same-origin');
-require(LIB_PATH . '/lib_install.php');
+require LIB_PATH . '/lib_install.php';
Minz_Session::init('FreshRSS');
@@ -144,7 +144,7 @@ function saveStep2(): void {
$customConfigPath = DATA_PATH . '/config.custom.php';
if (file_exists($customConfigPath)) {
- $customConfig = include($customConfigPath);
+ $customConfig = include $customConfigPath;
if (is_array($customConfig)) {
$config_array = array_merge($customConfig, $config_array);
if (!is_string($config_array['default_user'] ?? null)) {