Improper $smcFunc syntax
/Sources/ManageMaintenance.php Line 973
$request = $smcFunc['db_query']('', '
SELECT MAX(' . $primary_key . ')
FROM {db_prefix}' . $cur_table,
array(
)
);
Should this not be this?
$request = $smcFunc['db_query']('', '
SELECT MAX({raw:primary_key})
FROM {db_prefix}{string:cur_table}',
array(
'primary_key' => $primary_key,
'cur_table' => $cur_table
)
);
Nope, that's not going to work for you because the string type will escape it first. And you can't use the raw type for that because you can't guarantee what db_prefix will or will not be.
Ah, I see. I was just curious why the query wasn't following usual format.
primary_key could be the subject of a raw, but the table name can't - and if you're going to make an exception on one, might as well really go to town!
Just going through the code of the maintenance section while at work. Was working on cleaning up my old board which I just upgraded to 2.1, and noticed it was throwing a lot of errors. So I found a constructive way to waste time while getting paid.
Will work on it more when I get home and get my dev environment up and running.
Nice :) It's all appreciated, thank you!