mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-08 01:32:59 +02:00
fixes #1616 handle backticked rank column in conf.order_by setting
This commit is contained in:
@@ -141,6 +141,19 @@ ImageStdParams::load_from_db();
|
||||
session_start();
|
||||
load_plugins();
|
||||
|
||||
// 2022-02-25 due to escape on "rank" (becoming a mysql keyword in version 8), the $conf['order_by'] might
|
||||
// use a "rank", even if admin/configuration.php should have removed it. We must remove it.
|
||||
// TODO remove this data update as soon as 2025 arrives
|
||||
if (preg_match('/(, )?`rank` ASC/', $conf['order_by']))
|
||||
{
|
||||
$order_by = preg_replace('/(, )?`rank` ASC/', '', $conf['order_by']);
|
||||
if ('ORDER BY ' == $order_by)
|
||||
{
|
||||
$order_by = 'ORDER BY id ASC';
|
||||
}
|
||||
conf_update_param('order_by', $order_by, true);
|
||||
}
|
||||
|
||||
// users can have defined a custom order pattern, incompatible with GUI form
|
||||
if (isset($conf['order_by_custom']))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user