From 241676caf2677b2231801fda32d5026269439ff4 Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Tue, 8 Aug 2006 13:58:25 +0000 Subject: [PATCH] Removing the last references to OutputPage::sysopRequired() and OutputPage::developerRequired() (mostly using OutputPage::permissionRequired(), but in one case - reverting of a protected image - OutputPage::readOnlyPage is better), and throwing an exception when calling them; removing two useless comments. --- includes/Article.php | 2 +- includes/ImagePage.php | 4 ++-- includes/OutputPage.php | 27 ++------------------------- includes/SpecialIpblocklist.php | 2 +- includes/User.php | 1 - 5 files changed, 6 insertions(+), 30 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index a30f17f14a..368210f4ff 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -887,7 +887,7 @@ class Article { } if ((!$wgUser->isAllowed('delete'))) { - $wgOut->sysopRequired(); + $wgOut->permissionRequired( 'delete' ); return; } diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 7e8709087b..88a0a12ad3 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -442,7 +442,7 @@ END # Only sysops can delete images. Previously ordinary users could delete # old revisions, but this is no longer the case. if ( !$wgUser->isAllowed('delete') ) { - $wgOut->sysopRequired(); + $wgOut->permissionRequired( 'delete' ); return; } if ( $wgUser->isBlocked() ) { @@ -580,7 +580,7 @@ END return; } if ( ! $this->mTitle->userCanEdit() ) { - $wgOut->sysopRequired(); + $wgOut->readOnlyPage( $this->getContent(), true ); return; } if ( $wgUser->isBlocked() ) { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e677dcbacd..77f0ca0d83 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -715,7 +715,6 @@ class OutputPage { /** * Display an error page noting that a given permission bit is required. - * This should generally replace the sysopRequired, developerRequired etc. * @param string $permission key required */ function permissionRequired( $permission ) { @@ -737,36 +736,14 @@ class OutputPage { * @deprecated */ function sysopRequired() { - global $wgUser; - - $this->setPageTitle( wfMsg( 'sysoptitle' ) ); - $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); - $this->setRobotpolicy( 'noindex,nofollow' ); - $this->setArticleRelated( false ); - $this->mBodytext = ''; - - $sk = $wgUser->getSkin(); - $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ), '' ); - $this->addHTML( wfMsgHtml( 'sysoptext', $ap ) ); - $this->returnToMain(); + throw new MWException( "Call to deprecated OutputPage::sysopRequired() method\n" ); } /** * @deprecated */ function developerRequired() { - global $wgUser; - - $this->setPageTitle( wfMsg( 'developertitle' ) ); - $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) ); - $this->setRobotpolicy( 'noindex,nofollow' ); - $this->setArticleRelated( false ); - $this->mBodytext = ''; - - $sk = $wgUser->getSkin(); - $ap = $sk->makeKnownLink( wfMsgForContent( 'administrators' ), '' ); - $this->addHTML( wfMsgHtml( 'developertext', $ap ) ); - $this->returnToMain(); + throw new MWException( "Call to deprecated OutputPage::developerRequired() method\n" ); } /** diff --git a/includes/SpecialIpblocklist.php b/includes/SpecialIpblocklist.php index 6df7f038b7..437fac7ff1 100644 --- a/includes/SpecialIpblocklist.php +++ b/includes/SpecialIpblocklist.php @@ -24,7 +24,7 @@ function wfSpecialIpblocklist() { } else if ( "submit" == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { if ( ! $wgUser->isAllowed('block') ) { - $wgOut->sysopRequired(); + $wgOut->permissionRequired( 'block' ); return; } $ipu->doSubmit(); diff --git a/includes/User.php b/includes/User.php index 1a6563cbde..7a77cd3a6b 100644 --- a/includes/User.php +++ b/includes/User.php @@ -543,7 +543,6 @@ class User { } # Proxy blocking - # FIXME ? proxyunbannable is to deprecate the old isSysop() if ( !$this->isAllowed('proxyunbannable') && !in_array( $ip, $wgProxyWhitelist ) ) { # Local list -- 2.20.1