Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -35,11 +35,7 @@ |
36 | 36 | * @param $request WebRequest : data posted. |
37 | 37 | */ |
38 | 38 | public function __construct( $request = null ) { |
39 | | - global $wgRequest; |
40 | | - |
41 | 39 | parent::__construct( 'Upload', 'upload' ); |
42 | | - |
43 | | - $this->loadRequest( is_null( $request ) ? $wgRequest : $request ); |
44 | 40 | } |
45 | 41 | |
46 | 42 | /** Misc variables **/ |
— | — | @@ -83,13 +79,9 @@ |
84 | 80 | |
85 | 81 | /** |
86 | 82 | * Initialize instance variables from request and create an Upload handler |
87 | | - * |
88 | | - * @param $request WebRequest: the request to extract variables from |
89 | 83 | */ |
90 | | - protected function loadRequest( $request ) { |
91 | | - global $wgUser; |
92 | | - |
93 | | - $this->mRequest = $request; |
| 84 | + protected function loadRequest() { |
| 85 | + $this->mRequest = $request = $this->getRequest(); |
94 | 86 | $this->mSourceType = $request->getVal( 'wpSourceType', 'file' ); |
95 | 87 | $this->mUpload = UploadBase::createFromRequest( $request ); |
96 | 88 | $this->mUploadClicked = $request->wasPosted() |
— | — | @@ -108,7 +100,7 @@ |
109 | 101 | $this->mDestWarningAck = $request->getText( 'wpDestFileWarningAck' ); |
110 | 102 | $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' ) |
111 | 103 | || $request->getCheck( 'wpUploadIgnoreWarning' ); |
112 | | - $this->mWatchthis = $request->getBool( 'wpWatchthis' ) && $wgUser->isLoggedIn(); |
| 104 | + $this->mWatchthis = $request->getBool( 'wpWatchthis' ) && $this->getUser()->isLoggedIn(); |
113 | 105 | $this->mCopyrightStatus = $request->getText( 'wpUploadCopyStatus' ); |
114 | 106 | $this->mCopyrightSource = $request->getText( 'wpUploadSource' ); |
115 | 107 | |
— | — | @@ -125,7 +117,7 @@ |
126 | 118 | // with their submissions, as that's new in 1.16. |
127 | 119 | $this->mTokenOk = true; |
128 | 120 | } else { |
129 | | - $this->mTokenOk = $wgUser->matchEditToken( $token ); |
| 121 | + $this->mTokenOk = $this->getUser()->matchEditToken( $token ); |
130 | 122 | } |
131 | 123 | |
132 | 124 | $this->uploadFormTextTop = ''; |
— | — | @@ -148,43 +140,42 @@ |
149 | 141 | * Special page entry point |
150 | 142 | */ |
151 | 143 | public function execute( $par ) { |
152 | | - global $wgUser, $wgOut; |
| 144 | + global $wgGroupPermissions; |
153 | 145 | |
154 | 146 | $this->setHeaders(); |
155 | 147 | $this->outputHeader(); |
156 | 148 | |
157 | 149 | # Check uploading enabled |
158 | 150 | if( !UploadBase::isEnabled() ) { |
159 | | - $wgOut->showErrorPage( 'uploaddisabled', 'uploaddisabledtext' ); |
160 | | - return; |
| 151 | + throw new ErrorPageError( 'uploaddisabled', 'uploaddisabledtext' ); |
161 | 152 | } |
162 | 153 | |
163 | 154 | # Check permissions |
164 | | - global $wgGroupPermissions; |
165 | | - $permissionRequired = UploadBase::isAllowed( $wgUser ); |
| 155 | + $user = $this->getUser(); |
| 156 | + $permissionRequired = UploadBase::isAllowed( $user ); |
166 | 157 | if( $permissionRequired !== true ) { |
167 | | - if( !$wgUser->isLoggedIn() && ( $wgGroupPermissions['user']['upload'] |
| 158 | + if( !$user->isLoggedIn() && ( $wgGroupPermissions['user']['upload'] |
168 | 159 | || $wgGroupPermissions['autoconfirmed']['upload'] ) ) { |
169 | 160 | // Custom message if logged-in users without any special rights can upload |
170 | | - $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); |
| 161 | + throw new ErrorPageError( 'uploadnologin', 'uploadnologintext' ); |
171 | 162 | } else { |
172 | | - $wgOut->permissionRequired( $permissionRequired ); |
| 163 | + throw new PermissionsError( $permissionRequired ); |
173 | 164 | } |
174 | | - return; |
175 | 165 | } |
176 | 166 | |
177 | 167 | # Check blocks |
178 | | - if( $wgUser->isBlocked() ) { |
179 | | - $wgOut->blockedPage(); |
| 168 | + if( $user->isBlocked() ) { |
| 169 | + $this->getOutput()->blockedPage(); |
180 | 170 | return; |
181 | 171 | } |
182 | 172 | |
183 | 173 | # Check whether we actually want to allow changing stuff |
184 | 174 | if( wfReadOnly() ) { |
185 | | - $wgOut->readOnlyPage(); |
186 | | - return; |
| 175 | + throw new ReadOnlyError; |
187 | 176 | } |
188 | 177 | |
| 178 | + $this->loadRequest(); |
| 179 | + |
189 | 180 | # Unsave the temporary file in case this was a cancelled upload |
190 | 181 | if ( $this->mCancelUpload ) { |
191 | 182 | if ( !$this->unsaveUploadedFile() ) { |
— | — | @@ -231,8 +222,7 @@ |
232 | 223 | if ( $form instanceof HTMLForm ) { |
233 | 224 | $form->show(); |
234 | 225 | } else { |
235 | | - global $wgOut; |
236 | | - $wgOut->addHTML( $form ); |
| 226 | + $this->getOutput()->addHTML( $form ); |
237 | 227 | } |
238 | 228 | |
239 | 229 | } |
— | — | @@ -246,8 +236,6 @@ |
247 | 237 | * @return UploadForm |
248 | 238 | */ |
249 | 239 | protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) { |
250 | | - global $wgOut; |
251 | | - |
252 | 240 | # Initialize form |
253 | 241 | $form = new UploadForm( array( |
254 | 242 | 'watch' => $this->getWatchCheck(), |
— | — | @@ -260,7 +248,7 @@ |
261 | 249 | 'texttop' => $this->uploadFormTextTop, |
262 | 250 | 'textaftersummary' => $this->uploadFormTextAfterSummary, |
263 | 251 | 'destfile' => $this->mDesiredDestName, |
264 | | - ) ); |
| 252 | + ), $this->getContext() ); |
265 | 253 | $form->setTitle( $this->getTitle() ); |
266 | 254 | |
267 | 255 | # Check the token, but only if necessary |
— | — | @@ -298,7 +286,7 @@ |
299 | 287 | $uploadFooter = wfMessage( 'uploadfooter' ); |
300 | 288 | if ( !$uploadFooter->isDisabled() ) { |
301 | 289 | $form->addPostText( '<div id="mw-upload-footer-message">' |
302 | | - . $wgOut->parse( $uploadFooter->plain() ) . "</div>\n" ); |
| 290 | + . $this->getOutput()->parse( $uploadFooter->plain() ) . "</div>\n" ); |
303 | 291 | } |
304 | 292 | |
305 | 293 | return $form; |
— | — | @@ -309,23 +297,22 @@ |
310 | 298 | * Shows the "view X deleted revivions link"" |
311 | 299 | */ |
312 | 300 | protected function showViewDeletedLinks() { |
313 | | - global $wgOut, $wgUser; |
314 | | - |
315 | 301 | $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName ); |
| 302 | + $user = $this->getUser(); |
316 | 303 | // Show a subtitle link to deleted revisions (to sysops et al only) |
317 | | - if( $title instanceof Title && $wgUser->isAllowed( 'deletedhistory' ) && !$wgUser->isBlocked() ) { |
318 | | - $canViewSuppress = $wgUser->isAllowed( 'suppressrevision' ); |
| 304 | + if( $title instanceof Title && $user->isAllowed( 'deletedhistory' ) && !$user->isBlocked() ) { |
| 305 | + $canViewSuppress = $user->isAllowed( 'suppressrevision' ); |
319 | 306 | $count = $title->isDeleted( $canViewSuppress ); |
320 | 307 | if ( $count > 0 ) { |
321 | 308 | $link = wfMsgExt( |
322 | | - $wgUser->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted', |
| 309 | + $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted', |
323 | 310 | array( 'parse', 'replaceafter' ), |
324 | | - $this->getSkin()->linkKnown( |
| 311 | + Linker::linkKnown( |
325 | 312 | SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ), |
326 | 313 | wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $count ) |
327 | 314 | ) |
328 | 315 | ); |
329 | | - $wgOut->addHTML( "<div id=\"contentSub2\">{$link}</div>" ); |
| 316 | + $this->getOutput()->addHTML( "<div id=\"contentSub2\">{$link}</div>" ); |
330 | 317 | } |
331 | 318 | } |
332 | 319 | } |
— | — | @@ -423,12 +410,10 @@ |
424 | 411 | * Checks are made in SpecialUpload::execute() |
425 | 412 | */ |
426 | 413 | protected function processUpload() { |
427 | | - global $wgUser, $wgOut; |
428 | | - |
429 | 414 | // Fetch the file if required |
430 | 415 | $status = $this->mUpload->fetchFile(); |
431 | 416 | if( !$status->isOK() ) { |
432 | | - $this->showUploadError( $wgOut->parse( $status->getWikiText() ) ); |
| 417 | + $this->showUploadError( $this->getOutput()->parse( $status->getWikiText() ) ); |
433 | 418 | return; |
434 | 419 | } |
435 | 420 | |
— | — | @@ -450,7 +435,7 @@ |
451 | 436 | } |
452 | 437 | |
453 | 438 | // Verify permissions for this title |
454 | | - $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser ); |
| 439 | + $permErrors = $this->mUpload->verifyTitlePermissions( $this->getUser() ); |
455 | 440 | if( $permErrors !== true ) { |
456 | 441 | $code = array_shift( $permErrors[0] ); |
457 | 442 | $this->showRecoverableUploadError( wfMsgExt( $code, |
— | — | @@ -475,16 +460,16 @@ |
476 | 461 | } else { |
477 | 462 | $pageText = false; |
478 | 463 | } |
479 | | - $status = $this->mUpload->performUpload( $this->mComment, $pageText, $this->mWatchthis, $wgUser ); |
| 464 | + $status = $this->mUpload->performUpload( $this->mComment, $pageText, $this->mWatchthis, $this->getUser() ); |
480 | 465 | if ( !$status->isGood() ) { |
481 | | - $this->showUploadError( $wgOut->parse( $status->getWikiText() ) ); |
| 466 | + $this->showUploadError( $this->getOutput()->parse( $status->getWikiText() ) ); |
482 | 467 | return; |
483 | 468 | } |
484 | 469 | |
485 | 470 | // Success, redirect to description page |
486 | 471 | $this->mUploadSuccessful = true; |
487 | 472 | wfRunHooks( 'SpecialUploadComplete', array( &$this ) ); |
488 | | - $wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() ); |
| 473 | + $this->getOutput()->redirect( $this->mLocalFile->getTitle()->getFullURL() ); |
489 | 474 | } |
490 | 475 | |
491 | 476 | /** |
— | — | @@ -539,8 +524,7 @@ |
540 | 525 | * state can get out of sync. |
541 | 526 | */ |
542 | 527 | protected function getWatchCheck() { |
543 | | - global $wgUser; |
544 | | - if( $wgUser->getOption( 'watchdefault' ) ) { |
| 528 | + if( $this->getUser()->getOption( 'watchdefault' ) ) { |
545 | 529 | // Watch all edits! |
546 | 530 | return true; |
547 | 531 | } |
— | — | @@ -552,7 +536,7 @@ |
553 | 537 | return $local->getTitle()->userIsWatching(); |
554 | 538 | } else { |
555 | 539 | // New page should get watched if that's our option. |
556 | | - return $wgUser->getOption( 'watchcreations' ); |
| 540 | + return $this->getUser()->getOption( 'watchcreations' ); |
557 | 541 | } |
558 | 542 | } |
559 | 543 | |
— | — | @@ -563,7 +547,7 @@ |
564 | 548 | * @param $details Array: result of UploadBase::verifyUpload |
565 | 549 | */ |
566 | 550 | protected function processVerificationError( $details ) { |
567 | | - global $wgFileExtensions, $wgLang; |
| 551 | + global $wgFileExtensions; |
568 | 552 | |
569 | 553 | switch( $details['status'] ) { |
570 | 554 | |
— | — | @@ -594,11 +578,11 @@ |
595 | 579 | case UploadBase::FILETYPE_BADTYPE: |
596 | 580 | $msg = wfMessage( 'filetype-banned-type' ); |
597 | 581 | if ( isset( $details['blacklistedExt'] ) ) { |
598 | | - $msg->params( $wgLang->commaList( $details['blacklistedExt'] ) ); |
| 582 | + $msg->params( $this->getLang()->commaList( $details['blacklistedExt'] ) ); |
599 | 583 | } else { |
600 | 584 | $msg->params( $details['finalExt'] ); |
601 | 585 | } |
602 | | - $msg->params( $wgLang->commaList( $wgFileExtensions ), |
| 586 | + $msg->params( $this->getLang()->commaList( $wgFileExtensions ), |
603 | 587 | count( $wgFileExtensions ) ); |
604 | 588 | |
605 | 589 | // Add PLURAL support for the first parameter. This results |
— | — | @@ -639,13 +623,12 @@ |
640 | 624 | * @return Boolean: success |
641 | 625 | */ |
642 | 626 | protected function unsaveUploadedFile() { |
643 | | - global $wgOut; |
644 | 627 | if ( !( $this->mUpload instanceof UploadFromStash ) ) { |
645 | 628 | return true; |
646 | 629 | } |
647 | 630 | $success = $this->mUpload->unsaveUploadedFile(); |
648 | 631 | if ( !$success ) { |
649 | | - $wgOut->showFileDeleteError( $this->mUpload->getTempPath() ); |
| 632 | + $this->getOutput()->showFileDeleteError( $this->mUpload->getTempPath() ); |
650 | 633 | return false; |
651 | 634 | } else { |
652 | 635 | return true; |
— | — | @@ -662,8 +645,6 @@ |
663 | 646 | * @return String: empty string if there is no warning or an HTML fragment |
664 | 647 | */ |
665 | 648 | public static function getExistsWarning( $exists ) { |
666 | | - global $wgUser; |
667 | | - |
668 | 649 | if ( !$exists ) { |
669 | 650 | return ''; |
670 | 651 | } |
— | — | @@ -672,8 +653,6 @@ |
673 | 654 | $filename = $file->getTitle()->getPrefixedText(); |
674 | 655 | $warning = ''; |
675 | 656 | |
676 | | - $sk = $wgUser->getSkin(); |
677 | | - |
678 | 657 | if( $exists['warning'] == 'exists' ) { |
679 | 658 | // Exact match |
680 | 659 | $warning = wfMsgExt( 'fileexists', 'parseinline', $filename ); |
— | — | @@ -697,7 +676,7 @@ |
698 | 677 | } elseif ( $exists['warning'] == 'was-deleted' ) { |
699 | 678 | # If the file existed before and was deleted, warn the user of this |
700 | 679 | $ltitle = SpecialPage::getTitleFor( 'Log' ); |
701 | | - $llink = $sk->linkKnown( |
| 680 | + $llink = Linker::linkKnown( |
702 | 681 | $ltitle, |
703 | 682 | wfMsgHtml( 'deletionlog' ), |
704 | 683 | array(), |
— | — | @@ -741,7 +720,6 @@ |
742 | 721 | */ |
743 | 722 | public static function getDupeWarning( $dupes ) { |
744 | 723 | if( $dupes ) { |
745 | | - global $wgOut; |
746 | 724 | $msg = '<gallery>'; |
747 | 725 | foreach( $dupes as $file ) { |
748 | 726 | $title = $file->getTitle(); |
— | — | @@ -751,7 +729,7 @@ |
752 | 730 | $msg .= '</gallery>'; |
753 | 731 | return '<li>' . |
754 | 732 | wfMsgExt( 'file-exists-duplicate', array( 'parse' ), count( $dupes ) ) . |
755 | | - $wgOut->parse( $msg ) . |
| 733 | + $this->getOutput()->parse( $msg ) . |
756 | 734 | "</li>\n"; |
757 | 735 | } else { |
758 | 736 | return ''; |
— | — | @@ -779,7 +757,7 @@ |
780 | 758 | |
781 | 759 | protected $mMaxFileSize = array(); |
782 | 760 | |
783 | | - public function __construct( $options = array() ) { |
| 761 | + public function __construct( array $options = array(), RequestContext $context = null ) { |
784 | 762 | $this->mWatch = !empty( $options['watch'] ); |
785 | 763 | $this->mForReUpload = !empty( $options['forreupload'] ); |
786 | 764 | $this->mSessionKey = isset( $options['sessionkey'] ) |
— | — | @@ -803,7 +781,7 @@ |
804 | 782 | + $this->getOptionsSection(); |
805 | 783 | |
806 | 784 | wfRunHooks( 'UploadFormInitDescriptor', array( &$descriptor ) ); |
807 | | - parent::__construct( $descriptor, 'upload' ); |
| 785 | + parent::__construct( $descriptor, $context, 'upload' ); |
808 | 786 | |
809 | 787 | # Set some form properties |
810 | 788 | $this->setSubmitText( wfMsg( 'uploadbtn' ) ); |
— | — | @@ -829,8 +807,6 @@ |
830 | 808 | * @return Array: descriptor array |
831 | 809 | */ |
832 | 810 | protected function getSourceSection() { |
833 | | - global $wgLang, $wgUser, $wgRequest; |
834 | | - |
835 | 811 | if ( $this->mSessionKey ) { |
836 | 812 | return array( |
837 | 813 | 'SessionKey' => array( |
— | — | @@ -844,9 +820,9 @@ |
845 | 821 | ); |
846 | 822 | } |
847 | 823 | |
848 | | - $canUploadByUrl = UploadFromUrl::isEnabled() && $wgUser->isAllowed( 'upload_by_url' ); |
| 824 | + $canUploadByUrl = UploadFromUrl::isEnabled() && $this->getUser()->isAllowed( 'upload_by_url' ); |
849 | 825 | $radio = $canUploadByUrl; |
850 | | - $selectedSourceType = strtolower( $wgRequest->getText( 'wpSourceType', 'File' ) ); |
| 826 | + $selectedSourceType = strtolower( $this->getRequest()->getText( 'wpSourceType', 'File' ) ); |
851 | 827 | |
852 | 828 | $descriptor = array(); |
853 | 829 | if ( $this->mTextTop ) { |
— | — | @@ -876,7 +852,7 @@ |
877 | 853 | 'radio' => &$radio, |
878 | 854 | 'help' => wfMsgExt( 'upload-maxfilesize', |
879 | 855 | array( 'parseinline', 'escapenoentities' ), |
880 | | - $wgLang->formatSize( $this->mMaxUploadSize['file'] ) |
| 856 | + $this->getContext()->getLang()->formatSize( $this->mMaxUploadSize['file'] ) |
881 | 857 | ) . ' ' . wfMsgHtml( 'upload_source_file' ), |
882 | 858 | 'checked' => $selectedSourceType == 'file', |
883 | 859 | ); |
— | — | @@ -891,7 +867,7 @@ |
892 | 868 | 'radio' => &$radio, |
893 | 869 | 'help' => wfMsgExt( 'upload-maxfilesize', |
894 | 870 | array( 'parseinline', 'escapenoentities' ), |
895 | | - $wgLang->formatSize( $this->mMaxUploadSize['url'] ) |
| 871 | + $this->getContext()->getLang()->formatSize( $this->mMaxUploadSize['url'] ) |
896 | 872 | ) . ' ' . wfMsgHtml( 'upload_source_url' ), |
897 | 873 | 'checked' => $selectedSourceType == 'url', |
898 | 874 | ); |
— | — | @@ -915,7 +891,7 @@ |
916 | 892 | protected function getExtensionsMessage() { |
917 | 893 | # Print a list of allowed file extensions, if so configured. We ignore |
918 | 894 | # MIME type here, it's incomprehensible to most people and too long. |
919 | | - global $wgLang, $wgCheckFileExtensions, $wgStrictFileExtensions, |
| 895 | + global $wgCheckFileExtensions, $wgStrictFileExtensions, |
920 | 896 | $wgFileExtensions, $wgFileBlacklist; |
921 | 897 | |
922 | 898 | if( $wgCheckFileExtensions ) { |
— | — | @@ -923,16 +899,16 @@ |
924 | 900 | # Everything not permitted is banned |
925 | 901 | $extensionsList = |
926 | 902 | '<div id="mw-upload-permitted">' . |
927 | | - wfMsgExt( 'upload-permitted', 'parse', $wgLang->commaList( $wgFileExtensions ) ) . |
| 903 | + wfMsgExt( 'upload-permitted', 'parse', $this->getContext()->getLang()->commaList( $wgFileExtensions ) ) . |
928 | 904 | "</div>\n"; |
929 | 905 | } else { |
930 | 906 | # We have to list both preferred and prohibited |
931 | 907 | $extensionsList = |
932 | 908 | '<div id="mw-upload-preferred">' . |
933 | | - wfMsgExt( 'upload-preferred', 'parse', $wgLang->commaList( $wgFileExtensions ) ) . |
| 909 | + wfMsgExt( 'upload-preferred', 'parse', $this->getContext()->getLang()->commaList( $wgFileExtensions ) ) . |
934 | 910 | "</div>\n" . |
935 | 911 | '<div id="mw-upload-prohibited">' . |
936 | | - wfMsgExt( 'upload-prohibited', 'parse', $wgLang->commaList( $wgFileBlacklist ) ) . |
| 912 | + wfMsgExt( 'upload-prohibited', 'parse', $this->getContext()->getLang()->commaList( $wgFileBlacklist ) ) . |
937 | 913 | "</div>\n"; |
938 | 914 | } |
939 | 915 | } else { |
— | — | @@ -949,8 +925,6 @@ |
950 | 926 | * @return Array: descriptor array |
951 | 927 | */ |
952 | 928 | protected function getDescriptionSection() { |
953 | | - global $wgUser; |
954 | | - |
955 | 929 | if ( $this->mSessionKey ) { |
956 | 930 | $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash(); |
957 | 931 | try { |
— | — | @@ -990,7 +964,7 @@ |
991 | 965 | ? 'filereuploadsummary' |
992 | 966 | : 'fileuploadsummary', |
993 | 967 | 'default' => $this->mComment, |
994 | | - 'cols' => intval( $wgUser->getOption( 'cols' ) ), |
| 968 | + 'cols' => intval( $this->getUser()->getOption( 'cols' ) ), |
995 | 969 | 'rows' => 8, |
996 | 970 | ) |
997 | 971 | ); |
— | — | @@ -1049,16 +1023,15 @@ |
1050 | 1024 | * @return Array: descriptor array |
1051 | 1025 | */ |
1052 | 1026 | protected function getOptionsSection() { |
1053 | | - global $wgUser; |
1054 | | - |
1055 | | - if ( $wgUser->isLoggedIn() ) { |
| 1027 | + $user = $this->getUser(); |
| 1028 | + if ( $user->isLoggedIn() ) { |
1056 | 1029 | $descriptor = array( |
1057 | 1030 | 'Watchthis' => array( |
1058 | 1031 | 'type' => 'check', |
1059 | 1032 | 'id' => 'wpWatchthis', |
1060 | 1033 | 'label-message' => 'watchthisupload', |
1061 | 1034 | 'section' => 'options', |
1062 | | - 'default' => $wgUser->getOption( 'watchcreations' ), |
| 1035 | + 'default' => $user->getOption( 'watchcreations' ), |
1063 | 1036 | ) |
1064 | 1037 | ); |
1065 | 1038 | } |
— | — | @@ -1097,11 +1070,10 @@ |
1098 | 1071 | } |
1099 | 1072 | |
1100 | 1073 | /** |
1101 | | - * Add upload JS to $wgOut |
| 1074 | + * Add upload JS to the OutputPage |
1102 | 1075 | */ |
1103 | 1076 | protected function addUploadJS() { |
1104 | 1077 | global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions; |
1105 | | - global $wgOut; |
1106 | 1078 | |
1107 | 1079 | $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck; |
1108 | 1080 | $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview && $wgEnableAPI; |
— | — | @@ -1120,10 +1092,11 @@ |
1121 | 1093 | 'wgMaxUploadSize' => $this->mMaxUploadSize, |
1122 | 1094 | ); |
1123 | 1095 | |
1124 | | - $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
| 1096 | + $out = $this->getOutput(); |
| 1097 | + $out->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
1125 | 1098 | |
1126 | 1099 | |
1127 | | - $wgOut->addModules( array( |
| 1100 | + $out->addModules( array( |
1128 | 1101 | 'mediawiki.action.edit', // For <charinsert> support |
1129 | 1102 | 'mediawiki.legacy.upload', // Old form stuff... |
1130 | 1103 | 'mediawiki.special.upload', // Newer extras for thumbnail preview. |