r47735 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47734‎ | r47735 | r47736 >
Date:00:48, 24 February 2009
Author:dale
Status:deferred
Tags:
Comment:
maintenance updates
Modified paths:
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php
@@ -14,6 +14,7 @@
1515 --offset [val] //start on a given offset (in case things don't finish
1616
1717 actions:
 18+ revert_last_edits --num_edits [X] //reverts last X edits (do --dry first)
1819 strip_speech_by //strips extra speech by text
1920 update_stream_desc //updates stream desc
2021 update_archive_org_files [stream_name] //updates pointers to archive.org mp4 streaming
@@ -25,6 +26,12 @@
2627 $mvDryRun = ( isset( $options['dry'] ) ) ? true:false;
2728
2829 switch ( $args[0] ) {
 30+ case 'revert_last_edits':
 31+ if( !$options['num_edits'] )
 32+ die('we need a number of edits to revert');
 33+
 34+ do_revert_by_time( $args[1] );
 35+ break;
2936 case 'strip_speech_by' :
3037 strip_speech_by();
3138 break;
@@ -42,6 +49,33 @@
4350 run_archive_org_update( $stream_name );
4451 break;
4552 }
 53+function do_revert_by_time( $num ){
 54+ global $mvDryRun;
 55+ $dbr = wfGetDB( DB_READ );
 56+ $dbw = wfGetDB( DB_WRITE );
 57+ $sql = " SELECT *
 58+FROM `recentchanges`
 59+ORDER BY `recentchanges`.`rc_timestamp` DESC
 60+LIMIT 0, {$num}";
 61+
 62+ $result = $dbr->query( $sql );
 63+ //get the first last 10
 64+ while ( $rc_edit = $dbr->fetchObject( $result ) ) {
 65+ //if(!$mvDryRun)
 66+ //get the -1 revision
 67+ if($rc_edit->rc_last_oldid != 0 ){
 68+ $rev = Revision::newFromId( $rc_edit->rc_last_oldid );
 69+ $rTitle = Title::makeTitle( $rc_edit->rc_namespace, $rc_edit->rc_title );
 70+ //$rev = Revision::newFromTitle( $title, $rc_edit->rc_this_oldid );
 71+ $old_text = $rev->getRawText();
 72+ print "Revert one edit on: " . $rc_edit->rc_title . "\n";
 73+ if(!$mvDryRun){
 74+ do_update_wiki_page( $rTitle, $old_text, MV_NS_STREAM, $force = true );
 75+ }
 76+ }
 77+ //do_update_wiki_page( $streamTitle, $out, MV_NS_STREAM, $force = true );
 78+ }
 79+}
4680 function run_archive_org_update($stream_name=''){
4781 //first get all the streams:
4882 include_once( 'metavid2mvWiki.inc.php' );
@@ -72,8 +106,7 @@
73107 }
74108 }
75109 //now that we keept categories force update the page:
76 - do_update_wiki_page( $streamTitle, $out, MV_NS_STREAM, $force = true );
77 -
 110+ do_update_wiki_page( $streamTitle, $out, MV_NS_STREAM, $force = true );
78111 }
79112 }
80113 }
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.php
@@ -90,7 +90,7 @@
9191 'all_sync_past_date' --date [mm/dd/yy] all in_sync streams past date (-d option required)
9292 [stream_name] will insert all records for the given stream name
9393 'people' [person_name] will insert all the people articles optional followed by a person name
94 - 'bill' [bill_key]? ...empty bill key will insert all bills based on gov track subject page
 94+ 'bill' [bill_key]? ...empty bill key will insert all bills based on gov track subject page
9595 'interest' will insert interests (uses people as base so run people first)
9696 'update_templates' will update templates & some semantic properties
9797 'file_check' checks inserted streams file urls/pointers
@@ -120,7 +120,7 @@
121121 case 'all_sync_past_date':
122122 if ( !isset( $options['date'] ) )die( 'date missing' . "\n" );
123123 do_stream_insert( 'all_sync_past_date' );
124 - break;
 124+ break;
125125 case 'people' :
126126 $force = ( isset( $options['force'] ) ) ? true:false;
127127 $person_name = ( isset( $args[1] ) ) ? $args[1]:'';
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -181,6 +181,11 @@
182182 // $set['mv_ogg_high_quality']='http://128.114.20.64/media/' . $stream->name . '.HQ.ogg';
183183 }
184184 }
 185+
 186+ //check archive.org paths:
 187+ ao_file_Ogg_Video
 188+
 189+
185190 if ( count( $set ) == 0 ) {
186191 // no files present (remove stream)
187192 print 'no files present should remove: ' . $stream->name . "\n";

Status & tagging log