Clean up some unused variables.
This is essentially 1ccc0c8c1a
without the renames and some other things related to Psalm.
This commit is contained in:
parent
f0f22c23c5
commit
8727fb3ba8
|
@ -32,8 +32,6 @@
|
|||
|
||||
startup_gettext();
|
||||
|
||||
$script_started = microtime(true);
|
||||
|
||||
if (!init_plugins()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 (?)");
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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#');
|
||||
|
|
|
@ -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 = ?");
|
||||
|
|
|
@ -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"] ?? [];
|
||||
|
|
|
@ -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', '<')) {
|
||||
|
|
|
@ -1223,13 +1223,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")) {
|
||||
|
@ -1546,7 +1543,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();
|
||||
|
|
|
@ -260,8 +260,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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
startup_gettext();
|
||||
|
||||
$script_started = microtime(true);
|
||||
|
||||
if (!init_plugins()) return;
|
||||
|
||||
$span = OpenTelemetry\API\Trace\Span::getCurrent();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue