/scripts/process/supporter_single.php
PHP | 66 lines | 31 code | 22 blank | 13 comment | 3 complexity | e06d5940d57f4c7aa54e3a5e486bfc89 MD5 | raw file
Possible License(s): MIT, LGPL-2.1
- <?php
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
- require('../../load.php');
- list($cmd, $supporter_KEY) = $argv;
- #if ($_REQUEST['supporter_KEY']) {$supporter_KEY = $_REQUEST['supporter_KEY'];}
- if (!$supporter_KEY) {
- $args = json_decode(file_get_contents( 'php://input'),true);
- trigger_error(print_r($args,TRUE));
- $supporter_KEY =$args['supporter_KEY'];
- }
- #$supporter_KEY = 48965489;
- #$file = '/tmp/process.log';
- // The new person to add to the file
- #trigger_error(print_r($supporter_KEY,TRUE));
- $sql = "SELECT * FROM supporter WHERE supporter_KEY=".$supporter_KEY;
- $S = $db->Execute($sql) or die($db->errorMsg().$sql);
- $s = $S->GetAssoc();
- $x=0;
- foreach($s as $supporter_arr){
- $supporter = new Supporter($supporter_arr);
- #$supporter->process_data_augmentation();
- # $supporter->geovalidate();
-
- if ($supporter_arr['source_processed'] != 1){
- $supporter->process_source();
- }
-
- $supporter->updateDonationCounts();
- $supporter->updateActionCounts();
- $supporter->updateEmailCounts();
- $supporter->updateUnsubscribeInfo();
- $supporter->updateSupporterTypes();
- #update local
- $supporter->db_update();
- #save to salsa
- $data=$supporter->data;
- $data['key'] = $supporter_arr['supporter_KEY'];
- unset($data['organization_KEY']);
- #$out = $DIA->save('supporter',$data);
-
- # echo '<pre>';
- # print_r($data);
- # echo '</pre>';
- $x++;
-
- echo 'completed'.'
- ';
- }