Merge branch 'feature/unused-var-cleanup' into 'master'
Clean up some unused variables. See merge request tt-rss/tt-rss!19
This commit is contained in:
commit
283ad4ebea
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
startup_gettext();
|
startup_gettext();
|
||||||
|
|
||||||
$script_started = microtime(true);
|
|
||||||
|
|
||||||
if (!init_plugins()) {
|
if (!init_plugins()) {
|
||||||
return;
|
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 = [];
|
$qfh_ret = [];
|
||||||
|
|
||||||
if (!$is_cat && is_numeric($feed_id) && $feed_id < PLUGIN_FEED_BASE_INDEX && $feed_id > LABEL_BASE_INDEX) {
|
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) {
|
foreach ($elems as $e) {
|
||||||
if ($e->nodeName == "iframe") {
|
if ($e->nodeName == "iframe") {
|
||||||
$matches = [];
|
$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_image = "https://img.youtube.com/vi/" . $matches[1] . "/hqdefault.jpg";
|
||||||
$article_stream = "https://youtu.be/" . $matches[1];
|
$article_stream = "https://youtu.be/" . $matches[1];
|
||||||
$article_kind = Article::ARTICLE_KIND_YOUTUBE;
|
$article_kind = Article::ARTICLE_KIND_YOUTUBE;
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Db_Migrations {
|
||||||
|
|
||||||
$sth = $this->pdo->query("SELECT * FROM {$this->migrations_table}");
|
$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 = ?");
|
$sth = $this->pdo->prepare("UPDATE {$this->migrations_table} SET schema_version = ?");
|
||||||
} else {
|
} else {
|
||||||
$sth = $this->pdo->prepare("INSERT INTO {$this->migrations_table} (schema_version) VALUES (?)");
|
$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) {
|
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")) {
|
if (implements_interface($p, "Cache_Adapter")) {
|
||||||
|
|
||||||
/** @var Cache_Adapter $p */
|
/** @var Cache_Adapter $p */
|
||||||
|
|
|
@ -52,7 +52,6 @@ class FeedParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() : void {
|
function init() : void {
|
||||||
$root = $this->doc->firstChild;
|
|
||||||
$xpath = new DOMXPath($this->doc);
|
$xpath = new DOMXPath($this->doc);
|
||||||
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
|
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom');
|
||||||
$xpath->registerNamespace('atom03', 'http://purl.org/atom/ns#');
|
$xpath->registerNamespace('atom03', 'http://purl.org/atom/ns#');
|
||||||
|
|
|
@ -1132,8 +1132,6 @@ class Feeds extends Handler_Protected {
|
||||||
return ["code" => 8];
|
return ["code" => 8];
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdo = Db::pdo();
|
|
||||||
|
|
||||||
$url = UrlHelper::validate($url);
|
$url = UrlHelper::validate($url);
|
||||||
|
|
||||||
if (!$url) return ["code" => 2];
|
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) {
|
static function _find_by_title(string $title, bool $cat = false, int $owner_uid = 0) {
|
||||||
|
|
||||||
$res = false;
|
|
||||||
|
|
||||||
if ($cat) {
|
if ($cat) {
|
||||||
$res = ORM::for_table('ttrss_feed_categories')
|
$res = ORM::for_table('ttrss_feed_categories')
|
||||||
->where('owner_uid', $owner_uid ? $owner_uid : $_SESSION['uid'])
|
->where('owner_uid', $owner_uid ? $owner_uid : $_SESSION['uid'])
|
||||||
|
@ -1735,7 +1731,6 @@ class Feeds extends Handler_Protected {
|
||||||
$vfeed_query_part = $override_vfeed;
|
$vfeed_query_part = $override_vfeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed_title = "";
|
|
||||||
$feed_site_url = "";
|
$feed_site_url = "";
|
||||||
$last_error = "";
|
$last_error = "";
|
||||||
$last_updated = "";
|
$last_updated = "";
|
||||||
|
@ -2157,7 +2152,7 @@ class Feeds extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
static function _clear_access_keys(int $owner_uid): void {
|
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)
|
->where('owner_uid', $owner_uid)
|
||||||
->delete_many();
|
->delete_many();
|
||||||
}
|
}
|
||||||
|
@ -2168,7 +2163,7 @@ class Feeds extends Handler_Protected {
|
||||||
* @see Handler_Public#generate_syndicated_feed()
|
* @see Handler_Public#generate_syndicated_feed()
|
||||||
*/
|
*/
|
||||||
static function _update_access_key(string $feed_id, bool $is_cat, int $owner_uid): ?string {
|
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('owner_uid', $owner_uid)
|
||||||
->where('feed_id', $feed_id)
|
->where('feed_id', $feed_id)
|
||||||
->where('is_cat', $is_cat)
|
->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);
|
if (!$purge_interval) $purge_interval = self::_get_purge_interval($feed_id);
|
||||||
|
|
||||||
$pdo = Db::pdo();
|
$pdo = Db::pdo();
|
||||||
|
|
||||||
$owner_uid = false;
|
|
||||||
$rows_deleted = 0;
|
$rows_deleted = 0;
|
||||||
|
|
||||||
$sth = $pdo->prepare("SELECT owner_uid FROM ttrss_feeds WHERE id = ?");
|
$sth = $pdo->prepare("SELECT owner_uid FROM ttrss_feeds WHERE id = ?");
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Mailer {
|
||||||
$to_address = $params["to_address"];
|
$to_address = $params["to_address"];
|
||||||
$subject = $params["subject"];
|
$subject = $params["subject"];
|
||||||
$message = $params["message"];
|
$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_name = $params["from_name"] ?? Config::get(Config::SMTP_FROM_NAME);
|
||||||
$from_address = $params["from_address"] ?? Config::get(Config::SMTP_FROM_ADDRESS);
|
$from_address = $params["from_address"] ?? Config::get(Config::SMTP_FROM_ADDRESS);
|
||||||
$additional_headers = $params["headers"] ?? [];
|
$additional_headers = $params["headers"] ?? [];
|
||||||
|
|
|
@ -612,8 +612,6 @@ class OPML extends Handler_Protected {
|
||||||
function opml_import(int $owner_uid, string $filename = "") {
|
function opml_import(int $owner_uid, string $filename = "") {
|
||||||
if (!$owner_uid) return;
|
if (!$owner_uid) return;
|
||||||
|
|
||||||
$doc = false;
|
|
||||||
|
|
||||||
if (!$filename) {
|
if (!$filename) {
|
||||||
if ($_FILES['opml_file']['error'] != 0) {
|
if ($_FILES['opml_file']['error'] != 0) {
|
||||||
print_error(T_sprintf("Upload failed with error code %d",
|
print_error(T_sprintf("Upload failed with error code %d",
|
||||||
|
@ -644,8 +642,6 @@ class OPML extends Handler_Protected {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$loaded = false;
|
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
|
|
||||||
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
|
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
|
||||||
|
|
|
@ -1225,13 +1225,10 @@ class Pref_Prefs extends Handler_Protected {
|
||||||
$proc = proc_open("git clone " . escapeshellarg($plugin['clone_url']) . " " . $tmp_dir,
|
$proc = proc_open("git clone " . escapeshellarg($plugin['clone_url']) . " " . $tmp_dir,
|
||||||
$descriptorspec, $pipes, sys_get_temp_dir());
|
$descriptorspec, $pipes, sys_get_temp_dir());
|
||||||
|
|
||||||
$status = 0;
|
|
||||||
|
|
||||||
if (is_resource($proc)) {
|
if (is_resource($proc)) {
|
||||||
$rv["stdout"] = stream_get_contents($pipes[1]);
|
$rv["stdout"] = stream_get_contents($pipes[1]);
|
||||||
$rv["stderr"] = stream_get_contents($pipes[2]);
|
$rv["stderr"] = stream_get_contents($pipes[2]);
|
||||||
$status = proc_close($proc);
|
$rv["git_status"] = proc_close($proc);
|
||||||
$rv["git_status"] = $status;
|
|
||||||
|
|
||||||
// yeah I know about mysterious RC = -1
|
// yeah I know about mysterious RC = -1
|
||||||
if (file_exists("$tmp_dir/init.php")) {
|
if (file_exists("$tmp_dir/init.php")) {
|
||||||
|
@ -1548,7 +1545,7 @@ class Pref_Prefs extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteAppPasswords(): void {
|
function deleteAppPasswords(): void {
|
||||||
$passwords = ORM::for_table('ttrss_app_passwords')
|
ORM::for_table('ttrss_app_passwords')
|
||||||
->where('owner_uid', $_SESSION['uid'])
|
->where('owner_uid', $_SESSION['uid'])
|
||||||
->where_in('id', $_REQUEST['ids'] ?? [])
|
->where_in('id', $_REQUEST['ids'] ?? [])
|
||||||
->delete_many();
|
->delete_many();
|
||||||
|
|
|
@ -263,8 +263,6 @@ class Prefs {
|
||||||
|
|
||||||
list ($def_val, $type_hint) = self::_DEFAULTS[$pref_name];
|
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)) {
|
if ($this->_is_cached($pref_name, $owner_uid, $profile_id)) {
|
||||||
$cached_value = $this->_get_cache($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);
|
return Config::cast_to($cached_value, $type_hint);
|
||||||
|
|
|
@ -873,7 +873,7 @@ class RSSUtils {
|
||||||
|
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
|
|
||||||
$entry_obj = ORM::for_table('ttrss_entries')
|
ORM::for_table('ttrss_entries')
|
||||||
->find_one($base_entry_id)
|
->find_one($base_entry_id)
|
||||||
->set('date_updated', Db::NOW())
|
->set('date_updated', Db::NOW())
|
||||||
->save();
|
->save();
|
||||||
|
@ -1028,7 +1028,7 @@ class RSSUtils {
|
||||||
WHERE guid IN (?, ?, ?)");
|
WHERE guid IN (?, ?, ?)");
|
||||||
$csth->execute([$entry_guid, $entry_guid_hashed, $entry_guid_hashed_compat]);
|
$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);
|
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) */
|
/** migrates favicons from legacy storage in feed-icons/ to cache/feed-icons/using new naming (sans .ico suffix) */
|
||||||
static function migrate_feed_icons() : void {
|
static function migrate_feed_icons() : void {
|
||||||
$old_dir = Config::get(Config::ICONS_DIR);
|
$old_dir = Config::get(Config::ICONS_DIR);
|
||||||
$new_dir = Config::get(Config::CACHE_DIR) . '/feed-icons';
|
|
||||||
|
|
||||||
$dh = opendir($old_dir);
|
$dh = opendir($old_dir);
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,6 @@ class UserHelper {
|
||||||
static function reset_password(int $uid, bool $format_output = false, string $new_password = ""): void {
|
static function reset_password(int $uid, bool $format_output = false, string $new_password = ""): void {
|
||||||
|
|
||||||
$user = ORM::for_table('ttrss_users')->find_one($uid);
|
$user = ORM::for_table('ttrss_users')->find_one($uid);
|
||||||
$message = "";
|
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
$sth = \Db::pdo()->prepare("SELECT id FROM ttrss_sessions WHERE id=?");
|
$sth = \Db::pdo()->prepare("SELECT id FROM ttrss_sessions WHERE id=?");
|
||||||
$sth->execute([$id]);
|
$sth->execute([$id]);
|
||||||
|
|
||||||
if ($row = $sth->fetch()) {
|
if ($sth->fetch()) {
|
||||||
$sth = \Db::pdo()->prepare("UPDATE ttrss_sessions SET data=?, expire=? WHERE id=?");
|
$sth = \Db::pdo()->prepare("UPDATE ttrss_sessions SET data=?, expire=? WHERE id=?");
|
||||||
$sth->execute([$data, $expire, $id]);
|
$sth->execute([$data, $expire, $id]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<?php
|
<?php
|
||||||
foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
|
foreach (PluginHost::getInstance()->get_plugins() as $p) {
|
||||||
if (method_exists($p, "get_css")) {
|
if (method_exists($p, "get_css")) {
|
||||||
echo $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 = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");
|
||||||
$sth->execute([$feed, $_SESSION['uid']]);
|
$sth->execute([$feed, $_SESSION['uid']]);
|
||||||
|
|
||||||
if ($row = $sth->fetch()) {
|
if ($sth->fetch()) {
|
||||||
array_push($tmp, $feed);
|
array_push($tmp, $feed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
startup_gettext();
|
startup_gettext();
|
||||||
|
|
||||||
$script_started = microtime(true);
|
|
||||||
|
|
||||||
if (!init_plugins()) return;
|
if (!init_plugins()) return;
|
||||||
|
|
||||||
$span = OpenTelemetry\API\Trace\Span::getCurrent();
|
$span = OpenTelemetry\API\Trace\Span::getCurrent();
|
||||||
|
|
|
@ -188,7 +188,6 @@
|
||||||
Debug::log("Lock: $lock_filename");
|
Debug::log("Lock: $lock_filename");
|
||||||
|
|
||||||
$lock_handle = make_lockfile($lock_filename);
|
$lock_handle = make_lockfile($lock_filename);
|
||||||
$must_exit = false;
|
|
||||||
|
|
||||||
if (isset($options["task"]) && isset($options["pidlock"])) {
|
if (isset($options["task"]) && isset($options["pidlock"])) {
|
||||||
$waits = $options["task"] * 5;
|
$waits = $options["task"] * 5;
|
||||||
|
@ -512,8 +511,6 @@
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rc = -1;
|
|
||||||
|
|
||||||
if ($enable) {
|
if ($enable) {
|
||||||
Debug::log("Enabling API access for user $login...");
|
Debug::log("Enabling API access for user $login...");
|
||||||
$rc = Prefs::set(Prefs::ENABLE_API_ACCESS, true, $uid, null);
|
$rc = Prefs::set(Prefs::ENABLE_API_ACCESS, true, $uid, null);
|
||||||
|
|
Loading…
Reference in New Issue