r46934 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46933‎ | r46934 | r46935 >
Date:18:24, 6 February 2009
Author:dale
Status:deferred
Tags:
Comment:
maintenance bill fix
Modified paths:
  • /trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php (modified) (history)
  • /trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/maintenance/scrape_and_insert.inc.php
@@ -46,7 +46,7 @@
4747 if ( !$this->streams[$stream_name]->doesStreamExist() ) {
4848 die( 'error: stream ' . $stream_name . ' does not exist' );
4949 }
50 - print "Proccessing Stream: $stream_name \n";
 50+ print "processing Stream: $stream_name \n";
5151 }
5252 }
5353 }
@@ -350,7 +350,7 @@
351351 $bill_key = trim( $debate_matches[1] );
352352 print "found debate: tag " . $bill_key . "\n";
353353 // build gov-track-congress-session friendly debate url:
354 - if ( $this->get_and_proccess_billid( $bill_key, $stream->date_start_time ) != null ) {
 354+ if ( $this->get_and_process_billid( $bill_key, $stream->date_start_time ) != null ) {
355355 $bill_categories[$bill_key] = $bill_key;
356356 }
357357 }
@@ -404,7 +404,7 @@
405405 // conform white space and case:
406406 $bill_name = str_replace( array( 'S. ', 'Con. ', 'Res. ' ), array( 'S.', 'CON.', 'RES. ' ), $bill_name );
407407 // make sure its not a false possitave and load bill data from govTrack:
408 - if ( $this->get_and_proccess_billid( $bill_name, $stream->date_start_time ) ) {
 408+ if ( $this->get_and_process_billid( $bill_name, $stream->date_start_time ) ) {
409409 $bill_categories[$bill_name] = $bill_name;
410410 }
411411 }
@@ -454,7 +454,7 @@
455455 print "failed to update restrictions :(\n";
456456 }
457457
458 - // proccess each bill to the annotation body;
 458+ // process each bill to the annotation body;
