projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Makes the forum link available for all logged users.
[platal.git]
/
bin
/
formatAddresses.php
diff --git
a/bin/formatAddresses.php
b/bin/formatAddresses.php
index
6b8a8dd
..
f73b288
100755
(executable)
--- a/
bin/formatAddresses.php
+++ b/
bin/formatAddresses.php
@@
-24,17
+24,18
@@
require './connect.db.inc.php';
require_once '../classes/address.php';
require_once '../classes/geocoder.php';
require_once '../classes/gmapsgeocoder.php';
require_once '../classes/address.php';
require_once '../classes/geocoder.php';
require_once '../classes/gmapsgeocoder.php';
+require_once '../classes/visibility.php';
$globals->debug = 0; // Do not store backtraces
$targets = array(
$globals->debug = 0; // Do not store backtraces
$targets = array(
- 'g' => 'formatted_address',
- 'p' => 'postalText'
+ 'g' => '
pa.
formatted_address',
+ 'p' => 'p
a.p
ostalText'
);
$ranges = array(
'f' => ' != \'\'',
'e' => ' = \'\'',
);
$ranges = array(
'f' => ' != \'\'',
'e' => ' = \'\'',
- 'a' => 'IS NOT NULL'
+ 'a' => '
IS NOT NULL'
);
$options = getopt('g::t:r:h::', array('geocode::', 'target:', 'range:', 'help::'));
);
$options = getopt('g::t:r:h::', array('geocode::', 'target:', 'range:', 'help::'));
@@
-85,11
+86,12
@@
EOF;
exit;
}
exit;
}
-print "Formats addresses
addresses
.\n";
+print "Formats addresses.\n";
-$where = '';
if ($range != 'a') {
if ($range != 'a') {
- $where = 'WHERE ' . $targets[$target] . $ranges[$range];
+ $where = $targets[$target] . $ranges[$range];
+} else {
+ $where = null;
}
if ($geocoding_required) {
}
if ($geocoding_required) {
@@
-102,10
+104,7
@@
if ($geocoding_required) {
$display_limit = 100;
}
$display_limit = 100;
}
-$it = XDB::rawIterator('SELECT *
- FROM profile_addresses
- ' . $where . '
- ORDER BY pid, jobid, type, id');
+$it = Address::iterate(array(), array(), array(), Visibility::get(Visibility::VIEW_PRIVATE), $where);
$total = $it->total();
$i = 0;
$total = $it->total();
$i = 0;
@@
-113,12
+112,11
@@
$j = 0;
$skipped = 0;
printf("\r%u / %u", $i, $total);
$skipped = 0;
printf("\r%u / %u", $i, $total);
-while ($item = $it->next()) {
- $address = new Address($item);
+while ($address = $it->next()) {
$address->changed = ($geocoding_required ? 1 : 0);
$address->format();
if ($address->delete()) {
$address->changed = ($geocoding_required ? 1 : 0);
$address->format();
if ($address->delete()) {
- $address->save();
+ $address->save(
false
);
} else {
++$skipped;
}
} else {
++$skipped;
}