3 // WARNING: this script takes a few weeks to be executed completly, thus run it into a screen.
5 require_once 'connect.db.inc.php';
6 require_once '../../classes/address.php';
8 $globals->debug
= 0; // Do not store backtraces.
10 print "Tries to geocode addresses (due a bug in the previous release, all addresses must run once again).\n";
11 $time = XDB
::fetchOneCell('SELECT COUNT(distinct(pid), jobid)
12 FROM profile_addresses
13 WHERE accuracy IS NOT NULL AND accuracy > 0');
14 $time = ceil($time / 60 / 24);
15 print "It will approximately take $time days.\n";
17 $it = XDB
::rawIterator('SELECT *
18 FROM profile_addresses
19 WHERE accuracy IS NOT NULL AND accuracy > 0
20 ORDER BY pid, jobid, type, id');
21 $total = $it->total();
23 printf("\r%u / %u", $i, $total);
26 while ($item = $it->next()) {
27 $address = new Address($item);
28 $address->format(array('requireGeocoding' => true
, 'stripGeocoding' => true
));
31 if (!($pid == $address->pid
&& $jobid == $address->jobid
)) {
33 $jobid = $address->jobid
;
38 printf("\r%u / %u", $i, $total);
40 print "\nGeocoding done.\n\n";
41 print "That's all folks!\n";
43 /* vim:set et sw=4 sts=4 ts=4: */