Skip to content

Commit

Permalink
👽 the big php7 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dphiffer committed Dec 27, 2017
2 parents eb5b647 + 17e533b commit 1c9467e
Show file tree
Hide file tree
Showing 127 changed files with 23,380 additions and 1,979 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*~
.vagrant
www/include/config_dev.php
www/include/secrets_dev.php
www/include/config_local*.php
www/include/secrets*.php
www/test*.php
tests/coverage.state
Expand Down
42 changes: 37 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ templates:
secret:
php -q ./bin/generate_secret.php

countries:
php -q ./bin/mk_countries.php

setup:
if test ! -f www/include/secrets.php; then cp www/include/secrets.php.example www/include/secrets.php; fi
ubuntu/setup-ubuntu.sh
Expand All @@ -29,12 +32,20 @@ setup-nossl:
ubuntu/setup-db.sh wof_api wof_api
ubuntu/setup-apache-conf.sh nossl

mapzen: styleguide mapzenjs refill
mapzen: styleguide favicons mapzenjs refill

styleguide:
if test -e www/css/mapzen.styleguide.css; then cp www/css/mapzen.styleguide.css www/css/mapzen.styleguide.css.bak; fi
curl -s -o www/css/mapzen.styleguide.css https://mapzen.com/common/styleguide/styles/styleguide.css
curl -s -o www/css/mapzen.website.css https://mapzen.com/common/styleguide/styles/website.css
curl -s -o www/javascript/mapzen.styleguide.min.js https://mapzen.com/common/styleguide/scripts/mapzen-styleguide.min.js
curl -s -o www/common/styleguide/images/background/contour_darkpurple2_lg.png https://mapzen.com/common/styleguide/images/background/contour_darkpurple2_lg.png

favicons:
curl -s -o www/images/favicons/apple-touch-icon.png https://mapzen.com/common/styleguide/images/favicons/apple-touch-icon.png
curl -s -o www/images/favicons/favicon-16x16.png https://mapzen.com/common/styleguide/images/favicons/favicon-16x16.png
curl -s -o www/images/favicons/favicon-32x32.png https://mapzen.com/common/styleguide/images/favicons/favicon-32x32.png
curl -s -o www/images/favicons/manifest.json https://mapzen.com/common/styleguide/images/favicons/manifest.json
curl -s -o www/images/favicons/safari-pinned-tab.svg https://mapzen.com/common/styleguide/images/favicons/safari-pinned-tab.svg

tangram:
curl -s -o www/javascript/tangram.js https://mapzen.com/tangram/tangram.debug.js
Expand All @@ -44,25 +55,46 @@ refill:
curl -s -o www/tangram/refill-style.zip https://mapzen.com/carto/refill-style/refill-style.zip

mapzenjs:
curl -s -o www/css/mapzen.js.css https://mapzen.com/js/mapzen.css
curl -s -o www/javascript/mapzen.js https://mapzen.com/js/mapzen.js
curl -s -o www/javascript/mapzen.min.js https://mapzen.com/js/mapzen.min.js
#curl -s -o www/css/mapzen.js.css https://mapzen.com/js/mapzen.css
#curl -s -o www/javascript/mapzen.js https://mapzen.com/js/mapzen.js
#curl -s -o www/javascript/mapzen.min.js https://mapzen.com/js/mapzen.min.js

whosonfirstjs:
curl -s -o www/javascript/mapzen.whosonfirst.uri.js https://raw.githubusercontent.com/whosonfirst/js-mapzen-whosonfirst/master/src/mapzen.whosonfirst.uri.js
curl -s -o www/javascript/mapzen.places.api.js https://raw.githubusercontent.com/whosonfirst/js-mapzen-whosonfirst/master/src/mapzen.places.api.js
curl -s -o www/javascript/mapzen.whosonfirst.geojson.js https://raw.githubusercontent.com/whosonfirst/js-mapzen-whosonfirst/master/src/mapzen.whosonfirst.geojson.js

chrome:
curl -s -o www/css/mapzen.whosonfirst.chrome.css https://raw.githubusercontent.com/whosonfirst/css-mapzen-whosonfirst/master/css/mapzen.whosonfirst.chrome.css
curl -s -o www/javascript/mapzen.whosonfirst.chrome.js https://raw.githubusercontent.com/whosonfirst/js-mapzen-whosonfirst/master/src/mapzen.whosonfirst.chrome.js
curl -s -o www/javascript/mapzen.whosonfirst.chrome.init.js https://raw.githubusercontent.com/whosonfirst/js-mapzen-whosonfirst/master/src/mapzen.whosonfirst.chrome.init.js

whosonfirst:
curl -s -o www/include/lib_whosonfirst_brands_sizes.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_brands_sizes.php
curl -s -o www/include/lib_whosonfirst_brands_sizes_spec.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_brands_sizes_spec.php
curl -s -o www/include/lib_whosonfirst_placetypes.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_placetypes.php
curl -s -o www/include/lib_whosonfirst_placetypes_spec.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_placetypes_spec.php
curl -s -o www/include/lib_whosonfirst_sources.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_sources.php
curl -s -o www/include/lib_whosonfirst_sources_spec.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_sources_spec.php
curl -s -o www/include/lib_whosonfirst_uri.php https://raw.githubusercontent.com/whosonfirst/flamework-whosonfirst/master/www/include/lib_whosonfirst_uri.php

leaflet-locate:
curl -s -o www/javascript/L.Control.Locate.min.js https://raw.githubusercontent.com/domoritz/leaflet-locatecontrol/gh-pages/dist/L.Control.Locate.min.js
curl -s -o www/javascript/L.Control.Locate.js https://raw.githubusercontent.com/domoritz/leaflet-locatecontrol/gh-pages/src/L.Control.Locate.js
curl -s -o www/css/L.Control.Locate.css https://raw.githubusercontent.com/domoritz/leaflet-locatecontrol/gh-pages/dist/L.Control.Locate.css
curl -s -o www/css/L.Control.Locate.min.css https://raw.githubusercontent.com/domoritz/leaflet-locatecontrol/gh-pages/dist/L.Control.Locate.min.css

LEAFLET_MARKERCLUSTER_VERSION = 1.1.0
leaflet-markercluster:
curl -s -L -o /tmp/leaflet-markercluster.zip https://github.com/Leaflet/Leaflet.markercluster/archive/v$(LEAFLET_MARKERCLUSTER_VERSION).zip
unzip -q /tmp/leaflet-markercluster.zip -d /tmp
cp /tmp/Leaflet.markercluster-$(LEAFLET_MARKERCLUSTER_VERSION)/dist/leaflet.markercluster.js www/javascript/leaflet.markercluster.min.js
cp /tmp/Leaflet.markercluster-$(LEAFLET_MARKERCLUSTER_VERSION)/dist/leaflet.markercluster-src.js www/javascript/leaflet.markercluster.js
cp /tmp/Leaflet.markercluster-$(LEAFLET_MARKERCLUSTER_VERSION)/dist/MarkerCluster.css www/css/leaflet.markercluster.css
cp /tmp/Leaflet.markercluster-$(LEAFLET_MARKERCLUSTER_VERSION)/dist/MarkerCluster.Default.css www/css/leaflet.markercluster.default.css
rm -rf /tmp/Leaflet.markercluster-$(LEAFLET_MARKERCLUSTER_VERSION)
rm /tmp/leaflet-markercluster.zip

dev-to-master:
git checkout master
git pull origin dev
Expand Down
6 changes: 4 additions & 2 deletions bin/disable_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ PROJECT=`dirname $BIN`

WWW="${PROJECT}/www"
INCLUDE="${WWW}/include"
CONFIG="${INCLUDE}/config.php"

${PERL} -p -i -e "s/\['cfg'\]\['site_disabled'\]\s*=\s*[^;];/['cfg']['site_disabled'] = 1;/" ${CONFIG}
for CONFIG in `ls -a ${INCLUDE}/config.php ${INCLUDE}/config_local*.php`
do
${PERL} -p -i -e "s/\['cfg'\]\['site_disabled'\]\s*=\s*[^;];/['cfg']['site_disabled'] = 1;/" ${CONFIG}
done

exit 0
5 changes: 4 additions & 1 deletion bin/enable_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ WWW="${PROJECT}/www"
INCLUDE="${WWW}/include"
CONFIG="${INCLUDE}/config.php"

