summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2024-01-13 18:29:30 +0000
committerAndrew Dolgov <[email protected]>2024-01-13 18:29:30 +0000
commit283ad4ebea9e93a97848000f38ca91b23ce883ff (patch)
tree0b9ea618b438156b3803df115afec5e34d30e3a8
parentd334023267848accb339c8ec3186be2afde3b514 (diff)
parent8727fb3ba8a28da48c71bdd39166b9aeb3c3d986 (diff)
Merge branch 'feature/unused-var-cleanup' into 'master'
Clean up some unused variables. See merge request tt-rss/tt-rss!19
-rw-r--r--backend.php2
-rw-r--r--classes/API.php14
-rw-r--r--classes/Article.php2
-rw-r--r--classes/Db_Migrations.php2
-rw-r--r--classes/DiskCache.php2
-rw-r--r--classes/FeedParser.php1
-rw-r--r--classes/Feeds.php11
-rw-r--r--classes/Mailer.php2
-rw-r--r--classes/OPML.php4
-rw-r--r--classes/Pref_Prefs.php7
-rw-r--r--classes/Prefs.php2
-rw-r--r--classes/RSSUtils.php5
-rw-r--r--classes/UserHelper.php1
-rw-r--r--include/sessions.php2
-rw-r--r--index.php2
-rw-r--r--plugins/af_psql_trgm/init.php2
-rw-r--r--public.php2
-rwxr-xr-xupdate.php3
18 files changed, 13 insertions, 53 deletions
diff --git a/backend.php b/backend.php
index 44d4284c3..5aceb46dc 100644
--- a/backend.php
+++ b/backend.php
@@ -32,8 +32,6 @@
startup_gettext();
- $script_started = microtime(true);
-
if (!init_plugins()) {
return;
}
diff --git a/classes/API.php b/classes/API.php
index 3a3ae0e63..45820f300 100644
--- a/classes/API.php
+++ b/classes/API.php
@@ -691,20 +691,6 @@ class API extends Handler {
}
}
- $params = array(
- "feed" => $feed_id,
- "limit" => $limit,
- "view_mode" => $view_mode,
- "cat_view" => $is_cat,
- "search" => $search,
- "override_order" => $order,
- "offset" => $offset,
- "since_id" => $since_id,
- "include_children" => $include_nested,
- "check_first_id" => $check_first_id,
- "skip_first_id_check" => $skip_first_id_check
- );
-
$qfh_ret = [];
if (!$is_cat && is_numeric($feed_id) && $feed_id < PLUGIN_FEED_BASE_INDEX && $feed_id > LABEL_BASE_INDEX) {
diff --git a/classes/Article.php b/classes/Article.php
index 0b446479b..c496ea131 100644
--- a/classes/Article.php
+++ b/classes/Article.php
@@ -606,7 +606,7 @@ class Article extends Handler_Protected {
foreach ($elems as $e) {
if ($e->nodeName == "iframe") {
$matches = [];
- if ($rrr = preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) {
+ if (preg_match("/\/embed\/([\w-]+)/", $e->getAttribute("src"), $matches)) {
$article_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg";
$article_stream = "https://youtu.be/" . $matches[1];
$article_kind = Article::ARTICLE_KIND_YOUTUBE;
diff --git a/classes/Db_Migrations.php b/classes/Db_Migrations.php
index d63736987..c2a8c326d 100644
--- a/classes/Db_Migrations.php
+++ b/classes/Db_Migrations.php
@@ -35,7 +35,7 @@ class Db_Migrations {
$sth = $this->pdo->query("SELECT * FROM {$this->migrations_table}");
- if ($res = $sth->fetch()) {
+ if ($sth->fetch()) {
$sth = $this->pdo->prepare("UPDATE {$this->migrations_table} SET schema_version = ?");
} else {
$sth = $this->pdo->prepare("INSERT INTO {$this->migrations_table} (schema_version) VALUES (?)");
diff --git a/classes/DiskCache.php b/classes/DiskCache.php
index 290fbd9c3..196eed02d 100644
--- a/classes/DiskCache.php
+++ b/classes/DiskCache.php
@@ -206,7 +206,7 @@ class DiskCache implements Cache_Adapter {
}
public function __construct(string $dir) {
- foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
+ foreach (PluginHost::getInstance()->get_plugins() as $p) {
if (implements_interface($p, "Cache_Adapter")) {
/** @var Cache_Adapter $p */
diff --git a/classes/FeedParser.php b/classes/FeedParser.php
index 4b9c63f56..729d77206 100644
--- a/classes/FeedParser.php
+++ b/classes/FeedParser.php
@@ -52,7 +52,6 @@ class FeedParser {
}
function init() : void {
- $root = $this->doc->firstChild;
$xpath = new DOMXPath($this->doc);
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
$xpath->registerNamespace('atom03', 'http://purl.org/atom/ns#');
diff --git a/classes/Feeds.php b/classes/Feeds.php
index c673f0bd7..88128cc48 100644
--- a/classes/Feeds.php
+++ b/classes/Feeds.php
@@ -1132,8 +1132,6 @@ class Feeds extends Handler_Protected {
return ["code" => 8];
}
- $pdo = Db::pdo();
-
$url = UrlHelper::validate($url);
if (!$url) return ["code" => 2];
@@ -1277,8 +1275,6 @@ class Feeds extends Handler_Protected {
*/
static function _find_by_title(string $title, bool $cat = false, int $owner_uid = 0) {
- $res = false;
-
if ($cat) {
$res = ORM::for_table('ttrss_feed_categories')
->where('owner_uid', $owner_uid ? $owner_uid : $_SESSION['uid'])
@@ -1735,7 +1731,6 @@ class Feeds extends Handler_Protected {
$vfeed_query_part = $override_vfeed;
}
- $feed_title = "";
$feed_site_url = "";
$last_error = "";
$last_updated = "";
@@ -2157,7 +2152,7 @@ class Feeds extends Handler_Protected {
}
static function _clear_access_keys(int $owner_uid): void {
- $key = ORM::for_table('ttrss_access_keys')
+ ORM::for_table('ttrss_access_keys')
->where('owner_uid', $owner_uid)
->delete_many();
}
@@ -2168,7 +2163,7 @@ class Feeds extends Handler_Protected {
* @see Handler_Public#generate_syndicated_feed()
*/
static function _update_access_key(string $feed_id, bool $is_cat, int $owner_uid): ?string {
- $key = ORM::for_table('ttrss_access_keys')
+ ORM::for_table('ttrss_access_keys')
->where('owner_uid', $owner_uid)
->where('feed_id', $feed_id)
->where('is_cat', $is_cat)
@@ -2212,8 +2207,6 @@ class Feeds extends Handler_Protected {
if (!$purge_interval) $purge_interval = self::_get_purge_interval($feed_id);
$pdo = Db::pdo();
-
- $owner_uid = false;
$rows_deleted = 0;
$sth = $pdo->prepare("SELECT owner_uid FROM ttrss_feeds WHERE id = ?");
diff --git a/classes/Mailer.php b/classes/Mailer.php
index ac5c641eb..569b6cee2 100644
--- a/classes/Mailer.php
+++ b/classes/Mailer.php
@@ -12,7 +12,7 @@ class Mailer {
$to_address = $params["to_address"];
$subject = $params["subject"];
$message = $params["message"];
- $message_html = $params["message_html"] ?? "";
+ // $message_html = $params["message_html"] ?? "";
$from_name = $params["from_name"] ?? Config::get(Config::SMTP_FROM_NAME);
$from_address = $params["from_address"] ?? Config::get(Config::SMTP_FROM_ADDRESS);
$additional_headers = $params["headers"] ?? [];
diff --git a/classes/OPML.php b/classes/OPML.php
index b9f5f2eab..6b95a89db 100644
--- a/classes/OPML.php
+++ b/classes/OPML.php
@@ -612,8 +612,6 @@ class OPML extends Handler_Protected {
function opml_import(int $owner_uid, string $filename = "") {
if (!$owner_uid) return;
- $doc = false;
-
if (!$filename) {
if ($_FILES['opml_file']['error'] != 0) {
print_error(T_sprintf("Upload failed with error code %d",
@@ -644,8 +642,6 @@ class OPML extends Handler_Protected {
return false;
}
- $loaded = false;
-
$doc = new DOMDocument();
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
diff --git a/classes/Pref_Prefs.php b/classes/Pref_Prefs.php
index 72ec35546..5cbf3c6d1 100644
--- a/classes/Pref_Prefs.php
+++ b/classes/Pref_Prefs.php
@@ -1225,13 +1225,10 @@ class Pref_Prefs extends Handler_Protected {
$proc = proc_open("git clone " . escapeshellarg($plugin['clone_url']) . " " . $tmp_dir,
$descriptorspec, $pipes, sys_get_temp_dir());
- $status = 0;
-
if (is_resource($proc)) {
$rv["stdout"] = stream_get_contents($pipes[1]);
$rv["stderr"] = stream_get_contents($pipes[2]);
- $status = proc_close($proc);
- $rv["git_status"] = $status;
+ $rv["git_status"] = proc_close($proc);
// yeah I know about mysterious RC = -1
if (file_exists("$tmp_dir/init.php")) {
@@ -1548,7 +1545,7 @@ class Pref_Prefs extends Handler_Protected {
}
function deleteAppPasswords(): void {
- $passwords = ORM::for_table('ttrss_app_passwords')
+ ORM::for_table('ttrss_app_passwords')
->where('owner_uid', $_SESSION['uid'])
->where_in('id', $_REQUEST['ids'] ?? [])
->delete_many();
diff --git a/classes/Prefs.php b/classes/Prefs.php
index 4426c2117..e315802a9 100644
--- a/classes/Prefs.php
+++ b/classes/Prefs.php
@@ -263,8 +263,6 @@ class Prefs {
list ($def_val, $type_hint) = self::_DEFAULTS[$pref_name];
- $cached_value = $this->_get_cache($pref_name, $owner_uid, $profile_id);
-
if ($this->_is_cached($pref_name, $owner_uid, $profile_id)) {
$cached_value = $this->_get_cache($pref_name, $owner_uid, $profile_id);
return Config::cast_to($cached_value, $type_hint);
diff --git a/classes/RSSUtils.php b/classes/RSSUtils.php
index ea3c074ab..751e1d9c7 100644
--- a/classes/RSSUtils.php
+++ b/classes/RSSUtils.php
@@ -873,7 +873,7 @@ class RSSUtils {
$pdo->commit();
- $entry_obj = ORM::for_table('ttrss_entries')
+ ORM::for_table('ttrss_entries')
->find_one($base_entry_id)
->set('date_updated', Db::NOW())
->save();
@@ -1028,7 +1028,7 @@ class RSSUtils {
WHERE guid IN (?, ?, ?)");
$csth->execute([$entry_guid, $entry_guid_hashed, $entry_guid_hashed_compat]);
- if (!$row = $csth->fetch()) {
+ if (!$csth->fetch()) {
Debug::log("base guid [$entry_guid or $entry_guid_hashed] not found, creating...", Debug::LOG_VERBOSE);
@@ -1746,7 +1746,6 @@ class RSSUtils {
/** migrates favicons from legacy storage in feed-icons/ to cache/feed-icons/using new naming (sans .ico suffix) */
static function migrate_feed_icons() : void {
$old_dir = Config::get(Config::ICONS_DIR);
- $new_dir = Config::get(Config::CACHE_DIR) . '/feed-icons';
$dh = opendir($old_dir);
diff --git a/classes/UserHelper.php b/classes/UserHelper.php
index 4d9f30548..b47f2853e 100644
--- a/classes/UserHelper.php
+++ b/classes/UserHelper.php
@@ -250,7 +250,6 @@ class UserHelper {
static function reset_password(int $uid, bool $format_output = false, string $new_password = ""): void {
$user = ORM::for_table('ttrss_users')->find_one($uid);
- $message = "";
if ($user) {
diff --git a/include/sessions.php b/include/sessions.php
index 48afd0a8b..605ca9325 100644
--- a/include/sessions.php
+++ b/include/sessions.php
@@ -93,7 +93,7 @@
$sth = \Db::pdo()->prepare("SELECT id FROM ttrss_sessions WHERE id=?");
$sth->execute([$id]);
- if ($row = $sth->fetch()) {
+ if ($sth->fetch()) {
$sth = \Db::pdo()->prepare("UPDATE ttrss_sessions SET data=?, expire=? WHERE id=?");
$sth->execute([$data, $expire, $id]);
} else {
diff --git a/index.php b/index.php
index e9f85264e..bcd50f854 100644
--- a/index.php
+++ b/index.php
@@ -45,7 +45,7 @@
<style type="text/css">
<?php
- foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
+ foreach (PluginHost::getInstance()->get_plugins() as $p) {
if (method_exists($p, "get_css")) {
echo $p->get_css();
}
diff --git a/plugins/af_psql_trgm/init.php b/plugins/af_psql_trgm/init.php
index 4767e071b..28a0ab933 100644
--- a/plugins/af_psql_trgm/init.php
+++ b/plugins/af_psql_trgm/init.php
@@ -385,7 +385,7 @@ class Af_Psql_Trgm extends Plugin {
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");
$sth->execute([$feed, $_SESSION['uid']]);
- if ($row = $sth->fetch()) {
+ if ($sth->fetch()) {
array_push($tmp, $feed);
}
}
diff --git a/public.php b/public.php
index 6d9bc4b0c..3eb4b4083 100644
--- a/public.php
+++ b/public.php
@@ -10,8 +10,6 @@
startup_gettext();
- $script_started = microtime(true);
-
if (!init_plugins()) return;
$span = OpenTelemetry\API\Trace\Span::getCurrent();
diff --git a/update.php b/update.php
index 4c10e3072..442ec857a 100755
--- a/update.php
+++ b/update.php
@@ -188,7 +188,6 @@
Debug::log("Lock: $lock_filename");
$lock_handle = make_lockfile($lock_filename);
- $must_exit = false;
if (isset($options["task"]) && isset($options["pidlock"])) {
$waits = $options["task"] * 5;
@@ -512,8 +511,6 @@
exit(1);
}
- $rc = -1;
-
if ($enable) {
Debug::log("Enabling API access for user $login...");
$rc = Prefs::set(Prefs::ENABLE_API_ACCESS, true, $uid, null);