Skip to content

Commit 243faef

Browse files
authored
Merge pull request #2 from Wikia/PLATFORM_6983-fixes
PLATFORM-6983 | Fix PvXcode to work on MW 1.37
2 parents dced713 + 6104f56 commit 243faef

File tree

2 files changed

+24
-31
lines changed

2 files changed

+24
-31
lines changed

specials/SpecialPvXConvert.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,27 @@ class SpecialPvXConvert extends SpecialPage {
2222
*/
2323
public function __construct() {
2424
parent::__construct( 'PvXConvert' );
25-
26-
$this->wgRequest = $this->getRequest();
27-
$this->wgUser = $this->getUser();
28-
$this->output = $this->getOutput();
29-
30-
$this->DB = wfGetDB( DB_PRIMARY );
3125
}
3226

3327
/**
3428
* Main Execute for the Special Page
3529
*
3630
* @param $par - Not used, but expected to be there by mediawiki.
3731
* @return void - echos to page.
32+
* @throws MWException
3833
*/
3934
public function execute( $par = null ) {
40-
$name = $this->wgRequest->getText( 'wpName' );
41-
$build = $this->wgRequest->getText( 'wpBuild' );
35+
$request = $this->getRequest();
36+
$output = $this->getOutput();
37+
$name = $request->getText( 'wpName' );
38+
$build = $request->getText( 'wpBuild' );
4239

4340
if ( $build ) {
4441
$rout = $this->formatBuild( $build, $name );
45-
$this->output->addWikiText( "== Preview ==" );
46-
$this->output->addWikiText( $rout );
47-
$this->output->addHtml( "<br>" );
48-
$this->output->addWikiText( "== PvXcode ==" );
42+
$output->addWikiTextAsContent( "== Preview ==" );
43+
$output->addWikiTextAsContent( $rout );
44+
$output->addHtml( "<br>" );
45+
$output->addWikiTextAsContent( "== PvXcode ==" );
4946
$out = "<p><textarea cols='80' rows='10' wrap='virtual'>" . $rout . "</textarea></p>";
5047
} else {
5148
$out = '<p>
@@ -56,8 +53,8 @@ public function execute( $par = null ) {
5653
&nbsp;&nbsp;|&nbsp;Wilderness&nbsp;Survival&nbsp;|&nbsp;12&nbsp;+&nbsp;1&nbsp;+&nbsp;3<br>
5754
&nbsp;&nbsp;|&nbsp;Expertise&nbsp;|&nbsp;12&nbsp;+&nbsp;1<br>
5855
}}<br>
59-
{{skill bar|Echo|Dust Trap|Barbed Trap|Flame Trap|Trappers Speed|
60-
Troll Unguent|Whirling Defense|Resurrection Signet}}</code>
56+
{{skill bar|Echo|Dust Trap|Barbed Trap|Flame Trap|Trappers Speed|Troll
57+
Unguent|Whirling Defense|Resurrection Signet}}</code>
6158
<p>Enter old style GuildWiki &quot;Attributes and Skills&quot; template:</p>
6259
<form action="' . $_SERVER["PHP_SELF"] . '" method="get">
6360
<input name="title" type="hidden" value="Special:PvXconvert" />
@@ -69,7 +66,7 @@ public function execute( $par = null ) {
6966
}
7067
$this->setHeaders();
7168

72-
$this->output->addHtml( $out );
69+
$output->addHtml( $out );
7370
}
7471

7572
/**

specials/SpecialPvXDecode.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ class SpecialPvXDecode extends SpecialPage {
2121
* @return void
2222
*/
2323
public function __construct() {
24-
global $wgRequest, $wgUser;
25-
2624
parent::__construct( 'PvXDecode' );
27-
28-
$this->wgRequest = $wgRequest;
29-
$this->wgUser = $wgUser;
30-
$this->output = $this->getOutput();
31-
3225
$this->DB = wfGetDB( DB_PRIMARY );
3326

3427
require_once( GWBBCODE_ROOT . '/gwbbcode.inc.php' );
@@ -38,22 +31,25 @@ public function __construct() {
3831
* Main Execute for the Specil Page
3932
* @param $par - Not used, but expected to be there by mediawiki.
4033
* @return void - echos to page.
34+
* @throws MWException
4135
*/
4236
public function execute( $par = null ) {
43-
$name = $this->wgRequest->getText( 'wpName' );
44-
$build = $this->wgRequest->getText( 'wpBuild' );
37+
$request = $this->getRequest();
38+
$output = $this->getOutput();
39+
$name = $request->getText( 'wpName' );
40+
$build = $request->getText( 'wpBuild' );
4541

4642
if ( $build ) {
47-
if ( strlen( $name ) > 1 ) {
43+
if ( strlen( $name ) >= 1 ) {
4844
$rout = template_to_gwbbcode( $name . ";" . $build );
4945
} else {
5046
$rout = template_to_gwbbcode( $build );
5147
}
5248

53-
$this->output->addWikiText( "== Preview ==" );
54-
$this->output->addWikiText( "<pvxbig>" . $rout . "</pvxbig>" );
55-
$this->output->addHtml( "<br>" );
56-
$this->output->addWikiText( "== PvXcode ==" );
49+
$output->addWikiTextAsContent( "== Preview ==" );
50+
$output->addWikiTextAsContent( "<pvxbig>" . $rout . "</pvxbig>" );
51+
$output->addHtml( "<br>" );
52+
$output->addWikiTextAsContent( "== PvXcode ==" );
5753
$out =
5854
"<p><textarea cols='80' rows='10' wrap='virtual'>\n<pvxbig>\n" . $rout . "\n</pvxbig>\n</textarea></p>";
5955

@@ -76,15 +72,15 @@ public function execute( $par = null ) {
7672
}
7773
$this->setHeaders();
7874

79-
$this->output->addHtml( $out );
75+
$output->addHTML( $out );
8076
}
8177

8278
/**
8379
* Return the group name for this special page.
8480
*
8581
* @return string
8682
*/
87-
protected function getGroupName() {
83+
protected function getGroupName(): string {
8884
// Change to display in a different category on Special:SpecialPages.
8985
return 'pvx';
9086
}

0 commit comments

Comments
 (0)