if ( !$options['changed'] ) {
$good = 0;
- $total = 0;
} elseif ( $options['created'] ) {
$good = (int)$this->isCountable( $editInfo );
- $total = 1;
} elseif ( $options['oldcountable'] !== null ) {
$good = (int)$this->isCountable( $editInfo ) - (int)$options['oldcountable'];
- $total = 0;
} else {
$good = 0;
- $total = 0;
}
+ $edits = $options['changed'] ? 1 : 0;
+ $total = $options['created'] ? 1 : 0;
- DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, $good, $total ) );
+ DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, $edits, $good, $total ) );
DeferredUpdates::addUpdate( new SearchUpdate( $id, $title, $content ) );
// If this is another user's talk page, update newtalk.
if ( $options['created'] ) {
self::onArticleCreate( $this->mTitle );
- } else {
+ } elseif ( $options['changed'] ) { // bug 50785
self::onArticleEdit( $this->mTitle );
}
$revision = new Revision( array(
'title' => $this->getTitle(), // for determining the default content model
'page' => $this->getId(),
+ 'user_text' => $user->getName(),
+ 'user' => $user->getId(),
'text' => $serialized,
'length' => $content->getSize(),
'comment' => $comment,
// insert null revision to identify the page protection change as edit summary
$latest = $this->getLatest();
- $nullRevision = $this->insertProtectNullRevision( $revCommentMsg, $limit, $expiry, $cascade, $reason );
+ $nullRevision = $this->insertProtectNullRevision( $revCommentMsg, $limit, $expiry, $cascade, $reason, $user );
if ( $nullRevision === null ) {
return Status::newFatal( 'no-null-revision', $this->mTitle->getPrefixedText() );
}
* @param array $expiry Per restriction type expiration
* @param int $cascade Set to false if cascading protection isn't allowed.
* @param string $reason
+ * @param User|null $user
* @return Revision|null Null on error
*/
- public function insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason ) {
+ public function insertProtectNullRevision( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user = null ) {
global $wgContLang;
$dbw = wfGetDB( DB_MASTER );
)->inContentLanguage()->text();
}
- $nullRev = Revision::newNullRevision( $dbw, $this->getId(), $editComment, true );
+ $nullRev = Revision::newNullRevision( $dbw, $this->getId(), $editComment, true, $user );
if ( $nullRev ) {
$nullRev->insertOn( $dbw );