r25340 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25339‎ | r25340 | r25341 >
Date:08:47, 31 August 2007
Author:aaron
Status:old
Tags:
Comment:
*Fix title recognition error when no page id given, but title given / Set view_page_statistics is set as the default mode. / Allow par argument for specialpage (patch by Henning Heitkötter, bug 4358)
*Stop page from getting fucked up on submit. Was due to DB error text crammed into page - replace on the user,rev key rather than insert and get duplicate key errors.
Modified paths:
  • /trunk/extensions/Review/Review.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Review/Review.php
@@ -322,7 +322,7 @@
323323 'val_comment' => $value->val_comment ,
324324 'val_ip' => $value->val_ip ,
325325 ) ;
326 - $dbw->insert ( 'validate' , $data ) ;
 326+ $dbw->replace( 'validate', array('val_user') , $data ) ;
327327 }
328328 $dbw->commit();
329329 }
@@ -751,7 +751,7 @@
752752
753753 $out = "" ;
754754 $skin =& $wgUser->getSkin () ;
755 - $mode = $wgRequest->getText ( 'mode' , "" ) ;
 755+ $mode = $wgRequest->getText ( 'mode' , 'view_page_statistics' ) ;
756756 $page_id = $wgRequest->getInt ( 'page_id' , 0 ) ;
757757 $rev_id = $wgRequest->getInt ( 'rev_id' , 0 ) ;
758758 $user_id = $wgRequest->getInt ( 'user_id' , 0 ) ;
@@ -769,7 +769,13 @@
770770 }
771771
772772 if ( $page_id == 0 ) {
773 - $title = NULL ;
 773+ if( $par != null){
 774+ $title = Title::newFromUrl($par);
 775+ $page_id = $title->getArticleID();
 776+ }
 777+ else{
 778+ $title = NULL ;
 779+ }
774780 } else {
775781 $title = Title::newFromID ( $page_id ) ;
776782 }
@@ -794,7 +800,7 @@
795801
796802 // FIXME: use private methods!
797803 # Modes
798 - if ( $mode == 'view_page_statistics' ) {
 804+ if ( $mode == 'view_page_statistics' && $title != null ) {
799805 # View statistics for one page
800806 $revisions = $this->get_reviewed_revisions ( $title ) ;
801807 arsort ( $revisions ) ; # Newest first
@@ -816,7 +822,7 @@
817823 $out .= "</table>\n" ;
818824 }
819825 $page_title = wfMsgForContent ( 'review_for_page' , $title->getPrefixedText() ) ;
820 - } else if ( $mode == 'view_version_statistics' ) {
 826+ } else if ( $mode == 'view_version_statistics' && $title != null ) {
821827 # View statistics for a specific version of a page
822828 $data = array () ;
823829 $out .= "<table id='review_statistics_table'>\n" ;

Status & tagging log