459459 $bcat = '';
460460 $bill_lead_in = "\n\nBill ";
461461 // print_r($bill_categories);
@@ -575,7 +575,7 @@
576576 print "GOT openCon id: $openCongBillId from $bill_key\n";
577577 print "GOT mapLight id: $mapLightBillId from $bill_key\n";
578578 if ( $govTrackBillId ) {
579 - $this->proccessBill( $govTrackBillId, $bill_key, $openCongBillId, $mapLightBillId );
 579+ $this->processBill( $govTrackBillId, $bill_key, $openCongBillId, $mapLightBillId );
580580 $this->govTrackBillId = $govTrackBillId;
581581 return $this->govTrackBillId;
582582 } else {
@@ -606,7 +606,7 @@
607607 return false;
608608 }
609609 }
610 - function proccessBill( $govTrackBillId, $bill_key, $openCongBillId = false, $mapLightBillId = false, $forceUpdate = false ) {
 610+ function processBill( $govTrackBillId, $bill_key, $openCongBillId = false, $mapLightBillId = false, $forceUpdate = false ) {
611611 // get the bill title & its sponsor / co-sponsors:
612612 $rawGovTrackPage = $this->doRequest( $this->govTrack_bill_url . $govTrackBillId );
613613
@@ -786,7 +786,7 @@
787787 print " found bill key:$session_num $bill_key \n";
788788 // set a flag as to not get caught in infintate loop:
789789 $this->bill_name_maplight_lookup = false;
790 - $this->get_and_proccess_billid( $bill_key, '', $session_num );
 790+ $this->get_and_process_billid( $bill_key, '', $session_num );
791791 print " found bill title: " . $this->cur_bill_short_title . "\n";
792792 // should now have the bill name update the cache and return
793793 $this->mapLight_bill_cache[$mapBillId] = $this->cur_bill_short_title;
Index: trunk/extensions/MetavidWiki/maintenance/metavid2mvWiki.inc.php
@@ -297,7 +297,7 @@
298298 }
299299 // do insert/copy all media images
300300 if ( !isset( $options['skipimage'] ) ) {
301 - do_proccess_images( $stream, $force );
 301+ do_process_images( $stream, $force );
302302 print "done with images\n";
303303 }
304304 if ( !isset( $options['skipfiles'] ) ) {
@@ -305,8 +305,8 @@
306306 do_stream_file_check( $stream );
307307 }
308308 if ( !isset( $options['skiptext'] ) ) {
309 - // proccess all stream text:
310 - do_proccess_text( $stream, $force );
 309+ // process all stream text:
 310+ do_process_text( $stream, $force );
311311 }
312312 if ( !isset( $options['skipSpeechMeta'] ) ) {
313313 // do annoative track for continus speches
@@ -389,7 +389,7 @@
390390 }
391391 }
392392 }
393 -function do_proccess_text( $stream, $force ) {
 393+function do_process_text( $stream, $force ) {
394394 $dbr = wfGetDB( DB_SLAVE );
395395 if ( $force ) {
396396 global $botUserName;
@@ -481,7 +481,7 @@
482482 /*
483483 * for each image add it to the image directory
484484 */
485 -function do_proccess_images( $stream, $force = false ) {
 485+function do_process_images( $stream, $force = false ) {
486486 global $mvLocalImgLoc, $MVStreams, $wgDBname;
487487 $dbr =& wfGetDB( DB_SLAVE );
488488 $dbw =& wfGetDB( DB_MASTER );
@@ -755,23 +755,17 @@
756756
757757 //get all people from the congress people category
758758 $result = $dbr->select( 'categorylinks', 'cl_sortkey', array (
759 - 'cl_to' => 'Person',
760 - /*'`cl_sortkey` LIKE \'%' . mysql_escape_string( $val
761 - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array (*/
762 - 'LIMIT' => $result_limit
763 - ) );
 759+ 'cl_to' => 'Person'
 760+ )
 761+ );
 762+
 763+ if ( $dbr->numRows( $result ) == 0 )
 764+ die( 'could not find people: ' . "\n" );
764765 $out = '';
765766 while ( $row = $dbr->fetchObject( $result ) ) {
766767 $person_name = $row->cl_sortkey;
767768 $person_ary[$person_name] = true;
768769 }
769 -
770 - if ( $dbr->numRows( $res ) == 0 )
771 - die( 'could not find people: ' . "\n" );
772 - $person_ary = array ();
773 - while ( $person = $dbr->fetchObject( $res ) ) {
774 - $person_ary[] = $person;
775 - }
776770 foreach ( $person_ary as $person ) {
777771 $person_title = Title :: newFromUrl( $person->name_clean );
778772 // semantic data via template:
@@ -819,7 +813,7 @@
820814 }
821815 } else if ( $dbKey == 'contribution_date_range' ) {
822816 if ( !$mapk ) {
823 - print 'out of order attr proccess missing mapk' . "\n";
 817+ print 'out of order attr process missing mapk' . "\n";
824818 } else {
825819 $raw_results = $mvScrape->doRequest( 'http://www.maplight.org/map/us/legislator/' . $mapk );
826820 preg_match( '/Showing\scontributions<\/dt><dd>([^<]*)</', $raw_results, $matches );
@@ -891,7 +885,7 @@
892886 $page_body .= "Funding Interest $hr_inx=" . html_entity_decode( $matches[2][$k] ) . "|\n";
893887 $page_body .= "Funding Amount $hr_inx=\$" . $matches[3][$k] . "|\n";
894888 if ( $doInterestLookup ) {
895 - // make sure the intrest has been proccessed:
 889+ // make sure the intrest has been processed:
896890 do_proc_interest( $matches[1][$k], html_entity_decode( $matches[2][$k] ) );
897891 }
898892 // do_proc_interest('G1100','Chambers of commerce');
@@ -1034,7 +1028,7 @@
10351029 print "removed title: " . $pTitle->getText() . "\n";
10361030 }
10371031 }
1038 -function mv_proccess_attr( $table, $stream_id ) {
 1032+function mv_process_attr( $table, $stream_id ) {
10391033 global $start_time, $end_time;
10401034 $dbr = wfGetDB( DB_SLAVE );
10411035 $sql = "SELECT * FROM `metavid`.`$table` WHERE `stream_fk`=$stream_id";

Status & tagging log