Index: trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | --offset [val] //start on a given offset (in case things don't finish |
16 | 16 | |
17 | 17 | actions: |
| 18 | + revert_last_edits --num_edits [X] //reverts last X edits (do --dry first) |
18 | 19 | strip_speech_by //strips extra speech by text |
19 | 20 | update_stream_desc //updates stream desc |
20 | 21 | update_archive_org_files [stream_name] //updates pointers to archive.org mp4 streaming |
— | — | @@ -25,6 +26,12 @@ |
26 | 27 | $mvDryRun = ( isset( $options['dry'] ) ) ? true:false; |
27 | 28 | |
28 | 29 | 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; |
29 | 36 | case 'strip_speech_by' : |
30 | 37 | strip_speech_by(); |
31 | 38 | break; |
— | — | @@ -42,6 +49,33 @@ |
43 | 50 | run_archive_org_update( $stream_name ); |
44 | 51 | break; |
45 | 52 | } |
| 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 | +} |
46 | 80 | function run_archive_org_update($stream_name=''){ |
47 | 81 | //first get all the streams: |
48 | 82 | include_once( 'metavid2mvWiki.inc.php' ); |
— | — | @@ -72,8 +106,7 @@ |
73 | 107 | } |
74 | 108 | } |
75 | 109 | //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 ); |
78 | 111 | } |
79 | 112 | } |
80 | 113 | } |
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | 'all_sync_past_date' --date [mm/dd/yy] all in_sync streams past date (-d option required) |
92 | 92 | [stream_name] will insert all records for the given stream name |
93 | 93 | '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 |
95 | 95 | 'interest' will insert interests (uses people as base so run people first) |
96 | 96 | 'update_templates' will update templates & some semantic properties |
97 | 97 | 'file_check' checks inserted streams file urls/pointers |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | case 'all_sync_past_date': |
122 | 122 | if ( !isset( $options['date'] ) )die( 'date missing' . "\n" ); |
123 | 123 | do_stream_insert( 'all_sync_past_date' ); |
124 | | - break; |
| 124 | + break; |
125 | 125 | case 'people' : |
126 | 126 | $force = ( isset( $options['force'] ) ) ? true:false; |
127 | 127 | $person_name = ( isset( $args[1] ) ) ? $args[1]:''; |
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php |
— | — | @@ -181,6 +181,11 @@ |
182 | 182 | // $set['mv_ogg_high_quality']='http://128.114.20.64/media/' . $stream->name . '.HQ.ogg'; |
183 | 183 | } |
184 | 184 | } |
| 185 | + |
| 186 | + //check archive.org paths: |
| 187 | + ao_file_Ogg_Video |
| 188 | + |
| 189 | + |
185 | 190 | if ( count( $set ) == 0 ) { |
186 | 191 | // no files present (remove stream) |
187 | 192 | print 'no files present should remove: ' . $stream->name . "\n"; |