echo date('Y-m-d H:i:s == ').$sMsg."\n";
}
-$aWarnings = [];
+$aWarnings = array();
function warn($sMsg)
add_executable(nominatim export.c geometry.cpp import.c index.c input.c nominatim.c postgresql.c sprompt.c)
-include(CheckIncludeFile)
-CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
-CHECK_INCLUDE_FILE(sys/endian.h HAVE_SYS_ENDIAN_H)
-if(HAVE_BYTESWAP_H)
- target_compile_definitions(nominatim PRIVATE HAVE_BYTESWAP_H)
-endif(HAVE_BYTESWAP_H)
-if(HAVE_SYS_ENDIAN_H)
- target_compile_definitions(nominatim PRIVATE HAVE_SYS_ENDIAN_H)
-endif(HAVE_SYS_ENDIAN_H)
+
+CHECK_SYMBOL_EXISTS(bswap_32 "byteswap.h" HAVE_BYTESWAP)
+CHECK_SYMBOL_EXISTS(bswap32 "sys/endian.h" HAVE_SYS_ENDIAN)
+
+target_compile_definitions(nominatim
+ PRIVATE HAVE_BYTESWAP=$<BOOL:${HAVE_BYTESWAP}>
+ PRIVATE HAVE_SYS_ENDIAN=$<BOOL:${HAVE_SYS_ENDIAN}>
+)
+
target_link_libraries(nominatim ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PostgreSQL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
#define PG_OID_INT8 20
#define PG_OID_INT4 23
-#if defined(HAVE_BYTESWAP_H)
+#if HAVE_BYTESWAP
#include <byteswap.h>
-#elif defined(HAVE_SYS_ENDIAN_H)
+#define PG_BSWAP32(x) bswap_32(x)
+#define PG_BSWAP64(x) bswap_64(x)
+#elif HAVE_SYS_ENDIAN
#include <sys/endian.h>
+#define PG_BSWAP32(x) bswap32(x)
+#define PG_BSWAP64(x) bswap64(x)
+#else
+#error "No appropriate byteswap found for your system."
#endif
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define PGint16(x) (x)
+#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define PGint32(x) (x)
+#define PGint64(x) (x)
+#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#define PGint32(x) PG_BSWAP32(x)
+#define PGint64(x) PG_BSWAP64(x)
+#elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)
#define PGint32(x) (x)
#define PGint64(x) (x)
+#elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _LITTLE_ENDIAN)
+#define PGint32(x) PG_BSWAP32(x)
+#define PGint64(x) PG_BSWAP64(x)
#else
-#define PGint16(x) __bswap_16 (x)
-#define PGint32(x) __bswap_32 (x)
-#define PGint64(x) __bswap_64 (x)
+#error "Cannot determine byte order."
#endif
const char *build_conninfo(const char *db, const char *username, const char *password, const char *host, const char *port);
<severity>0</severity>
</rule>
+ <!-- array() instead of [] for initialisation -->
+ <rule ref="Generic.Arrays.DisallowShortArraySyntax.Found" />
relation_members TEXT[];
relMember RECORD;
linkedplacex RECORD;
+ addr_item RECORD;
search_diameter FLOAT;
search_prevdiameter FLOAT;
search_maxrank INTEGER;
parent_place_id_rank = 0;
- -- convert isin to array of tokenids
+ -- convert address store to array of tokenids
--DEBUG: RAISE WARNING 'Starting address search';
isin_tokens := '{}'::int[];
IF NEW.address IS NOT NULL THEN
- isin := avals(NEW.address);
- IF array_upper(isin, 1) IS NOT NULL THEN
- FOR i IN 1..array_upper(isin, 1) LOOP
- -- TODO further split terms with comma and semicolon
- address_street_word_id := get_name_id(make_standard_name(isin[i]));
+ FOR addr_item IN SELECT * FROM each(NEW.address)
+ LOOP
+ IF addr_item.key IN ('city', 'tiger:county', 'state', 'suburb', 'province', 'district', 'region', 'county', 'municipality', 'hamlet', 'village', 'subdistrict', 'town', 'neighbourhood', 'quarter', 'parish') THEN
+ address_street_word_id := get_name_id(make_standard_name(addr_item.value));
IF address_street_word_id IS NOT NULL AND NOT(ARRAY[address_street_word_id] <@ isin_tokens) THEN
- nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
isin_tokens := isin_tokens || address_street_word_id;
END IF;
-
- -- merge word into address vector
- address_street_word_id := get_word_id(make_standard_name(isin[i]));
+ address_street_word_id := get_word_id(make_standard_name(addr_item.value));
IF address_street_word_id IS NOT NULL THEN
nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
END IF;
- END LOOP;
- END IF;
- END IF;
+ END IF;
+ IF addr_item.key = 'is_in' THEN
+ -- is_in items need splitting
+ isin := regexp_split_to_array(addr_item.value, E'[;,]');
+ IF array_upper(isin, 1) IS NOT NULL THEN
+ FOR i IN 1..array_upper(isin, 1) LOOP
+ address_street_word_id := get_name_id(make_standard_name(isin[i]));
+ IF address_street_word_id IS NOT NULL AND NOT(ARRAY[address_street_word_id] <@ isin_tokens) THEN
+ isin_tokens := isin_tokens || address_street_word_id;
+ END IF;
- -- %NOTIGERDATA% IF 0 THEN
- -- for the USA we have an additional address table. Merge in zip codes from there too
- IF NEW.rank_search = 26 AND NEW.country_code = 'us' THEN
- FOR location IN SELECT distinct postcode from location_property_tiger where parent_place_id = NEW.place_id LOOP
- address_street_word_id := get_name_id(make_standard_name(location.postcode));
- nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
- isin_tokens := isin_tokens || address_street_word_id;
-
- -- also merge in the single word version
- address_street_word_id := get_word_id(make_standard_name(location.postcode));
- nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
+ -- merge word into address vector
+ address_street_word_id := get_word_id(make_standard_name(isin[i]));
+ IF address_street_word_id IS NOT NULL THEN
+ nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
+ END IF;
+ END LOOP;
+ END IF;
+ END IF;
END LOOP;
END IF;
- --DEBUG: RAISE WARNING 'Tiger postcodes collected';
- -- %NOTIGERDATA% END IF;
+ nameaddress_vector := array_merge(nameaddress_vector, isin_tokens);
-- RAISE WARNING 'ISIN: %', isin_tokens;
END LOOP;
--DEBUG: RAISE WARNING 'address computed';
- -- try using the isin value to find parent places
- IF array_upper(isin_tokens, 1) IS NOT NULL THEN
- FOR i IN 1..array_upper(isin_tokens, 1) LOOP
---RAISE WARNING ' getNearestNamedFeature: % % % %',NEW.partition, place_centroid, search_maxrank, isin_tokens[i];
- IF NOT ARRAY[isin_tokens[i]] <@ nameaddress_vector THEN
-
- FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP
-
---RAISE WARNING ' ISIN: %',location;
-
- IF location.rank_search > 4 THEN
- nameaddress_vector := array_merge(nameaddress_vector, location.keywords::integer[]);
- INSERT INTO place_addressline (place_id, address_place_id, fromarea, isaddress, distance, cached_rank_address)
- VALUES (NEW.place_id, location.place_id, false, NOT address_havelevel[location.rank_address], location.distance, location.rank_address);
- IF NEW.postcode is null AND location.postcode is not null
- AND NOT address_havelevel[location.rank_address] THEN
- NEW.postcode := location.postcode;
- END IF;
-
- address_havelevel[location.rank_address] := true;
-
- IF location.rank_address > parent_place_id_rank THEN
- NEW.parent_place_id = location.place_id;
- parent_place_id_rank = location.rank_address;
- END IF;
- END IF;
- END LOOP;
-
- END IF;
-
- END LOOP;
- END IF;
- --DEBUG: RAISE WARNING 'isin tokens processed';
-
-- for long ways we should add search terms for the entire length
IF st_length(NEW.geometry) > 0.05 THEN
CREATE INDEX idx_osmline_parent_place_id ON location_property_osmline USING BTREE (parent_place_id) {ts:search-index};
-CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST (centroid) {ts:address-index};
-
DROP INDEX IF EXISTS place_id_idx;
CREATE UNIQUE INDEX idx_place_osm_unique on place using btree(osm_id,osm_type,class,type) {ts:address-index};
$$
LANGUAGE plpgsql;
-create or replace function getNearestNamedFeature(in_partition INTEGER, point GEOMETRY, maxrank INTEGER, isin_token INTEGER) RETURNS setof nearfeature AS $$
-DECLARE
- r nearfeature%rowtype;
-BEGIN
-
--- start
- IF in_partition = -partition- THEN
- FOR r IN
- SELECT place_id, name_vector, address_rank, search_rank,
- ST_Distance(centroid, point) as distance, null as isguess
- FROM search_name_-partition-
- WHERE name_vector @> ARRAY[isin_token]
- AND search_rank < maxrank
- UNION ALL
- SELECT place_id, name_vector, address_rank, search_rank,
- ST_Distance(centroid, point) as distance, null as isguess
- FROM search_name_country
- WHERE name_vector @> ARRAY[isin_token]
- AND search_rank < maxrank
- ORDER BY distance ASC limit 1
- LOOP
- RETURN NEXT r;
- END LOOP;
- RETURN;
- END IF;
--- end
-
- RAISE EXCEPTION 'Unknown partition %', in_partition;
-END
-$$
-LANGUAGE plpgsql;
-
create or replace function getNearestNamedRoadFeature(in_partition INTEGER, point GEOMETRY, isin_token INTEGER[])
RETURNS setof nearfeature AS $$
DECLARE
INSERT INTO search_name (place_id, search_rank, address_rank, importance, country_code, name_vector, nameaddress_vector, centroid)
values (in_place_id, in_rank_search, in_rank_address, in_importance, in_country_code, in_name_vector, in_nameaddress_vector, in_centroid);
- IF in_rank_search <= 4 THEN
- DELETE FROM search_name_country WHERE place_id = in_place_id;
- IF in_rank_address > 0 THEN
- INSERT INTO search_name_country (place_id, search_rank, address_rank, name_vector, centroid)
- values (in_place_id, in_rank_search, in_rank_address, in_name_vector, in_geometry);
- END IF;
- RETURN TRUE;
- END IF;
-
-- start
IF in_partition = -partition- THEN
DELETE FROM search_name_-partition- values WHERE place_id = in_place_id;
BEGIN
DELETE from search_name WHERE place_id = in_place_id;
- DELETE from search_name_country WHERE place_id = in_place_id;
-- start
IF in_partition = -partition- THEN
CREATE TABLE location_area_country () INHERITS (location_area_large) {ts:address-data};
CREATE INDEX idx_location_area_country_geometry ON location_area_country USING GIST (geometry) {ts:address-index};
-CREATE TABLE search_name_country () INHERITS (search_name_blank) {ts:address-data};
-CREATE INDEX idx_search_name_country_place_id ON search_name_country USING BTREE (place_id) {ts:address-index};
-CREATE INDEX idx_search_name_country_name_vector ON search_name_country USING GIN (name_vector) WITH (fastupdate = off) {ts:address-index};
-
-- start
CREATE TABLE location_area_large_-partition- () INHERITS (location_area_large) {ts:address-data};
CREATE INDEX idx_location_area_large_-partition-_place_id ON location_area_large_-partition- USING BTREE (place_id) {ts:address-index};
Then search_name contains
| object | name_vector | nameaddress_vector |
| N1 | foo | the road |
+
+ Scenario: Some addr: tags are added to address when the name exists
+ Given the scene roads-with-pois
+ And the places
+ | osm | class | type | name | geometry |
+ | N1 | place | state | new york | 80 80 |
+ | N1 | place | city | bonn | 81 81 |
+ | N1 | place | suburb | smalltown| 80 81 |
+ And the named places
+ | osm | class | type | addr+city | addr+state | addr+suburb | geometry |
+ | W1 | highway | service | bonn | New York | Smalltown | :w-north |
+ When importing
+ Then search_name contains
+ | object | nameaddress_vector |
+ | W1 | bonn, new york, smalltown |
+
+ Scenario: A known addr:* tag is not added if the name is unknown
+ Given the scene roads-with-pois
+ And the places
+ | osm | class | type | name | addr+city | geometry |
+ | W1 | highway | residential | Road | Nandu | :w-north |
+ When importing
+ Then search_name contains not
+ | object | nameaddress_vector |
+ | W1 | nandu |
+
+ Scenario: addr:postcode is not added to the address terms
+ Given the scene roads-with-pois
+ And the places
+ | osm | class | type | name+ref | geometry |
+ | N1 | place | state | 12345 | 80 80 |
+ And the named places
+ | osm | class | type | addr+postcode | geometry |
+ | W1 | highway | residential | 12345 | :w-north |
+ When importing
+ Then search_name contains not
+ | object | nameaddress_vector |
+ | W1 | 12345 |
+
+ Scenario: is_in is split and added to the address search terms
+ Given the scene roads-with-pois
+ And the places
+ | osm | class | type | name | geometry |
+ | N1 | place | state | new york | 80 80 |
+ | N1 | place | city | bonn | 81 81 |
+ | N1 | place | suburb | smalltown| 80 81 |
+ And the named places
+ | osm | class | type | addr+is_in | geometry |
+ | W1 | highway | service | bonn, New York, Smalltown | :w-north |
+ When importing
+ Then search_name contains
+ | object | nameaddress_vector |
+ | W1 | bonn, new york, smalltown |
+
context.db.commit()
-@then("search_name contains")
-def check_search_name_contents(context):
+@then("search_name contains(?P<exclude> not)?")
+def check_search_name_contents(context, exclude):
cur = context.db.cursor(cursor_factory=psycopg2.extras.DictCursor)
for row in context.table:
FROM word, (SELECT unnest(%s) as term) t
WHERE word_token = make_standard_name(t.term)""",
(terms,))
- ok_(subcur.rowcount >= len(terms),
- "No word entry found for " + row[h])
+ if not exclude:
+ ok_(subcur.rowcount >= len(terms),
+ "No word entry found for " + row[h])
for wid in subcur:
- assert_in(wid[0], res[h],
- "Missing term for %s/%s: %s" % (pid, h, wid[1]))
+ if exclude:
+ assert_not_in(wid[0], res[h],
+ "Found term for %s/%s: %s" % (pid, h, wid[1]))
+ else:
+ assert_in(wid[0], res[h],
+ "Missing term for %s/%s: %s" % (pid, h, wid[1]))
else:
assert_db_column(res, h, row[h], context)
);
$this->assertEquals(
array(
- ['', 0, 2],
- ['', 0.12558103905863, 1.9960534568565],
- ['', 0.25066646712861, 1.984229402629]
+ array('', 0, 2),
+ array('', 0.12558103905863, 1.9960534568565),
+ array('', 0.25066646712861, 1.984229402629)
),
array_splice($aPoints, 0, 3)
);
);
$this->assertEquals(
array(
- [10, 21],
- [10.062790519529, 20.998026728428],
- [10.125333233564, 20.992114701314]
+ array(10, 21),
+ array(10.062790519529, 20.998026728428),
+ array(10.125333233564, 20.992114701314)
),
array_splice($aPoints, 0, 3)
);
// POLYGON
$this->assertEquals(
array(
- ['30', '10'],
- ['40', '40'],
- ['20', '40'],
- ['10', '20'],
- ['30', '10']
+ array('30', '10'),
+ array('40', '40'),
+ array('20', '40'),
+ array('10', '20'),
+ array('30', '10')
),
geometryText2Points('POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))', $fRadius)
);
// MULTIPOLYGON
$this->assertEquals(
array(
- ['30', '20'], // first polygon only
- ['45', '40'],
- ['10', '40'],
- ['30', '20'],
+ array('30', '20'), // first polygon only
+ array('45', '40'),
+ array('10', '40'),
+ array('30', '20'),
),
geometryText2Points('MULTIPOLYGON(((30 20, 45 40, 10 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))', $fRadius)
);
private function closestHouseNumberEvenOddOther($startnumber, $endnumber, $fraction, $aExpected)
{
- foreach (['even', 'odd', 'other'] as $itype) {
+ foreach (array('even', 'odd', 'other') as $itype) {
$this->assertEquals(
$aExpected[$itype],
- closestHouseNumber([
+ closestHouseNumber(array(
'startnumber' => $startnumber,
'endnumber' => $endnumber,
'fraction' => $fraction,
'interpolationtype' => $itype
- ]),
+ )),
"$startnumber => $endnumber, $fraction, $itype"
);
}
public function testClosestHouseNumber()
{
- $this->closestHouseNumberEvenOddOther(50, 100, 0.5, ['even' => 76, 'odd' => 75, 'other' => 75]);
+ $this->closestHouseNumberEvenOddOther(50, 100, 0.5, array('even' => 76, 'odd' => 75, 'other' => 75));
// upper bound
- $this->closestHouseNumberEvenOddOther(50, 100, 1.5, ['even' => 100, 'odd' => 100, 'other' => 100]);
+ $this->closestHouseNumberEvenOddOther(50, 100, 1.5, array('even' => 100, 'odd' => 100, 'other' => 100));
// lower bound
- $this->closestHouseNumberEvenOddOther(50, 100, -0.5, ['even' => 50, 'odd' => 50, 'other' => 50]);
+ $this->closestHouseNumberEvenOddOther(50, 100, -0.5, array('even' => 50, 'odd' => 50, 'other' => 50));
// fraction 0
- $this->closestHouseNumberEvenOddOther(50, 100, 0, ['even' => 50, 'odd' => 51, 'other' => 50]);
+ $this->closestHouseNumberEvenOddOther(50, 100, 0, array('even' => 50, 'odd' => 51, 'other' => 50));
// start == end
- $this->closestHouseNumberEvenOddOther(50, 50, 0.5, ['even' => 50, 'odd' => 50, 'other' => 50]);
+ $this->closestHouseNumberEvenOddOther(50, 50, 0.5, array('even' => 50, 'odd' => 50, 'other' => 50));
}
}
public function testGetBool()
{
- $oParams = new ParameterParser([
+ $oParams = new ParameterParser(array(
'bool1' => '1',
'bool2' => '0',
'bool3' => 'true',
'bool4' => 'false',
'bool5' => ''
- ]);
+ ));
$this->assertSame(false, $oParams->getBool('non-exists'));
$this->assertSame(true, $oParams->getBool('non-exists', true));
public function testGetInt()
{
- $oParams = new ParameterParser([
+ $oParams = new ParameterParser(array(
'int1' => '5',
'int2' => '-1',
'int3' => 0
- ]);
+ ));
$this->assertSame(false, $oParams->getInt('non-exists'));
$this->assertSame(999, $oParams->getInt('non-exists', 999));
public function testGetIntWithNonNumber()
{
$this->setExpectedException(Exception::class, "Integer number expected for parameter 'int4'");
- (new ParameterParser(['int4' => 'a']))->getInt('int4');
+ (new ParameterParser(array('int4' => 'a')))->getInt('int4');
}
public function testGetIntWithEmpytString()
{
$this->setExpectedException(Exception::class, "Integer number expected for parameter 'int5'");
- (new ParameterParser(['int5' => '']))->getInt('int5');
+ (new ParameterParser(array('int5' => '')))->getInt('int5');
}
public function testGetFloat()
{
- $oParams = new ParameterParser([
+ $oParams = new ParameterParser(array(
'float1' => '1.0',
'float2' => '-5',
'float3' => 0
- ]);
+ ));
$this->assertSame(false, $oParams->getFloat('non-exists'));
$this->assertSame(999, $oParams->getFloat('non-exists', 999));
public function testGetFloatWithEmptyString()
{
$this->setExpectedException(Exception::class, "Floating-point number expected for parameter 'float4'");
- (new ParameterParser(['float4' => '']))->getFloat('float4');
+ (new ParameterParser(array('float4' => '')))->getFloat('float4');
}
public function testGetFloatWithTextString()
{
$this->setExpectedException(Exception::class, "Floating-point number expected for parameter 'float5'");
- (new ParameterParser(['float5' => 'a']))->getFloat('float5');
+ (new ParameterParser(array('float5' => 'a')))->getFloat('float5');
}
public function testGetFloatWithInvalidNumber()
{
$this->setExpectedException(Exception::class, "Floating-point number expected for parameter 'float6'");
- (new ParameterParser(['float6' => '-55.']))->getFloat('float6');
+ (new ParameterParser(array('float6' => '-55.')))->getFloat('float6');
}
public function testGetString()
{
- $oParams = new ParameterParser([
+ $oParams = new ParameterParser(array(
'str1' => 'abc',
'str2' => '',
'str3' => '0'
- ]);
+ ));
$this->assertSame(false, $oParams->getString('non-exists'));
$this->assertSame('default', $oParams->getString('non-exists', 'default'));
public function testGetSet()
{
- $oParams = new ParameterParser([
+ $oParams = new ParameterParser(array(
'val1' => 'foo',
'val2' => '',
'val3' => 0
- ]);
+ ));
- $this->assertSame(false, $oParams->getSet('non-exists', ['foo', 'bar']));
- $this->assertSame('default', $oParams->getSet('non-exists', ['foo', 'bar'], 'default'));
- $this->assertSame('foo', $oParams->getSet('val1', ['foo', 'bar']));
+ $this->assertSame(false, $oParams->getSet('non-exists', array('foo', 'bar')));
+ $this->assertSame('default', $oParams->getSet('non-exists', array('foo', 'bar'), 'default'));
+ $this->assertSame('foo', $oParams->getSet('val1', array('foo', 'bar')));
- $this->assertSame(false, $oParams->getSet('val2', ['foo', 'bar']));
- $this->assertSame(0, $oParams->getSet('val3', ['foo', 'bar']));
+ $this->assertSame(false, $oParams->getSet('val2', array('foo', 'bar')));
+ $this->assertSame(0, $oParams->getSet('val3', array('foo', 'bar')));
}
public function testGetSetWithValueNotInSet()
{
$this->setExpectedException(Exception::class, "Parameter 'val4' must be one of: foo, bar");
- (new ParameterParser(['val4' => 'faz']))->getSet('val4', ['foo', 'bar']);
+ (new ParameterParser(array('val4' => 'faz')))->getSet('val4', array('foo', 'bar'));
}
public function testGetStringList()
{
- $oParams = new ParameterParser([
+ $oParams = new ParameterParser(array(
'list1' => ',a,b,c,,c,d',
'list2' => 'a',
'list3' => '',
'list4' => '0'
- ]);
+ ));
$this->assertSame(false, $oParams->getStringList('non-exists'));
- $this->assertSame(['a', 'b'], $oParams->getStringList('non-exists', ['a', 'b']));
- $this->assertSame(['a', 'b', 'c', 'c', 'd'], $oParams->getStringList('list1'));
- $this->assertSame(['a'], $oParams->getStringList('list2'));
+ $this->assertSame(array('a', 'b'), $oParams->getStringList('non-exists', array('a', 'b')));
+ $this->assertSame(array('a', 'b', 'c', 'c', 'd'), $oParams->getStringList('list1'));
+ $this->assertSame(array('a'), $oParams->getStringList('list2'));
$this->assertSame(false, $oParams->getStringList('list3'));
$this->assertSame(false, $oParams->getStringList('list4'));
}
public function testGetPreferredLanguages()
{
- $oParams = new ParameterParser(['accept-language' => '']);
- $this->assertSame([
+ $oParams = new ParameterParser(array('accept-language' => ''));
+ $this->assertSame(array(
'short_name:default' => 'short_name:default',
'name:default' => 'name:default',
'short_name' => 'short_name',
'official_name' => 'official_name',
'ref' => 'ref',
'type' => 'type'
- ], $oParams->getPreferredLanguages('default'));
+ ), $oParams->getPreferredLanguages('default'));
- $oParams = new ParameterParser(['accept-language' => 'de,en']);
- $this->assertSame([
+ $oParams = new ParameterParser(array('accept-language' => 'de,en'));
+ $this->assertSame(array(
'short_name:de' => 'short_name:de',
'name:de' => 'name:de',
'short_name:en' => 'short_name:en',
'official_name' => 'official_name',
'ref' => 'ref',
'type' => 'type'
- ], $oParams->getPreferredLanguages('default'));
+ ), $oParams->getPreferredLanguages('default'));
- $oParams = new ParameterParser(['accept-language' => 'fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3']);
- $this->assertSame([
+ $oParams = new ParameterParser(array('accept-language' => 'fr-ca,fr;q=0.8,en-ca;q=0.5,en;q=0.3'));
+ $this->assertSame(array(
'short_name:fr-ca' => 'short_name:fr-ca',
'name:fr-ca' => 'name:fr-ca',
'short_name:fr' => 'short_name:fr',
'official_name' => 'official_name',
'ref' => 'ref',
'type' => 'type',
- ], $oParams->getPreferredLanguages('default'));
+ ), $oParams->getPreferredLanguages('default'));
}
}
sudo apt-get install -y -qq python3-dev python3-pip python3-psycopg2 php5-cgi
-pip3 install --quiet behave nose pytidylib psycopg2
+pip3 install --quiet behave nose pytidylib psycopg2-binary
# Travis uses phpenv to support multiple PHP versions. We need to make sure
# these packages get installed to the phpenv-set PHP (below /home/travis/.phpenv/),
// we initialize these to avoid warnings in our logfile
$sViewBox = '';
$bShowPolygons = '';
-$aExcludePlaceIDs = [];
+$aExcludePlaceIDs = array();
$sMoreURL = '';
include(CONST_BasePath.'/lib/template/search-'.$sOutputFormat.'.php');
$aPlace = array_merge($aPlace, $aOutlineResult);
}
} else {
- $aPlace = [];
+ $aPlace = array();
}
logEnd($oDB, $hLog, sizeof($aPlace)?1:0);