PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/process/supporter_single.php

https://github.com/radicaldesigns/jaguar
PHP | 66 lines | 31 code | 22 blank | 13 comment | 3 complexity | e06d5940d57f4c7aa54e3a5e486bfc89 MD5 | raw file
Possible License(s): MIT, LGPL-2.1
  1. <?php
  2. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  3. require('../../load.php');
  4. list($cmd, $supporter_KEY) = $argv;
  5. #if ($_REQUEST['supporter_KEY']) {$supporter_KEY = $_REQUEST['supporter_KEY'];}
  6. if (!$supporter_KEY) {
  7. $args = json_decode(file_get_contents( 'php://input'),true);
  8. trigger_error(print_r($args,TRUE));
  9. $supporter_KEY =$args['supporter_KEY'];
  10. }
  11. #$supporter_KEY = 48965489;
  12. #$file = '/tmp/process.log';
  13. // The new person to add to the file
  14. #trigger_error(print_r($supporter_KEY,TRUE));
  15. $sql = "SELECT * FROM supporter WHERE supporter_KEY=".$supporter_KEY;
  16. $S = $db->Execute($sql) or die($db->errorMsg().$sql);
  17. $s = $S->GetAssoc();
  18. $x=0;
  19. foreach($s as $supporter_arr){
  20. $supporter = new Supporter($supporter_arr);
  21. #$supporter->process_data_augmentation();
  22. # $supporter->geovalidate();
  23. if ($supporter_arr['source_processed'] != 1){
  24. $supporter->process_source();
  25. }
  26. $supporter->updateDonationCounts();
  27. $supporter->updateActionCounts();
  28. $supporter->updateEmailCounts();
  29. $supporter->updateUnsubscribeInfo();
  30. $supporter->updateSupporterTypes();
  31. #update local
  32. $supporter->db_update();
  33. #save to salsa
  34. $data=$supporter->data;
  35. $data['key'] = $supporter_arr['supporter_KEY'];
  36. unset($data['organization_KEY']);
  37. #$out = $DIA->save('supporter',$data);
  38. # echo '<pre>';
  39. # print_r($data);
  40. # echo '</pre>';
  41. $x++;
  42. echo 'completed'.'
  43. ';
  44. }