Changeset 859
- Timestamp:
- 05/12/09 18:02:16 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
g-map/optionals/de.gmap.wbb/files/lib/acp/action/UpdateMapAction.class.php
r763 r859 12 12 class UpdateMapAction extends UpdateCounterAction { 13 13 public $action = 'UpdateMap'; 14 public $everything = true;15 14 16 15 /** 17 * updates the user positions16 * @see Action::execute() 18 17 */ 19 private function myupdate($limit, $offset, $google, $col) { 18 public function execute() { 19 parent::execute(); 20 21 $google = new MapDiscover(true); 22 23 // fetch column names 24 $col = $google->getColumns(); 25 26 20 27 //Setting default Values. (Location to City) 21 28 $sql = "UPDATE wcf".WCF_N."_user_option_value … … 30 37 // if there is no api key specified - abort 31 38 if (defined('MAP_API') && MAP_API != "Api-Key") { 32 $sql = "SELECT userID, 33 ".$col['street']." AS street, 34 ".$col['zip']." AS zip, 35 ".$col['city']." AS city, 36 ".$col['country']." AS country 37 FROM wcf".WCF_N."_user_option_value 38 WHERE (".$col['enable']." = 1 AND ".$col['location']." != '') 39 GROUP BY CONCAT(".$col['street'].",".$col['zip'].",".$col['city'].",".$col['country'].") 40 LIMIT $limit 41 OFFSET $offset"; 42 $result = WCF::getDB()->sendQuery($sql); 43 44 while ($row = WCF::getDB()->fetchArray($result)) { 45 $google->update($row['street'], $row['zip'], $row['city'], $row['country']); 46 } 39 $this->calcProgress(); 40 $this->finish(); 47 41 } 48 } 49 50 /** 51 * @see Action::execute() 52 */ 53 public function execute() { 54 parent::execute(); 55 56 $google = new MapDiscover(true); 57 58 // fetch column names 59 $col = $google->getColumns(); 60 42 61 43 // count 62 44 $sql = "SELECT COUNT(userID) AS c … … 70 52 $count = $row['c']; 71 53 72 $this->myupdate($this->limit, ($this->limit * $this->loop), $google, $col); 54 55 $sql = "SELECT userID, 56 ".$col['street']." AS street, 57 ".$col['zip']." AS zip, 58 ".$col['city']." AS city, 59 ".$col['country']." AS country 60 FROM wcf".WCF_N."_user_option_value 61 WHERE (".$col['enable']." = 1 AND ".$col['location']." != '') 62 GROUP BY CONCAT(".$col['street'].",".$col['zip'].",".$col['city'].",".$col['country'].")"; 63 $result = WCF::getDB()->sendQuery($sql, $this->limit, ($this->limit * $this->loop)); 64 if (!WCF::getDB()->countRows($result)) { 65 $this->calcProgress(); 66 $this->finish(); 67 } 68 while ($row = WCF::getDB()->fetchArray($result)) { 69 $google->update($row['street'], $row['zip'], $row['city'], $row['country']); 70 } 71 73 72 $this->executed(); 74 73 75 if($this->everything) { 76 $this->calcProgress(($this->limit * $this->loop), $count); 77 $this->nextLoop(); 78 } 74 $this->calcProgress(($this->limit * $this->loop), $count); 75 $this->nextLoop(); 79 76 } 80 77 }
