Topic: minor change in restore functions

Gents,
I propose changing the line 305 in /admin/db/maintenance_db.inc from:
$line = str_replace("0_", $connection["tbpref"], $line);
to
$line = preg_replace('/\d+_/', $connection['tbpref'], $line);

This way, any restore with any prefix will be converted to current table prefix.

Regards,
Serban

Re: minor change in restore functions

Blindly rewriting the input seems dangerous enough as it is. Your proposal means any sequence of digits followed by an underscore will be replaced, whereas it can currently only happen to the string "0_".

I suggest line 305 be removed. Or at the very least be changed to consider some context. To make it foolproof we would need a parser for SQL, but extending the matched strings to each of the "allowed commands" might be good enough. At least until someone starts storing SQL queries in the database...

I'm thinking something like
preg_replace("/CREATE TABLE \d+_/i", "CREATE TABLE ".$connection['tbpref'], $line);
preg_replace("/INSERT INTO \d+_/i", "INSERT INTO ".$connection['tbpref'], $line);
...

It might work, but it's not pretty.

Re: minor change in restore functions

you are right.