That construct has poor locking characteristics in terms of
auto-inc columns as well as not allowing such inserts concurrently
for statement-based replication. Also, the INSERT..SELECT did not
have an ORDER BY, which could lead to pr_id drift with statement
based replication.
Change-Id: I47ca89abcbe4598d3b56cf077a47055500a0647f
if ( $protected ) {
# Protect the redirect title as the title used to be...
if ( $protected ) {
# Protect the redirect title as the title used to be...
- $dbw->insertSelect( 'page_restrictions', 'page_restrictions',
- [
- 'pr_page' => $redirid,
- 'pr_type' => 'pr_type',
- 'pr_level' => 'pr_level',
- 'pr_cascade' => 'pr_cascade',
- 'pr_user' => 'pr_user',
- 'pr_expiry' => 'pr_expiry'
- ],
+ $res = $dbw->select(
+ 'page_restrictions',
+ '*',
[ 'pr_page' => $pageid ],
__METHOD__,
[ 'pr_page' => $pageid ],
__METHOD__,
+ $rowsInsert = [];
+ foreach ( $res as $row ) {
+ $rowsInsert[] = [
+ 'pr_page' => $redirid,
+ 'pr_type' => $row->pr_type,
+ 'pr_level' => $row->pr_level,
+ 'pr_cascade' => $row->pr_cascade,
+ 'pr_user' => $row->pr_user,
+ 'pr_expiry' => $row->pr_expiry
+ ];
+ }
+ $dbw->insert( 'page_restrictions', $rowsInsert, __METHOD__, [ 'IGNORE' ] );
// Build comment for log
$comment = wfMessage(
// Build comment for log
$comment = wfMessage(