* @param int $pageId: ID number of the page to read from
* @param string $summary Revision's summary
* @param bool $minor Whether the revision should be considered as minor
+ * @param User|null $user User object to use or null for $wgUser
* @return Revision|null Revision or null on error
*/
- public static function newNullRevision( $dbw, $pageId, $summary, $minor ) {
+ public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
global $wgContentHandlerUseDB;
wfProfileIn( __METHOD__ );
__METHOD__ );
if ( $current ) {
+ if ( !$user ) {
+ global $wgUser;
+ $user = $wgUser;
+ }
+
$row = array(
'page' => $pageId,
+ 'user_text' => $user->getName(),
+ 'user' => $user->getId(),
'comment' => $summary,
'minor_edit' => $minor,
'text_id' => $current->rev_text_id,
}
# Save a null revision in the page's history notifying of the move
- $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
+ $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $wgUser );
if ( !is_object( $nullRevision ) ) {
throw new MWException( 'No valid null revision produced in ' . __METHOD__ );
}
// 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 );
$dbw,
$descTitle->getArticleID(),
$editSummary,
- false
+ false,
+ $user
);
if ( !is_null( $nullRevision ) ) {
$nullRevision->insertOn( $dbw );
$comment = $detail; // quick
$dbw = wfGetDB( DB_MASTER );
$latest = $title->getLatestRevID();
- $nullRevision = Revision::newNullRevision( $dbw, $title->getArticleID(), $comment, true );
+ $nullRevision = Revision::newNullRevision( $dbw, $title->getArticleID(), $comment, true, $this->getUser() );
if ( !is_null( $nullRevision ) ) {
$nullRevision->insertOn( $dbw );
$page = WikiPage::factory( $title );