1 | <?php |
||
28 | class PurgeAction extends FormAction { |
||
29 | |||
30 | private $redirectParams; |
||
31 | |||
32 | public function getName() { |
||
35 | |||
36 | public function requiresUnblock() { |
||
39 | |||
40 | public function getDescription() { |
||
43 | |||
44 | public function onSubmit( $data ) { |
||
47 | |||
48 | public function show() { |
||
49 | $this->setHeaders(); |
||
50 | |||
51 | // This will throw exceptions if there's a problem |
||
52 | $this->checkCanExecute( $this->getUser() ); |
||
53 | |||
54 | $user = $this->getUser(); |
||
55 | |||
56 | if ( $user->pingLimiter( 'purge' ) ) { |
||
57 | // TODO: Display actionthrottledtext |
||
58 | return; |
||
59 | } |
||
60 | |||
61 | if ( $this->getRequest()->wasPosted() ) { |
||
62 | $this->redirectParams = wfArrayToCgi( array_diff_key( |
||
63 | $this->getRequest()->getQueryValues(), |
||
64 | [ 'title' => null, 'action' => null ] |
||
65 | ) ); |
||
66 | if ( $this->onSubmit( [] ) ) { |
||
67 | $this->onSuccess(); |
||
68 | } |
||
69 | } else { |
||
70 | $this->redirectParams = $this->getRequest()->getVal( 'redirectparams', '' ); |
||
71 | $form = $this->getForm(); |
||
72 | if ( $form->show() ) { |
||
73 | $this->onSuccess(); |
||
74 | } |
||
75 | } |
||
76 | } |
||
77 | |||
78 | protected function alterForm( HTMLForm $form ) { |
||
81 | |||
82 | protected function preText() { |
||
85 | |||
86 | protected function postText() { |
||
89 | |||
90 | public function onSuccess() { |
||
93 | |||
94 | public function doesWrites() { |
||
97 | } |
||
98 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: