mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
fixes #2488 improve handling of derivative config
Refactors how derivative and disabled_derivatives config values are loaded from the database, supporting both parameters and using a new safe_unserialize function. Updates ImageStdParams to use the global config and ensures proper serialization/deserialization of disabled type maps, with improved save logic to avoid unnecessary writes.
This commit is contained in:
21
i.php
21
i.php
@@ -365,6 +365,15 @@ function send_derivative($expires)
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
function safe_unserialize($value)
|
||||
{
|
||||
if (is_string($value))
|
||||
{
|
||||
return unserialize($value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
$page=array();
|
||||
$begin = $step = microtime(true);
|
||||
$timing=array();
|
||||
@@ -388,7 +397,17 @@ catch (Exception $e)
|
||||
}
|
||||
pwg_db_check_charset();
|
||||
|
||||
list($conf['derivatives']) = pwg_db_fetch_row(pwg_query('SELECT value FROM '.$prefixeTable.'config WHERE param=\'derivatives\''));
|
||||
$query = '
|
||||
SELECT param, value
|
||||
FROM '.$prefixeTable.'config
|
||||
WHERE param IN (\'derivatives\', \'disabled_derivatives\')
|
||||
;';
|
||||
|
||||
$result = pwg_query($query);
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$conf[ $row['param'] ] = $row['value'];
|
||||
}
|
||||
ImageStdParams::load_from_db();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user