*
* @deprecated since 1.25, use MovePage's methods instead
* @param Title $nt The new title
- * @param bool $auth Ignored
+ * @param bool $auth Whether to check user permissions (uses $wgUser)
* @param string $reason Is the log summary of the move, used for spam checking
* @return array|bool True on success, getUserPermissionsErrors()-like array on failure
*/
}
$mp = new MovePage( $this, $nt );
- $errors = wfMergeErrorArrays(
- $mp->isValidMove()->getErrorsArray(),
- $mp->checkPermissions( $wgUser, $reason )->getErrorsArray()
- );
+ $errors = $mp->isValidMove()->getErrorsArray();
+ if ( $auth ) {
+ $errors = wfMergeErrorArrays(
+ $errors,
+ $mp->checkPermissions( $wgUser, $reason )->getErrorsArray()
+ );
+ }
return $errors ? : true;
}
<?php
+/**
+ * @group Database
+ */
class MovePageTest extends MediaWikiTestCase {
/**
array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ),
);
}
+
+ /**
+ * Integration test to catch regressions like T74870. Taken and modified
+ * from SemanticMediaWiki
+ */
+ public function testTitleMoveCompleteIntegrationTest() {
+ $oldTitle = Title::newFromText( 'Help:Some title' );
+ WikiPage::factory( $oldTitle )->doEditContent( new WikitextContent( 'foo' ), 'bar' );
+ $newTitle = Title::newFromText( 'Help:Some other title' );
+ $this->assertNull(
+ WikiPage::factory( $newTitle )->getRevision()
+ );
+
+ $this->assertTrue( $oldTitle->moveTo( $newTitle, false, 'test1', true ) );
+ $this->assertNotNull(
+ WikiPage::factory( $oldTitle )->getRevision()
+ );
+ $this->assertNotNull(
+ WikiPage::factory( $newTitle)->getRevision()
+ );
+ }
}