Merge pull request 'Address upcoming string interpolation deprecation (PHP 8.2)' (#90) from wn/tt-rss:feature/php82-str-intrp-deprecation into master
Reviewed-on: https://dev.tt-rss.org/tt-rss/tt-rss/pulls/90
This commit is contained in:
commit
9a0dcdd6cc
|
@ -17,7 +17,7 @@ class Db_Migrations {
|
|||
|
||||
function initialize_for_plugin(Plugin $plugin, bool $base_is_latest = true, string $schema_suffix = "sql"): void {
|
||||
$plugin_dir = PluginHost::getInstance()->get_plugin_dir($plugin);
|
||||
$this->initialize($plugin_dir . "/${schema_suffix}",
|
||||
$this->initialize("{$plugin_dir}/{$schema_suffix}",
|
||||
strtolower("ttrss_migrations_plugin_" . get_class($plugin)),
|
||||
$base_is_latest);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class Db_Migrations {
|
|||
}
|
||||
|
||||
private function set_version(int $version): void {
|
||||
Debug::log("Updating table {$this->migrations_table} with version ${version}...", Debug::LOG_EXTENDED);
|
||||
Debug::log("Updating table {$this->migrations_table} with version {$version}...", Debug::LOG_EXTENDED);
|
||||
|
||||
$sth = $this->pdo->query("SELECT * FROM {$this->migrations_table}");
|
||||
|
||||
|
@ -170,7 +170,7 @@ class Db_Migrations {
|
|||
try {
|
||||
$this->migrate_to($i);
|
||||
} catch (PDOException $e) {
|
||||
user_error("Failed to apply migration ${i} for {$this->migrations_table}: " . $e->getMessage(), E_USER_WARNING);
|
||||
user_error("Failed to apply migration {$i} for {$this->migrations_table}: " . $e->getMessage(), E_USER_WARNING);
|
||||
return false;
|
||||
//throw $e;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ class Db_Migrations {
|
|||
*/
|
||||
private function get_lines(int $version) : array {
|
||||
if ($version > 0)
|
||||
$filename = "{$this->migrations_path}/${version}.sql";
|
||||
$filename = "{$this->migrations_path}/{$version}.sql";
|
||||
else
|
||||
$filename = "{$this->base_path}/{$this->base_filename}";
|
||||
|
||||
|
@ -196,7 +196,7 @@ class Db_Migrations {
|
|||
fn($line) => strlen(trim($line)) > 0 && !in_array(strtolower($line), ["begin", "commit"]));
|
||||
|
||||
} else {
|
||||
user_error("Requested schema file ${filename} not found.", E_USER_ERROR);
|
||||
user_error("Requested schema file {$filename} not found.", E_USER_ERROR);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ class DiskCache {
|
|||
if ($fake_extension)
|
||||
$fake_extension = ".$fake_extension";
|
||||
|
||||
header("Content-Disposition: inline; filename=\"${filename}${fake_extension}\"");
|
||||
header("Content-Disposition: inline; filename=\"{$filename}{$fake_extension}\"");
|
||||
|
||||
return $this->send_local_file($this->get_full_path($filename));
|
||||
}
|
||||
|
|
|
@ -1749,11 +1749,11 @@ class Feeds extends Handler_Protected {
|
|||
}
|
||||
|
||||
if (!$allow_archived) {
|
||||
$from_qpart = "${ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id), ttrss_feeds";
|
||||
$from_qpart = "{$ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id), ttrss_feeds";
|
||||
$feed_check_qpart = "ttrss_user_entries.feed_id = ttrss_feeds.id AND";
|
||||
|
||||
} else {
|
||||
$from_qpart = "${ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id)
|
||||
$from_qpart = "{$ext_tables_part}ttrss_entries LEFT JOIN ttrss_user_entries ON (ref_id = ttrss_entries.id)
|
||||
LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
|
||||
$feed_check_qpart = "";
|
||||
}
|
||||
|
@ -2238,7 +2238,7 @@ class Feeds extends Handler_Protected {
|
|||
* @return array{0: string, 1: array<int, string>} [$search_query_part, $search_words]
|
||||
*/
|
||||
private static function _search_to_sql(string $search, string $search_language, int $owner_uid): array {
|
||||
$keywords = str_getcsv(preg_replace('/(-?\w+)\:"(\w+)/', '"${1}:${2}', trim($search)), ' ');
|
||||
$keywords = str_getcsv(preg_replace('/(-?\w+)\:"(\w+)/', '"{$1}:{$2}', trim($search)), ' ');
|
||||
$query_keywords = array();
|
||||
$search_words = array();
|
||||
$search_query_leftover = array();
|
||||
|
|
|
@ -14,15 +14,15 @@ class PluginHandler extends Handler_Protected {
|
|||
if (validate_csrf($csrf_token) || $plugin->csrf_ignore($method)) {
|
||||
$plugin->$method();
|
||||
} else {
|
||||
user_error("Rejected ${plugin_name}->${method}(): invalid CSRF token.", E_USER_WARNING);
|
||||
user_error("Rejected {$plugin_name}->{$method}(): invalid CSRF token.", E_USER_WARNING);
|
||||
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||
}
|
||||
} else {
|
||||
user_error("Rejected ${plugin_name}->${method}(): unknown method.", E_USER_WARNING);
|
||||
user_error("Rejected {$plugin_name}->{$method}(): unknown method.", E_USER_WARNING);
|
||||
print Errors::to_json(Errors::E_UNKNOWN_METHOD);
|
||||
}
|
||||
} else {
|
||||
user_error("Rejected ${plugin_name}->${method}(): unknown plugin.", E_USER_WARNING);
|
||||
user_error("Rejected {$plugin_name}->{$method}(): unknown plugin.", E_USER_WARNING);
|
||||
print Errors::to_json(Errors::E_UNKNOWN_PLUGIN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class Pref_Labels extends Handler_Protected {
|
|||
|
||||
if ($kind == "fg" || $kind == "bg") {
|
||||
$sth = $this->pdo->prepare("UPDATE ttrss_labels2 SET
|
||||
${kind}_color = ? WHERE id = ?
|
||||
{$kind}_color = ? WHERE id = ?
|
||||
AND owner_uid = ?");
|
||||
|
||||
$sth->execute([$color, $id, $_SESSION['uid']]);
|
||||
|
|
|
@ -240,7 +240,7 @@ class Pref_Prefs extends Handler_Protected {
|
|||
$user->full_name = clean($_POST['full_name']);
|
||||
|
||||
if ($user->email != $new_email) {
|
||||
Logger::log(E_USER_NOTICE, "Email address of user ".$user->login." has been changed to ${new_email}.");
|
||||
Logger::log(E_USER_NOTICE, "Email address of user {$user->login} has been changed to {$new_email}.");
|
||||
|
||||
if ($user->email) {
|
||||
$mailer = new Mailer();
|
||||
|
|
|
@ -88,18 +88,18 @@ function get_list_of_locales($locale) {
|
|||
if ($modifier) {
|
||||
if ($country) {
|
||||
if ($charset)
|
||||
array_push($locale_names, "${lang}_$country.$charset@$modifier");
|
||||
array_push($locale_names, "${lang}_$country@$modifier");
|
||||
array_push($locale_names, "{$lang}_$country.$charset@$modifier");
|
||||
array_push($locale_names, "{$lang}_$country@$modifier");
|
||||
} elseif ($charset)
|
||||
array_push($locale_names, "${lang}.$charset@$modifier");
|
||||
array_push($locale_names, "{$lang}.$charset@$modifier");
|
||||
array_push($locale_names, "$lang@$modifier");
|
||||
}
|
||||
if ($country) {
|
||||
if ($charset)
|
||||
array_push($locale_names, "${lang}_$country.$charset");
|
||||
array_push($locale_names, "${lang}_$country");
|
||||
array_push($locale_names, "{$lang}_$country.$charset");
|
||||
array_push($locale_names, "{$lang}_$country");
|
||||
} elseif ($charset)
|
||||
array_push($locale_names, "${lang}.$charset");
|
||||
array_push($locale_names, "{$lang}.$charset");
|
||||
array_push($locale_names, $lang);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue