'RevisionInsertComplete': called after a revision is inserted into the DB
$revision: the Revision
+$edit: was this a new edit?
'SavePreferences': called at the end of PreferencesForm::savePreferences;
returning false prevents the preferences from being saved.
) );
$dbw->begin();
- $revisionId = $revision->insertOn( $dbw );
+ $revisionId = $revision->insertOn( $dbw, true );
# Update page
$ok = $this->updateRevisionOn( $dbw, $revision, $lastRevision );
'minor_edit' => $isminor,
'text' => $text
) );
- $revisionId = $revision->insertOn( $dbw );
+ $revisionId = $revision->insertOn( $dbw, true );
$this->mTitle->resetArticleID( $newid );
* number on success and dies horribly on failure.
*
* @param Database $dbw
+ * @param bool $edit, was this a new edit? (optional)
* @return int
*/
- public function insertOn( &$dbw ) {
+ public function insertOn( &$dbw, $edit=false ) {
global $wgDefaultExternalStore;
wfProfileIn( __METHOD__ );
$this->mId = !is_null($rev_id) ? $rev_id : $dbw->insertId();
- wfRunHooks( 'RevisionInsertComplete', array( &$this ) );
+ wfRunHooks( 'RevisionInsertComplete', array( &$this, $edit ) );
wfProfileOut( __METHOD__ );
return $this->mId;
$dbw = wfGetDB( DB_MASTER );
$nullRevision = Revision::newNullRevision(
$dbw, $title->getArticleId(), $comment, true );
- $nullRevision->insertOn( $dbw );
+ $nullRevision->insertOn( $dbw, true );
# Update page record
$article = new Article( $title );
$article->updateRevisionOn( $dbw, $nullRevision );
'deleted' => $unsuppress ? 0 : $row->ar_deleted,
'len' => $row->ar_len
) );
- $revision->insertOn( $dbw );
+ $revision->insertOn( $dbw, false );
$restored++;
wfRunHooks( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) );
# Save a null revision in the page's history notifying of the move
$nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
- $nullRevId = $nullRevision->insertOn( $dbw );
+ $nullRevId = $nullRevision->insertOn( $dbw, true );
# Change the name of the target page:
$dbw->update( 'page',
'page' => $newid,
'comment' => $comment,
'text' => $redirectText ) );
- $redirectRevision->insertOn( $dbw );
+ $redirectRevision->insertOn( $dbw, true );
$redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
# Now, we record the link from the redirect to the new title.
# Save a null revision in the page's history notifying of the move
$nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
- $nullRevId = $nullRevision->insertOn( $dbw );
+ $nullRevId = $nullRevision->insertOn( $dbw, true );
# Rename page entry
$dbw->update( 'page',
'page' => $newid,
'comment' => $comment,
'text' => $redirectText ) );
- $redirectRevision->insertOn( $dbw );
+ $redirectRevision->insertOn( $dbw, true );
$redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
# Record the just-created redirect's linking to the page
if( $descTitle->exists() ) {
# Create a null revision
$nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleId(), $log->getRcComment(), false );
- $nullRevision->insertOn( $dbw );
+ $nullRevision->insertOn( $dbw, true );
$article->updateRevisionOn( $dbw, $nullRevision );
# Invalidate the cache for the description page
if( $descTitle->exists() ) {
# Create a null revision
$nullRevision = Revision::newNullRevision( $dbw, $descTitle->getArticleId(), $log->getRcComment(), false );
- $nullRevision->insertOn( $dbw );
+ $nullRevision->insertOn( $dbw, true );
$article->updateRevisionOn( $dbw, $nullRevision );
# Invalidate the cache for the description page