Bug: T229456
Change-Id: Ibce207904375a762943dff3352db7affd13c1aaa
* Insert or update the redirect table entry for this page to indicate it redirects to $rt
* @param Title $rt Redirect target
* @param int|null $oldLatest Prior page_latest for check and set
* Insert or update the redirect table entry for this page to indicate it redirects to $rt
* @param Title $rt Redirect target
* @param int|null $oldLatest Prior page_latest for check and set
*/
public function insertRedirectEntry( Title $rt, $oldLatest = null ) {
$dbw = wfGetDB( DB_MASTER );
*/
public function insertRedirectEntry( Title $rt, $oldLatest = null ) {
$dbw = wfGetDB( DB_MASTER );
+ $success = true;
+ } else {
+ $success = false;
}
$dbw->endAtomic( __METHOD__ );
}
$dbw->endAtomic( __METHOD__ );
- $this->insertRedirectEntry( $redirectTitle );
+ $success = $this->insertRedirectEntry( $redirectTitle );
} else {
// This is not a redirect, remove row from redirect table
$where = [ 'rd_from' => $this->getId() ];
$dbw->delete( 'redirect', $where, __METHOD__ );
} else {
// This is not a redirect, remove row from redirect table
$where = [ 'rd_from' => $this->getId() ];
$dbw->delete( 'redirect', $where, __METHOD__ );
}
if ( $this->getTitle()->getNamespace() == NS_FILE ) {
RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() );
}
}
if ( $this->getTitle()->getNamespace() == NS_FILE ) {
RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() );
}
- return ( $dbw->affectedRows() != 0 );
public function provideUpdateRedirectOn() {
yield [ '#REDIRECT [[Foo]]', true, null, true, true, 0 ];
public function provideUpdateRedirectOn() {
yield [ '#REDIRECT [[Foo]]', true, null, true, true, 0 ];
- yield [ '#REDIRECT [[Foo]]', true, 'Foo', true, false, 1 ];
+ yield [ '#REDIRECT [[Foo]]', true, 'Foo', true, true, 1 ];
yield [ 'SomeText', false, null, false, true, 0 ];
yield [ 'SomeText', false, null, false, true, 0 ];
- yield [ 'SomeText', false, 'Foo', false, false, 1 ];
+ yield [ 'SomeText', false, 'Foo', false, true, 1 ];