$title->invalidateCache();
if ( $wgUseSquid ) {
// Send purge now that page_touched update was committed above
- $update = SquidUpdate::newSimplePurge( $title );
+ $update = new SquidUpdate( $title->getSquidURLs() );
$update->doUpdate();
}
} );
$user = is_null( $user ) ? $wgUser : $user;
if ( !Hooks::run( 'ArticleDelete',
- array( &$this, &$user, &$reason, &$error, &$status )
+ array( &$this, &$user, &$reason, &$error, &$status, $suppress )
) ) {
if ( $status->isOK() ) {
// Hook aborted but didn't set a fatal status
}
if ( count( $added ) ) {
- $insertRows = array();
- foreach ( $added as $cat ) {
- $insertRows[] = array(
- 'cat_title' => $cat,
- 'cat_pages' => 1,
- 'cat_subcats' => ( $ns == NS_CATEGORY ) ? 1 : 0,
- 'cat_files' => ( $ns == NS_FILE ) ? 1 : 0,
- );
- }
- $dbw->upsert(
+ $existingAdded = $dbw->selectFieldValues(
'category',
- $insertRows,
- array( 'cat_title' ),
- $addFields,
- $method
+ 'cat_title',
+ array( 'cat_title' => $added ),
+ __METHOD__
);
+
+ // For category rows that already exist, do a plain
+ // UPDATE instead of INSERT...ON DUPLICATE KEY UPDATE
+ // to avoid creating gaps in the cat_id sequence.
+ if ( count( $existingAdded ) ) {
+ $dbw->update(
+ 'category',
+ $addFields,
+ array( 'cat_title' => $existingAdded ),
+ __METHOD__
+ );
+ }
+
+ $missingAdded = array_diff( $added, $existingAdded );
+ if ( count( $missingAdded ) ) {
+ $insertRows = array();
+ foreach ( $missingAdded as $cat ) {
+ $insertRows[] = array(
+ 'cat_title' => $cat,
+ 'cat_pages' => 1,
+ 'cat_subcats' => ( $ns == NS_CATEGORY ) ? 1 : 0,
+ 'cat_files' => ( $ns == NS_FILE ) ? 1 : 0,
+ );
+ }
+ $dbw->upsert(
+ 'category',
+ $insertRows,
+ array( 'cat_title' ),
+ $addFields,
+ $method
+ );
+ }
}
if ( count( $deleted ) ) {
if ( $this->getLinksTimestamp() < $this->getTouched() ) {
$params['isOpportunistic'] = true;
$params['rootJobTimestamp'] = $parserOutput->getCacheTime();
-
- JobQueueGroup::singleton()->lazyPush( EnqueueJob::newFromLocalJobs(
- new JobSpecification( 'refreshLinks', $params,
- array( 'removeDuplicates' => true ), $this->mTitle )
- ) );
+ JobQueueGroup::singleton()->lazyPush( new RefreshLinksJob( $this->mTitle, $params ) );
}
}
*
* @param Content|null $content Optional Content object for determining the
* necessary updates.
- * @return array An array of DataUpdates objects
+ * @return DataUpdate[]
*/
public function getDeletionUpdates( Content $content = null ) {
if ( !$content ) {