${PERL} -p -i -e "s/\['cfg'\]\['site_disabled'\]\s*=\s*[^;];/['cfg']['site_disabled'] = 0;/" ${CONFIG}
for CONFIG in `ls -a ${INCLUDE}/config.php ${INCLUDE}/config_local*.php`
do
${PERL} -p -i -e "s/\['cfg'\]\['site_disabled'\]\s*=\s*[^;];/['cfg']['site_disabled'] = 0;/" ${CONFIG}
done

exit 0
63 changes: 63 additions & 0 deletions bin/mk_countries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

include("init_local.php");
loadlib("whosonfirst_places");
loadlib("api_whosonfirst_utils");

$_REQUEST['placetype'] = 'country';
$filters = api_whosonfirst_utils_search_filters();

$args = array(
'per_page' => 500
);

$php = '<' . '?php';
$now = date('Y-m-d H:i:s');

$head = <<<END
$php
# this file was also generated by robots on $now
# https://github.com/whosonfirst/whosonfirst-www-api/blob/master/bin/mk_countries.php
# https://github.com/whosonfirst/whosonfirst-www-api/blob/master/Makefile
########################################################################
\$GLOBALS['whosonfirst_countries'] = array(
END;

$fh = fopen('www/include/lib_whosonfirst_countries.php', 'w');
fwrite($fh, $head);

$countries = array();
$rsp = whosonfirst_places_search('', $filters, $args);
foreach ($rsp['rows'] as $place) {
$esc_id = intval($place['wof:id']);
$esc_name = addslashes($place['wof:name']);
$esc_code = addslashes($place['iso:country']);
$countries[$esc_code] = array(
'wof:id' => $esc_id,
'wof:name' => $place['wof:name']
);
$country = <<<END
'{$esc_code}' => array(
'wof:id' => $esc_id,
'wof:name' => '$esc_name'
),
END;
fwrite($fh, $country);
}

$foot = <<<END
);
# the end
END;

fwrite($fh, $foot);
fclose($fh);

$countries_json = json_encode($countries);
file_put_contents('www/javascript/whosonfirst_countries.js', "var whosonfirst_countries = $countries_json;");
75 changes: 75 additions & 0 deletions config/whosonfirst-www-api-elasticsearch.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
################################
# Elasticsearch
################################

# Elasticsearch home directory
#ES_HOME=/usr/share/elasticsearch

# Elasticsearch configuration directory
#CONF_DIR=/etc/elasticsearch

# Elasticsearch data directory
#DATA_DIR=/var/lib/elasticsearch

# Elasticsearch logs directory
#LOG_DIR=/var/log/elasticsearch

# Elasticsearch PID directory
#PID_DIR=/var/run/elasticsearch

# Heap size defaults to 256m min, 1g max
# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g
#ES_HEAP_SIZE=2g

# Heap new generation
#ES_HEAP_NEWSIZE=

# Maximum direct memory
#ES_DIRECT_SIZE=

# Additional Java OPTS
ES_JAVA_OPTS=-Dmapper.allow_dots_in_name=true

# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true

# Path to the GC log file
#ES_GC_LOG_FILE=/var/log/elasticsearch/gc.log

################################
# Elasticsearch service
################################

# SysV init.d
#
# When executing the init script, this user will be used to run the elasticsearch service.
# The default value is 'elasticsearch' and is declared in the init.d file.
# Note that this setting is only used by the init script. If changed, make sure that
# the configured user can read and write into the data, work, plugins and log directories.
# For systemd service, the user is usually configured in file /usr/lib/systemd/system/elasticsearch.service
#ES_USER=elasticsearch
#ES_GROUP=elasticsearch

# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
ES_STARTUP_SLEEP_TIME=5

################################
# System properties
################################

# Specifies the maximum file descriptor number that can be opened by this process
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
# /usr/lib/systemd/system/elasticsearch.service takes precedence
#MAX_OPEN_FILES=65536

# The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml (ES_HEAP_SIZE must also be set).
# When using Systemd, the LimitMEMLOCK property must be set
# in /usr/lib/systemd/system/elasticsearch.service
#MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
#MAX_MAP_COUNT=262144
Loading

0 comments on commit 1c9467e

Please sign in to comment.