aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/undelete.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/undelete.php')
-rw-r--r--maintenance/undelete.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/maintenance/undelete.php b/maintenance/undelete.php
index 784bed9f378a..57aef228541d 100644
--- a/maintenance/undelete.php
+++ b/maintenance/undelete.php
@@ -21,7 +21,6 @@
* @ingroup Maintenance
*/
-use MediaWiki\StubObject\StubGlobalUser;
use MediaWiki\Title\Title;
use MediaWiki\User\User;
@@ -53,11 +52,16 @@ class Undelete extends Maintenance {
if ( !$user ) {
$this->fatalError( "Invalid username" );
}
- StubGlobalUser::setUser( $user );
- $archive = new PageArchive( $title );
- $this->output( "Undeleting " . $title->getPrefixedDBkey() . '...' );
- $archive->undeleteAsUser( [], $user, $reason );
+ $page = $this->getServiceContainer()->getWikiPageFactory()->newFromTitle( $title );
+ $this->output( "Undeleting " . $title->getPrefixedDBkey() . "...\n" );
+
+ $status = $this->getServiceContainer()->getUndeletePageFactory()
+ ->newUndeletePage( $page, $user )
+ ->undeleteUnsafe( $reason );
+ if ( !$status->isGood() ) {
+ $this->fatalError( $status );
+ }
$this->output( "done\n" );
}
}