r32213 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32212‎ | r32213 | r32214 >
Date:08:51, 20 March 2008
Author:dale
Status:old
Tags:
Comment:
updates for bot maintenance of stream files
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/MV_EditStreamPage.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -209,6 +209,7 @@
210210 }
211211 function do_annotate_speeches($stream, $force){
212212 print "do annotations for $stream->name \n";
 213+ $dbr =& wfGetDB(DB_SLAVE);
213214 if($force){
214215 global $botUserName;
215216 //get wiki stream id:
@@ -280,15 +281,21 @@
281282 function do_proccess_text($stream, $force){
282283 $dbr = wfGetDB(DB_SLAVE);
283284 if($force){
 285+ global $botUserName;
284286 //get wiki stream id:
285287 $wikiStream = new MV_Stream(array('name'=>$stream->name));
286288 //first remove all bot edited pages:
287289 $mvd_res = MV_Index::getMVDInRange($wikiStream->getStreamId(),null,null,'Ht_en');
288290 while($row = $dbr->fetchObject($mvd_res)){
289291 $title = Title::newFromText($row->wiki_title, MV_NS_MVD);
290 - $article = new Article($title);
291 - $article->doDelete('mvbot removal');
292 - print "removed $row->wiki_title \n";
 292+ $current = Revision::newFromTitle( $title );
 293+ if($current->getUserText()==$botUserName){
 294+ $article = new Article($title);
 295+ $article->doDelete('mvbot removal');
 296+ print "removed $row->wiki_title \n";
 297+ }else{
 298+ print "skiped $roe->wiki_title (last edit by: ". $current->getUserText().")\n";
 299+ }
293300 }
294301 }
295302 /* for now use the stream search table (in the future should put in our orphaned person data)
Index: trunk/extensions/MetavidWiki/maintenance/maintenance_util.inc.php
@@ -131,7 +131,7 @@
132132 return ;
133133 }
134134 if($wgTitle->getNamespace()==MV_NS_MVD && MV_Index::getMVDbyTitle($wgTitle->getDBkey())==null){
135 - print "missing assoc mvd ...update \n";
 135+ //print "missing assoc mvd ...update \n";
136136 }else{
137137 if ($wgTitle->exists()) {
138138 //if last edit!=mvBot skip (don't overwite peoples improvments')
Index: trunk/extensions/MetavidWiki/includes/MV_EditStreamPage.php
@@ -82,7 +82,10 @@
8383 return true;
8484 }
8585 function proccessReq(& $streamFiles){
86 - global $wgRequest;
 86+ global $wgRequest, $wgUser;
 87+ //make sure the user can edit streams:
 88+ if(!$wgUser->isAllowed('mv_edit_stream'))return ;
 89+
8790 $this->mv_action = $wgRequest->getVal('mv_action');
8891 if($this->mv_action=='new_stream_file'){
8992 //@@todo a bit more input scrubbing:
Index: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php
@@ -150,7 +150,7 @@
151151
152152 $wgGroupPermissions['user']['mv_delete_mvd'] = true;
153153 $wgGroupPermissions['sysop']['mv_edit_stream']=true;
154 -
 154+$wgGroupPermissions['bot']['mv_edit_stream']=true;
155155 ###
156156 # If you already have custom namespaces on your site, insert
157157 # $mvNamespaceIndex = ???; in your config before including the settings

Status & tagging log