Address upcoming string interpolation deprecation.
https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation
This commit is contained in:
parent
602e868425
commit
d376cd6142
|
@ -17,7 +17,7 @@ class Db_Migrations {
|
||||||
|
|
||||||
function initialize_for_plugin(Plugin $plugin, bool $base_is_latest = true, string $schema_suffix = "sql"): void {
|
function initialize_for_plugin(Plugin $plugin, bool $base_is_latest = true, string $schema_suffix = "sql"): void {
|
||||||
$plugin_dir = PluginHost::getInstance()->get_plugin_dir($plugin);
|
$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)),
|
strtolower("ttrss_migrations_plugin_" . get_class($plugin)),
|
||||||
$base_is_latest);
|
$base_is_latest);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class Db_Migrations {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_version(int $version): void {
|
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}");
|
$sth = $this->pdo->query("SELECT * FROM {$this->migrations_table}");
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class Db_Migrations {
|
||||||
try {
|
try {
|
||||||
$this->migrate_to($i);
|
$this->migrate_to($i);
|
||||||
} catch (PDOException $e) {
|
} 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;
|
return false;
|
||||||
//throw $e;
|
//throw $e;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ class Db_Migrations {
|
||||||
*/
|
*/
|
||||||
private function get_lines(int $version) : array {
|
private function get_lines(int $version) : array {
|
||||||
if ($version > 0)
|
if ($version > 0)
|
||||||
$filename = "{$this->migrations_path}/${version}.sql";
|
$filename = "{$this->migrations_path}/{$version}.sql";
|
||||||
else
|
else
|
||||||
$filename = "{$this->base_path}/{$this->base_filename}";
|
$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"]));
|
fn($line) => strlen(trim($line)) > 0 && !in_array(strtolower($line), ["begin", "commit"]));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
user_error("Requested schema file ${filename} not found.", E_USER_ERROR);
|
user_error("Requested schema file {$filename} not found.", E_USER_ERROR);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,7 +306,7 @@ class DiskCache {
|
||||||
if ($fake_extension)
|
if ($fake_extension)
|
||||||
$fake_extension = ".$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));
|
return $this->send_local_file($this->get_full_path($filename));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1749,11 +1749,11 @@ class Feeds extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$allow_archived) {
|
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";
|
$feed_check_qpart = "ttrss_user_entries.feed_id = ttrss_feeds.id AND";
|
||||||
|
|
||||||
} else {
|
} 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)";
|
LEFT JOIN ttrss_feeds ON (feed_id = ttrss_feeds.id)";
|
||||||
$feed_check_qpart = "";
|
$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]
|
* @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 {
|
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();
|
$query_keywords = array();
|
||||||
$search_words = array();
|
$search_words = array();
|
||||||
$search_query_leftover = array();
|
$search_query_leftover = array();
|
||||||
|
|
|
@ -14,15 +14,15 @@ class PluginHandler extends Handler_Protected {
|
||||||
if (validate_csrf($csrf_token) || $plugin->csrf_ignore($method)) {
|
if (validate_csrf($csrf_token) || $plugin->csrf_ignore($method)) {
|
||||||
$plugin->$method();
|
$plugin->$method();
|
||||||
} else {
|
} 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);
|
print Errors::to_json(Errors::E_UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
print Errors::to_json(Errors::E_UNKNOWN_METHOD);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
print Errors::to_json(Errors::E_UNKNOWN_PLUGIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Pref_Labels extends Handler_Protected {
|
||||||
|
|
||||||
if ($kind == "fg" || $kind == "bg") {
|
if ($kind == "fg" || $kind == "bg") {
|
||||||
$sth = $this->pdo->prepare("UPDATE ttrss_labels2 SET
|
$sth = $this->pdo->prepare("UPDATE ttrss_labels2 SET
|
||||||
${kind}_color = ? WHERE id = ?
|
{$kind}_color = ? WHERE id = ?
|
||||||
AND owner_uid = ?");
|
AND owner_uid = ?");
|
||||||
|
|
||||||
$sth->execute([$color, $id, $_SESSION['uid']]);
|
$sth->execute([$color, $id, $_SESSION['uid']]);
|
||||||
|
|
|
@ -240,7 +240,7 @@ class Pref_Prefs extends Handler_Protected {
|
||||||
$user->full_name = clean($_POST['full_name']);
|
$user->full_name = clean($_POST['full_name']);
|
||||||
|
|
||||||
if ($user->email != $new_email) {
|
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) {
|
if ($user->email) {
|
||||||
$mailer = new Mailer();
|
$mailer = new Mailer();
|
||||||
|
|
|
@ -88,18 +88,18 @@ function get_list_of_locales($locale) {
|
||||||
if ($modifier) {
|
if ($modifier) {
|
||||||
if ($country) {
|
if ($country) {
|
||||||
if ($charset)
|
if ($charset)
|
||||||
array_push($locale_names, "${lang}_$country.$charset@$modifier");
|
array_push($locale_names, "{$lang}_$country.$charset@$modifier");
|
||||||
array_push($locale_names, "${lang}_$country@$modifier");
|
array_push($locale_names, "{$lang}_$country@$modifier");
|
||||||
} elseif ($charset)
|
} elseif ($charset)
|
||||||
array_push($locale_names, "${lang}.$charset@$modifier");
|
array_push($locale_names, "{$lang}.$charset@$modifier");
|
||||||
array_push($locale_names, "$lang@$modifier");
|
array_push($locale_names, "$lang@$modifier");
|
||||||
}
|
}
|
||||||
if ($country) {
|
if ($country) {
|
||||||
if ($charset)
|
if ($charset)
|
||||||
array_push($locale_names, "${lang}_$country.$charset");
|
array_push($locale_names, "{$lang}_$country.$charset");
|
||||||
array_push($locale_names, "${lang}_$country");
|
array_push($locale_names, "{$lang}_$country");
|
||||||
} elseif ($charset)
|
} elseif ($charset)
|
||||||
array_push($locale_names, "${lang}.$charset");
|
array_push($locale_names, "{$lang}.$charset");
|
||||||
array_push($locale_names, $lang);
|
array_push($locale_names, $lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue