* Best if all done inside a transaction.
*
* @param DatabaseBase $dbw
- * @return int The newly created page_id key, or false if the title already existed
+ * @return int|bool The newly created page_id key; false if the title already existed
*/
public function insertOn( $dbw ) {
-
$page_id = $dbw->nextSequenceValue( 'page_page_id_seq' );
$dbw->insert( 'page', array(
'page_id' => $page_id,
$newid = $dbw->insertId();
$this->mId = $newid;
$this->mTitle->resetArticleID( $newid );
- }
- return $affected ? $newid : false;
+ return $newid;
+ } else {
+ return false;
+ }
}
/**
// Clone the title, so we have the information we need when we log
$logTitle = clone $this->mTitle;
- // Log the deletion, if the page was suppressed, log it at Oversight instead
+ // Log the deletion, if the page was suppressed, put it in the suppression log instead
$logtype = $suppress ? 'suppress' : 'delete';
$logEntry = new ManualLogEntry( $logtype, 'delete' );
$dbw->commit( __METHOD__ );
}
+ // Show log excerpt on 404 pages rather than just a link
+ $key = wfMemcKey( 'page-recent-delete', md5( $logTitle->getPrefixedText() ) );
+ ObjectCache::getMainStashInstance()->set( $key, 1, 86400 );
+
$this->doDeleteUpdates( $id, $content );
Hooks::run( 'ArticleDeleteComplete', array( &$this, &$user, $reason, $id, $content, $logEntry ) );
// Purge squid for this page only
$title->purgeSquid();
-
- $revid = $revision ? $revision->getId() : null;
// Clear file cache for this page only
HTMLFileCache::clearFileCache( $title );
+
+ $revid = $revision ? $revision->getId() : null;
DeferredUpdates::addCallableUpdate( function() use ( $title, $revid ) {
InfoAction::invalidateCache( $title, $revid );
} );