Fix import sql with -- into content

This commit is contained in:
Laurent Destailleur 2026-08-18 13:37:28 +02:00
parent e5afc4a0b4
commit 2e627e55cb

View file

@ -242,7 +242,8 @@ function run_sql($sqlfile, $silent = 1, $entity = 0, $usesavepoint = 1, $handler
// Add line buf to buffer if not a comment
if ($nocommentremoval || !preg_match('/^\s*--/', $buf)) {
if (empty($nocommentremoval)) {
$buf = preg_replace('/([,;ERLT05\)])\s+--.*$/i', '\1', $buf); //remove comment on lines that does not start with --, before adding it to the buffer
$buf = preg_replace('/([,;ERLT05\)])\s+--\s.*$/i', '\1', $buf); // remove comment on lines that does not start with --, like "... -- a comment"
$buf = preg_replace('/([,;ERLT05\)])\s+--$/i', '\1', $buf); // remove comment on lines that does not start with --, like "... --"
}
if ($buffer) {
$buffer .= ' ';