MediaWiki  master
Go to the documentation of this file.
1 <?php
30  public function __construct() {
31  parent::__construct( 'PermanentLink' );
32  $this->mAllowedRedirectParams = [];
33  }
39  public function getRedirect( $subpage ) {
40  $subpage = intval( $subpage );
41  if ( $subpage === 0 ) {
42  return false;
43  }
44  $this->mAddedRedirectParams['oldid'] = $subpage;
46  return true;
47  }
49  protected function showNoRedirectPage() {
50  $this->addHelpLink( 'Help:PermanentLink' );
51  $this->setHeaders();
52  $this->outputHeader();
53  $this->showForm();
54  }
56  private function showForm() {
57  $form = HTMLForm::factory( 'ooui', [
58  'revid' => [
59  'type' => 'int',
60  'name' => 'revid',
61  'label-message' => 'permanentlink-revid',
62  ],
63  ], $this->getContext(), 'permanentlink' );
64  $form->setSubmitTextMsg( 'permanentlink-submit' );
65  $form->setSubmitCallback( [ $this, 'onFormSubmit' ] );
66  $form->show();
67  }
69  public function onFormSubmit( $formData ) {
70  $revid = $formData['revid'];
71  $title = $this->getPageTitle( $revid ?: null );
72  $url = $title->getFullUrlForRedirect();
73  $this->getOutput()->redirect( $url );
74  }
76  public function isListed() {
77  return true;
78  }
80  protected function getGroupName() {
81  return 'redirects';
82  }
83 }
Gets the context this SpecialPage is executed in.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Get the OutputPage being used for this instance.
static factory( $displayFormat)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:299
Shortcut to construct a special page alias.
Sets headers - this should be called from the execute() method of all derived classes! ...
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:767
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
getPageTitle( $subpage=false)
Get a self-referential title object.