Index: trunk/phase3/includes/specials/SpecialUndelete.php |
— | — | @@ -574,47 +574,42 @@ |
575 | 575 | */ |
576 | 576 | class SpecialUndelete extends SpecialPage { |
577 | 577 | var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mFilename; |
578 | | - var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken, $mRequest; |
| 578 | + var $mTargetTimestamp, $mAllowed, $mCanView, $mComment, $mToken; |
579 | 579 | |
580 | 580 | /** |
581 | 581 | * @var Title |
582 | 582 | */ |
583 | 583 | var $mTargetObj; |
584 | 584 | |
585 | | - function __construct( $request = null ) { |
| 585 | + function __construct() { |
586 | 586 | parent::__construct( 'Undelete', 'deletedhistory' ); |
587 | | - |
588 | | - if ( $request === null ) { |
589 | | - global $wgRequest; |
590 | | - $this->mRequest = $wgRequest; |
591 | | - } else { |
592 | | - $this->mRequest = $request; |
593 | | - } |
594 | 587 | } |
595 | 588 | |
596 | 589 | function loadRequest() { |
597 | | - global $wgUser; |
598 | | - $this->mAction = $this->mRequest->getVal( 'action' ); |
599 | | - $this->mTarget = $this->mRequest->getVal( 'target' ); |
600 | | - $this->mSearchPrefix = $this->mRequest->getText( 'prefix' ); |
601 | | - $time = $this->mRequest->getVal( 'timestamp' ); |
| 590 | + $request = $this->getRequest(); |
| 591 | + $user = $this->getUser(); |
| 592 | + |
| 593 | + $this->mAction = $request->getVal( 'action' ); |
| 594 | + $this->mTarget = $request->getVal( 'target' ); |
| 595 | + $this->mSearchPrefix = $request->getText( 'prefix' ); |
| 596 | + $time = $request->getVal( 'timestamp' ); |
602 | 597 | $this->mTimestamp = $time ? wfTimestamp( TS_MW, $time ) : ''; |
603 | | - $this->mFilename = $this->mRequest->getVal( 'file' ); |
| 598 | + $this->mFilename = $request->getVal( 'file' ); |
604 | 599 | |
605 | | - $posted = $this->mRequest->wasPosted() && |
606 | | - $wgUser->matchEditToken( $this->mRequest->getVal( 'wpEditToken' ) ); |
607 | | - $this->mRestore = $this->mRequest->getCheck( 'restore' ) && $posted; |
608 | | - $this->mInvert = $this->mRequest->getCheck( 'invert' ) && $posted; |
609 | | - $this->mPreview = $this->mRequest->getCheck( 'preview' ) && $posted; |
610 | | - $this->mDiff = $this->mRequest->getCheck( 'diff' ); |
611 | | - $this->mComment = $this->mRequest->getText( 'wpComment' ); |
612 | | - $this->mUnsuppress = $this->mRequest->getVal( 'wpUnsuppress' ) && $wgUser->isAllowed( 'suppressrevision' ); |
613 | | - $this->mToken = $this->mRequest->getVal( 'token' ); |
| 600 | + $posted = $request->wasPosted() && |
| 601 | + $user->matchEditToken( $request->getVal( 'wpEditToken' ) ); |
| 602 | + $this->mRestore = $request->getCheck( 'restore' ) && $posted; |
| 603 | + $this->mInvert = $request->getCheck( 'invert' ) && $posted; |
| 604 | + $this->mPreview = $request->getCheck( 'preview' ) && $posted; |
| 605 | + $this->mDiff = $request->getCheck( 'diff' ); |
| 606 | + $this->mComment = $request->getText( 'wpComment' ); |
| 607 | + $this->mUnsuppress = $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' ); |
| 608 | + $this->mToken = $request->getVal( 'token' ); |
614 | 609 | |
615 | | - if ( $wgUser->isAllowed( 'undelete' ) && !$wgUser->isBlocked() ) { |
| 610 | + if ( $user->isAllowed( 'undelete' ) && !$user->isBlocked() ) { |
616 | 611 | $this->mAllowed = true; // user can restore |
617 | 612 | $this->mCanView = true; // user can view content |
618 | | - } elseif ( $wgUser->isAllowed( 'deletedtext' ) ) { |
| 613 | + } elseif ( $user->isAllowed( 'deletedtext' ) ) { |
619 | 614 | $this->mAllowed = false; // user cannot restore |
620 | 615 | $this->mCanView = true; // user can view content |
621 | 616 | } else { // user can only view the list of revisions |
— | — | @@ -627,7 +622,7 @@ |
628 | 623 | if( $this->mRestore || $this->mInvert ) { |
629 | 624 | $timestamps = array(); |
630 | 625 | $this->mFileVersions = array(); |
631 | | - foreach( $this->mRequest->getValues() as $key => $val ) { |
| 626 | + foreach( $request->getValues() as $key => $val ) { |
632 | 627 | $matches = array(); |
633 | 628 | if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) { |
634 | 629 | array_push( $timestamps, $matches[1] ); |
— | — | @@ -643,10 +638,8 @@ |
644 | 639 | } |
645 | 640 | |
646 | 641 | function execute( $par ) { |
647 | | - global $wgOut, $wgUser; |
648 | | - |
649 | 642 | $this->setHeaders(); |
650 | | - if ( !$this->userCanExecute( $wgUser ) ) { |
| 643 | + if ( !$this->userCanExecute( $this->getUser() ) ) { |
651 | 644 | $this->displayRestrictionError(); |
652 | 645 | return; |
653 | 646 | } |
— | — | @@ -654,10 +647,12 @@ |
655 | 648 | |
656 | 649 | $this->loadRequest(); |
657 | 650 | |
| 651 | + $out = $this->getOutput(); |
| 652 | + |
658 | 653 | if ( $this->mAllowed ) { |
659 | | - $wgOut->setPageTitle( wfMsg( 'undeletepage' ) ); |
| 654 | + $out->setPageTitle( wfMsg( 'undeletepage' ) ); |
660 | 655 | } else { |
661 | | - $wgOut->setPageTitle( wfMsg( 'viewdeletedpage' ) ); |
| 656 | + $out->setPageTitle( wfMsg( 'viewdeletedpage' ) ); |
662 | 657 | } |
663 | 658 | |
664 | 659 | if( $par != '' ) { |
— | — | @@ -672,7 +667,7 @@ |
673 | 668 | |
674 | 669 | if( is_null( $this->mTargetObj ) ) { |
675 | 670 | # Not all users can just browse every deleted page from the list |
676 | | - if( $wgUser->isAllowed( 'browsearchive' ) ) { |
| 671 | + if( $this->getUser()->isAllowed( 'browsearchive' ) ) { |
677 | 672 | $this->showSearchForm(); |
678 | 673 | |
679 | 674 | # List undeletable articles |
— | — | @@ -681,7 +676,7 @@ |
682 | 677 | $this->showList( $result ); |
683 | 678 | } |
684 | 679 | } else { |
685 | | - $wgOut->addWikiMsg( 'undelete-header' ); |
| 680 | + $out->addWikiMsg( 'undelete-header' ); |
686 | 681 | } |
687 | 682 | return; |
688 | 683 | } |
— | — | @@ -692,16 +687,16 @@ |
693 | 688 | $file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename ); |
694 | 689 | // Check if user is allowed to see this file |
695 | 690 | if ( !$file->exists() ) { |
696 | | - $wgOut->addWikiMsg( 'filedelete-nofile', $this->mFilename ); |
| 691 | + $out->addWikiMsg( 'filedelete-nofile', $this->mFilename ); |
697 | 692 | return; |
698 | 693 | } elseif( !$file->userCan( File::DELETED_FILE ) ) { |
699 | 694 | if( $file->isDeleted( File::DELETED_RESTRICTED ) ) { |
700 | | - $wgOut->permissionRequired( 'suppressrevision' ); |
| 695 | + $out->permissionRequired( 'suppressrevision' ); |
701 | 696 | } else { |
702 | | - $wgOut->permissionRequired( 'deletedtext' ); |
| 697 | + $out->permissionRequired( 'deletedtext' ); |
703 | 698 | } |
704 | 699 | return false; |
705 | | - } elseif ( !$wgUser->matchEditToken( $this->mToken, $this->mFilename ) ) { |
| 700 | + } elseif ( !$this->getUser()->matchEditToken( $this->mToken, $this->mFilename ) ) { |
706 | 701 | $this->showFileConfirmationForm( $this->mFilename ); |
707 | 702 | return false; |
708 | 703 | } else { |
— | — | @@ -711,7 +706,7 @@ |
712 | 707 | if( $this->mRestore && $this->mAction == 'submit' ) { |
713 | 708 | global $wgUploadMaintenance; |
714 | 709 | if( $wgUploadMaintenance && $this->mTargetObj && $this->mTargetObj->getNamespace() == NS_FILE ) { |
715 | | - $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n", array( 'filedelete-maintenance' ) ); |
| 710 | + $out->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n", array( 'filedelete-maintenance' ) ); |
716 | 711 | return; |
717 | 712 | } |
718 | 713 | return $this->undelete(); |
— | — | @@ -723,10 +718,11 @@ |
724 | 719 | } |
725 | 720 | |
726 | 721 | function showSearchForm() { |
727 | | - global $wgOut, $wgScript; |
728 | | - $wgOut->addWikiMsg( 'undelete-header' ); |
| 722 | + global $wgScript; |
729 | 723 | |
730 | | - $wgOut->addHTML( |
| 724 | + $this->getOutput()->addWikiMsg( 'undelete-header' ); |
| 725 | + |
| 726 | + $this->getOutput()->addHTML( |
731 | 727 | Xml::openElement( 'form', array( |
732 | 728 | 'method' => 'get', |
733 | 729 | 'action' => $wgScript ) ) . |
— | — | @@ -749,21 +745,20 @@ |
750 | 746 | * @return bool |
751 | 747 | */ |
752 | 748 | private function showList( $result ) { |
753 | | - global $wgLang, $wgOut; |
| 749 | + $out = $this->getOutput(); |
754 | 750 | |
755 | 751 | if( $result->numRows() == 0 ) { |
756 | | - $wgOut->addWikiMsg( 'undelete-no-results' ); |
| 752 | + $out->addWikiMsg( 'undelete-no-results' ); |
757 | 753 | return; |
758 | 754 | } |
759 | 755 | |
760 | | - $wgOut->addWikiMsg( 'undeletepagetext', $wgLang->formatNum( $result->numRows() ) ); |
| 756 | + $out->addWikiMsg( 'undeletepagetext', $this->getLang()->formatNum( $result->numRows() ) ); |
761 | 757 | |
762 | | - $sk = $this->getSkin(); |
763 | 758 | $undelete = $this->getTitle(); |
764 | | - $wgOut->addHTML( "<ul>\n" ); |
| 759 | + $out->addHTML( "<ul>\n" ); |
765 | 760 | foreach ( $result as $row ) { |
766 | 761 | $title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title ); |
767 | | - $link = $sk->linkKnown( |
| 762 | + $link = Linker::linkKnown( |
768 | 763 | $undelete, |
769 | 764 | htmlspecialchars( $title->getPrefixedText() ), |
770 | 765 | array(), |
— | — | @@ -771,20 +766,18 @@ |
772 | 767 | ); |
773 | 768 | $revs = wfMsgExt( 'undeleterevisions', |
774 | 769 | array( 'parseinline' ), |
775 | | - $wgLang->formatNum( $row->count ) ); |
776 | | - $wgOut->addHTML( "<li>{$link} ({$revs})</li>\n" ); |
| 770 | + $this->getLang()->formatNum( $row->count ) ); |
| 771 | + $out->addHTML( "<li>{$link} ({$revs})</li>\n" ); |
777 | 772 | } |
778 | 773 | $result->free(); |
779 | | - $wgOut->addHTML( "</ul>\n" ); |
| 774 | + $out->addHTML( "</ul>\n" ); |
780 | 775 | |
781 | 776 | return true; |
782 | 777 | } |
783 | 778 | |
784 | 779 | private function showRevision( $timestamp ) { |
785 | | - global $wgLang, $wgUser, $wgOut; |
| 780 | + $out = $this->getOutput(); |
786 | 781 | |
787 | | - $skin = $this->getSkin(); |
788 | | - |
789 | 782 | if( !preg_match( '/[0-9]{14}/', $timestamp ) ) { |
790 | 783 | return 0; |
791 | 784 | } |
— | — | @@ -794,81 +787,81 @@ |
795 | 788 | $rev = $archive->getRevision( $timestamp ); |
796 | 789 | |
797 | 790 | if( !$rev ) { |
798 | | - $wgOut->addWikiMsg( 'undeleterevision-missing' ); |
| 791 | + $out->addWikiMsg( 'undeleterevision-missing' ); |
799 | 792 | return; |
800 | 793 | } |
801 | 794 | |
802 | 795 | if( $rev->isDeleted( Revision::DELETED_TEXT ) ) { |
803 | 796 | if( !$rev->userCan( Revision::DELETED_TEXT ) ) { |
804 | | - $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' ); |
| 797 | + $out->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' ); |
805 | 798 | return; |
806 | 799 | } else { |
807 | | - $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' ); |
808 | | - $wgOut->addHTML( '<br />' ); |
| 800 | + $out->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' ); |
| 801 | + $out->addHTML( '<br />' ); |
809 | 802 | // and we are allowed to see... |
810 | 803 | } |
811 | 804 | } |
812 | 805 | |
813 | | - $wgOut->setPageTitle( wfMsg( 'undeletepage' ) ); |
| 806 | + $out->setPageTitle( wfMsg( 'undeletepage' ) ); |
814 | 807 | |
815 | | - $link = $skin->linkKnown( |
816 | | - $this->getTitle( $this->mTargetObj->getPrefixedDBkey() ), |
817 | | - htmlspecialchars( $this->mTargetObj->getPrefixedText() ) |
818 | | - ); |
819 | | - |
820 | 808 | if( $this->mDiff ) { |
821 | 809 | $previousRev = $archive->getPreviousRevision( $timestamp ); |
822 | 810 | if( $previousRev ) { |
823 | 811 | $this->showDiff( $previousRev, $rev ); |
824 | | - if( $wgUser->getOption( 'diffonly' ) ) { |
| 812 | + if( $this->getUser()->getOption( 'diffonly' ) ) { |
825 | 813 | return; |
826 | 814 | } else { |
827 | | - $wgOut->addHTML( '<hr />' ); |
| 815 | + $out->addHTML( '<hr />' ); |
828 | 816 | } |
829 | 817 | } else { |
830 | | - $wgOut->addWikiMsg( 'undelete-nodiff' ); |
| 818 | + $out->addWikiMsg( 'undelete-nodiff' ); |
831 | 819 | } |
832 | 820 | } |
833 | 821 | |
| 822 | + $link = Linker::linkKnown( |
| 823 | + $this->getTitle( $this->mTargetObj->getPrefixedDBkey() ), |
| 824 | + htmlspecialchars( $this->mTargetObj->getPrefixedText() ) |
| 825 | + ); |
| 826 | + |
834 | 827 | // date and time are separate parameters to facilitate localisation. |
835 | 828 | // $time is kept for backward compat reasons. |
836 | | - $time = htmlspecialchars( $wgLang->timeAndDate( $timestamp, true ) ); |
837 | | - $d = htmlspecialchars( $wgLang->date( $timestamp, true ) ); |
838 | | - $t = htmlspecialchars( $wgLang->time( $timestamp, true ) ); |
839 | | - $user = $skin->revUserTools( $rev ); |
| 829 | + $time = $this->getLang()->timeAndDate( $timestamp, true ); |
| 830 | + $d = $this->getLang()->date( $timestamp, true ); |
| 831 | + $t = $this->getLang()->time( $timestamp, true ); |
| 832 | + $user = Linker::revUserTools( $rev ); |
840 | 833 | |
841 | 834 | if( $this->mPreview ) { |
842 | 835 | $openDiv = '<div id="mw-undelete-revision" class="mw-warning">'; |
843 | 836 | } else { |
844 | 837 | $openDiv = '<div id="mw-undelete-revision">'; |
845 | 838 | } |
846 | | - $wgOut->addHTML( $openDiv ); |
| 839 | + $out->addHTML( $openDiv ); |
847 | 840 | |
848 | 841 | // Revision delete links |
849 | 842 | if ( !$this->mDiff ) { |
850 | 843 | $revdel = $this->revDeleteLink( $rev ); |
851 | 844 | if ( $revdel ) { |
852 | | - $wgOut->addHTML( $revdel ); |
| 845 | + $out->addHTML( $revdel ); |
853 | 846 | } |
854 | 847 | } |
855 | 848 | |
856 | | - $wgOut->addWikiMsgArray( 'undelete-revision', array( $link, $time, $user, $d, $t ), array( 'replaceafter' ) ); |
857 | | - $wgOut->addHTML( '</div>' ); |
| 849 | + $out->addHTML( wfMessage( 'undelete-revision' )->rawParams( $link )->params( |
| 850 | + $time )->rawParams( $user )->params( $d, $t )->parse() . '</div>' ); |
858 | 851 | wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj, $rev ) ); |
859 | 852 | |
860 | 853 | if( $this->mPreview ) { |
861 | 854 | // Hide [edit]s |
862 | | - $popts = $wgOut->parserOptions(); |
| 855 | + $popts = $out->parserOptions(); |
863 | 856 | $popts->setEditSection( false ); |
864 | | - $wgOut->parserOptions( $popts ); |
865 | | - $wgOut->addWikiTextTitleTidy( $rev->getText( Revision::FOR_THIS_USER ), $this->mTargetObj, true ); |
| 857 | + $out->parserOptions( $popts ); |
| 858 | + $out->addWikiTextTitleTidy( $rev->getText( Revision::FOR_THIS_USER ), $this->mTargetObj, true ); |
866 | 859 | } |
867 | 860 | |
868 | | - $wgOut->addHTML( |
| 861 | + $out->addHTML( |
869 | 862 | Xml::element( 'textarea', array( |
870 | 863 | 'readonly' => 'readonly', |
871 | | - 'cols' => intval( $wgUser->getOption( 'cols' ) ), |
872 | | - 'rows' => intval( $wgUser->getOption( 'rows' ) ) ), |
| 864 | + 'cols' => intval( $this->getUser()->getOption( 'cols' ) ), |
| 865 | + 'rows' => intval( $this->getUser()->getOption( 'rows' ) ) ), |
873 | 866 | $rev->getText( Revision::FOR_THIS_USER ) . "\n" ) . |
874 | 867 | Xml::openElement( 'div' ) . |
875 | 868 | Xml::openElement( 'form', array( |
— | — | @@ -885,7 +878,7 @@ |
886 | 879 | Xml::element( 'input', array( |
887 | 880 | 'type' => 'hidden', |
888 | 881 | 'name' => 'wpEditToken', |
889 | | - 'value' => $wgUser->editToken() ) ) . |
| 882 | + 'value' => $this->getUser()->editToken() ) ) . |
890 | 883 | Xml::element( 'input', array( |
891 | 884 | 'type' => 'submit', |
892 | 885 | 'name' => 'preview', |
— | — | @@ -910,12 +903,10 @@ |
911 | 904 | * @return string HTML fragment |
912 | 905 | */ |
913 | 906 | function revDeleteLink( $rev ) { |
914 | | - global $wgUser; |
915 | | - $canHide = $wgUser->isAllowed( 'deleterevision' ); |
916 | | - if( $canHide || ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) { |
917 | | - $skin = $this->getSkin(); |
| 907 | + $canHide = $this->getUser()->isAllowed( 'deleterevision' ); |
| 908 | + if( $canHide || ( $rev->getVisibility() && $this->getUser()->isAllowed( 'deletedhistory' ) ) ) { |
918 | 909 | if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
919 | | - $revdlink = $skin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
| 910 | + $revdlink = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
920 | 911 | } else { |
921 | 912 | if ( $rev->getId() ) { |
922 | 913 | // RevDelete links using revision ID are stable across |
— | — | @@ -934,7 +925,7 @@ |
935 | 926 | 'ids' => $rev->getTimestamp() |
936 | 927 | ); |
937 | 928 | } |
938 | | - return $skin->revDeleteLink( $query, |
| 929 | + return Linker::revDeleteLink( $query, |
939 | 930 | $rev->isDeleted( File::DELETED_RESTRICTED ), $canHide ); |
940 | 931 | } |
941 | 932 | } else { |
— | — | @@ -951,11 +942,9 @@ |
952 | 943 | * @return String: HTML |
953 | 944 | */ |
954 | 945 | function showDiff( $previousRev, $currentRev ) { |
955 | | - global $wgOut; |
956 | | - |
957 | 946 | $diffEngine = new DifferenceEngine( $previousRev->getTitle() ); |
958 | 947 | $diffEngine->showDiffStyle(); |
959 | | - $wgOut->addHTML( |
| 948 | + $this->getOutput()->addHTML( |
960 | 949 | "<div>" . |
961 | 950 | "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" . |
962 | 951 | "<col class='diff-marker' />" . |
— | — | @@ -983,8 +972,6 @@ |
984 | 973 | * @return string |
985 | 974 | */ |
986 | 975 | private function diffHeader( $rev, $prefix ) { |
987 | | - global $wgUser, $wgLang; |
988 | | - $sk = $this->getSkin(); |
989 | 976 | $isDeleted = !( $rev->getId() && $rev->getTitle() ); |
990 | 977 | if( $isDeleted ) { |
991 | 978 | /// @todo FIXME: $rev->getTitle() is null for deleted revs...? |
— | — | @@ -1002,23 +989,24 @@ |
1003 | 990 | $del = $this->revDeleteLink( $rev ); |
1004 | 991 | return |
1005 | 992 | '<div id="mw-diff-' . $prefix . 'title1"><strong>' . |
1006 | | - $sk->link( |
| 993 | + Linker::link( |
1007 | 994 | $targetPage, |
1008 | | - wfMsgHtml( |
| 995 | + wfMsgExt( |
1009 | 996 | 'revisionasof', |
1010 | | - htmlspecialchars( $wgLang->timeanddate( $rev->getTimestamp(), true ) ), |
1011 | | - htmlspecialchars( $wgLang->date( $rev->getTimestamp(), true ) ), |
1012 | | - htmlspecialchars( $wgLang->time( $rev->getTimestamp(), true ) ) |
| 997 | + array( 'escape' ), |
| 998 | + $this->getLang()->timeanddate( $rev->getTimestamp(), true ), |
| 999 | + $this->getLang()->date( $rev->getTimestamp(), true ), |
| 1000 | + $this->getLang()->time( $rev->getTimestamp(), true ) |
1013 | 1001 | ), |
1014 | 1002 | array(), |
1015 | 1003 | $targetQuery |
1016 | 1004 | ) . |
1017 | 1005 | '</strong></div>' . |
1018 | 1006 | '<div id="mw-diff-'.$prefix.'title2">' . |
1019 | | - $sk->revUserTools( $rev ) . '<br />' . |
| 1007 | + Linker::revUserTools( $rev ) . '<br />' . |
1020 | 1008 | '</div>' . |
1021 | 1009 | '<div id="mw-diff-'.$prefix.'title3">' . |
1022 | | - $sk->revComment( $rev ) . $del . '<br />' . |
| 1010 | + Linker::revComment( $rev ) . $del . '<br />' . |
1023 | 1011 | '</div>'; |
1024 | 1012 | } |
1025 | 1013 | |
— | — | @@ -1026,19 +1014,18 @@ |
1027 | 1015 | * Show a form confirming whether a tokenless user really wants to see a file |
1028 | 1016 | */ |
1029 | 1017 | private function showFileConfirmationForm( $key ) { |
1030 | | - global $wgOut, $wgUser, $wgLang; |
1031 | 1018 | $file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename ); |
1032 | | - $wgOut->addWikiMsg( 'undelete-show-file-confirm', |
| 1019 | + $this->getOutput()->addWikiMsg( 'undelete-show-file-confirm', |
1033 | 1020 | $this->mTargetObj->getText(), |
1034 | | - $wgLang->date( $file->getTimestamp() ), |
1035 | | - $wgLang->time( $file->getTimestamp() ) ); |
1036 | | - $wgOut->addHTML( |
| 1021 | + $this->getLang()->date( $file->getTimestamp() ), |
| 1022 | + $this->getLang()->time( $file->getTimestamp() ) ); |
| 1023 | + $this->getOutput()->addHTML( |
1037 | 1024 | Xml::openElement( 'form', array( |
1038 | 1025 | 'method' => 'POST', |
1039 | 1026 | 'action' => $this->getTitle()->getLocalURL( |
1040 | 1027 | 'target=' . urlencode( $this->mTarget ) . |
1041 | 1028 | '&file=' . urlencode( $key ) . |
1042 | | - '&token=' . urlencode( $wgUser->editToken( $key ) ) ) |
| 1029 | + '&token=' . urlencode( $this->getUser()->editToken( $key ) ) ) |
1043 | 1030 | ) |
1044 | 1031 | ) . |
1045 | 1032 | Xml::submitButton( wfMsg( 'undelete-show-file-submit' ) ) . |
— | — | @@ -1050,16 +1037,16 @@ |
1051 | 1038 | * Show a deleted file version requested by the visitor. |
1052 | 1039 | */ |
1053 | 1040 | private function showFile( $key ) { |
1054 | | - global $wgOut, $wgRequest; |
1055 | | - $wgOut->disable(); |
| 1041 | + $this->getOutput()->disable(); |
1056 | 1042 | |
1057 | 1043 | # We mustn't allow the output to be Squid cached, otherwise |
1058 | 1044 | # if an admin previews a deleted image, and it's cached, then |
1059 | 1045 | # a user without appropriate permissions can toddle off and |
1060 | 1046 | # nab the image, and Squid will serve it |
1061 | | - $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); |
1062 | | - $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); |
1063 | | - $wgRequest->response()->header( 'Pragma: no-cache' ); |
| 1047 | + $response = $this->getRequest()->response(); |
| 1048 | + $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); |
| 1049 | + $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' ); |
| 1050 | + $response->header( 'Pragma: no-cache' ); |
1064 | 1051 | |
1065 | 1052 | global $IP; |
1066 | 1053 | require_once( "$IP/includes/StreamFile.php" ); |
— | — | @@ -1069,16 +1056,14 @@ |
1070 | 1057 | } |
1071 | 1058 | |
1072 | 1059 | private function showHistory() { |
1073 | | - global $wgUser, $wgOut; |
1074 | | - |
1075 | | - $sk = $wgUser->getSkin(); |
| 1060 | + $out = $this->getOutput(); |
1076 | 1061 | if( $this->mAllowed ) { |
1077 | | - $wgOut->addModules( 'mediawiki.special.undelete' ); |
1078 | | - $wgOut->setPageTitle( wfMsg( 'undeletepage' ) ); |
| 1062 | + $out->addModules( 'mediawiki.special.undelete' ); |
| 1063 | + $out->setPageTitle( wfMsg( 'undeletepage' ) ); |
1079 | 1064 | } else { |
1080 | | - $wgOut->setPageTitle( wfMsg( 'viewdeletedpage' ) ); |
| 1065 | + $out->setPageTitle( wfMsg( 'viewdeletedpage' ) ); |
1081 | 1066 | } |
1082 | | - $wgOut->wrapWikiMsg( |
| 1067 | + $out->wrapWikiMsg( |
1083 | 1068 | "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n", |
1084 | 1069 | array( 'undeletepagetitle', $this->mTargetObj->getPrefixedText() ) |
1085 | 1070 | ); |
— | — | @@ -1088,18 +1073,18 @@ |
1089 | 1074 | /* |
1090 | 1075 | $text = $archive->getLastRevisionText(); |
1091 | 1076 | if( is_null( $text ) ) { |
1092 | | - $wgOut->addWikiMsg( 'nohistory' ); |
| 1077 | + $out->addWikiMsg( 'nohistory' ); |
1093 | 1078 | return; |
1094 | 1079 | } |
1095 | 1080 | */ |
1096 | | - $wgOut->addHTML( '<div class="mw-undelete-history">' ); |
| 1081 | + $out->addHTML( '<div class="mw-undelete-history">' ); |
1097 | 1082 | if ( $this->mAllowed ) { |
1098 | | - $wgOut->addWikiMsg( 'undeletehistory' ); |
1099 | | - $wgOut->addWikiMsg( 'undeleterevdel' ); |
| 1083 | + $out->addWikiMsg( 'undeletehistory' ); |
| 1084 | + $out->addWikiMsg( 'undeleterevdel' ); |
1100 | 1085 | } else { |
1101 | | - $wgOut->addWikiMsg( 'undeletehistorynoadmin' ); |
| 1086 | + $out->addWikiMsg( 'undeletehistorynoadmin' ); |
1102 | 1087 | } |
1103 | | - $wgOut->addHTML( '</div>' ); |
| 1088 | + $out->addHTML( '</div>' ); |
1104 | 1089 | |
1105 | 1090 | # List all stored revisions |
1106 | 1091 | $revisions = $archive->listRevisions(); |
— | — | @@ -1132,22 +1117,22 @@ |
1133 | 1118 | $action = $this->getTitle()->getLocalURL( array( 'action' => 'submit' ) ); |
1134 | 1119 | # Start the form here |
1135 | 1120 | $top = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) ); |
1136 | | - $wgOut->addHTML( $top ); |
| 1121 | + $out->addHTML( $top ); |
1137 | 1122 | } |
1138 | 1123 | |
1139 | 1124 | # Show relevant lines from the deletion log: |
1140 | | - $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) . "\n" ); |
1141 | | - LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTargetObj->getPrefixedText() ); |
| 1125 | + $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) . "\n" ); |
| 1126 | + LogEventsList::showLogExtract( $out, 'delete', $this->mTargetObj->getPrefixedText() ); |
1142 | 1127 | # Show relevant lines from the suppression log: |
1143 | | - if( $wgUser->isAllowed( 'suppressionlog' ) ) { |
1144 | | - $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'suppress' ) ) . "\n" ); |
1145 | | - LogEventsList::showLogExtract( $wgOut, 'suppress', $this->mTargetObj->getPrefixedText() ); |
| 1128 | + if( $this->getUser()->isAllowed( 'suppressionlog' ) ) { |
| 1129 | + $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'suppress' ) ) . "\n" ); |
| 1130 | + LogEventsList::showLogExtract( $out, 'suppress', $this->mTargetObj->getPrefixedText() ); |
1146 | 1131 | } |
1147 | 1132 | |
1148 | 1133 | if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) { |
1149 | 1134 | # Format the user-visible controls (comment field, submission button) |
1150 | 1135 | # in a nice little table |
1151 | | - if( $wgUser->isAllowed( 'suppressrevision' ) ) { |
| 1136 | + if( $this->getUser()->isAllowed( 'suppressrevision' ) ) { |
1152 | 1137 | $unsuppressBox = |
1153 | 1138 | "<tr> |
1154 | 1139 | <td> </td> |
— | — | @@ -1186,51 +1171,49 @@ |
1187 | 1172 | Xml::closeElement( 'table' ) . |
1188 | 1173 | Xml::closeElement( 'fieldset' ); |
1189 | 1174 | |
1190 | | - $wgOut->addHTML( $table ); |
| 1175 | + $out->addHTML( $table ); |
1191 | 1176 | } |
1192 | 1177 | |
1193 | | - $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'history' ) ) . "\n" ); |
| 1178 | + $out->addHTML( Xml::element( 'h2', null, wfMsg( 'history' ) ) . "\n" ); |
1194 | 1179 | |
1195 | 1180 | if( $haveRevisions ) { |
1196 | 1181 | # The page's stored (deleted) history: |
1197 | | - $wgOut->addHTML( '<ul>' ); |
| 1182 | + $out->addHTML( '<ul>' ); |
1198 | 1183 | $remaining = $revisions->numRows(); |
1199 | 1184 | $earliestLiveTime = $this->mTargetObj->getEarliestRevTime(); |
1200 | 1185 | |
1201 | 1186 | foreach ( $revisions as $row ) { |
1202 | 1187 | $remaining--; |
1203 | | - $wgOut->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining, $sk ) ); |
| 1188 | + $out->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining ) ); |
1204 | 1189 | } |
1205 | 1190 | $revisions->free(); |
1206 | | - $wgOut->addHTML( '</ul>' ); |
| 1191 | + $out->addHTML( '</ul>' ); |
1207 | 1192 | } else { |
1208 | | - $wgOut->addWikiMsg( 'nohistory' ); |
| 1193 | + $out->addWikiMsg( 'nohistory' ); |
1209 | 1194 | } |
1210 | 1195 | |
1211 | 1196 | if( $haveFiles ) { |
1212 | | - $wgOut->addHTML( Xml::element( 'h2', null, wfMsg( 'filehist' ) ) . "\n" ); |
1213 | | - $wgOut->addHTML( '<ul>' ); |
| 1197 | + $out->addHTML( Xml::element( 'h2', null, wfMsg( 'filehist' ) ) . "\n" ); |
| 1198 | + $out->addHTML( '<ul>' ); |
1214 | 1199 | foreach ( $files as $row ) { |
1215 | | - $wgOut->addHTML( $this->formatFileRow( $row, $sk ) ); |
| 1200 | + $out->addHTML( $this->formatFileRow( $row ) ); |
1216 | 1201 | } |
1217 | 1202 | $files->free(); |
1218 | | - $wgOut->addHTML( '</ul>' ); |
| 1203 | + $out->addHTML( '</ul>' ); |
1219 | 1204 | } |
1220 | 1205 | |
1221 | 1206 | if ( $this->mAllowed ) { |
1222 | 1207 | # Slip in the hidden controls here |
1223 | 1208 | $misc = Html::hidden( 'target', $this->mTarget ); |
1224 | | - $misc .= Html::hidden( 'wpEditToken', $wgUser->editToken() ); |
| 1209 | + $misc .= Html::hidden( 'wpEditToken', $this->getUser()->editToken() ); |
1225 | 1210 | $misc .= Xml::closeElement( 'form' ); |
1226 | | - $wgOut->addHTML( $misc ); |
| 1211 | + $out->addHTML( $misc ); |
1227 | 1212 | } |
1228 | 1213 | |
1229 | 1214 | return true; |
1230 | 1215 | } |
1231 | 1216 | |
1232 | | - private function formatRevisionRow( $row, $earliestLiveTime, $remaining, $sk ) { |
1233 | | - global $wgLang; |
1234 | | - |
| 1217 | + private function formatRevisionRow( $row, $earliestLiveTime, $remaining ) { |
1235 | 1218 | $rev = Revision::newFromArchiveRow( $row, |
1236 | 1219 | array( 'page' => $this->mTargetObj->getArticleId() ) ); |
1237 | 1220 | $stxt = ''; |
— | — | @@ -1254,11 +1237,11 @@ |
1255 | 1238 | $titleObj = $this->getTitle(); |
1256 | 1239 | # Last link |
1257 | 1240 | if( !$rev->userCan( Revision::DELETED_TEXT ) ) { |
1258 | | - $pageLink = htmlspecialchars( $wgLang->timeanddate( $ts, true ) ); |
| 1241 | + $pageLink = htmlspecialchars( $this->getLang()->timeanddate( $ts, true ) ); |
1259 | 1242 | $last = wfMsgHtml( 'diff' ); |
1260 | 1243 | } elseif( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) { |
1261 | | - $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk ); |
1262 | | - $last = $sk->linkKnown( |
| 1244 | + $pageLink = $this->getPageLink( $rev, $titleObj, $ts ); |
| 1245 | + $last = Linker::linkKnown( |
1263 | 1246 | $titleObj, |
1264 | 1247 | wfMsgHtml( 'diff' ), |
1265 | 1248 | array(), |
— | — | @@ -1269,63 +1252,61 @@ |
1270 | 1253 | ) |
1271 | 1254 | ); |
1272 | 1255 | } else { |
1273 | | - $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk ); |
| 1256 | + $pageLink = $this->getPageLink( $rev, $titleObj, $ts ); |
1274 | 1257 | $last = wfMsgHtml( 'diff' ); |
1275 | 1258 | } |
1276 | 1259 | } else { |
1277 | | - $pageLink = htmlspecialchars( $wgLang->timeanddate( $ts, true ) ); |
| 1260 | + $pageLink = htmlspecialchars( $this->getLang()->timeanddate( $ts, true ) ); |
1278 | 1261 | $last = wfMsgHtml( 'diff' ); |
1279 | 1262 | } |
1280 | 1263 | // User links |
1281 | | - $userLink = $sk->revUserTools( $rev ); |
| 1264 | + $userLink = Linker::revUserTools( $rev ); |
1282 | 1265 | // Revision text size |
1283 | 1266 | $size = $row->ar_len; |
1284 | 1267 | if( !is_null( $size ) ) { |
1285 | | - $stxt = $sk->formatRevisionSize( $size ); |
| 1268 | + $stxt = Linker::formatRevisionSize( $size ); |
1286 | 1269 | } |
1287 | 1270 | // Edit summary |
1288 | | - $comment = $sk->revComment( $rev ); |
| 1271 | + $comment = Linker::revComment( $rev ); |
1289 | 1272 | // Revision delete links |
1290 | 1273 | $revdlink = $this->revDeleteLink( $rev ); |
1291 | 1274 | return "<li>$checkBox $revdlink ($last) $pageLink . . $userLink $stxt $comment</li>"; |
1292 | 1275 | } |
1293 | 1276 | |
1294 | | - private function formatFileRow( $row, $sk ) { |
1295 | | - global $wgUser, $wgLang; |
1296 | | - |
| 1277 | + private function formatFileRow( $row ) { |
1297 | 1278 | $file = ArchivedFile::newFromRow( $row ); |
1298 | 1279 | |
1299 | 1280 | $ts = wfTimestamp( TS_MW, $row->fa_timestamp ); |
1300 | 1281 | if( $this->mAllowed && $row->fa_storage_key ) { |
1301 | 1282 | $checkBox = Xml::check( 'fileid' . $row->fa_id ); |
1302 | 1283 | $key = urlencode( $row->fa_storage_key ); |
1303 | | - $pageLink = $this->getFileLink( $file, $this->getTitle(), $ts, $key, $sk ); |
| 1284 | + $pageLink = $this->getFileLink( $file, $this->getTitle(), $ts, $key ); |
1304 | 1285 | } else { |
1305 | 1286 | $checkBox = ''; |
1306 | | - $pageLink = $wgLang->timeanddate( $ts, true ); |
| 1287 | + $pageLink = $this->getLang()->timeanddate( $ts, true ); |
1307 | 1288 | } |
1308 | | - $userLink = $this->getFileUser( $file, $sk ); |
| 1289 | + $userLink = $this->getFileUser( $file ); |
1309 | 1290 | $data = |
1310 | 1291 | wfMsg( 'widthheight', |
1311 | | - $wgLang->formatNum( $row->fa_width ), |
1312 | | - $wgLang->formatNum( $row->fa_height ) ) . |
| 1292 | + $this->getLang()->formatNum( $row->fa_width ), |
| 1293 | + $this->getLang()->formatNum( $row->fa_height ) ) . |
1313 | 1294 | ' (' . |
1314 | | - wfMsg( 'nbytes', $wgLang->formatNum( $row->fa_size ) ) . |
| 1295 | + wfMsg( 'nbytes', $this->getLang()->formatNum( $row->fa_size ) ) . |
1315 | 1296 | ')'; |
1316 | 1297 | $data = htmlspecialchars( $data ); |
1317 | | - $comment = $this->getFileComment( $file, $sk ); |
| 1298 | + $comment = $this->getFileComment( $file ); |
1318 | 1299 | // Add show/hide deletion links if available |
1319 | | - $canHide = $wgUser->isAllowed( 'deleterevision' ); |
1320 | | - if( $canHide || ( $file->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) { |
| 1300 | + $canHide = $this->getUser()->isAllowed( 'deleterevision' ); |
| 1301 | + if( $canHide || ( $file->getVisibility() && $this->getUser()->isAllowed( 'deletedhistory' ) ) ) { |
1321 | 1302 | if( !$file->userCan( File::DELETED_RESTRICTED ) ) { |
1322 | | - $revdlink = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
| 1303 | + $revdlink = Linker::revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops |
1323 | 1304 | } else { |
1324 | 1305 | $query = array( |
1325 | 1306 | 'type' => 'filearchive', |
1326 | 1307 | 'target' => $this->mTargetObj->getPrefixedDBkey(), |
1327 | 1308 | 'ids' => $row->fa_id |
1328 | 1309 | ); |
1329 | | - $revdlink = $sk->revDeleteLink( $query, |
| 1310 | + $revdlink = Linker::revDeleteLink( $query, |
1330 | 1311 | $file->isDeleted( File::DELETED_RESTRICTED ), $canHide ); |
1331 | 1312 | } |
1332 | 1313 | } else { |
— | — | @@ -1338,18 +1319,15 @@ |
1339 | 1320 | * Fetch revision text link if it's available to all users |
1340 | 1321 | * |
1341 | 1322 | * @param $rev Revision |
1342 | | - * @param $sk Skin |
1343 | 1323 | * @return string |
1344 | 1324 | */ |
1345 | | - function getPageLink( $rev, $titleObj, $ts, $sk ) { |
1346 | | - global $wgLang; |
| 1325 | + function getPageLink( $rev, $titleObj, $ts ) { |
| 1326 | + $time = htmlspecialchars( $this->getLang()->timeanddate( $ts, true ) ); |
1347 | 1327 | |
1348 | | - $time = htmlspecialchars( $wgLang->timeanddate( $ts, true ) ); |
1349 | | - |
1350 | 1328 | if( !$rev->userCan( Revision::DELETED_TEXT ) ) { |
1351 | 1329 | return '<span class="history-deleted">' . $time . '</span>'; |
1352 | 1330 | } else { |
1353 | | - $link = $sk->linkKnown( |
| 1331 | + $link = Linker::linkKnown( |
1354 | 1332 | $titleObj, |
1355 | 1333 | $time, |
1356 | 1334 | array(), |
— | — | @@ -1369,23 +1347,20 @@ |
1370 | 1348 | * Fetch image view link if it's available to all users |
1371 | 1349 | * |
1372 | 1350 | * @param $file File |
1373 | | - * @param $sk Skin |
1374 | 1351 | * @return String: HTML fragment |
1375 | 1352 | */ |
1376 | | - function getFileLink( $file, $titleObj, $ts, $key, $sk ) { |
1377 | | - global $wgLang, $wgUser; |
1378 | | - |
| 1353 | + function getFileLink( $file, $titleObj, $ts, $key ) { |
1379 | 1354 | if( !$file->userCan( File::DELETED_FILE ) ) { |
1380 | | - return '<span class="history-deleted">' . $wgLang->timeanddate( $ts, true ) . '</span>'; |
| 1355 | + return '<span class="history-deleted">' . $this->getLang()->timeanddate( $ts, true ) . '</span>'; |
1381 | 1356 | } else { |
1382 | | - $link = $sk->linkKnown( |
| 1357 | + $link = Linker::linkKnown( |
1383 | 1358 | $titleObj, |
1384 | | - $wgLang->timeanddate( $ts, true ), |
| 1359 | + $this->getLang()->timeanddate( $ts, true ), |
1385 | 1360 | array(), |
1386 | 1361 | array( |
1387 | 1362 | 'target' => $this->mTargetObj->getPrefixedText(), |
1388 | 1363 | 'file' => $key, |
1389 | | - 'token' => $wgUser->editToken( $key ) |
| 1364 | + 'token' => $this->getUser()->editToken( $key ) |
1390 | 1365 | ) |
1391 | 1366 | ); |
1392 | 1367 | if( $file->isDeleted( File::DELETED_FILE ) ) { |
— | — | @@ -1399,15 +1374,14 @@ |
1400 | 1375 | * Fetch file's user id if it's available to this user |
1401 | 1376 | * |
1402 | 1377 | * @param $file File |
1403 | | - * @param $sk Skin |
1404 | 1378 | * @return String: HTML fragment |
1405 | 1379 | */ |
1406 | | - function getFileUser( $file, $sk ) { |
| 1380 | + function getFileUser( $file ) { |
1407 | 1381 | if( !$file->userCan( File::DELETED_USER ) ) { |
1408 | 1382 | return '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>'; |
1409 | 1383 | } else { |
1410 | | - $link = $sk->userLink( $file->getRawUser(), $file->getRawUserText() ) . |
1411 | | - $sk->userToolLinks( $file->getRawUser(), $file->getRawUserText() ); |
| 1384 | + $link = Linker::userLink( $file->getRawUser(), $file->getRawUserText() ) . |
| 1385 | + Linker::userToolLinks( $file->getRawUser(), $file->getRawUserText() ); |
1412 | 1386 | if( $file->isDeleted( File::DELETED_USER ) ) { |
1413 | 1387 | $link = '<span class="history-deleted">' . $link . '</span>'; |
1414 | 1388 | } |
— | — | @@ -1419,15 +1393,14 @@ |
1420 | 1394 | * Fetch file upload comment if it's available to this user |
1421 | 1395 | * |
1422 | 1396 | * @param $file File |
1423 | | - * @param $sk Skin |
1424 | 1397 | * @return String: HTML fragment |
1425 | 1398 | */ |
1426 | | - function getFileComment( $file, $sk ) { |
| 1399 | + function getFileComment( $file ) { |
1427 | 1400 | if( !$file->userCan( File::DELETED_COMMENT ) ) { |
1428 | 1401 | return '<span class="history-deleted"><span class="comment">' . |
1429 | 1402 | wfMsgHtml( 'rev-deleted-comment' ) . '</span></span>'; |
1430 | 1403 | } else { |
1431 | | - $link = $sk->commentBlock( $file->getRawDescription() ); |
| 1404 | + $link = Linker::commentBlock( $file->getRawDescription() ); |
1432 | 1405 | if( $file->isDeleted( File::DELETED_COMMENT ) ) { |
1433 | 1406 | $link = '<span class="history-deleted">' . $link . '</span>'; |
1434 | 1407 | } |
— | — | @@ -1436,11 +1409,10 @@ |
1437 | 1410 | } |
1438 | 1411 | |
1439 | 1412 | function undelete() { |
1440 | | - global $wgOut, $wgUser; |
1441 | 1413 | if ( wfReadOnly() ) { |
1442 | | - $wgOut->readOnlyPage(); |
1443 | | - return; |
| 1414 | + throw new ReadOnlyError; |
1444 | 1415 | } |
| 1416 | + |
1445 | 1417 | if( !is_null( $this->mTargetObj ) ) { |
1446 | 1418 | $archive = new PageArchive( $this->mTargetObj ); |
1447 | 1419 | wfRunHooks( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj ) ); |
— | — | @@ -1454,24 +1426,23 @@ |
1455 | 1427 | if ( $ok[1] ) { // Undeleted file count |
1456 | 1428 | wfRunHooks( 'FileUndeleteComplete', array( |
1457 | 1429 | $this->mTargetObj, $this->mFileVersions, |
1458 | | - $wgUser, $this->mComment ) ); |
| 1430 | + $this->getUser(), $this->mComment ) ); |
1459 | 1431 | } |
1460 | 1432 | |
1461 | | - $skin = $wgUser->getSkin(); |
1462 | | - $link = $skin->linkKnown( $this->mTargetObj ); |
1463 | | - $wgOut->addWikiMsgArray( 'undeletedpage', array( $link ), array( 'replaceafter' ) ); |
| 1433 | + $link = Linker::linkKnown( $this->mTargetObj ); |
| 1434 | + $this->getOutput()->addHTML( wfMessage( 'undeletedpage' )->rawParams( $link )->parse() ); |
1464 | 1435 | } else { |
1465 | | - $wgOut->showFatalError( wfMsg( 'cannotundelete' ) ); |
1466 | | - $wgOut->addWikiMsg( 'undeleterevdel' ); |
| 1436 | + $this->getOutput()->showFatalError( wfMsg( 'cannotundelete' ) ); |
| 1437 | + $this->getOutput()->addWikiMsg( 'undeleterevdel' ); |
1467 | 1438 | } |
1468 | 1439 | |
1469 | 1440 | // Show file deletion warnings and errors |
1470 | 1441 | $status = $archive->getFileStatus(); |
1471 | 1442 | if( $status && !$status->isGood() ) { |
1472 | | - $wgOut->addWikiText( $status->getWikiText( 'undelete-error-short', 'undelete-error-long' ) ); |
| 1443 | + $this->getOutput()->addWikiText( $status->getWikiText( 'undelete-error-short', 'undelete-error-long' ) ); |
1473 | 1444 | } |
1474 | 1445 | } else { |
1475 | | - $wgOut->showFatalError( wfMsg( 'cannotundelete' ) ); |
| 1446 | + $this->getOutput()->showFatalError( wfMsg( 'cannotundelete' ) ); |
1476 | 1447 | } |
1477 | 1448 | return false; |
1478 | 1449 | } |