In this code (include/functions.inc.php function pwg_log:
// If plugin developers add their own sections, Piwigo will automatically add it in the history.section enum column
if (isset($page['section']))
{
// set cache if not available
if (!isset($conf['history_sections_cache']))
{
conf_update_param('history_sections_cache', get_enums(HISTORY_TABLE, 'section'), true);
}
$conf['history_sections_cache'] = safe_unserialize($conf['history_sections_cache']);
if (in_array($page['section'], $conf['history_sections_cache']))
{
$section = $page['section'];
}
elseif (preg_match('/^[a-zA-Z0-9_-]+$/', $page['section']))
{
$history_sections = get_enums(HISTORY_TABLE, 'section');
$history_sections[] = $page['section'];
// alter history table structure, to include a new section
pwg_query('ALTER TABLE '.HISTORY_TABLE.' CHANGE section section enum(\''.implode("','", array_unique($history_sections)).'\') DEFAULT NULL;');
// and refresh cache
conf_update_param('history_sections_cache', get_enums(HISTORY_TABLE, 'section'), true);
$section = $page['section'];
}
}
We do as if the history.section is case sensitive. It's not. If you try to add section42 in the ENUM field while Section42 already exists, MySQL will throw an error.
In this code (`include/functions.inc.php` function `pwg_log`:
```
// If plugin developers add their own sections, Piwigo will automatically add it in the history.section enum column
if (isset($page['section']))
{
// set cache if not available
if (!isset($conf['history_sections_cache']))
{
conf_update_param('history_sections_cache', get_enums(HISTORY_TABLE, 'section'), true);
}
$conf['history_sections_cache'] = safe_unserialize($conf['history_sections_cache']);
if (in_array($page['section'], $conf['history_sections_cache']))
{
$section = $page['section'];
}
elseif (preg_match('/^[a-zA-Z0-9_-]+$/', $page['section']))
{
$history_sections = get_enums(HISTORY_TABLE, 'section');
$history_sections[] = $page['section'];
// alter history table structure, to include a new section
pwg_query('ALTER TABLE '.HISTORY_TABLE.' CHANGE section section enum(\''.implode("','", array_unique($history_sections)).'\') DEFAULT NULL;');
// and refresh cache
conf_update_param('history_sections_cache', get_enums(HISTORY_TABLE, 'section'), true);
$section = $page['section'];
}
}
```
We do as if the `history.section` is case sensitive. It's not. If you try to add `section42` in the ENUM field while `Section42` already exists, MySQL will throw an error.
<!-- github-sync-id:2087971812 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
In this code (
include/functions.inc.phpfunctionpwg_log:We do as if the
history.sectionis case sensitive. It's not. If you try to addsection42in the ENUM field whileSection42already exists, MySQL will throw an error.