r40874 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40873‎ | r40874 | r40875 >
Date:19:37, 15 September 2008
Author:aaron
Status:old
Tags:
Comment:
* Bail out to repo list for some invalid param cases
* Break some long lines
Modified paths:
  • /trunk/extensions/CodeReview/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/SpecialCode.php
@@ -132,6 +132,11 @@
133133
134134 function execute() {
135135 global $wgOut;
 136+ if( !$this->mRepo ) {
 137+ $view = new CodeRepoListView();
 138+ $view->execute();
 139+ return;
 140+ }
136141 $pager = new SvnRevTablePager( $this );
137142 $wgOut->addHtml( $pager->getBody() . $pager->getNavigationBar() );
138143 }
@@ -175,7 +180,9 @@
176181 switch( $name ){
177182 case 'cr_id':
178183 global $wgUser;
179 - return $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $value ), htmlspecialchars( $value ) );
 184+ return $wgUser->getSkin()->link(
 185+ SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $value ), htmlspecialchars( $value )
 186+ );
180187 case 'cr_author':
181188 return $this->mView->authorLink( $value );
182189 case 'cr_message':
@@ -197,12 +204,18 @@
198205 function __construct( $repoName, $rev ){
199206 parent::__construct();
200207 $this->mRepo = CodeRepository::newFromName( $repoName );
201 - $this->mRev = $this->mRepo->getRevision( intval( $rev ) );
 208+ $this->mRev = $this->mRepo ? $this->mRepo->getRevision( intval( $rev ) ) : null;
202209 }
203210
204211 function execute(){
205212 global $wgOut, $wgUser;
206 - $repoLink = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ), htmlspecialchars( $this->mRepo->getName() ) );
 213+ if( !$this->mRepo || $this->mRev ) {
 214+ $view = new CodeRepoListView();
 215+ $view->execute();
 216+ return;
 217+ }
 218+ $repoLink = $wgUser->getSkin()->link( SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() ),
 219+ htmlspecialchars( $this->mRepo->getName() ) );
207220 $rev = $this->mRev->getId();
208221 $revText = htmlspecialchars( $rev );
209222 $viewvc = $this->mRepo->getViewVcBase();

Status & tagging log