name: Cookstyle
+
on:
- push
- pull_request
+
+concurrency:
+ group: ${{ github.workflow }}-{{ github.head_ref || github.ref }}
+ cancel-in-progress: true
+
jobs:
cookstyle:
name: Cookstyle
runs-on: ubuntu-latest
steps:
- name: Check out code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Setup ruby
- uses: actions/setup-ruby@v1.1.3
- - name: Cache gems
- uses: actions/cache@v2.1.4
+ uses: ruby/setup-ruby@v1
with:
- path: vendor/bundle
- key: bundle-${{ runner.OS }}-${{ hashFiles('Gemfile.lock') }}
- restore-keys: |
- bundle-${{ runner.OS }}-
- - name: Install gems
- run: |
- gem install bundler
- bundle config set deployment true
- bundle install --jobs 4 --retry 3
+ bundler-cache: true
- name: Run cookstyle
run: bundle exec cookstyle --format fuubar
name: Test Kitchen
+
on:
- push
- pull_request
+
+concurrency:
+ group: ${{ github.workflow }}-{{ github.head_ref || github.ref }}
+ cancel-in-progress: true
+
jobs:
kitchen:
name: Test Kitchen
- blogs
- civicrm
- clamav
+ - community
- db-backup
- db-base
- db-master
- logstash-forwarder
- mail
- mailman
+ - matomo
- memcached
- munin
- munin-plugins
- osmosis
- osqa
- otrs
+ - overpass
- passenger
- php
- php-apache
- php-fpm
- - piwik
- planet
- planet-current
- planet-dump
- serverinfo
- snmpd
- spamassassin
- - squid
- ssl
- stateofthemap
- subversion
- sysfs
- taginfo
- tile
- - tilecache
- tilelog
- tools
- trac
- - web-backend
- web-cgimap
- web-frontend
- web-rails
- wiki
os:
- ubuntu-2004
- include:
- - suite: trac
- os: ubuntu-1804
- exclude:
- - suite: trac
- os: ubuntu-2004
fail-fast: false
steps:
- name: Check out code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- name: Setup ruby
- uses: actions/setup-ruby@v1.1.3
- - name: Cache gems
- uses: actions/cache@v2.1.4
+ uses: ruby/setup-ruby@v1
with:
- path: vendor/bundle
- key: bundle-${{ runner.OS }}-${{ hashFiles('Gemfile.lock') }}
- restore-keys: |
- bundle-${{ runner.OS }}-
- - name: Disable apparmor for mysqld
- run: |
- sudo apt-get install apparmor-utils
- sudo aa-disable /usr/sbin/mysqld
- - name: Install gems
- run: |
- gem install bundler
- bundle config set deployment true
- bundle install --jobs 4 --retry 3
+ bundler-cache: true
- name: Run kitchen test ${{ matrix.suite }}-${{ matrix.os }}
run: bundle exec kitchen test ${{ matrix.suite }}-${{ matrix.os }}
---
driver:
name: dokken
- chef_version: 16
+ chef_version: 17
+ volumes:
+ - /var/lib/docker
env:
- container=dokken
sudo: false
platforms:
- - name: ubuntu-18.04
- driver:
- image: dokken/ubuntu-18.04
- privileged: true
- pid_one_command: /bin/systemd
- intermediate_instructions:
- - RUN /usr/bin/apt-get update -y
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
- name: clamav
run_list:
- recipe[clamav::default]
+ - name: community
+ run_list:
+ - recipe[community::default]
- name: db-backup
run_list:
- recipe[db::backup]
attributes:
logstash:
forwarder:
- filebeat.prospectors:
- - input_type: log
+ filebeat.inputs:
+ - type: filestream
+ id: apache
paths:
- /var/log/apache2/access.log
- type: apache
+ fields:
+ type: apache
+ fields_under_root: true
- name: mail
run_list:
- role[mail]
- name: mailman
run_list:
- recipe[mailman::default]
+ - name: matomo
+ run_list:
+ - recipe[matomo::default]
- name: memcached
run_list:
- recipe[memcached::default]
- name: otrs
run_list:
- recipe[otrs::default]
+ - name: overpass
+ run_list:
+ - recipe[overpass::default]
- name: passenger
run_list:
- recipe[passenger::default]
- name: php-fpm
run_list:
- recipe[php::fpm]
- - name: piwik
- run_list:
- - recipe[piwik::default]
- name: planet
run_list:
- recipe[planet::default]
- name: prometheus-server
run_list:
- recipe[prometheus::server]
+ attributes:
+ prometheus:
+ promscale: true
- name: python
run_list:
- recipe[python::default]
- name: spamassassin
run_list:
- recipe[spamassassin::default]
- - name: squid
- run_list:
- - recipe[squid::default]
- name: ssl
run_list:
- recipe[ssl::default]
- name: tile
run_list:
- recipe[tile::default]
- - name: tilecache
- run_list:
- - recipe[tilecache::default]
- name: tilelog
run_list:
- recipe[tilelog::default]
- name: trac
run_list:
- recipe[trac::default]
- - name: web-backend
- run_list:
- - recipe[web::backend]
- name: web-cgimap
run_list:
- recipe[web::cgimap]
inherit_from: .rubocop_todo.yml
AllCops:
- TargetRubyVersion: 2.7
+ TargetRubyVersion: 3.0
ChefModernize/IncludingAptDefaultRecipe:
Enabled: false
+
+Chef/Modernize/CronDFileOrTemplate:
+ Enabled: false
Layout/ExtraSpacing:
AllowForAlignment: true
# This configuration was generated by
# `rubocop --auto-gen-config`
-# on 2020-07-30 08:39:06 UTC using RuboCop version 0.88.0.
+# on 2021-05-11 07:26:15 UTC using RuboCop version 1.14.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 1038
+# Offense count: 1124
# Cop supports --auto-correct.
# Configuration parameters: .
# SupportedStyles: strings, symbols
-ChefStyle/AttributeKeys:
+Chef/Style/AttributeKeys:
EnforcedStyle: symbols
-
-# Offense count: 3
-# Configuration parameters: CountBlocks.
-Metrics/BlockNesting:
- Max: 4
ast (2.4.2)
bcrypt_pbkdf (1.1.0)
builder (3.2.4)
- chef-utils (16.10.17)
- cookstyle (7.9.0)
- rubocop (= 1.11.0)
- diff-lcs (1.4.4)
- docker-api (2.0.0)
+ chef-utils (17.10.0)
+ concurrent-ruby
+ concurrent-ruby (1.1.10)
+ cookstyle (7.32.1)
+ rubocop (= 1.25.1)
+ diff-lcs (1.5.0)
+ docker-api (2.2.0)
excon (>= 0.47.0)
multi_json
- ed25519 (1.2.4)
+ ed25519 (1.3.0)
erubi (1.10.0)
- excon (0.79.0)
- ffi (1.14.2)
+ excon (0.92.4)
+ ffi (1.15.5)
gssapi (1.3.1)
ffi (>= 1.0.1)
- gyoku (1.3.1)
+ gyoku (1.4.0)
builder (>= 2.1.2)
+ rexml (~> 3.0)
httpclient (2.8.3)
- kitchen-dokken (2.12.1)
+ kitchen-dokken (2.17.3)
docker-api (>= 1.33, < 3)
lockfile (~> 2.1)
- test-kitchen (>= 1.15, < 3)
+ test-kitchen (>= 1.15, < 4)
license-acceptance (2.1.13)
pastel (~> 0.7)
tomlrb (>= 1.2, < 3.0)
tty-prompt (~> 0.20)
little-plugger (1.1.4)
lockfile (2.1.3)
- logging (2.3.0)
+ logging (2.3.1)
little-plugger (~> 1.1)
multi_json (~> 1.14)
- mixlib-install (3.12.7)
+ mixlib-install (3.12.19)
mixlib-shellout
mixlib-versioning
thor
- mixlib-shellout (3.2.5)
+ mixlib-shellout (3.2.7)
chef-utils
mixlib-versioning (1.2.12)
multi_json (1.15.0)
net-ssh (>= 4.0.0)
net-telnet (0.1.1)
nori (2.6.0)
- parallel (1.20.1)
- parser (3.0.0.0)
+ parallel (1.21.0)
+ parser (3.1.1.0)
ast (~> 2.4.1)
pastel (0.8.0)
tty-color (~> 0.5)
- rainbow (3.0.0)
- regexp_parser (2.1.1)
- rexml (3.2.4)
- rspec (3.9.0)
- rspec-core (~> 3.9.0)
- rspec-expectations (~> 3.9.0)
- rspec-mocks (~> 3.9.0)
- rspec-core (3.9.2)
- rspec-support (~> 3.9.3)
- rspec-expectations (3.9.2)
+ rainbow (3.1.1)
+ regexp_parser (2.2.1)
+ rexml (3.2.5)
+ rspec (3.10.0)
+ rspec-core (~> 3.10.0)
+ rspec-expectations (~> 3.10.0)
+ rspec-mocks (~> 3.10.0)
+ rspec-core (3.10.2)
+ rspec-support (~> 3.10.0)
+ rspec-expectations (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.9.0)
+ rspec-support (~> 3.10.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
- rspec-mocks (3.9.1)
+ rspec-mocks (3.10.3)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.9.0)
- rspec-support (3.9.3)
- rubocop (1.11.0)
+ rspec-support (~> 3.10.0)
+ rspec-support (3.10.3)
+ rubocop (1.25.1)
parallel (~> 1.10)
- parser (>= 3.0.0.0)
+ parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
- rubocop-ast (>= 1.2.0, < 2.0)
+ rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
- rubocop-ast (1.4.1)
- parser (>= 2.7.1.5)
+ rubocop-ast (1.16.0)
+ parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
rubyntlm (0.6.3)
- rubyzip (2.3.0)
- serverspec (2.41.5)
+ rubyzip (2.3.2)
+ serverspec (2.42.0)
multi_json
rspec (~> 3.0)
rspec-its
specinfra (~> 2.72)
sfl (2.3)
- specinfra (2.82.19)
+ specinfra (2.83.1)
net-scp
net-ssh (>= 2.7)
net-telnet (= 0.1.1)
sfl
- strings (0.2.0)
+ strings (0.2.1)
strings-ansi (~> 0.2)
- unicode-display_width (~> 1.5)
+ unicode-display_width (>= 1.5, < 3.0)
unicode_utils (~> 1.4)
strings-ansi (0.2.0)
- test-kitchen (2.11.1)
+ test-kitchen (3.3.1)
bcrypt_pbkdf (~> 1.0)
chef-utils (>= 16.4.35)
ed25519 (~> 1.2)
winrm (~> 2.0)
winrm-elevated (~> 1.0)
winrm-fs (~> 1.1)
- thor (1.1.0)
- tomlrb (2.0.1)
+ thor (1.2.1)
+ tomlrb (2.0.3)
tty-box (0.7.0)
pastel (~> 0.8)
strings (~> 0.2.0)
tty-cursor (~> 0.7)
tty-color (0.6.0)
tty-cursor (0.7.1)
- tty-prompt (0.23.0)
+ tty-prompt (0.23.1)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.9.0)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.1)
- unicode-display_width (1.7.0)
+ unicode-display_width (2.2.0)
unicode_utils (1.4.0)
winrm (2.3.6)
builder (>= 2.1.2)
test-kitchen
BUNDLED WITH
- 2.1.4
+ 2.2.16
# DO NOT EDIT - This file is being maintained by Chef - use authorized_keys2 instead
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6Hw67b4cRzXDvs88XSuKpXTJmFyietVqaQvJRedQflurHay5lGdFyzfPF0P+mG9l5O/qlKzXo5xvZNe6YOGcMCuxzOYiw/bAkEd7oHYVXVJr8jWL2zqusBmf5dLZDEjMtUX9w6IQWiuSvm3To3Fsohn2UjUqEi5aULu6h39O1JtcdtmIvjB4iTmIO4Eme8FxubktDImyCvwOAJVsYQASljeaTDa+31ANqMDehXZSRjFKaVECw1RNyvYclmkbj8rLiw648/IV9xRi/SMtZlNyxrcIKQ6hKmmiyaBA6a5QEqWj7OMVYCECAoNwlWKhBmkMx7fwOh1eKKOLFeFz2kdSt grant@home-desktop-key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDuVegqS8l8WgH1T1LMGyJ4OvPeI5Kek5f5bYsHy62DLOhd4aDHCjJPegfiKCdpYde/b2kOQuwG90cl1a+6DDvNXvIDarQvfNzNWGONOtb+NM0/+IuAfSeonh8ROWRLW5ciOQi0PuPGnjD9vYdFMKtCh1lyi9KOq9DJNR0HFqEJgoZg8BoclAUdtgPzYU/fVpgwAS5mdBUTIQga3CbVsRcTWLPFKNlgY46eWYEKb9XqZIoa5AlxqH6AtYjaUQBdGzRpo/PW71VZzpZMP/dhf6illQBUyFJXL+PyVZGsckq94fkb6j3E5OkuGT55o4fEVLQaIDh2sIUB5n2emnP5On44kNTCPZiAMAC2weLv9PD7RFgTuxVTa1WsxbDqqaTueHJH1P+K4TNx2w0wfTfxqXjXKQPwGED1+xHWwOQoWT9eSarvUQF1jtQdseNsljPkJtpTiD2CHIUuCohYm0DxGYbQSl7uTLDK5HfuMMhAfBry/kNDb7CFTWKzN98Zbam8fx7e9TnCoL4MOMR8GOZyw/ITMbjmWRV5JGFfNUvqrteb9DLh99ZNDrcAawoESFLQTaXGPNYwCMcsxHxZAo8obfRGM/RbGvS+njfib6tkMwh6H/7uA1MPVLEbLejosMUzylDcfaoqGB5SryzZSVO0f7lx4JadQDCAimGBb0N3Fem8Rw== grant.slater@FRIDAY
+ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGW+K3RYYU26wSOp0DWA4OA94UeX9AZdk8aaaiV1KopY grant@home
+ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG+dY7nSVDShpfzDrgs1UaDeFbQUlXVWl4eECFu0Zo3a grant.slater@LONGS22-M
# DO NOT EDIT - This file is being maintained by Chef - use authorized_keys2 instead
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyBrnrkjzAJqXtRP0MFKlc3v4fTnrRzzebIFH8YpFRCaLKpIXWVbg5BqXuxHB/vqf/1Gknycb7bgLPbhWr+b50D+nnodiJ35HPqrQVLG6nsqxnbbVXO1IR7KsctL+Wr3GW5pBeWct9GAALn8ACAR8zZ/4V6qXDgUvh0inefcqpks1YgdPdyAGLMFy7hzI5lY8kGh58kVPXMpyJLVnGX0yUjrip9IkPrGBvMDiGDiPwLOfKGDR0s1An1GK2i4k2rPxkZzdQSbqZXaaCw3MNJkDvwSmQNQp4Rprfy5BqptwJg4PLnGGePfYbzsqYA0/Pq4ccO+NPCDxZxb2XuVjgXEg8Q== matt@horntail.openstreetmap.org
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDntpfnmWsP/9nh3JvT/AuNz3t4azrH54vKLrdtovYQ14QC66GA9EyAJel2eamyhevHQw5JU3Ic6H0ycXZus6QNn5vZKBn72/HXc/mvfRO2F5PvWVVF5LROoe1YBmYJugqpRwFekt9pIs49bbu3lZolnmmVT/uQP3sTFgErc/eqBtzgB+0OYijddQl3otzOZaZh1o4YaUvyutVb8ND3D1xgPxavWKW8B3BTDLF/Lr0wyh+CTWc1LtXVifIWpe9Muv+l+iww8AScyryLdMfcrUY+k76HwmkLbNV01hWMbfnB+4KoshFHnpmFN/Q4maoEXQpwP1II3iEKVs6QWFc4dImREtpiUJm5XeznlmfBuMac2gZPyPqSQPoUmxDTV7+umbcpw5IMGKFom6GJJJN2Az40TqNoQBAwnrJrmxzvLU8POpfYdZZfPLUB8l9nELGvIMhbRTBVpq6t99AxqvHlk3hc6yPTBFfltiBDB62QyOIEggbecnMaD1VvAkrthRITNJ9h0zdvrXM+X0pMo1QM8dBqRvrbBD7fr3gy2Oo+/XMsxf6Q8Fd7iu8oU8HYCwDexqZ8y9Nb54dOglWzSEPsTBAWf6PtBtZaXZ/VnNy3zjnJuOA99STQmqH5OPCY0eg6yRE6TILj9J4wWAXytXL9lF5YAW8JIT4+8pa4WhJoUGQz1w== zerebubuth@gmail.com
# Keep tramp happy
if [[ "$TERM" = "dumb" ]]
then
+ unsetopt PROMPT_SP
+ unsetopt PROMPT_CR
unsetopt ZLE
fi
variables :hosts => admins["hosts"]
end
+apache_module "brotli" do
+ conf "brotli.conf.erb"
+end
+
apache_module "deflate" do
conf "deflate.conf.erb"
end
# limitations under the License.
#
+unified_mode true
+
default_action [:create, :enable]
property :conf, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action [:install, :enable]
property :module, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action [:create, :enable]
property :site, :kind_of => String, :name_property => true
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+<IfModule mod_deflate.c>
+ <IfModule mod_filter.c>
+ AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml
+ AddOutputFilterByType BROTLI_COMPRESS text/css
+ AddOutputFilterByType BROTLI_COMPRESS application/x-javascript application/javascript application/ecmascript
+ AddOutputFilterByType BROTLI_COMPRESS application/rss+xml
+ AddOutputFilterByType BROTLI_COMPRESS application/xml
+ AddOutputFilterByType BROTLI_COMPRESS image/svg+xml
+ </IfModule>
+</IfModule>
node[:apt][:sources].include?(repository) ? :add : :remove
end
-apt_repository "brightbox-ruby-ng" do
- action repository_actions["brightbox-ruby-ng"]
- uri "ppa:brightbox/ruby-ng"
-end
-
apt_repository "ubuntugis-stable" do
action repository_actions["ubuntugis-stable"]
uri "ppa:ubuntugis/ppa"
uri "ppa:osmadmins/ppa"
end
-apt_repository "squid2" do
- action repository_actions["squid2"]
- uri "ppa:osmadmins/squid2"
-end
-
-apt_repository "squid3" do
- action repository_actions["squid3"]
- uri "ppa:osmadmins/squid3"
-end
-
-apt_repository "squid4" do
- action repository_actions["squid4"]
- uri "ppa:osmadmins/squid4"
-end
-
apt_repository "management-component-pack" do
action repository_actions["management-component-pack"]
uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
key "D27D666CD88E42B4"
end
-apt_repository "elasticsearch6.x" do
- action repository_actions["elasticsearch6.x"]
- uri "https://artifacts.elastic.co/packages/6.x/apt"
+apt_repository "elasticsearch8.x" do
+ action repository_actions["elasticsearch8.x"]
+ uri "https://artifacts.elastic.co/packages/8.x/apt"
distribution "stable"
components ["main"]
key "D27D666CD88E42B4"
key "7FCC7D46ACCC4CF8"
end
-apt_repository "mediawiki" do
- action repository_actions["mediawiki"]
- uri "https://releases.wikimedia.org/debian"
- distribution "jessie-mediawiki"
- components ["main"]
- key "AF380A3036A03444"
-end
-
apt_repository "docker" do
action repository_actions["docker"]
uri "https://download.docker.com/linux/ubuntu"
apt_repository "timescaledb" do
action repository_actions["timescaledb"]
- uri "ppa:timescale/timescaledb-ppa"
+ uri "https://packagecloud.io/timescale/timescaledb/ubuntu"
+ components ["main"]
+ key "https://packagecloud.io/timescale/timescaledb/gpgkey"
end
package "unattended-upgrades"
opendir(DIR, "$dir") || die "Can't open ${dir}: $!";
-while (my $file = readdir(DIR))
-{
-# print "Expiring $file\n" if $file =~ $match && $file !~ $keep;
- unlink("${dir}/${file}") if $file =~ $match && $file !~ $keep;
-}
+my @files = sort(grep($match, readdir(DIR)));
closedir(DIR);
+pop @files;
+
+for my $file (@files)
+{
+# print "Expiring $file\n" if $file !~ $keep;
+ unlink("${dir}/${file}") if $file !~ $keep;
+}
+
exit 0;
sub Monday
# DO NOT EDIT - This file is being maintained by Chef
-for prefix in chef-server chef-repository chef-git forum git lists munin osm-blog osm-donate osmf-crm osmf-ledgersmb wiki-wiki.osmfoundation.org osqa otrs prometheus sotm svn switch2osm trac wiki-board.osmfoundation.org wiki-dwg.osmfoundation.org wiki-mwg.osmfoundation.org wiki-wiki.openstreetmap.org
+for prefix in blogs chef-server chef-repository chef-git community forum git lists munin osm-blog osm-donate osmf-crm osmf-ledgersmb wiki-wiki.osmfoundation.org osqa otrs prometheus sotm svn switch2osm trac wiki-board.osmfoundation.org wiki-dwg.osmfoundation.org wiki-mwg.osmfoundation.org wiki-wiki.openstreetmap.org
do
/usr/local/bin/expire-backups --days=3 --weeks=3 --months=3 /store/backup $prefix
done
package "bind9"
-service_name = if node[:lsb][:release].to_f < 20.04
- "bind9"
- else
- "named"
- end
-
-service service_name do
+service "named" do
action [:enable, :start]
end
owner "root"
group "root"
mode "644"
- notifies :restart, "service[#{service_name}]"
+ notifies :restart, "service[named]"
end
template "/etc/bind/named.conf.options" do
group "root"
mode "644"
variables :ipv4_clients => ipv4_clients, :ipv6_clients => ipv6_clients
- notifies :restart, "service[#{service_name}]"
+ notifies :restart, "service[named]"
end
template "/etc/bind/db.10" do
owner "root"
group "root"
mode "644"
- notifies :reload, "service[#{service_name}]"
+ notifies :reload, "service[named]"
end
firewall_rule "accept-dns-udp" do
$TTL 604800
@ IN SOA <%= node[:fdqn] %>. root.openstreetmap.org. (
- 2019040301 ; Serial
+ 2021092001 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
@ IN NS <%= node[:fdqn] %>.
3.0.0 IN PTR ridley.ucl.openstreetmap.org.
+4.0.0 IN PTR snap-02.ucl.openstreetmap.org.
5.0.0 IN PTR norbert.ucl.openstreetmap.org.
6.0.0 IN PTR urmel.ucl.openstreetmap.org.
7.0.0 IN PTR faffy.ucl.openstreetmap.org.
12.0.0 IN PTR sarel.ucl.openstreetmap.org.
13.0.0 IN PTR noquiklos.ucl.openstreetmap.org.
14.0.0 IN PTR errol.ucl.openstreetmap.org.
-15.0.0 IN PTR yevaud.ucl.openstreetmap.org.
+15.0.0 IN PTR ysera.ucl.openstreetmap.org.
17.0.0 IN PTR clifford.ucl.openstreetmap.org.
19.0.0 IN PTR grindtooth.ucl.openstreetmap.org.
20.0.0 IN PTR pummelzacken.ucl.openstreetmap.org.
51.0.0 IN PTR tiamat-23.ucl.openstreetmap.org.
3.1.0 IN PTR ridley.oob.openstreetmap.org.
+4.1.0 IN PTR snap-02.oob.openstreetmap.org.
5.1.0 IN PTR norbert.oob.openstreetmap.org.
6.1.0 IN PTR urmel.oob.openstreetmap.org.
8.1.0 IN PTR zark.oob.openstreetmap.org.
12.1.0 IN PTR sarel.oob.openstreetmap.org.
13.1.0 IN PTR noquiklos.oob.openstreetmap.org.
14.1.0 IN PTR errol.oob.openstreetmap.org.
-15.1.0 IN PTR yevaud.oob.openstreetmap.org.
+15.1.0 IN PTR ysera.oob.openstreetmap.org.
17.1.0 IN PTR clifford.oob.openstreetmap.org.
19.1.0 IN PTR grindtooth.oob.openstreetmap.org.
20.1.0 IN PTR pummelzacken.oob.openstreetmap.org.
41.33.0 IN PTR thorn-04.oob.openstreetmap.org.
42.33.0 IN PTR thorn-05.oob.openstreetmap.org.
-3.48.0 IN PTR orm.ams.openstreetmap.org.
-4.48.0 IN PTR ouroboros.ams.openstreetmap.org.
-5.48.0 IN PTR ramoth.ams.openstreetmap.org.
-6.48.0 IN PTR spike-01.ams.openstreetmap.org.
-7.48.0 IN PTR spike-02.ams.openstreetmap.org.
-8.48.0 IN PTR spike-03.ams.openstreetmap.org.
9.48.0 IN PTR dulcy.ams.openstreetmap.org.
10.48.0 IN PTR ironbelly.ams.openstreetmap.org.
11.48.0 IN PTR spike-06.ams.openstreetmap.org.
13.48.0 IN PTR spike-08.ams.openstreetmap.org.
14.48.0 IN PTR tabaluga.ams.openstreetmap.org.
15.48.0 IN PTR odin.ams.openstreetmap.org.
+16.48.0 IN PTR lockheed.ams.openstreetmap.org.
+49.48.0 IN PTR snap-01.ams.openstreetmap.org.
50.48.0 IN PTR karm.ams.openstreetmap.org.
-51.48.0 IN PTR thorn-01.ams.openstreetmap.org.
52.48.0 IN PTR thorn-02.ams.openstreetmap.org.
53.48.0 IN PTR thorn-03.ams.openstreetmap.org.
-100.48.0 IN PTR pdu1.openstreetmap.org.
-101.48.0 IN PTR pdu2.openstreetmap.org.
+100.48.0 IN PTR pdu1.ams.openstreetmap.org.
+101.48.0 IN PTR pdu2.ams.openstreetmap.org.
+102.48.0 IN PTR oob1.ams.openstreetmap.org.
-3.49.0 IN PTR orm.oob.openstreetmap.org.
-4.49.0 IN PTR ouroboros.oob.openstreetmap.org.
-5.49.0 IN PTR ramoth.oob.openstreetmap.org.
-6.49.0 IN PTR spike-01.oob.openstreetmap.org.
-7.49.0 IN PTR spike-02.oob.openstreetmap.org.
-8.49.0 IN PTR spike-03.oob.openstreetmap.org.
9.49.0 IN PTR dulcy.oob.openstreetmap.org.
10.49.0 IN PTR ironbelly.oob.openstreetmap.org.
11.49.0 IN PTR spike-06.oob.openstreetmap.org.
13.49.0 IN PTR spike-08.oob.openstreetmap.org.
14.49.0 IN PTR tabaluga.oob.openstreetmap.org.
15.49.0 IN PTR odin.oob.openstreetmap.org.
+16.49.0 IN PTR lockheed.oob.openstreetmap.org.
+49.49.0 IN PTR snap-01.oob.openstreetmap.org.
50.49.0 IN PTR karm.oob.openstreetmap.org.
-51.49.0 IN PTR thorn-01.oob.openstreetmap.org.
52.49.0 IN PTR thorn-02.oob.openstreetmap.org.
53.49.0 IN PTR thorn-03.oob.openstreetmap.org.
+
+2.64.0 IN PTR fafnir.dub.openstreetmap.org.
+3.64.0 IN PTR spike-01.dub.openstreetmap.org.
+4.64.0 IN PTR spike-02.dub.openstreetmap.org.
+5.64.0 IN PTR spike-03.dub.openstreetmap.org.
+6.64.0 IN PTR idris.dub.openstreetmap.org.
+7.64.0 IN PTR konqi.dub.openstreetmap.org.
+8.64.0 IN PTR naga.dub.openstreetmap.org.
+9.64.0 IN PTR culebre.dub.openstreetmap.org.
+50.64.0 IN PTR snap-03.dub.openstreetmap.org.
+100.64.0 IN PTR pdu1.dub.openstreetmap.org.
+101.64.0 IN PTR pdu2.dub.openstreetmap.org.
+102.64.0 IN PTR oob1.dub.openstreetmap.org.
+
+2.65.0 IN PTR fafnir.oob.openstreetmap.org.
+3.65.0 IN PTR spike-01.oob.openstreetmap.org.
+4.65.0 IN PTR spike-02.oob.openstreetmap.org.
+5.65.0 IN PTR spike-03.oob.openstreetmap.org.
+6.65.0 IN PTR idris.oob.openstreetmap.org.
+7.65.0 IN PTR konqi.oob.openstreetmap.org.
+8.65.0 IN PTR naga.oob.openstreetmap.org.
+9.65.0 IN PTR culebre.oob.openstreetmap.org.
+50.65.0 IN PTR snap-03.oob.openstreetmap.org.
end
wordpress_plugin "blog.openstreetmap.org-google-sitemap-generator" do
+ action :delete
plugin "google-sitemap-generator"
site "blog.openstreetmap.org"
end
+# wordpress_plugin "blog.openstreetmap.org-www-xml-sitemap-generator-org" do
+# plugin "www-xml-sitemap-generator-org"
+# site "blog.openstreetmap.org"
+# end
+
wordpress_plugin "blog.openstreetmap.org-shareadraft" do
plugin "shareadraft"
site "blog.openstreetmap.org"
plugin "sitepress-multilingual-cms"
site "blog.openstreetmap.org"
repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
- not_if { ENV["TEST_KITCHEN"] }
+ revision "master"
+ not_if { kitchen? }
end
wordpress_plugin "blog.openstreetmap.org-wordpress-importer" do
site "blog.openstreetmap.org"
end
+wordpress_plugin "blog.openstreetmap.org-wp-piwik" do
+ plugin "wp-piwik"
+ site "blog.openstreetmap.org"
+end
+
git "/srv/blog.openstreetmap.org/casts" do
action :sync
repository "https://github.com/openstreetmap/opengeodata-podcasts.git"
depends "accounts"
depends "apache"
depends "git"
+depends "ruby"
include_recipe "accounts"
include_recipe "apache"
include_recipe "git"
-
-ruby_version = if node[:lsb][:release].to_f < 20.04
- "2.5"
- else
- "2.7"
- end
+include_recipe "ruby"
package %W[
- ruby#{ruby_version}
- ruby#{ruby_version}-dev
make
gcc
g++
libsqlite3-dev
+ sqlite3
]
-gem_package "bundler#{ruby_version}" do
- package_name "bundler"
- version "~> 2.1.4"
- gem_binary "gem#{ruby_version}"
- options "--format-executable"
-end
-
directory "/srv/blogs.openstreetmap.org" do
owner "blogs"
group "blogs"
depth 1
user "blogs"
group "blogs"
- notifies :run, "execute[/srv/blogs.openstreetmap.org/Gemfile]", :immediately
+ notifies :run, "bundle_install[/srv/blogs.openstreetmap.org]", :immediately
end
-execute "/srv/blogs.openstreetmap.org/Gemfile" do
+bundle_install "/srv/blogs.openstreetmap.org" do
action :nothing
- command "bundle#{ruby_version} install --deployment"
- cwd "/srv/blogs.openstreetmap.org"
- user "blogs"
- group "blogs"
- notifies :run, "execute[/srv/blogs.openstreetmap.org]", :immediately
+ options "--deployment"
+ user "root"
+ group "root"
+ notifies :run, "bundle_exec[/srv/blogs.openstreetmap.org]", :immediately
end
-execute "/srv/blogs.openstreetmap.org" do
+bundle_exec "/srv/blogs.openstreetmap.org" do
action :nothing
- command "bundle#{ruby_version} exec pluto build -t osm -o build"
- cwd "/srv/blogs.openstreetmap.org"
+ command "pluto build -t osm -o build"
user "blogs"
group "blogs"
end
owner "root"
group "root"
mode "0755"
- variables :ruby_version => ruby_version
end
cron_d "blogs" do
command "/usr/local/bin/blogs-update"
mailto "admins@openstreetmap.org"
end
+
+template "/etc/cron.daily/blogs-backup" do
+ source "backup.cron.erb"
+ owner "root"
+ group "root"
+ mode "0755"
+end
--- /dev/null
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+T=$(mktemp -d -t -p /var/tmp blogs.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=blogs-$D.tar.gz
+
+mkdir $T/blogs-$D
+sqlite3 /srv/blogs.openstreetmap.org/planet.db ".backup $T/blogs-$D/planet.db"
+
+export RSYNC_RSH="ssh -ax"
+
+nice tar --create --dereference --directory=$T blogs-$D | nice gzip --rsyncable -9 > $T/$B
+nice rsync --preallocate --fuzzy $T/$B backup::backup
+
+rm -rf $T
cd /srv/blogs.openstreetmap.org
-/usr/local/bin/bundle<%= @ruby_version %> exec pluto \
+<%= node[:ruby][:bundle] %> exec pluto \
--quieter \
--config=/srv/blogs.openstreetmap.org build \
--dbpath=/srv/blogs.openstreetmap.org \
default[:chef][:server][:version] = "12.17.33"
# Set the default client version
-default[:chef][:client][:version] = "16.8.14"
+default[:chef][:client][:version] = "17.10.3"
class Subversion
extend Chef::Mixin::ShellOut
+ def shell_out!(*args, **options)
+ options = args.pop if options.empty? && args.last.is_a?(Hash)
+
+ super(*args, **options)
+ end
+
def sync_command
if current_repository_matches_target_repository?
c = scm :update, new_resource.svn_arguments, verbose, authentication, proxy, "-r#{revision_int}", new_resource.destination
def svn_info
command = scm(:info)
- shell_out!(command, run_options(:cwd => cwd, :returns => [0, 1])).stdout
+ shell_out!(command, **run_options(:cwd => cwd, :returns => [0, 1])).stdout
end
def revision_int
- @revision_int ||= begin
- if new_resource.revision =~ /^\d+$/
- new_resource.revision
- else
- command = scm(:info, new_resource.repository, new_resource.svn_info_args, authentication, "-r#{new_resource.revision}")
- svn_info = shell_out!(command, run_options(:returns => [0, 1])).stdout
-
- extract_revision_info(svn_info)
- end
- end
+ @revision_int ||= if new_resource.revision =~ /^\d+$/
+ new_resource.revision
+ else
+ command = scm(:info, new_resource.repository, new_resource.svn_info_args, authentication, "-r#{new_resource.revision}")
+ svn_info = shell_out!(command, **run_options(:returns => [0, 1])).stdout
+
+ extract_revision_info(svn_info)
+ end
end
end
end
end
end
+ubuntu_release = if node[:lsb][:release].to_f < 22.04
+ node[:lsb][:release]
+ else
+ "20.04"
+ end
+
remote_file "#{cache_dir}/#{chef_package}" do
- source "https://packages.chef.io/files/stable/chef/#{chef_version}/ubuntu/#{node[:lsb][:release]}/#{chef_package}"
+ source "https://packages.chef.io/files/stable/chef/#{chef_version}/ubuntu/#{ubuntu_release}/#{chef_package}"
owner "root"
group "root"
mode "644"
--- /dev/null
+#
+# Cookbook:: chef
+# Recipe:: knife
+#
+# Copyright:: 2021, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package %w[
+ gcc
+ libc6-dev
+ make
+]
+
+chef_gem "knife"
# limitations under the License.
#
+include_recipe "chef::knife"
include_recipe "git"
keys = data_bag_item("chef", "keys")
#
include_recipe "apache"
+include_recipe "chef::knife"
include_recipe "munin"
# cache_dir = Chef::Config[:file_cache_path]
umask 0002
unset GIT_DIR
+knife="/opt/chef/embedded/bin/knife"
+
while read oldrev newrev refname
do
if [[ "$refname" = "refs/heads/master" ]]
if [[ $file == roles/*.rb ]]
then
case "$action" in
- A|M) knife role from file "${file}";;
- D) knife role delete -y "${file:t:r}";;
+ A|M) $knife role from file "${file}";;
+ D) $knife role delete -y "${file:t:r}";;
esac
elif [[ $file == data_bags/*/*.json ]]
then
case "$action" in
A|M)
- knife data bag create "${file:h:t}"
- knife data bag from file "${file:h:t}" "${file:t}";;
+ $knife data bag create "${file:h:t}"
+ $knife data bag from file "${file:h:t}" "${file:t}";;
D)
- knife data bag delete -y "${file:h:t}" "${file:t:r}";;
+ $knife data bag delete -y "${file:h:t}" "${file:t:r}";;
esac
elif [[ $file == cookbooks/* ]]
then
if [[ -n "$updated_cookbooks" ]]
then
- knife cookbook upload "${(ou)updated_cookbooks[@]}"
+ $knife cookbook upload "${(ou)updated_cookbooks[@]}"
fi
if [[ -n "$deleted_cookbooks" ]]
then
for cookbook in "${(ou)deleted_cookbooks[@]}"
do
- knife cookbook delete -y "$cookbook"
+ $knife cookbook delete -y "$cookbook"
done
fi
fi
-default[:civicrm][:version] = "5.34.0"
+default[:civicrm][:version] = "5.51.1"
default[:civicrm][:extensions][:cividiscount][:name] = "org.civicrm.module.cividiscount"
default[:civicrm][:extensions][:cividiscount][:repository] = "https://github.com/dlobo/org.civicrm.module.cividiscount.git"
-default[:civicrm][:extensions][:cividiscount][:revision] = "3.8.2"
+default[:civicrm][:extensions][:cividiscount][:revision] = "3.8.4"
default[:civicrm][:extensions][:osm][:name] = "de.systopia.osm"
default[:civicrm][:extensions][:osm][:repository] = "https://github.com/systopia/de.systopia.osm.git"
-default[:civicrm][:extensions][:osm][:revision] = "1.2.1"
+default[:civicrm][:extensions][:osm][:revision] = "1.3"
default[:civicrm][:extensions][:emailapi][:name] = "org.civicoop.emailapi"
-default[:civicrm][:extensions][:emailapi][:repository] = "https://github.com/CiviCooP/org.civicoop.emailapi.git"
-default[:civicrm][:extensions][:emailapi][:revision] = "1.19"
+default[:civicrm][:extensions][:emailapi][:repository] = "https://lab.civicrm.org/extensions/emailapi.git"
+default[:civicrm][:extensions][:emailapi][:revision] = "2.8"
default[:civicrm][:extensions][:civiruleshttppost][:name] = "org.civicoop.civiruleshttppost"
default[:civicrm][:extensions][:civiruleshttppost][:repository] = "https://github.com/CiviCooP/org.civicoop.civiruleshttppost.git"
default[:civicrm][:extensions][:civirules][:name] = "org.civicoop.civirules"
default[:civicrm][:extensions][:civirules][:repository] = "https://lab.civicrm.org/extensions/civirules.git"
-default[:civicrm][:extensions][:civirules][:revision] = "2.22"
+default[:civicrm][:extensions][:civirules][:revision] = "2.43"
default[:civicrm][:extensions][:mailchimp][:name] = "uk.co.vedaconsulting.mailchimp"
default[:civicrm][:extensions][:mailchimp][:repository] = "https://github.com/veda-consulting/uk.co.vedaconsulting.mailchimp.git"
-default[:civicrm][:extensions][:mailchimp][:revision] = "124083b29ab28246883bc83f207498a85f01ecde"
+default[:civicrm][:extensions][:mailchimp][:revision] = "0065ee6de2c2d653e49d10e9563349e8ffb1f9be"
default[:civicrm][:extensions][:username][:name] = "org.openstreetmap.username"
default[:civicrm][:extensions][:username][:repository] = "https://github.com/grischard/org.openstreetmap.username.git"
default[:civicrm][:extensions][:shoreditch][:name] = "org.civicrm.shoreditch"
default[:civicrm][:extensions][:shoreditch][:repository] = "https://github.com/civicrm/org.civicrm.shoreditch.git"
-default[:civicrm][:extensions][:shoreditch][:revision] = "1.0.0-beta.1"
+default[:civicrm][:extensions][:shoreditch][:revision] = "1.0.0-beta.11"
+
+default[:civicrm][:extensions][:membershipextra][:name] = "com.skvare.membershipextra"
+default[:civicrm][:extensions][:membershipextra][:repository] = "https://github.com/lemniscus/com.skvare.membershipextra.git"
+default[:civicrm][:extensions][:membershipextra][:revision] = "1593911d6bfe184b45d59773fed27bab69cbb93a"
+
+default[:civicrm][:extensions][:osmfverifycontributor][:name] = "osmf-verify-contributor"
+default[:civicrm][:extensions][:osmfverifycontributor][:repository] = "https://github.com/openstreetmap/osmf-verify-contributor.git"
+default[:civicrm][:extensions][:osmfverifycontributor][:revision] = "bb0cd61783033fb2e108c30e47224e5a818987f8"
php-xml
php-curl
rsync
- unzip
wkhtmltopdf
php-bcmath
+ php-intl
]
cache_dir = Chef::Config[:file_cache_path]
site "join.osmfoundation.org"
end
-wordpress_plugin "sitepress-multilingual-cms" do
- site "join.osmfoundation.org"
- repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
- not_if { ENV["TEST_KITCHEN"] }
-end
-
wordpress_plugin "contact-form-7" do
site "join.osmfoundation.org"
end
backup false
end
-execute "#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip" do
+archive_file "#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip" do
action :nothing
- command "unzip -o -qq #{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip"
- cwd "/opt/civicrm-#{civicrm_version}"
- user "wordpress"
+ destination "/opt/civicrm-#{civicrm_version}"
+ overwrite true
+ owner "wordpress"
group "wordpress"
- subscribes :run, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
+ subscribes :extract, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
end
-execute "#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz" do
+archive_file "#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz" do
action :nothing
- command "tar -zxf #{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz"
- cwd "/opt/civicrm-#{civicrm_version}/civicrm"
- user "wordpress"
+ destination "/opt/civicrm-#{civicrm_version}/civicrm"
+ overwrite true
+ owner "wordpress"
group "wordpress"
- subscribes :run, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
+ subscribes :extract, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
end
execute "/opt/civicrm-#{civicrm_version}/civicrm" do
command "rsync --archive --delete /opt/civicrm-#{civicrm_version}/civicrm/ #{civicrm_directory}"
user "wordpress"
group "wordpress"
- subscribes :run, "execute[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
- subscribes :run, "execute[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
+ subscribes :run, "archive_file[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
+ subscribes :run, "archive_file[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
end
directory "/srv/join.osmfoundation.org/wp-content/uploads" do
--- /dev/null
+# Community Cookbook
+
+This installs and configures the community.openstreetmap.org website.
--- /dev/null
+default[:accounts][:users][:community][:status] = :role
--- /dev/null
+name "community"
+maintainer "OpenStreetMap Administrators"
+maintainer_email "admins@openstreetmap.org"
+license "Apache-2.0"
+description "Installs and configures community site"
+
+version "1.0.0"
+supports "ubuntu"
+depends "accounts"
+depends "docker"
+depends "geoipupdate"
+depends "git"
+depends "ssl"
--- /dev/null
+#
+# Cookbook:: community
+# Recipe:: default
+#
+# Copyright:: 2021, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "accounts"
+include_recipe "docker"
+include_recipe "geoipupdate"
+include_recipe "git"
+include_recipe "ssl"
+
+passwords = data_bag_item("community", "passwords")
+license_keys = data_bag_item("geoipupdate", "license-keys") unless kitchen?
+
+directory "/srv/community.openstreetmap.org" do
+ owner "root"
+ group "root"
+ mode "755"
+end
+
+directory "/srv/community.openstreetmap.org/shared" do
+ owner "community"
+ group "community"
+ mode "755"
+end
+
+git "/srv/community.openstreetmap.org/docker" do
+ action :sync
+ repository "https://github.com/discourse/discourse_docker.git"
+ revision "main"
+ depth 1
+ user "root"
+ group "root"
+ notifies :run, "execute[discourse_container_data_rebuild]"
+ notifies :run, "execute[discourse_container_web_only_bootstrap]"
+ notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
+end
+
+template "/srv/community.openstreetmap.org/docker/containers/data.yml" do
+ source "data.yml.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables :passwords => passwords
+ notifies :run, "execute[discourse_container_data_rebuild]"
+end
+
+template "/srv/community.openstreetmap.org/docker/containers/web_only.yml" do
+ source "web_only.yml.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables :license_keys => license_keys, :passwords => passwords
+ notifies :run, "execute[discourse_container_web_only_bootstrap]"
+end
+
+template "/srv/community.openstreetmap.org/docker/containers/mail-receiver.yml" do
+ source "mail-receiver.yml.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables :passwords => passwords
+ notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
+end
+
+# Destroy Bootstap Start
+execute "discourse_container_data_rebuild" do
+ action :nothing
+ command "./launcher rebuild data"
+ cwd "/srv/community.openstreetmap.org/docker/"
+ user "root"
+ group "root"
+end
+
+ssl_certificate "community.openstreetmap.org" do
+ domains ["community.openstreetmap.org", "community.osm.org", "communities.openstreetmap.org", "communities.osm.org"]
+ notifies :run, "execute[discourse_container_web_only_bootstrap]"
+end
+
+execute "discourse_container_data_start" do
+ action :run
+ command "./launcher start data"
+ cwd "/srv/community.openstreetmap.org/docker/"
+ user "root"
+ group "root"
+end
+
+execute "discourse_container_web_only_bootstrap" do
+ action :nothing
+ command "./launcher bootstrap web_only"
+ cwd "/srv/community.openstreetmap.org/docker/"
+ user "root"
+ group "root"
+ notifies :run, "execute[discourse_container_web_only_destroy]", :immediately
+end
+
+execute "discourse_container_web_only_destroy" do
+ action :nothing
+ command "./launcher destroy web_only"
+ cwd "/srv/community.openstreetmap.org/docker/"
+ user "root"
+ group "root"
+ notifies :run, "execute[discourse_container_web_only_start]", :immediately
+end
+
+execute "discourse_container_web_only_start" do
+ action :run
+ command "./launcher start web_only"
+ cwd "/srv/community.openstreetmap.org/docker/"
+ user "root"
+ group "root"
+ notifies :run, "execute[discourse_container_data_start]", :before
+end
+
+# Destroy Bootstap Start
+execute "discourse_container_mail_receiver_rebuild" do
+ action :nothing
+ command "./launcher rebuild mail-receiver"
+ cwd "/srv/community.openstreetmap.org/docker/"
+ user "root"
+ group "root"
+end
+
+template "/etc/cron.daily/community-backup" do
+ source "backup.cron.erb"
+ owner "root"
+ group "root"
+ mode "750"
+end
+
+node.default[:prometheus][:exporters][443] = {
+ :name => "community",
+ :address => "#{node[:prometheus][:address]}:443",
+ :sni => "community.openstreetmap.org"
+}
--- /dev/null
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+T=$(mktemp -d -t -p /var/tmp community.XXXXXXXXXX)
+D=$(date +%Y-%m-%d)
+B=community-$D.tar.gz
+
+mkdir $T/community-$D
+ln -s /srv/community.openstreetmap.org/docker/containers $T/community-$D/containers
+ln -s /srv/community.openstreetmap.org/shared/web-only $T/community-$D/shared-web-only
+ln -s /srv/community.openstreetmap.org/shared/data/redis_data $T/community-$D/shared-data-redis_data
+ln -s /srv/community.openstreetmap.org/shared/data/postgres_backup $T/community-$D/shared-data-postgres_backup
+
+export RSYNC_RSH="ssh -ax"
+
+nice tar --create --numeric-owner --dereference --directory=$T community-$D | nice gzip --rsyncable -9 > $T/$B
+nice rsync --preallocate --fuzzy $T/$B backup::backup
+
+rm -rf $T
--- /dev/null
+# A container for all things Data, be sure to set a secret password for
+# discourse account, SOME_SECRET is just an example
+#
+
+templates:
+ - "templates/postgres.template.yml"
+ - "templates/redis.template.yml"
+
+# any extra arguments for Docker?
+# docker_args:
+
+params:
+ db_default_text_search_config: "pg_catalog.english"
+
+ ## Set db_shared_buffers to a max of 25% of the total memory.
+ ## will be set automatically by bootstrap based on detected RAM, or you can override
+ db_shared_buffers: "4096MB"
+
+ ## can improve sorting performance, but adds memory usage per-connection
+ #db_work_mem: "40MB"
+
+env:
+ # ensure locale exists in container, you may need to install it
+ LC_ALL: en_US.UTF-8
+ LANG: en_US.UTF-8
+ LANGUAGE: en_US.UTF-8
+
+volumes:
+ - volume:
+ host: /srv/community.openstreetmap.org/shared/data
+ guest: /shared
+ - volume:
+ host: /srv/community.openstreetmap.org/shared/data/log/var-log
+ guest: /var/log
+
+# TODO: SOME_SECRET to a password for the discourse user
+hooks:
+ after_postgres:
+ - exec:
+ stdin: |
+ alter user discourse with password '<%= @passwords["database"] %>';
+ cmd: su - postgres -c 'psql discourse'
+
+ raise_on_fail: false
+ - file:
+ path: /var/spool/cron/crontabs/postgres
+ contents: |
+ # m h dom mon dow command
+ # MAILTO=?
+ 0 4 * * * /var/lib/postgresql/take-database-backup
--- /dev/null
+## this is the incoming mail receiver container template
+##
+## After making changes to this file, you MUST rebuild
+## /var/discourse/launcher rebuild mail-receiver
+##
+## BE *VERY* CAREFUL WHEN EDITING!
+## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
+## visit http://www.yamllint.com/ to validate this file as needed
+
+base_image: discourse/mail-receiver:release
+update_pups: false
+
+expose:
+ - "2500:25" # SMTP
+
+env:
+ LC_ALL: en_US.UTF-8
+ LANG: en_US.UTF-8
+ LANGUAGE: en_US.UTF-8
+
+ ## Where e-mail to your forum should be sent. In general, it's perfectly fine
+ ## to use the same domain as the forum itself here.
+ MAIL_DOMAIN: community.openstreetmap.org
+ POSTCONF_smtpd_tls_key_file: /shared/ssl/ssl.key
+ POSTCONF_smtpd_tls_cert_file: /shared/ssl/ssl.crt
+ POSTCONF_smtpd_tls_security_level: may
+
+ ## The URL of the mail processing endpoint of your Discourse forum.
+ ## This is simply your forum's base URL, with `/admin/email/handle_mail`
+ ## appended. Be careful if you're running a subfolder setup -- in that case,
+ ## the URL needs to have the subfolder included!
+ DISCOURSE_MAIL_ENDPOINT: 'https://community.openstreetmap.org/admin/email/handle_mail'
+
+ ## The master API key of your Discourse forum. You can get this from
+ ## the "API" tab of your admin panel.
+ DISCOURSE_API_KEY: '<%= @passwords["mail_receiver_api_key"] %>'
+
+ ## The username to use for processing incoming e-mail. Unless you have
+ ## renamed the `system` user, you should leave this as-is.
+ DISCOURSE_API_USERNAME: system
+
+volumes:
+ - volume:
+ host: /srv/community.openstreetmap.org/shared/mail-receiver/postfix-spool
+ guest: /var/spool/postfix
+ - volume:
+ host: /etc/ssl/certs/community.openstreetmap.org.pem
+ guest: /shared/ssl/ssl.crt
+ - volume:
+ host: /etc/ssl/private/community.openstreetmap.org.key
+ guest: /shared/ssl/ssl.key
--- /dev/null
+templates:
+ - "templates/web.template.yml"
+ - "templates/web.ratelimited.template.yml"
+ - "templates/web.ssl.template.yml"
+
+## which TCP/IP ports should this container expose?
+## If you want Discourse to share a port with another webserver like Apache or nginx,
+## see https://meta.discourse.org/t/17247 for details
+expose:
+ - "80:80" # http
+ - "443:443" # https
+
+# Use 'links' key to link containers together, aka use Docker --link flag.
+links:
+ - link:
+ name: data
+ alias: data
+
+# any extra arguments for Docker?
+# docker_args:
+
+# Workaround bug: https://github.com/discourse/discourse_docker/pull/505
+# params:
+# version: v2.8.7
+
+env:
+ LC_ALL: en_US.UTF-8
+ LANG: en_US.UTF-8
+ LANGUAGE: en_US.UTF-8
+ EMBER_CLI_PROD_ASSETS: 1
+ DISCOURSE_FORCE_HTTPS: true
+
+ ## How many concurrent web requests are supported? Depends on memory and CPU cores.
+ ## will be set automatically by bootstrap based on detected CPUs, or you can override
+ UNICORN_WORKERS: 8
+
+ ## TODO: The domain name this Discourse instance will respond to
+ DISCOURSE_HOSTNAME: community.openstreetmap.org
+
+ ## Uncomment if you want the container to be started with the same
+ ## hostname (-h option) as specified above (default "$hostname-$config")
+ #DOCKER_USE_HOSTNAME: true
+
+ ## TODO: List of comma delimited emails that will be made admin and developer
+ ## on initial signup example 'user1@example.com,user2@example.com'
+ DISCOURSE_DEVELOPER_EMAILS: 'operations@openstreetmap.org'
+
+ ## TODO: The SMTP mail server used to validate new accounts and send notifications
+ # SMTP ADDRESS, username, and password are required
+ # WARNING the char '#' in SMTP password can cause problems!
+ DISCOURSE_SMTP_ADDRESS: mail.openstreetmap.org
+ DISCOURSE_SMTP_PORT: 26
+ DISCOURSE_SMTP_USER_NAME:
+ DISCOURSE_SMTP_PASSWORD:
+ # DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
+ DISCOURSE_SMTP_DOMAIN: community.openstreetmap.org
+ DISCOURSE_NOTIFICATION_EMAIL: community@noreply.openstreetmap.org
+
+ ## TODO: configure connectivity to the databases
+ DISCOURSE_DB_SOCKET: ''
+ #DISCOURSE_DB_USERNAME: discourse
+ DISCOURSE_DB_PASSWORD: '<%= @passwords["database"] %>'
+ DISCOURSE_DB_HOST: data
+ DISCOURSE_REDIS_HOST: data
+
+ ## The maxmind geolocation IP address key for IP address lookup
+ ## see https://meta.discourse.org/t/-/137387/23 for details
+<% if @license_keys -%>
+ DISCOURSE_MAXMIND_LICENSE_KEY: '<%= @license_keys[node[:geoipupdate][:account]] %>'
+<% end -%>
+
+volumes:
+ - volume:
+ host: /srv/community.openstreetmap.org/shared/web-only
+ guest: /shared
+ - volume:
+ host: /srv/community.openstreetmap.org/shared/web-only/log/var-log
+ guest: /var/log
+ - volume:
+ host: /etc/ssl/certs/community.openstreetmap.org.pem
+ guest: /shared/ssl/ssl.crt
+ - volume:
+ host: /etc/ssl/private/community.openstreetmap.org.key
+ guest: /shared/ssl/ssl.key
+
+## Plugins go here
+## see https://meta.discourse.org/t/19157 for details
+hooks:
+ after_code:
+ - exec:
+ cd: $home/plugins
+ cmd:
+ - git clone --depth 1 https://github.com/discourse/discourse-oauth2-basic.git
+ - git clone --depth 1 https://github.com/discourse/discourse-solved.git
+ - git clone --depth 1 https://github.com/discourse/discourse-canned-replies.git
+ - git clone --depth 1 https://github.com/discourse/discourse-reactions.git
+ - git clone --depth 1 https://github.com/discourse/discourse-prometheus.git
+ - git clone --depth 1 https://github.com/discourse/discourse-translator.git
+ - exec:
+ cd: $home
+ cmd:
+ - git fetch --depth=1 origin tag v2.8.7 --no-tags
+ - git checkout v2.8.7
+ after_ssl:
+ - replace:
+ filename: "/etc/nginx/conf.d/discourse.conf"
+ from: /listen 80;/
+ to: |
+ listen 80;
+ rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent;
+
+ - replace:
+ filename: "/etc/nginx/conf.d/discourse.conf"
+ from: /add_header.+/
+ to: |
+ add_header Strict-Transport-Security 'max-age=63072000';
depends "git"
depends "postgresql"
depends "python"
+depends "ruby"
depends "web"
include_recipe "git"
include_recipe "postgresql"
include_recipe "python"
+include_recipe "ruby"
passwords = data_bag_item("db", "passwords")
wal_secrets = data_bag_item("db", "wal-secrets")
-ruby_version = node[:passenger][:ruby_version]
-db_version = node[:db][:cluster].split("/").first
-pg_config = "/usr/lib/postgresql/#{db_version}/bin/pg_config"
-function_directory = "/srv/www.openstreetmap.org/rails/db/functions/#{db_version}"
-
postgresql_munin "openstreetmap" do
cluster node[:db][:cluster]
database "openstreetmap"
end
rails_port "www.openstreetmap.org" do
- ruby ruby_version
directory "/srv/www.openstreetmap.org/rails"
user "rails"
group "rails"
database_name "openstreetmap"
database_username "openstreetmap"
database_password passwords["openstreetmap"]
- gpx_dir "/store/rails/gpx"
-end
-
-directory function_directory do
- owner "rails"
- group "rails"
- mode "755"
-end
-
-execute function_directory do
- action :nothing
- command "make BUNDLE=bundle#{ruby_version} PG_CONFIG=#{pg_config} DESTDIR=#{function_directory}"
- cwd "/srv/www.openstreetmap.org/rails/db/functions"
- user "rails"
- group "rails"
- subscribes :run, "directory[#{function_directory}]"
- subscribes :run, "git[/srv/www.openstreetmap.org/rails]"
-end
-
-link "/usr/lib/postgresql/#{db_version}/lib/libpgosm.so" do
- to "#{function_directory}/libpgosm.so"
- owner "root"
- group "root"
end
package %w[
git "/opt/osmdbt" do
action :sync
repository "https://github.com/openstreetmap/osmdbt.git"
- revision "v0.2"
+ revision "v0.5"
depth 1
user "root"
group "root"
end
-directory "/opt/osmdbt/build-#{db_version}" do
- owner "root"
- group "root"
- mode "755"
-end
-
-execute "/opt/osmdbt/CMakeLists.txt" do
- action :nothing
- command "cmake -DPG_CONFIG=/usr/lib/postgresql/#{db_version}/bin/pg_config .."
- cwd "/opt/osmdbt/build-#{db_version}"
- user "root"
- group "root"
- subscribes :run, "git[/opt/osmdbt]"
-end
-
-execute "/opt/osmdbt/build-#{db_version}/postgresql-plugin/Makefile" do
- action :nothing
- command "make"
- cwd "/opt/osmdbt/build-#{db_version}/postgresql-plugin"
- user "root"
- group "root"
- subscribes :run, "execute[/opt/osmdbt/CMakeLists.txt]"
-end
-
-link "/usr/lib/postgresql/#{db_version}/lib/osm-logical.so" do
- to "/opt/osmdbt/build-#{db_version}/postgresql-plugin/osm-logical.so"
- owner "root"
- group "root"
+node[:postgresql][:versions].each do |db_version|
+ pg_config = "/usr/lib/postgresql/#{db_version}/bin/pg_config"
+ function_directory = "/srv/www.openstreetmap.org/rails/db/functions/#{db_version}"
+
+ directory function_directory do
+ owner "rails"
+ group "rails"
+ mode "755"
+ end
+
+ execute function_directory do
+ action :nothing
+ command "make BUNDLE=#{node[:ruby][:bundle]} PG_CONFIG=#{pg_config} DESTDIR=#{function_directory}"
+ cwd "/srv/www.openstreetmap.org/rails/db/functions"
+ user "rails"
+ group "rails"
+ subscribes :run, "directory[#{function_directory}]"
+ subscribes :run, "git[/srv/www.openstreetmap.org/rails]"
+ end
+
+ link "/usr/lib/postgresql/#{db_version}/lib/libpgosm.so" do
+ to "#{function_directory}/libpgosm.so"
+ owner "root"
+ group "root"
+ end
+
+ directory "/opt/osmdbt/build-#{db_version}" do
+ owner "root"
+ group "root"
+ mode "755"
+ end
+
+ execute "/opt/osmdbt/build-#{db_version}" do
+ action :nothing
+ command "cmake -DPG_CONFIG=/usr/lib/postgresql/#{db_version}/bin/pg_config .."
+ cwd "/opt/osmdbt/build-#{db_version}"
+ user "root"
+ group "root"
+ subscribes :run, "directory[/opt/osmdbt/build-#{db_version}]"
+ subscribes :run, "git[/opt/osmdbt]"
+ end
+
+ execute "/opt/osmdbt/build-#{db_version}/postgresql-plugin/Makefile" do
+ action :nothing
+ command "make"
+ cwd "/opt/osmdbt/build-#{db_version}/postgresql-plugin"
+ user "root"
+ group "root"
+ subscribes :run, "execute[/opt/osmdbt/build-#{db_version}]"
+ end
+
+ link "/usr/lib/postgresql/#{db_version}/lib/osm-logical.so" do
+ to "/opt/osmdbt/build-#{db_version}/postgresql-plugin/osm-logical.so"
+ owner "root"
+ group "root"
+ end
end
package "lzop"
mode "750"
variables :s3_key => wal_secrets["s3_key"]
end
+
+remote_file "/usr/local/bin/wal-g" do
+ action :create
+ source "https://github.com/wal-g/wal-g/releases/download/v1.1/wal-g-pg-ubuntu-20.04-amd64"
+ owner "root"
+ group "root"
+ mode "755"
+end
+
+template "/usr/local/bin/openstreetmap-wal-g" do
+ source "wal-g.erb"
+ owner "root"
+ group "postgres"
+ mode "750"
+ variables :s3_key => wal_secrets["s3_key"]
+end
--- /dev/null
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+export WALE_S3_PREFIX="s3://openstreetmap-wal/"
+export AWS_ACCESS_KEY_ID="AKIAIQX2LTDOBIW4CZUQ"
+export AWS_SECRET_ACCESS_KEY="<%= @s3_key %>"
+export AWS_REGION="eu-west-2"
+
+exec /usr/local/bin/wal-g "$@" < /dev/null
depends "php"
depends "postgresql"
depends "python"
+depends "ruby"
depends "tools"
depends "web"
include_recipe "php::fpm"
include_recipe "postgresql"
include_recipe "python"
+include_recipe "ruby"
package %w[
php-cgi
autoconf
automake
libtool
+ libargon2-dev
libfcgi-dev
libxml2-dev
libmemcached-dev
libpqxx-dev
libcrypto++-dev
libyajl-dev
+ libfmt-dev
zlib1g-dev
+ nano
+ osm2pgsql
]
nodejs_package "svgo"
end
end
-if node[:postgresql][:clusters][:"12/main"]
+if node[:postgresql][:clusters][:"14/main"]
postgresql_user "apis" do
- cluster "12/main"
+ cluster "14/main"
end
template "/usr/local/bin/cleanup-rails-assets" do
mode "755"
end
- ruby_version = node[:passenger][:ruby_version]
-
systemd_service "rails-jobs@" do
description "Rails job queue runner"
type "simple"
user "apis"
working_directory "/srv/%i.apis.dev.openstreetmap.org/rails"
- exec_start "/usr/local/bin/bundle#{ruby_version} exec rake jobs:work"
+ exec_start "#{node[:ruby][:bundle]} exec rails jobs:work"
restart "on-failure"
private_tmp true
private_devices true
cgimap_port = 9000
+ Dir.glob("/srv/*.apis.dev.openstreetmap.org").each do |dir|
+ node.default_unless[:dev][:rails][File.basename(dir).split(".").first] = {}
+ end
+
node[:dev][:rails].each do |name, details|
database_name = details[:database] || "apis_#{name}"
site_name = "#{name}.apis.dev.openstreetmap.org"
secret_key_base = persistent_token("dev", "rails", name, "secret_key_base")
postgresql_database database_name do
- cluster "12/main"
+ cluster "14/main"
owner "apis"
end
postgresql_extension "#{database_name}_btree_gist" do
- cluster "12/main"
+ cluster "14/main"
database database_name
extension "btree_gist"
end
end
rails_port site_name do
- ruby ruby_version
directory rails_directory
user "apis"
group "apis"
repository details[:repository]
revision details[:revision]
- database_port node[:postgresql][:clusters][:"12/main"][:port]
+ database_port node[:postgresql][:clusters][:"14/main"][:port]
database_name database_name
database_username "apis"
email_from "OpenStreetMap <web@noreply.openstreetmap.org>"
cwd cgimap_directory
user "apis"
group "apis"
- subscribes :run, "git[#{cgimap_directory}]", :immediate
+ subscribes :run, "git[#{cgimap_directory}]", :immediately
end
execute "#{cgimap_directory}/configure" do
cwd cgimap_directory
user "apis"
group "apis"
- subscribes :run, "execute[#{cgimap_directory}/autogen.sh]", :immediate
+ subscribes :run, "execute[#{cgimap_directory}/autogen.sh]", :immediately
end
execute "#{cgimap_directory}/Makefile" do
cwd cgimap_directory
user "apis"
group "apis"
- subscribes :run, "execute[#{cgimap_directory}/configure]", :immediate
+ subscribes :run, "execute[#{cgimap_directory}/configure]", :immediately
notifies :restart, "service[cgimap@#{name}]"
end
group "root"
mode "640"
variables :cgimap_port => cgimap_port,
- :database_port => node[:postgresql][:clusters][:"12/main"][:port],
+ :database_port => node[:postgresql][:clusters][:"14/main"][:port],
:database_name => database_name,
:log_directory => log_directory
notifies :restart, "service[cgimap@#{name}]"
action :delete
end
+ service "rails-jobs@#{name}" do
+ action [:stop, :disable]
+ end
+
directory site_directory do
action :delete
recursive true
postgresql_database database_name do
action :drop
- cluster "12/main"
+ cluster "14/main"
end
end
end
CGIMAP_MEMCACHE="127.0.0.1"
CGIMAP_RATELIMIT="204800"
CGIMAP_MAXDEBT="250"
+CGIMAP_MAP_AREA="<%= node[:web][:max_request_area] %>"
+CGIMAP_MAP_NODES"<%= node[:web][:max_number_of_nodes] %>"
+CGIMAP_MAX_WAY_NODES="<%= node[:web][:max_number_of_way_nodes] %>"
+CGIMAP_MAX_RELATION_MEMBERS="<%= node[:web][:max_number_of_relation_members] %>"
<dt>If you are a user...</dt>
<dd>You probably want <a href="https://www.openstreetmap.org/">OpenStreetMap</a> itself.</dd>
<dt>If you are a developer...</dt>
-<dd>You might be interested in <a href="https://apis.dev.openstreetmap.org/">live instances</a> of various <a href="https://wiki.openstreetmap.org/index.php/The_Rails_Port#Installation_on_Debian">Rails Port</a> code branches in <a href="https://svn.openstreetmap.org/sites/rails_port_branches/">SVN</a> for testing clients against.</dd>
+<dd>You might be interested in <a href="https://apis.dev.openstreetmap.org/">live instances</a> of various <a href="https://github.com/openstreetmap/openstreetmap-website#readme">Rails Port</a> code branches for testing clients against.</dd>
</body>
</html>
OAUTH_KEY = website.key
end
end
+
+ if ActiveRecord::Base.connection.table_exists?(:oauth_applications)
+ unless id = webmaster.oauth2_applications.find_by_name("iD")
+ id = webmaster.oauth2_applications.new
+ id.name = "iD"
+ id.redirect_uri = "https://<%= @site %>/id"
+ id.scopes = Oauth.scopes.map(&:name)
+ id.confidential = true
+ id.save!
+ end
+
+ if Kernel.const_defined?("Settings")
+ Settings.id_application = id.uid
+ else
+ ID_APPLICATION = id.uid
+ end
+
+ unless website = webmaster.oauth2_applications.find_by_name("Web Site")
+ website = webmaster.oauth2_applications.new
+ website.name = "Web Site"
+ website.redirect_uri = "https://<%= @site %>/"
+ website.scopes = Oauth.scopes.map(&:name)
+ website.confidential = true
+ website.save!
+ end
+
+ if Kernel.const_defined?("Settings")
+ Settings.oauth_application = website.uid
+ else
+ OAUTH_APPLICATION = website.uid
+ end
+ end
end
# Ethernet controller: Intel Corporation Ethernet Connection X722 for 10GBASE-T
SUBSYSTEM=="net", ACTION=="add", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x37d2", RUN+="/sbin/ethtool -G $name rx 4096 tx 4096"
+# Disable Firmware Based LLDP handler
+SUBSYSTEM=="net", ACTION=="add", ENV{INTERFACE}=="*", DRIVERS=="i40e", RUN+="/sbin/ethtool --set-priv-flags $name disable-fw-lldp on"
+
# Workaround unreliable Western Digital WD RE3/RE4 disks (ATA only)
# Set sufficent Linux subsystem timeout and fix severe NCQ performance issue
ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", ENV{ID_BUS}=="ata", ENV{ID_MODEL}=="WDC_WD5002ABYS-02B1B0", ATTR{device/timeout}="90", ATTR{device/queue_depth}="1", ATTR{queue/nr_requests}="256"
include_recipe "networking"
-package "isc-dhcp-server"
+package %w[
+ isc-dhcp-server
+ tftpd-hpa
+]
+
+service "tftpd-hpa" do
+ action [:enable, :start]
+ supports :status => true, :restart => true
+end
+
+remote_file "/srv/tftp/netboot.xyz.efi" do
+ action :create
+ source "https://boot.netboot.xyz/ipxe/netboot.xyz.efi"
+ owner "root"
+ group "root"
+ mode "644"
+end
+
+remote_file "/srv/tftp/netboot.xyz.kpxe" do
+ action :create
+ source "https://boot.netboot.xyz/ipxe/netboot.xyz.kpxe"
+ owner "root"
+ group "root"
+ mode "644"
+end
domain = "#{node[:networking][:roles][:external][:zone]}.openstreetmap.org"
supports :status => true, :restart => true
subscribes :restart, "template[/etc/dhcp/dhcpd.conf]"
end
+
+service "isc-dhcp-server6" do
+ action [:disable, :stop]
+end
# DO NOT EDIT - This file is being maintained by Chef
+option architecture-type code 93 = unsigned integer 16;
+
default-lease-time 600;
max-lease-time 7200;
<% node.interfaces(:role => :internal).each do |interface| -%>
option domain-name "<%= @domain %>";
option domain-name-servers <%= interface[:gateway] %>;
option ntp-servers <%= node[:ntp][:servers].first %>;
+
+ class "pxeclients" {
+ match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
+ next-server <%= interface[:gateway] %>;
+
+ if option architecture-type = 00:07 {
+ filename "netboot.xyz.efi";
+ } else {
+ filename "netboot.xyz.kpxe";
+ }
+ }
}
<% end -%>
+host oob1.ams.openstreetmap.org {
+ hardware ethernet ea:e4:8e:c2:5b:19;
+ server-name "oob1.ams.openstreetmap.org";
+ fixed-address oob1.ams.openstreetmap.org;
+}
+
host pdu1.ams.openstreetmap.org {
hardware ethernet 00:c0:b7:e3:e8:f2;
server-name "pdu1.ams.openstreetmap.org";
fixed-address pdu2.ams.openstreetmap.org;
}
+host oob1.dub.openstreetmap.org {
+ hardware ethernet 62:bd:62:a6:05:25;
+ server-name "oob1.dub.openstreetmap.org";
+ fixed-address oob1.dub.openstreetmap.org;
+}
+
+host pdu1.dub.openstreetmap.org {
+ hardware ethernet 28:29:86:48:f7:f5;
+ server-name "pdu1.dub.openstreetmap.org";
+ fixed-address pdu1.dub.openstreetmap.org;
+}
+
+host pdu2.dub.openstreetmap.org {
+ hardware ethernet 28:29:86:48:f8:64;
+ server-name "pdu2.dub.openstreetmap.org";
+ fixed-address pdu2.dub.openstreetmap.org;
+}
+
host clifford.oob.openstreetmap.org {
hardware ethernet 1c:c1:de:78:20:d6;
server-name "clifford.oob.openstreetmap.org";
fixed-address clifford.oob.openstreetmap.org;
}
+host culebre.oob.openstreetmap.org {
+ hardware ethernet 3c:ec:ef:2f:29:41;
+ server-name "culebre.oob.openstreetmap.org";
+ fixed-address culebre.oob.openstreetmap.org;
+}
+
host draco.oob.openstreetmap.org {
hardware ethernet 9c:8e:99:25:99:7d;
server-name "draco.oob.openstreetmap.org";
fixed-address eustace.oob.openstreetmap.org;
}
+host fafnir.oob.openstreetmap.org {
+ hardware ethernet 38:63:bb:39:f0:96;
+ server-name "fafnir.oob.openstreetmap.org";
+ fixed-address fafnir.oob.openstreetmap.org;
+}
+
+host gorwen.oob.openstreetmap.org {
+ hardware ethernet d8:9d:67:5f:bd:bc;
+ server-name "gorwen.oob.openstreetmap.org";
+ fixed-address gorwen.oob.openstreetmap.org;
+}
+
host grindtooth.oob.openstreetmap.org {
hardware ethernet 98:4b:e1:6d:77:85;
server-name "grindtooth.oob.openstreetmap.org";
fixed-address grindtooth.oob.openstreetmap.org;
}
+host horntail.oob.openstreetmap.org {
+ hardware ethernet 3c:ec:ef:82:ac:d2;
+ server-name "horntail.oob.openstreetmap.org";
+ fixed-address horntail.oob.openstreetmap.org;
+}
+
+host idris.oob.openstreetmap.org {
+ hardware ethernet 94:57:a5:50:b5:a0;
+ server-name "idris.oob.openstreetmap.org";
+ fixed-address idris.oob.openstreetmap.org;
+}
+
host ironbelly.oob.openstreetmap.org {
hardware ethernet 00:25:90:cd:14:84;
server-name "ironbelly.oob.openstreetmap.org";
fixed-address ironbelly.oob.openstreetmap.org;
}
+host jakelong.oob.openstreetmap.org {
+ hardware ethernet d8:9d:67:66:02:9e;
+ server-name "jakelong.oob.openstreetmap.org";
+ fixed-address jakelong.oob.openstreetmap.org;
+}
+
host karm.oob.openstreetmap.org {
hardware ethernet 0c:c4:7a:67:cf:c4;
server-name "karm.oob.openstreetmap.org";
fixed-address karm.oob.openstreetmap.org;
}
+host konqi.oob.openstreetmap.org {
+ hardware ethernet ec:b1:d7:7a:ea:64;
+ server-name "konqi.oob.openstreetmap.org";
+ fixed-address konqi.oob.openstreetmap.org;
+}
+
+host lockheed.oob.openstreetmap.org {
+ hardware ethernet 44:1e:a1:57:8f:fe;
+ server-name "lockheed.oob.openstreetmap.org";
+ fixed-address lockheed.oob.openstreetmap.org;
+}
+
+host longma.oob.openstreetmap.org {
+ hardware ethernet 3c:ec:ef:2f:6d:4e;
+ server-name "longma.oob.openstreetmap.org";
+ fixed-address longma.oob.openstreetmap.org;
+}
+
+host naga.oob.openstreetmap.org {
+ hardware ethernet 94:57:a5:5f:11:f2;
+ server-name "naga.oob.openstreetmap.org";
+ fixed-address naga.oob.openstreetmap.org;
+}
+
host noquiklos.oob.openstreetmap.org {
hardware ethernet 18:a9:05:70:b0:1e;
server-name "noquiklos.oob.openstreetmap.org";
fixed-address noquiklos.oob.openstreetmap.org;
}
+host norbert.oob.openstreetmap.org {
+ hardware ethernet 3c:ec:ef:82:ac:cf;
+ server-name "norbert.oob.openstreetmap.org";
+ fixed-address norbert.oob.openstreetmap.org;
+}
+
host odin.oob.openstreetmap.org {
hardware ethernet ac:1f:6b:c0:59:a3;
server-name "odin.oob.openstreetmap.org";
fixed-address odin.oob.openstreetmap.org;
}
-host orm.oob.openstreetmap.org {
- hardware ethernet 00:e0:81:c5:26:80;
- server-name "orm.oob.openstreetmap.org";
- fixed-address orm.oob.openstreetmap.org;
-}
-
-host ouroboros.oob.openstreetmap.org {
- hardware ethernet d4:85:64:4c:3d:00;
- server-name "ouroboros.oob.openstreetmap.org";
- fixed-address ouroboros.oob.openstreetmap.org;
-}
-
host pummelzacken.oob.openstreetmap.org {
hardware ethernet 00:25:90:cf:72:73;
server-name "pummelzacken.oob.openstreetmap.org";
fixed-address pummelzacken.oob.openstreetmap.org;
}
-host ramoth.oob.openstreetmap.org {
- hardware ethernet 0c:c4:7a:af:75:eb;
- server-name "ramoth.oob.openstreetmap.org";
- fixed-address ramoth.oob.openstreetmap.org;
-}
-
host ridley.oob.openstreetmap.org {
hardware ethernet d4:85:64:52:2d:d8;
server-name "ridley.oob.openstreetmap.org";
fixed-address snap-02.oob.openstreetmap.org;
}
+host snap-03.oob.openstreetmap.org {
+ hardware ethernet 3c:ec:ef:82:ab:f2;
+ server-name "snap-03.oob.openstreetmap.org";
+ fixed-address snap-03.oob.openstreetmap.org;
+}
+
host smaug.oob.openstreetmap.org {
hardware ethernet 00:30:48:9d:57:ff;
server-name "smaug.oob.openstreetmap.org";
}
host spike-01.oob.openstreetmap.org {
- hardware ethernet 1c:c1:de:e8:1a:1c;
+ hardware ethernet 3c:a8:2a:11:78:d6;
server-name "spike-01.oob.openstreetmap.org";
fixed-address spike-01.oob.openstreetmap.org;
}
host spike-02.oob.openstreetmap.org {
- hardware ethernet 68:b5:99:af:d6:9c;
+ hardware ethernet 14:58:d0:5d:74:44;
server-name "spike-02.oob.openstreetmap.org";
fixed-address spike-02.oob.openstreetmap.org;
}
host spike-03.oob.openstreetmap.org {
- hardware ethernet 1c:c1:de:79:61:98;
+ hardware ethernet 38:63:bb:3a:b0:ce;
server-name "spike-03.oob.openstreetmap.org";
fixed-address spike-03.oob.openstreetmap.org;
}
fixed-address tiamat-23.oob.openstreetmap.org;
}
-host thorn-01.oob.openstreetmap.org {
- hardware ethernet 44:1e:a1:57:8f:fe;
- server-name "thorn-01.oob.openstreetmap.org";
- fixed-address thorn-01.oob.openstreetmap.org;
-}
-
host thorn-02.oob.openstreetmap.org {
hardware ethernet e4:11:5b:ce:e8:aa;
server-name "thorn-02.oob.openstreetmap.org";
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Base class for all HTML classes
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_Common
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @copyright 2001-2009 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id: Common.php,v 1.15 2009/04/03 15:26:22 avb Exp $
- * @link http://pear.php.net/package/HTML_Common/
- */
-
-/**
- * Base class for all HTML classes
- *
- * @category HTML
- * @package HTML_Common
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @version Release: 1.2.5
- * @abstract
- */
-class HTML_Common
-{
- /**
- * Associative array of attributes
- * @var array
- * @access private
- */
- var $_attributes = array();
-
- /**
- * Tab offset of the tag
- * @var int
- * @access private
- */
- var $_tabOffset = 0;
-
- /**
- * Tab string
- * @var string
- * @since 1.7
- * @access private
- */
- var $_tab = "\11";
-
- /**
- * Contains the line end string
- * @var string
- * @since 1.7
- * @access private
- */
- var $_lineEnd = "\12";
-
- /**
- * HTML comment on the object
- * @var string
- * @since 1.5
- * @access private
- */
- var $_comment = '';
-
- /**
- * Class constructor
- * @param mixed $attributes Associative array of table tag attributes
- * or HTML attributes name="value" pairs
- * @param int $tabOffset Indent offset in tabs
- * @access public
- */
- function HTML_Common($attributes = null, $tabOffset = 0)
- {
- $this->setAttributes($attributes);
- $this->setTabOffset($tabOffset);
- } // end constructor
-
- /**
- * Returns the current API version
- * @access public
- * @returns double
- */
- function apiVersion()
- {
- return 1.7;
- } // end func apiVersion
-
- /**
- * Returns the lineEnd
- *
- * @since 1.7
- * @access private
- * @return string
- */
- function _getLineEnd()
- {
- return $this->_lineEnd;
- } // end func getLineEnd
-
- /**
- * Returns a string containing the unit for indenting HTML
- *
- * @since 1.7
- * @access private
- * @return string
- */
- function _getTab()
- {
- return $this->_tab;
- } // end func _getTab
-
- /**
- * Returns a string containing the offset for the whole HTML code
- *
- * @return string
- * @access private
- */
- function _getTabs()
- {
- return str_repeat($this->_getTab(), $this->_tabOffset);
- } // end func _getTabs
-
- /**
- * Returns an HTML formatted attribute string
- * @param array $attributes
- * @return string
- * @access private
- */
- function _getAttrString($attributes)
- {
- $strAttr = '';
-
- if (is_array($attributes)) {
- $charset = HTML_Common::charset();
- foreach ($attributes as $key => $value) {
- $strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"';
- }
- }
- return $strAttr;
- } // end func _getAttrString
-
- /**
- * Returns a valid atrributes array from either a string or array
- * @param mixed $attributes Either a typical HTML attribute string or an associative array
- * @access private
- * @return array
- */
- function _parseAttributes($attributes)
- {
- if (is_array($attributes)) {
- $ret = array();
- foreach ($attributes as $key => $value) {
- if (is_int($key)) {
- $key = $value = strtolower($value);
- } else {
- $key = strtolower($key);
- }
- $ret[$key] = $value;
- }
- return $ret;
-
- } elseif (is_string($attributes)) {
- $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" .
- "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/";
- if (preg_match_all($preg, $attributes, $regs)) {
- for ($counter=0; $counter<count($regs[1]); $counter++) {
- $name = $regs[1][$counter];
- $check = $regs[0][$counter];
- $value = $regs[7][$counter];
- if (trim($name) == trim($check)) {
- $arrAttr[strtolower(trim($name))] = strtolower(trim($name));
- } else {
- if (substr($value, 0, 1) == "\"" || substr($value, 0, 1) == "'") {
- $arrAttr[strtolower(trim($name))] = substr($value, 1, -1);
- } else {
- $arrAttr[strtolower(trim($name))] = trim($value);
- }
- }
- }
- return $arrAttr;
- }
- }
- } // end func _parseAttributes
-
- /**
- * Returns the array key for the given non-name-value pair attribute
- *
- * @param string $attr Attribute
- * @param array $attributes Array of attribute
- * @since 1.0
- * @access private
- * @return bool
- */
- function _getAttrKey($attr, $attributes)
- {
- if (isset($attributes[strtolower($attr)])) {
- return true;
- } else {
- return null;
- }
- } //end func _getAttrKey
-
- /**
- * Updates the attributes in $attr1 with the values in $attr2 without changing the other existing attributes
- * @param array $attr1 Original attributes array
- * @param array $attr2 New attributes array
- * @access private
- */
- function _updateAttrArray(&$attr1, $attr2)
- {
- if (!is_array($attr2)) {
- return false;
- }
- foreach ($attr2 as $key => $value) {
- $attr1[$key] = $value;
- }
- } // end func _updateAtrrArray
-
- /**
- * Removes the given attribute from the given array
- *
- * @param string $attr Attribute name
- * @param array $attributes Attribute array
- * @since 1.4
- * @access private
- * @return void
- */
- function _removeAttr($attr, &$attributes)
- {
- $attr = strtolower($attr);
- if (isset($attributes[$attr])) {
- unset($attributes[$attr]);
- }
- } //end func _removeAttr
-
- /**
- * Returns the value of the given attribute
- *
- * @param string $attr Attribute name
- * @since 1.5
- * @access public
- * @return string|null returns null if an attribute does not exist
- */
- function getAttribute($attr)
- {
- $attr = strtolower($attr);
- if (isset($this->_attributes[$attr])) {
- return $this->_attributes[$attr];
- }
- return null;
- } //end func getAttribute
-
- /**
- * Sets the value of the attribute
- *
- * @param string Attribute name
- * @param string Attribute value (will be set to $name if omitted)
- * @access public
- */
- function setAttribute($name, $value = null)
- {
- $name = strtolower($name);
- if (is_null($value)) {
- $value = $name;
- }
- $this->_attributes[$name] = $value;
- } // end func setAttribute
-
- /**
- * Sets the HTML attributes
- * @param mixed $attributes Either a typical HTML attribute string or an associative array
- * @access public
- */
- function setAttributes($attributes)
- {
- $this->_attributes = $this->_parseAttributes($attributes);
- } // end func setAttributes
-
- /**
- * Returns the assoc array (default) or string of attributes
- *
- * @param bool Whether to return the attributes as string
- * @since 1.6
- * @access public
- * @return mixed attributes
- */
- function getAttributes($asString = false)
- {
- if ($asString) {
- return $this->_getAttrString($this->_attributes);
- } else {
- return $this->_attributes;
- }
- } //end func getAttributes
-
- /**
- * Updates the passed attributes without changing the other existing attributes
- * @param mixed $attributes Either a typical HTML attribute string or an associative array
- * @access public
- */
- function updateAttributes($attributes)
- {
- $this->_updateAttrArray($this->_attributes, $this->_parseAttributes($attributes));
- } // end func updateAttributes
-
- /**
- * Removes an attribute
- *
- * @param string $attr Attribute name
- * @since 1.4
- * @access public
- * @return void
- */
- function removeAttribute($attr)
- {
- $this->_removeAttr($attr, $this->_attributes);
- } //end func removeAttribute
-
- /**
- * Sets the line end style to Windows, Mac, Unix or a custom string.
- *
- * @param string $style "win", "mac", "unix" or custom string.
- * @since 1.7
- * @access public
- * @return void
- */
- function setLineEnd($style)
- {
- switch ($style) {
- case 'win':
- $this->_lineEnd = "\15\12";
- break;
- case 'unix':
- $this->_lineEnd = "\12";
- break;
- case 'mac':
- $this->_lineEnd = "\15";
- break;
- default:
- $this->_lineEnd = $style;
- }
- } // end func setLineEnd
-
- /**
- * Sets the tab offset
- *
- * @param int $offset
- * @access public
- */
- function setTabOffset($offset)
- {
- $this->_tabOffset = $offset;
- } // end func setTabOffset
-
- /**
- * Returns the tabOffset
- *
- * @since 1.5
- * @access public
- * @return int
- */
- function getTabOffset()
- {
- return $this->_tabOffset;
- } //end func getTabOffset
-
- /**
- * Sets the string used to indent HTML
- *
- * @since 1.7
- * @param string $string String used to indent ("\11", "\t", ' ', etc.).
- * @access public
- * @return void
- */
- function setTab($string)
- {
- $this->_tab = $string;
- } // end func setTab
-
- /**
- * Sets the HTML comment to be displayed at the beginning of the HTML string
- *
- * @param string
- * @since 1.4
- * @access public
- * @return void
- */
- function setComment($comment)
- {
- $this->_comment = $comment;
- } // end func setHtmlComment
-
- /**
- * Returns the HTML comment
- *
- * @since 1.5
- * @access public
- * @return string
- */
- function getComment()
- {
- return $this->_comment;
- } //end func getComment
-
- /**
- * Abstract method. Must be extended to return the objects HTML
- *
- * @access public
- * @return string
- * @abstract
- */
- function toHtml()
- {
- return '';
- } // end func toHtml
-
- /**
- * Displays the HTML to the screen
- *
- * @access public
- */
- function display()
- {
- print $this->toHtml();
- } // end func display
-
- /**
- * Sets the charset to use by htmlspecialchars() function
- *
- * Since this parameter is expected to be global, the function is designed
- * to be called statically:
- * <code>
- * HTML_Common::charset('utf-8');
- * </code>
- * or
- * <code>
- * $charset = HTML_Common::charset();
- * </code>
- *
- * @param string New charset to use. Omit if just getting the
- * current value. Consult the htmlspecialchars() docs
- * for a list of supported character sets.
- * @return string Current charset
- * @access public
- * @static
- */
- function charset($newCharset = null)
- {
- static $charset = 'ISO-8859-1';
-
- if (!is_null($newCharset)) {
- $charset = $newCharset;
- }
- return $charset;
- } // end func charset
-} // end class HTML_Common
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Create, validate and process HTML forms
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * PEAR and PEAR_Error classes, for error handling
- */
-require_once 'PEAR.php';
-/**
- * Base class for all HTML classes
- */
-require_once 'HTML/Common.php';
-/**
- * Static utility methods
- */
-require_once 'HTML/QuickForm/utils.php';
-
-/**
- * Element types known to HTML_QuickForm
- * @see HTML_QuickForm::registerElementType(), HTML_QuickForm::getRegisteredTypes(),
- * HTML_QuickForm::isTypeRegistered()
- * @global array $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES']
- */
-$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] =
- array(
- 'group' =>array('HTML/QuickForm/group.php','HTML_QuickForm_group'),
- 'hidden' =>array('HTML/QuickForm/hidden.php','HTML_QuickForm_hidden'),
- 'reset' =>array('HTML/QuickForm/reset.php','HTML_QuickForm_reset'),
- 'checkbox' =>array('HTML/QuickForm/checkbox.php','HTML_QuickForm_checkbox'),
- 'file' =>array('HTML/QuickForm/file.php','HTML_QuickForm_file'),
- 'image' =>array('HTML/QuickForm/image.php','HTML_QuickForm_image'),
- 'password' =>array('HTML/QuickForm/password.php','HTML_QuickForm_password'),
- 'radio' =>array('HTML/QuickForm/radio.php','HTML_QuickForm_radio'),
- 'button' =>array('HTML/QuickForm/button.php','HTML_QuickForm_button'),
- 'submit' =>array('HTML/QuickForm/submit.php','HTML_QuickForm_submit'),
- 'select' =>array('HTML/QuickForm/select.php','HTML_QuickForm_select'),
- 'hiddenselect' =>array('HTML/QuickForm/hiddenselect.php','HTML_QuickForm_hiddenselect'),
- 'text' =>array('HTML/QuickForm/text.php','HTML_QuickForm_text'),
- 'textarea' =>array('HTML/QuickForm/textarea.php','HTML_QuickForm_textarea'),
- 'link' =>array('HTML/QuickForm/link.php','HTML_QuickForm_link'),
- 'advcheckbox' =>array('HTML/QuickForm/advcheckbox.php','HTML_QuickForm_advcheckbox'),
- 'date' =>array('HTML/QuickForm/date.php','HTML_QuickForm_date'),
- 'static' =>array('HTML/QuickForm/static.php','HTML_QuickForm_static'),
- 'header' =>array('HTML/QuickForm/header.php', 'HTML_QuickForm_header'),
- 'html' =>array('HTML/QuickForm/html.php', 'HTML_QuickForm_html'),
- 'hierselect' =>array('HTML/QuickForm/hierselect.php', 'HTML_QuickForm_hierselect'),
- 'autocomplete' =>array('HTML/QuickForm/autocomplete.php', 'HTML_QuickForm_autocomplete'),
- 'xbutton' =>array('HTML/QuickForm/xbutton.php','HTML_QuickForm_xbutton')
- );
-
-/**
- * Validation rules known to HTML_QuickForm
- * @see HTML_QuickForm::registerRule(), HTML_QuickForm::getRegisteredRules(),
- * HTML_QuickForm::isRuleRegistered()
- * @global array $GLOBALS['_HTML_QuickForm_registered_rules']
- */
-$GLOBALS['_HTML_QuickForm_registered_rules'] = array(
- 'required' => array('html_quickform_rule_required', 'HTML/QuickForm/Rule/Required.php'),
- 'maxlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'),
- 'minlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'),
- 'rangelength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'),
- 'email' => array('html_quickform_rule_email', 'HTML/QuickForm/Rule/Email.php'),
- 'regex' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'lettersonly' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'alphanumeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'numeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'nopunctuation' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'nonzero' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'),
- 'callback' => array('html_quickform_rule_callback', 'HTML/QuickForm/Rule/Callback.php'),
- 'compare' => array('html_quickform_rule_compare', 'HTML/QuickForm/Rule/Compare.php')
-);
-
-// {{{ error codes
-
-/**#@+
- * Error codes for HTML_QuickForm
- *
- * Codes are mapped to textual messages by errorMessage() method, if you add a
- * new code be sure to add a new message for it to errorMessage()
- *
- * @see HTML_QuickForm::errorMessage()
- */
-define('QUICKFORM_OK', 1);
-define('QUICKFORM_ERROR', -1);
-define('QUICKFORM_INVALID_RULE', -2);
-define('QUICKFORM_NONEXIST_ELEMENT', -3);
-define('QUICKFORM_INVALID_FILTER', -4);
-define('QUICKFORM_UNREGISTERED_ELEMENT', -5);
-define('QUICKFORM_INVALID_ELEMENT_NAME', -6);
-define('QUICKFORM_INVALID_PROCESS', -7);
-define('QUICKFORM_DEPRECATED', -8);
-define('QUICKFORM_INVALID_DATASOURCE', -9);
-/**#@-*/
-
-// }}}
-
-/**
- * Create, validate and process HTML forms
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- */
-class HTML_QuickForm extends HTML_Common
-{
- // {{{ properties
-
- /**
- * Array containing the form fields
- * @since 1.0
- * @var array
- * @access private
- */
- var $_elements = array();
-
- /**
- * Array containing element name to index map
- * @since 1.1
- * @var array
- * @access private
- */
- var $_elementIndex = array();
-
- /**
- * Array containing indexes of duplicate elements
- * @since 2.10
- * @var array
- * @access private
- */
- var $_duplicateIndex = array();
-
- /**
- * Array containing required field IDs
- * @since 1.0
- * @var array
- * @access private
- */
- var $_required = array();
-
- /**
- * Prefix message in javascript alert if error
- * @since 1.0
- * @var string
- * @access public
- */
- var $_jsPrefix = 'Invalid information entered.';
-
- /**
- * Postfix message in javascript alert if error
- * @since 1.0
- * @var string
- * @access public
- */
- var $_jsPostfix = 'Please correct these fields.';
-
- /**
- * Datasource object implementing the informal
- * datasource protocol
- * @since 3.3
- * @var object
- * @access private
- */
- var $_datasource;
-
- /**
- * Array of default form values
- * @since 2.0
- * @var array
- * @access private
- */
- var $_defaultValues = array();
-
- /**
- * Array of constant form values
- * @since 2.0
- * @var array
- * @access private
- */
- var $_constantValues = array();
-
- /**
- * Array of submitted form values
- * @since 1.0
- * @var array
- * @access private
- */
- var $_submitValues = array();
-
- /**
- * Array of submitted form files
- * @since 1.0
- * @var integer
- * @access public
- */
- var $_submitFiles = array();
-
- /**
- * Value for maxfilesize hidden element if form contains file input
- * @since 1.0
- * @var integer
- * @access public
- */
- var $_maxFileSize = 1048576; // 1 Mb = 1048576
-
- /**
- * Flag to know if all fields are frozen
- * @since 1.0
- * @var boolean
- * @access private
- */
- var $_freezeAll = false;
-
- /**
- * Array containing the form rules
- * @since 1.0
- * @var array
- * @access private
- */
- var $_rules = array();
-
- /**
- * Form rules, global variety
- * @var array
- * @access private
- */
- var $_formRules = array();
-
- /**
- * Array containing the validation errors
- * @since 1.0
- * @var array
- * @access private
- */
- var $_errors = array();
-
- /**
- * Note for required fields in the form
- * @var string
- * @since 1.0
- * @access private
- */
- var $_requiredNote = '<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;"> denotes required field</span>';
-
- /**
- * Whether the form was submitted
- * @var boolean
- * @access private
- */
- var $_flagSubmitted = false;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- * @param string $formName Form's name.
- * @param string $method (optional)Form's method defaults to 'POST'
- * @param string $action (optional)Form's action
- * @param string $target (optional)Form's target defaults to '_self'
- * @param mixed $attributes (optional)Extra attributes for <form> tag
- * @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field
- * @access public
- */
- function HTML_QuickForm($formName='', $method='post', $action='', $target='', $attributes=null, $trackSubmit = false)
- {
- HTML_Common::HTML_Common($attributes);
- $method = (strtoupper($method) == 'GET') ? 'get' : 'post';
- $action = ($action == '') ? $_SERVER['PHP_SELF'] : $action;
- $target = empty($target) ? array() : array('target' => $target);
- $attributes = array('action'=>$action, 'method'=>$method, 'name'=>$formName, 'id'=>$formName) + $target;
- $this->updateAttributes($attributes);
- if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) {
- if (1 == get_magic_quotes_gpc()) {
- $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method? $_GET: $_POST);
- foreach ($_FILES as $keyFirst => $valFirst) {
- foreach ($valFirst as $keySecond => $valSecond) {
- if ('name' == $keySecond) {
- $this->_submitFiles[$keyFirst][$keySecond] = $this->_recursiveFilter('stripslashes', $valSecond);
- } else {
- $this->_submitFiles[$keyFirst][$keySecond] = $valSecond;
- }
- }
- }
- } else {
- $this->_submitValues = 'get' == $method? $_GET: $_POST;
- $this->_submitFiles = $_FILES;
- }
- $this->_flagSubmitted = count($this->_submitValues) > 0 || count($this->_submitFiles) > 0;
- }
- if ($trackSubmit) {
- unset($this->_submitValues['_qf__' . $formName]);
- $this->addElement('hidden', '_qf__' . $formName, null);
- }
- if (preg_match('/^([0-9]+)([a-zA-Z]*)$/', ini_get('upload_max_filesize'), $matches)) {
- // see http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
- switch (strtoupper($matches['2'])) {
- case 'G':
- $this->_maxFileSize = $matches['1'] * 1073741824;
- break;
- case 'M':
- $this->_maxFileSize = $matches['1'] * 1048576;
- break;
- case 'K':
- $this->_maxFileSize = $matches['1'] * 1024;
- break;
- default:
- $this->_maxFileSize = $matches['1'];
- }
- }
- } // end constructor
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Returns the current API version
- *
- * @since 1.0
- * @access public
- * @return float
- */
- function apiVersion()
- {
- return 3.2;
- } // end func apiVersion
-
- // }}}
- // {{{ registerElementType()
-
- /**
- * Registers a new element type
- *
- * @param string $typeName Name of element type
- * @param string $include Include path for element type
- * @param string $className Element class name
- * @since 1.0
- * @access public
- * @return void
- */
- function registerElementType($typeName, $include, $className)
- {
- $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][strtolower($typeName)] = array($include, $className);
- } // end func registerElementType
-
- // }}}
- // {{{ registerRule()
-
- /**
- * Registers a new validation rule
- *
- * @param string $ruleName Name of validation rule
- * @param string $type Either: 'regex', 'function' or 'rule' for an HTML_QuickForm_Rule object
- * @param string $data1 Name of function, regular expression or HTML_QuickForm_Rule classname
- * @param string $data2 Object parent of above function or HTML_QuickForm_Rule file path
- * @since 1.0
- * @access public
- * @return void
- */
- function registerRule($ruleName, $type, $data1, $data2 = null)
- {
- include_once('HTML/QuickForm/RuleRegistry.php');
- $registry =& HTML_QuickForm_RuleRegistry::singleton();
- $registry->registerRule($ruleName, $type, $data1, $data2);
- } // end func registerRule
-
- // }}}
- // {{{ elementExists()
-
- /**
- * Returns true if element is in the form
- *
- * @param string $element form name of element to check
- * @since 1.0
- * @access public
- * @return boolean
- */
- function elementExists($element=null)
- {
- return isset($this->_elementIndex[$element]);
- } // end func elementExists
-
- // }}}
- // {{{ setDatasource()
-
- /**
- * Sets a datasource object for this form object
- *
- * Datasource default and constant values will feed the QuickForm object if
- * the datasource implements defaultValues() and constantValues() methods.
- *
- * @param object $datasource datasource object implementing the informal datasource protocol
- * @param mixed $defaultsFilter string or array of filter(s) to apply to default values
- * @param mixed $constantsFilter string or array of filter(s) to apply to constants values
- * @since 3.3
- * @access public
- * @return void
- * @throws HTML_QuickForm_Error
- */
- function setDatasource(&$datasource, $defaultsFilter = null, $constantsFilter = null)
- {
- if (is_object($datasource)) {
- $this->_datasource =& $datasource;
- if (is_callable(array($datasource, 'defaultValues'))) {
- $this->setDefaults($datasource->defaultValues($this), $defaultsFilter);
- }
- if (is_callable(array($datasource, 'constantValues'))) {
- $this->setConstants($datasource->constantValues($this), $constantsFilter);
- }
- } else {
- return PEAR::raiseError(null, QUICKFORM_INVALID_DATASOURCE, null, E_USER_WARNING, "Datasource is not an object in QuickForm::setDatasource()", 'HTML_QuickForm_Error', true);
- }
- } // end func setDatasource
-
- // }}}
- // {{{ setDefaults()
-
- /**
- * Initializes default form values
- *
- * @param array $defaultValues values used to fill the form
- * @param mixed $filter (optional) filter(s) to apply to all default values
- * @since 1.0
- * @access public
- * @return void
- * @throws HTML_QuickForm_Error
- */
- function setDefaults($defaultValues = null, $filter = null)
- {
- if (is_array($defaultValues)) {
- if (isset($filter)) {
- if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
- foreach ($filter as $val) {
- if (!is_callable($val)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_FILTER, null, E_USER_WARNING, "Callback function does not exist in QuickForm::setDefaults()", 'HTML_QuickForm_Error', true);
- } else {
- $defaultValues = $this->_recursiveFilter($val, $defaultValues);
- }
- }
- } elseif (!is_callable($filter)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_FILTER, null, E_USER_WARNING, "Callback function does not exist in QuickForm::setDefaults()", 'HTML_QuickForm_Error', true);
- } else {
- $defaultValues = $this->_recursiveFilter($filter, $defaultValues);
- }
- }
- $this->_defaultValues = HTML_QuickForm::arrayMerge($this->_defaultValues, $defaultValues);
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->onQuickFormEvent('updateValue', null, $this);
- }
- }
- } // end func setDefaults
-
- // }}}
- // {{{ setConstants()
-
- /**
- * Initializes constant form values.
- * These values won't get overridden by POST or GET vars
- *
- * @param array $constantValues values used to fill the form
- * @param mixed $filter (optional) filter(s) to apply to all default values
- *
- * @since 2.0
- * @access public
- * @return void
- * @throws HTML_QuickForm_Error
- */
- function setConstants($constantValues = null, $filter = null)
- {
- if (is_array($constantValues)) {
- if (isset($filter)) {
- if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
- foreach ($filter as $val) {
- if (!is_callable($val)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_FILTER, null, E_USER_WARNING, "Callback function does not exist in QuickForm::setConstants()", 'HTML_QuickForm_Error', true);
- } else {
- $constantValues = $this->_recursiveFilter($val, $constantValues);
- }
- }
- } elseif (!is_callable($filter)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_FILTER, null, E_USER_WARNING, "Callback function does not exist in QuickForm::setConstants()", 'HTML_QuickForm_Error', true);
- } else {
- $constantValues = $this->_recursiveFilter($filter, $constantValues);
- }
- }
- $this->_constantValues = HTML_QuickForm::arrayMerge($this->_constantValues, $constantValues);
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->onQuickFormEvent('updateValue', null, $this);
- }
- }
- } // end func setConstants
-
- // }}}
- // {{{ setMaxFileSize()
-
- /**
- * Sets the value of MAX_FILE_SIZE hidden element
- *
- * @param int $bytes Size in bytes
- * @since 3.0
- * @access public
- * @return void
- */
- function setMaxFileSize($bytes = 0)
- {
- if ($bytes > 0) {
- $this->_maxFileSize = $bytes;
- }
- if (!$this->elementExists('MAX_FILE_SIZE')) {
- $this->addElement('hidden', 'MAX_FILE_SIZE', $this->_maxFileSize);
- } else {
- $el =& $this->getElement('MAX_FILE_SIZE');
- $el->updateAttributes(array('value' => $this->_maxFileSize));
- }
- } // end func setMaxFileSize
-
- // }}}
- // {{{ getMaxFileSize()
-
- /**
- * Returns the value of MAX_FILE_SIZE hidden element
- *
- * @since 3.0
- * @access public
- * @return int max file size in bytes
- */
- function getMaxFileSize()
- {
- return $this->_maxFileSize;
- } // end func getMaxFileSize
-
- // }}}
- // {{{ &createElement()
-
- /**
- * Creates a new form element of the given type.
- *
- * This method accepts variable number of parameters, their
- * meaning and count depending on $elementType
- *
- * @param string $elementType type of element to add (text, textarea, file...)
- * @since 1.0
- * @access public
- * @return HTML_QuickForm_Element
- * @throws HTML_QuickForm_Error
- */
- function &createElement($elementType)
- {
- $args = func_get_args();
- $element =& HTML_QuickForm::_loadElement('createElement', $elementType, array_slice($args, 1), null);
- return $element;
- } // end func createElement
-
- // }}}
- // {{{ _loadElement()
-
- /**
- * Returns a form element of the given type
- *
- * @param string $event event to send to newly created element ('createElement' or 'addElement')
- * @param string $type element type
- * @param array $args arguments for event
- * @since 2.0
- * @access private
- * @return HTML_QuickForm_Element
- * @throws HTML_QuickForm_Error
- */
- function &_loadElement($event, $type, $args, $form)
- {
- $type = strtolower($type);
- if (!HTML_QuickForm::isTypeRegistered($type)) {
- $error = PEAR::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, "Element '$type' does not exist in HTML_QuickForm::_loadElement()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- $className = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][1];
- $includeFile = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][0];
- include_once($includeFile);
- $elementObject = new $className();
- for ($i = 0; $i < 5; $i++) {
- if (!isset($args[$i])) {
- $args[$i] = null;
- }
- }
- $err = $elementObject->onQuickFormEvent($event, $args, $form);
- if ($err !== true) {
- return $err;
- }
- return $elementObject;
- } // end func _loadElement
-
- // }}}
- // {{{ addElement()
-
- /**
- * Adds an element into the form
- *
- * If $element is a string representing element type, then this
- * method accepts variable number of parameters, their meaning
- * and count depending on $element
- *
- * @param mixed $element element object or type of element to add (text, textarea, file...)
- * @since 1.0
- * @return HTML_QuickForm_Element a reference to newly added element
- * @access public
- * @throws HTML_QuickForm_Error
- */
- function &addElement($element)
- {
- if (is_object($element) && is_subclass_of($element, 'html_quickform_element')) {
- $elementObject = &$element;
- $elementObject->onQuickFormEvent('updateValue', null, $this);
- } else {
- $args = func_get_args();
- $elementObject =& $this->_loadElement('addElement', $element, array_slice($args, 1), $this);
- if (PEAR::isError($elementObject)) {
- return $elementObject;
- }
- }
- $elementName = $elementObject->getName();
-
- // Add the element if it is not an incompatible duplicate
- if (!empty($elementName) && isset($this->_elementIndex[$elementName])) {
- if ($this->_elements[$this->_elementIndex[$elementName]]->getType() ==
- $elementObject->getType()) {
- $this->_elements[] =& $elementObject;
- $elKeys = array_keys($this->_elements);
- $this->_duplicateIndex[$elementName][] = end($elKeys);
- } else {
- $error = PEAR::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, "Element '$elementName' already exists in HTML_QuickForm::addElement()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- } else {
- $this->_elements[] =& $elementObject;
- $elKeys = array_keys($this->_elements);
- $this->_elementIndex[$elementName] = end($elKeys);
- }
- if ($this->_freezeAll) {
- $elementObject->freeze();
- }
-
- return $elementObject;
- } // end func addElement
-
- // }}}
- // {{{ insertElementBefore()
-
- /**
- * Inserts a new element right before the other element
- *
- * Warning: it is not possible to check whether the $element is already
- * added to the form, therefore if you want to move the existing form
- * element to a new position, you'll have to use removeElement():
- * $form->insertElementBefore($form->removeElement('foo', false), 'bar');
- *
- * @access public
- * @since 3.2.4
- * @param HTML_QuickForm_element Element to insert
- * @param string Name of the element before which the new
- * one is inserted
- * @return HTML_QuickForm_element reference to inserted element
- * @throws HTML_QuickForm_Error
- */
- function &insertElementBefore(&$element, $nameAfter)
- {
- if (!empty($this->_duplicateIndex[$nameAfter])) {
- $error = PEAR::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, 'Several elements named "' . $nameAfter . '" exist in HTML_QuickForm::insertElementBefore().', 'HTML_QuickForm_Error', true);
- return $error;
- } elseif (!$this->elementExists($nameAfter)) {
- $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$nameAfter' does not exist in HTML_QuickForm::insertElementBefore()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- $elementName = $element->getName();
- $targetIdx = $this->_elementIndex[$nameAfter];
- $duplicate = false;
- // Like in addElement(), check that it's not an incompatible duplicate
- if (!empty($elementName) && isset($this->_elementIndex[$elementName])) {
- if ($this->_elements[$this->_elementIndex[$elementName]]->getType() != $element->getType()) {
- $error = PEAR::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, "Element '$elementName' already exists in HTML_QuickForm::insertElementBefore()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- $duplicate = true;
- }
- // Move all the elements after added back one place, reindex _elementIndex and/or _duplicateIndex
- $elKeys = array_keys($this->_elements);
- for ($i = end($elKeys); $i >= $targetIdx; $i--) {
- if (isset($this->_elements[$i])) {
- $currentName = $this->_elements[$i]->getName();
- $this->_elements[$i + 1] =& $this->_elements[$i];
- if ($this->_elementIndex[$currentName] == $i) {
- $this->_elementIndex[$currentName] = $i + 1;
- } else {
- $dupIdx = array_search($i, $this->_duplicateIndex[$currentName]);
- $this->_duplicateIndex[$currentName][$dupIdx] = $i + 1;
- }
- unset($this->_elements[$i]);
- }
- }
- // Put the element in place finally
- $this->_elements[$targetIdx] =& $element;
- if (!$duplicate) {
- $this->_elementIndex[$elementName] = $targetIdx;
- } else {
- $this->_duplicateIndex[$elementName][] = $targetIdx;
- }
- $element->onQuickFormEvent('updateValue', null, $this);
- if ($this->_freezeAll) {
- $element->freeze();
- }
- // If not done, the elements will appear in reverse order
- ksort($this->_elements);
- return $element;
- }
-
- // }}}
- // {{{ addGroup()
-
- /**
- * Adds an element group
- * @param array $elements array of elements composing the group
- * @param string $name (optional)group name
- * @param string $groupLabel (optional)group label
- * @param string $separator (optional)string to separate elements
- * @param string $appendName (optional)specify whether the group name should be
- * used in the form element name ex: group[element]
- * @return HTML_QuickForm_group reference to a newly added group
- * @since 2.8
- * @access public
- * @throws HTML_QuickForm_Error
- */
- function &addGroup($elements, $name=null, $groupLabel='', $separator=null, $appendName = true)
- {
- static $anonGroups = 1;
-
- if (0 == strlen($name)) {
- $name = 'qf_group_' . $anonGroups++;
- $appendName = false;
- }
- $group =& $this->addElement('group', $name, $groupLabel, $elements, $separator, $appendName);
- return $group;
- } // end func addGroup
-
- // }}}
- // {{{ &getElement()
-
- /**
- * Returns a reference to the element
- *
- * @param string $element Element name
- * @since 2.0
- * @access public
- * @return HTML_QuickForm_element reference to element
- * @throws HTML_QuickForm_Error
- */
- function &getElement($element)
- {
- if (isset($this->_elementIndex[$element])) {
- return $this->_elements[$this->_elementIndex[$element]];
- } else {
- $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::getElement()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- } // end func getElement
-
- // }}}
- // {{{ &getElementValue()
-
- /**
- * Returns the element's raw value
- *
- * This returns the value as submitted by the form (not filtered)
- * or set via setDefaults() or setConstants()
- *
- * @param string $element Element name
- * @since 2.0
- * @access public
- * @return mixed element value
- * @throws HTML_QuickForm_Error
- */
- function &getElementValue($element)
- {
- if (!isset($this->_elementIndex[$element])) {
- $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::getElementValue()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- $value = $this->_elements[$this->_elementIndex[$element]]->getValue();
- if (isset($this->_duplicateIndex[$element])) {
- foreach ($this->_duplicateIndex[$element] as $index) {
- if (null !== ($v = $this->_elements[$index]->getValue())) {
- if (is_array($value)) {
- $value[] = $v;
- } else {
- $value = (null === $value)? $v: array($value, $v);
- }
- }
- }
- }
- return $value;
- } // end func getElementValue
-
- // }}}
- // {{{ getSubmitValue()
-
- /**
- * Returns the elements value after submit and filter
- *
- * @param string Element name
- * @since 2.0
- * @access public
- * @return mixed submitted element value or null if not set
- */
- function getSubmitValue($elementName)
- {
- $value = null;
- if (isset($this->_submitValues[$elementName]) || isset($this->_submitFiles[$elementName])) {
- $value = isset($this->_submitValues[$elementName])? $this->_submitValues[$elementName]: array();
- if (is_array($value) && isset($this->_submitFiles[$elementName])) {
- foreach ($this->_submitFiles[$elementName] as $k => $v) {
- $value = HTML_QuickForm::arrayMerge($value, $this->_reindexFiles($this->_submitFiles[$elementName][$k], $k));
- }
- }
-
- } elseif ('file' == $this->getElementType($elementName)) {
- return $this->getElementValue($elementName);
-
- } elseif (false !== ($pos = strpos($elementName, '['))) {
- $base = str_replace(
- array('\\', '\''), array('\\\\', '\\\''),
- substr($elementName, 0, $pos)
- );
-
- $keys = str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- substr($elementName, $pos + 1, -1)
- );
- $idx = "['" . $keys . "']";
- $keyArray = explode("']['", $keys);
-
- if (isset($this->_submitValues[$base])) {
- $value = HTML_QuickForm_utils::recursiveValue($this->_submitValues[$base], $keyArray, NULL);
- }
-
- if ((is_array($value) || null === $value) && isset($this->_submitFiles[$base])) {
- $props = array('name', 'type', 'size', 'tmp_name', 'error');
- $code = "if (!isset(\$this->_submitFiles['{$base}']['name']{$idx})) {\n" .
- " return null;\n" .
- "} else {\n" .
- " \$v = array();\n";
- foreach ($props as $prop) {
- $code .= " \$v = HTML_QuickForm::arrayMerge(\$v, \$this->_reindexFiles(\$this->_submitFiles['{$base}']['{$prop}']{$idx}, '{$prop}'));\n";
- }
- $fileValue = eval($code . " return \$v;\n}\n");
- if (null !== $fileValue) {
- $value = null === $value? $fileValue: HTML_QuickForm::arrayMerge($value, $fileValue);
- }
- }
- }
-
- // This is only supposed to work for groups with appendName = false
- if (null === $value && 'group' == $this->getElementType($elementName)) {
- $group =& $this->getElement($elementName);
- $elements =& $group->getElements();
- foreach (array_keys($elements) as $key) {
- $name = $group->getElementName($key);
- // prevent endless recursion in case of radios and such
- if ($name != $elementName) {
- if (null !== ($v = $this->getSubmitValue($name))) {
- $value[$name] = $v;
- }
- }
- }
- }
- return $value;
- } // end func getSubmitValue
-
- // }}}
- // {{{ _reindexFiles()
-
- /**
- * A helper function to change the indexes in $_FILES array
- *
- * @param mixed Some value from the $_FILES array
- * @param string The key from the $_FILES array that should be appended
- * @return array
- */
- function _reindexFiles($value, $key)
- {
- if (!is_array($value)) {
- return array($key => $value);
- } else {
- $ret = array();
- foreach ($value as $k => $v) {
- $ret[$k] = $this->_reindexFiles($v, $key);
- }
- return $ret;
- }
- }
-
- // }}}
- // {{{ getElementError()
-
- /**
- * Returns error corresponding to validated element
- *
- * @param string $element Name of form element to check
- * @since 1.0
- * @access public
- * @return string error message corresponding to checked element
- */
- function getElementError($element)
- {
- if (isset($this->_errors[$element])) {
- return $this->_errors[$element];
- }
- } // end func getElementError
-
- // }}}
- // {{{ setElementError()
-
- /**
- * Set error message for a form element
- *
- * @param string $element Name of form element to set error for
- * @param string $message Error message, if empty then removes the current error message
- * @since 1.0
- * @access public
- * @return void
- */
- function setElementError($element, $message = null)
- {
- if (!empty($message)) {
- $this->_errors[$element] = $message;
- } else {
- unset($this->_errors[$element]);
- }
- } // end func setElementError
-
- // }}}
- // {{{ getElementType()
-
- /**
- * Returns the type of the given element
- *
- * @param string $element Name of form element
- * @since 1.1
- * @access public
- * @return string Type of the element, false if the element is not found
- */
- function getElementType($element)
- {
- if (isset($this->_elementIndex[$element])) {
- return $this->_elements[$this->_elementIndex[$element]]->getType();
- }
- return false;
- } // end func getElementType
-
- // }}}
- // {{{ updateElementAttr()
-
- /**
- * Updates Attributes for one or more elements
- *
- * @param mixed $elements Array of element names/objects or string of elements to be updated
- * @param mixed $attrs Array or sting of html attributes
- * @since 2.10
- * @access public
- * @return void
- */
- function updateElementAttr($elements, $attrs)
- {
- if (is_string($elements)) {
- $elements = preg_split('/[ ]?,[ ]?/', $elements);
- }
- foreach (array_keys($elements) as $key) {
- if (is_object($elements[$key]) && is_a($elements[$key], 'HTML_QuickForm_element')) {
- $elements[$key]->updateAttributes($attrs);
- } elseif (isset($this->_elementIndex[$elements[$key]])) {
- $this->_elements[$this->_elementIndex[$elements[$key]]]->updateAttributes($attrs);
- if (isset($this->_duplicateIndex[$elements[$key]])) {
- foreach ($this->_duplicateIndex[$elements[$key]] as $index) {
- $this->_elements[$index]->updateAttributes($attrs);
- }
- }
- }
- }
- } // end func updateElementAttr
-
- // }}}
- // {{{ removeElement()
-
- /**
- * Removes an element
- *
- * The method "unlinks" an element from the form, returning the reference
- * to the element object. If several elements named $elementName exist,
- * it removes the first one, leaving the others intact.
- *
- * @param string $elementName The element name
- * @param boolean $removeRules True if rules for this element are to be removed too
- * @access public
- * @since 2.0
- * @return HTML_QuickForm_element a reference to the removed element
- * @throws HTML_QuickForm_Error
- */
- function &removeElement($elementName, $removeRules = true)
- {
- if (!isset($this->_elementIndex[$elementName])) {
- $error = PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$elementName' does not exist in HTML_QuickForm::removeElement()", 'HTML_QuickForm_Error', true);
- return $error;
- }
- $el =& $this->_elements[$this->_elementIndex[$elementName]];
- unset($this->_elements[$this->_elementIndex[$elementName]]);
- if (empty($this->_duplicateIndex[$elementName])) {
- unset($this->_elementIndex[$elementName]);
- } else {
- $this->_elementIndex[$elementName] = array_shift($this->_duplicateIndex[$elementName]);
- }
- if ($removeRules) {
- $this->_required = array_diff($this->_required, array($elementName));
- unset($this->_rules[$elementName], $this->_errors[$elementName]);
- if ('group' == $el->getType()) {
- foreach (array_keys($el->getElements()) as $key) {
- unset($this->_rules[$el->getElementName($key)]);
- }
- }
- }
- return $el;
- } // end func removeElement
-
- // }}}
- // {{{ addRule()
-
- /**
- * Adds a validation rule for the given field
- *
- * If the element is in fact a group, it will be considered as a whole.
- * To validate grouped elements as separated entities,
- * use addGroupRule instead of addRule.
- *
- * @param string $element Form element name
- * @param string $message Message to display for invalid data
- * @param string $type Rule type, use getRegisteredRules() to get types
- * @param string $format (optional)Required for extra rule data
- * @param string $validation (optional)Where to perform validation: "server", "client"
- * @param boolean $reset Client-side validation: reset the form element to its original value if there is an error?
- * @param boolean $force Force the rule to be applied, even if the target form element does not exist
- * @since 1.0
- * @access public
- * @throws HTML_QuickForm_Error
- */
- function addRule($element, $message, $type, $format=null, $validation='server', $reset = false, $force = false)
- {
- if (!$force) {
- if (!is_array($element) && !$this->elementExists($element)) {
- return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::addRule()", 'HTML_QuickForm_Error', true);
- } elseif (is_array($element)) {
- foreach ($element as $el) {
- if (!$this->elementExists($el)) {
- return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$el' does not exist in HTML_QuickForm::addRule()", 'HTML_QuickForm_Error', true);
- }
- }
- }
- }
- if (false === ($newName = $this->isRuleRegistered($type, true))) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_RULE, null, E_USER_WARNING, "Rule '$type' is not registered in HTML_QuickForm::addRule()", 'HTML_QuickForm_Error', true);
- } elseif (is_string($newName)) {
- $type = $newName;
- }
- if (is_array($element)) {
- $dependent = $element;
- $element = array_shift($dependent);
- } else {
- $dependent = null;
- }
- if ($type == 'required' || $type == 'uploadedfile') {
- $this->_required[] = $element;
- }
- if (!isset($this->_rules[$element])) {
- $this->_rules[$element] = array();
- }
- if ($validation == 'client') {
- $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_attributes['id'] . '; } catch(e) { return true; } return myValidator(this);'));
- }
- $this->_rules[$element][] = array(
- 'type' => $type,
- 'format' => $format,
- 'message' => $message,
- 'validation' => $validation,
- 'reset' => $reset,
- 'dependent' => $dependent
- );
- } // end func addRule
-
- // }}}
- // {{{ addGroupRule()
-
- /**
- * Adds a validation rule for the given group of elements
- *
- * Only groups with a name can be assigned a validation rule
- * Use addGroupRule when you need to validate elements inside the group.
- * Use addRule if you need to validate the group as a whole. In this case,
- * the same rule will be applied to all elements in the group.
- * Use addRule if you need to validate the group against a function.
- *
- * @param string $group Form group name
- * @param mixed $arg1 Array for multiple elements or error message string for one element
- * @param string $type (optional)Rule type use getRegisteredRules() to get types
- * @param string $format (optional)Required for extra rule data
- * @param int $howmany (optional)How many valid elements should be in the group
- * @param string $validation (optional)Where to perform validation: "server", "client"
- * @param bool $reset Client-side: whether to reset the element's value to its original state if validation failed.
- * @since 2.5
- * @access public
- * @throws HTML_QuickForm_Error
- */
- function addGroupRule($group, $arg1, $type='', $format=null, $howmany=0, $validation = 'server', $reset = false)
- {
- if (!$this->elementExists($group)) {
- return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Group '$group' does not exist in HTML_QuickForm::addGroupRule()", 'HTML_QuickForm_Error', true);
- }
-
- $groupObj =& $this->getElement($group);
- if (is_array($arg1)) {
- $required = 0;
- foreach ($arg1 as $elementIndex => $rules) {
- $elementName = $groupObj->getElementName($elementIndex);
- foreach ($rules as $rule) {
- $format = (isset($rule[2])) ? $rule[2] : null;
- $validation = (isset($rule[3]) && 'client' == $rule[3])? 'client': 'server';
- $reset = isset($rule[4]) && $rule[4];
- $type = $rule[1];
- if (false === ($newName = $this->isRuleRegistered($type, true))) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_RULE, null, E_USER_WARNING, "Rule '$type' is not registered in HTML_QuickForm::addGroupRule()", 'HTML_QuickForm_Error', true);
- } elseif (is_string($newName)) {
- $type = $newName;
- }
-
- $this->_rules[$elementName][] = array(
- 'type' => $type,
- 'format' => $format,
- 'message' => $rule[0],
- 'validation' => $validation,
- 'reset' => $reset,
- 'group' => $group);
-
- if ('required' == $type || 'uploadedfile' == $type) {
- $groupObj->_required[] = $elementName;
- $this->_required[] = $elementName;
- $required++;
- }
- if ('client' == $validation) {
- $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_attributes['id'] . '; } catch(e) { return true; } return myValidator(this);'));
- }
- }
- }
- if ($required > 0 && count($groupObj->getElements()) == $required) {
- $this->_required[] = $group;
- }
- } elseif (is_string($arg1)) {
- if (false === ($newName = $this->isRuleRegistered($type, true))) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_RULE, null, E_USER_WARNING, "Rule '$type' is not registered in HTML_QuickForm::addGroupRule()", 'HTML_QuickForm_Error', true);
- } elseif (is_string($newName)) {
- $type = $newName;
- }
-
- // addGroupRule() should also handle <select multiple>
- if (is_a($groupObj, 'html_quickform_group')) {
- // Radios need to be handled differently when required
- if ($type == 'required' && $groupObj->getGroupType() == 'radio') {
- $howmany = ($howmany == 0) ? 1 : $howmany;
- } else {
- $howmany = ($howmany == 0) ? count($groupObj->getElements()) : $howmany;
- }
- }
-
- $this->_rules[$group][] = array('type' => $type,
- 'format' => $format,
- 'message' => $arg1,
- 'validation' => $validation,
- 'howmany' => $howmany,
- 'reset' => $reset);
- if ($type == 'required') {
- $this->_required[] = $group;
- }
- if ($validation == 'client') {
- $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_attributes['id'] . '; } catch(e) { return true; } return myValidator(this);'));
- }
- }
- } // end func addGroupRule
-
- // }}}
- // {{{ addFormRule()
-
- /**
- * Adds a global validation rule
- *
- * This should be used when for a rule involving several fields or if
- * you want to use some completely custom validation for your form.
- * The rule function/method should return true in case of successful
- * validation and array('element name' => 'error') when there were errors.
- *
- * @access public
- * @param mixed Callback, either function name or array(&$object, 'method')
- * @throws HTML_QuickForm_Error
- */
- function addFormRule($rule)
- {
- if (!is_callable($rule)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_RULE, null, E_USER_WARNING, 'Callback function does not exist in HTML_QuickForm::addFormRule()', 'HTML_QuickForm_Error', true);
- }
- $this->_formRules[] = $rule;
- }
-
- // }}}
- // {{{ applyFilter()
-
- /**
- * Applies a data filter for the given field(s)
- *
- * @param mixed $element Form element name or array of such names
- * @param mixed $filter Callback, either function name or array(&$object, 'method')
- * @since 2.0
- * @access public
- * @throws HTML_QuickForm_Error
- */
- function applyFilter($element, $filter)
- {
- if (!is_callable($filter)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_FILTER, null, E_USER_WARNING, "Callback function does not exist in QuickForm::applyFilter()", 'HTML_QuickForm_Error', true);
- }
- if ($element == '__ALL__') {
- $this->_submitValues = $this->_recursiveFilter($filter, $this->_submitValues);
- } else {
- if (!is_array($element)) {
- $element = array($element);
- }
- foreach ($element as $elName) {
- $value = $this->getSubmitValue($elName);
- if (null !== $value) {
- if (false === strpos($elName, '[')) {
- $this->_submitValues[$elName] = $this->_recursiveFilter($filter, $value);
- } else {
- $idx = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $elName
- ) . "']";
- eval("\$this->_submitValues{$idx} = \$this->_recursiveFilter(\$filter, \$value);");
- }
- }
- }
- }
- } // end func applyFilter
-
- // }}}
- // {{{ _recursiveFilter()
-
- /**
- * Recursively apply a filter function
- *
- * @param string $filter filter to apply
- * @param mixed $value submitted values
- * @since 2.0
- * @access private
- * @return cleaned values
- */
- function _recursiveFilter($filter, $value)
- {
- if (is_array($value)) {
- $cleanValues = array();
- foreach ($value as $k => $v) {
- $cleanValues[$k] = $this->_recursiveFilter($filter, $v);
- }
- return $cleanValues;
- } else {
- return call_user_func($filter, $value);
- }
- } // end func _recursiveFilter
-
- // }}}
- // {{{ arrayMerge()
-
- /**
- * Merges two arrays
- *
- * Merges two array like the PHP function array_merge but recursively.
- * The main difference is that existing keys will not be renumbered
- * if they are integers.
- *
- * @access public
- * @param array $a original array
- * @param array $b array which will be merged into first one
- * @return array merged array
- */
- function arrayMerge($a, $b)
- {
- foreach ($b as $k => $v) {
- if (is_array($v)) {
- if (isset($a[$k]) && !is_array($a[$k])) {
- $a[$k] = $v;
- } else {
- if (!isset($a[$k])) {
- $a[$k] = array();
- }
- $a[$k] = HTML_QuickForm::arrayMerge($a[$k], $v);
- }
- } else {
- $a[$k] = $v;
- }
- }
- return $a;
- } // end func arrayMerge
-
- // }}}
- // {{{ isTypeRegistered()
-
- /**
- * Returns whether or not the form element type is supported
- *
- * @param string $type Form element type
- * @since 1.0
- * @access public
- * @return boolean
- */
- function isTypeRegistered($type)
- {
- return isset($GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][strtolower($type)]);
- } // end func isTypeRegistered
-
- // }}}
- // {{{ getRegisteredTypes()
-
- /**
- * Returns an array of registered element types
- *
- * @since 1.0
- * @access public
- * @return array
- */
- function getRegisteredTypes()
- {
- return array_keys($GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES']);
- } // end func getRegisteredTypes
-
- // }}}
- // {{{ isRuleRegistered()
-
- /**
- * Returns whether or not the given rule is supported
- *
- * @param string $name Validation rule name
- * @param bool Whether to automatically register subclasses of HTML_QuickForm_Rule
- * @since 1.0
- * @access public
- * @return mixed true if previously registered, false if not, new rule name if auto-registering worked
- */
- function isRuleRegistered($name, $autoRegister = false)
- {
- if (is_scalar($name) && isset($GLOBALS['_HTML_QuickForm_registered_rules'][$name])) {
- return true;
- } elseif (!$autoRegister) {
- return false;
- }
- // automatically register the rule if requested
- include_once 'HTML/QuickForm/RuleRegistry.php';
- $ruleName = false;
- if (is_object($name) && is_a($name, 'html_quickform_rule')) {
- $ruleName = !empty($name->name)? $name->name: strtolower(get_class($name));
- } elseif (is_string($name) && class_exists($name)) {
- $parent = strtolower($name);
- do {
- if ('html_quickform_rule' == strtolower($parent)) {
- $ruleName = strtolower($name);
- break;
- }
- } while ($parent = get_parent_class($parent));
- }
- if ($ruleName) {
- $registry =& HTML_QuickForm_RuleRegistry::singleton();
- $registry->registerRule($ruleName, null, $name);
- }
- return $ruleName;
- } // end func isRuleRegistered
-
- // }}}
- // {{{ getRegisteredRules()
-
- /**
- * Returns an array of registered validation rules
- *
- * @since 1.0
- * @access public
- * @return array
- */
- function getRegisteredRules()
- {
- return array_keys($GLOBALS['_HTML_QuickForm_registered_rules']);
- } // end func getRegisteredRules
-
- // }}}
- // {{{ isElementRequired()
-
- /**
- * Returns whether or not the form element is required
- *
- * @param string $element Form element name
- * @since 1.0
- * @access public
- * @return boolean
- */
- function isElementRequired($element)
- {
- return in_array($element, $this->_required, true);
- } // end func isElementRequired
-
- // }}}
- // {{{ isElementFrozen()
-
- /**
- * Returns whether or not the form element is frozen
- *
- * @param string $element Form element name
- * @since 1.0
- * @access public
- * @return boolean
- */
- function isElementFrozen($element)
- {
- if (isset($this->_elementIndex[$element])) {
- return $this->_elements[$this->_elementIndex[$element]]->isFrozen();
- }
- return false;
- } // end func isElementFrozen
-
- // }}}
- // {{{ setJsWarnings()
-
- /**
- * Sets JavaScript warning messages
- *
- * @param string $pref Prefix warning
- * @param string $post Postfix warning
- * @since 1.1
- * @access public
- * @return void
- */
- function setJsWarnings($pref, $post)
- {
- $this->_jsPrefix = $pref;
- $this->_jsPostfix = $post;
- } // end func setJsWarnings
-
- // }}}
- // {{{ setRequiredNote()
-
- /**
- * Sets required-note
- *
- * @param string $note Message indicating some elements are required
- * @since 1.1
- * @access public
- * @return void
- */
- function setRequiredNote($note)
- {
- $this->_requiredNote = $note;
- } // end func setRequiredNote
-
- // }}}
- // {{{ getRequiredNote()
-
- /**
- * Returns the required note
- *
- * @since 2.0
- * @access public
- * @return string
- */
- function getRequiredNote()
- {
- return $this->_requiredNote;
- } // end func getRequiredNote
-
- // }}}
- // {{{ validate()
-
- /**
- * Performs the server side validation
- * @access public
- * @since 1.0
- * @return boolean true if no error found
- * @throws HTML_QuickForm_Error
- */
- function validate()
- {
- if (count($this->_rules) == 0 && count($this->_formRules) == 0 &&
- $this->isSubmitted()) {
- return (0 == count($this->_errors));
- } elseif (!$this->isSubmitted()) {
- return false;
- }
-
- include_once('HTML/QuickForm/RuleRegistry.php');
- $registry =& HTML_QuickForm_RuleRegistry::singleton();
-
- foreach ($this->_rules as $target => $rules) {
- $submitValue = $this->getSubmitValue($target);
-
- foreach ($rules as $rule) {
- if ((isset($rule['group']) && isset($this->_errors[$rule['group']])) ||
- isset($this->_errors[$target])) {
- continue 2;
- }
- // If element is not required and is empty, we shouldn't validate it
- if (!$this->isElementRequired($target)) {
- if (!isset($submitValue) || '' == $submitValue) {
- continue 2;
- // Fix for bug #3501: we shouldn't validate not uploaded files, either.
- // Unfortunately, we can't just use $element->isUploadedFile() since
- // the element in question can be buried in group. Thus this hack.
- // See also bug #12014, we should only consider a file that has
- // status UPLOAD_ERR_NO_FILE as not uploaded, in all other cases
- // validation should be performed, so that e.g. 'maxfilesize' rule
- // will display an error if status is UPLOAD_ERR_INI_SIZE
- // or UPLOAD_ERR_FORM_SIZE
- } elseif (is_array($submitValue)) {
- if (false === ($pos = strpos($target, '['))) {
- $isUpload = !empty($this->_submitFiles[$target]);
- } else {
- $base = str_replace(
- array('\\', '\''), array('\\\\', '\\\''),
- substr($target, 0, $pos)
- );
- $idx = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- substr($target, $pos + 1, -1)
- ) . "']";
- eval("\$isUpload = isset(\$this->_submitFiles['{$base}']['name']{$idx});");
- }
- if ($isUpload && (!isset($submitValue['error']) || UPLOAD_ERR_NO_FILE == $submitValue['error'])) {
- continue 2;
- }
- }
- }
- if (isset($rule['dependent']) && is_array($rule['dependent'])) {
- $values = array($submitValue);
- foreach ($rule['dependent'] as $elName) {
- $values[] = $this->getSubmitValue($elName);
- }
- $result = $registry->validate($rule['type'], $values, $rule['format'], true);
- } elseif (is_array($submitValue) && !isset($rule['howmany'])) {
- $result = $registry->validate($rule['type'], $submitValue, $rule['format'], true);
- } else {
- $result = $registry->validate($rule['type'], $submitValue, $rule['format'], false);
- }
-
- if (!$result || (!empty($rule['howmany']) && $rule['howmany'] > (int)$result)) {
- if (isset($rule['group'])) {
- $this->_errors[$rule['group']] = $rule['message'];
- } else {
- $this->_errors[$target] = $rule['message'];
- }
- }
- }
- }
-
- // process the global rules now
- foreach ($this->_formRules as $rule) {
- if (true !== ($res = call_user_func($rule, $this->_submitValues, $this->_submitFiles))) {
- if (is_array($res)) {
- $this->_errors += $res;
- } else {
- return PEAR::raiseError(null, QUICKFORM_ERROR, null, E_USER_WARNING, 'Form rule callback returned invalid value in HTML_QuickForm::validate()', 'HTML_QuickForm_Error', true);
- }
- }
- }
-
- return (0 == count($this->_errors));
- } // end func validate
-
- // }}}
- // {{{ freeze()
-
- /**
- * Displays elements without HTML input tags
- *
- * @param mixed $elementList array or string of element(s) to be frozen
- * @since 1.0
- * @access public
- * @throws HTML_QuickForm_Error
- */
- function freeze($elementList=null)
- {
- if (!isset($elementList)) {
- $this->_freezeAll = true;
- $elementList = array();
- } else {
- if (!is_array($elementList)) {
- $elementList = preg_split('/[ ]*,[ ]*/', $elementList);
- }
- $elementList = array_flip($elementList);
- }
-
- foreach (array_keys($this->_elements) as $key) {
- $name = $this->_elements[$key]->getName();
- if ($this->_freezeAll || isset($elementList[$name])) {
- $this->_elements[$key]->freeze();
- unset($elementList[$name]);
- }
- }
-
- if (!empty($elementList)) {
- return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Nonexistant element(s): '" . implode("', '", array_keys($elementList)) . "' in HTML_QuickForm::freeze()", 'HTML_QuickForm_Error', true);
- }
- return true;
- } // end func freeze
-
- // }}}
- // {{{ isFrozen()
-
- /**
- * Returns whether or not the whole form is frozen
- *
- * @since 3.0
- * @access public
- * @return boolean
- */
- function isFrozen()
- {
- return $this->_freezeAll;
- } // end func isFrozen
-
- // }}}
- // {{{ process()
-
- /**
- * Performs the form data processing
- *
- * @param mixed $callback Callback, either function name or array(&$object, 'method')
- * @param bool $mergeFiles Whether uploaded files should be processed too
- * @since 1.0
- * @access public
- * @throws HTML_QuickForm_Error
- * @return mixed Whatever value the $callback function returns
- */
- function process($callback, $mergeFiles = true)
- {
- if (!is_callable($callback)) {
- return PEAR::raiseError(null, QUICKFORM_INVALID_PROCESS, null, E_USER_WARNING, "Callback function does not exist in QuickForm::process()", 'HTML_QuickForm_Error', true);
- }
- $values = ($mergeFiles === true) ? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles) : $this->_submitValues;
- return call_user_func($callback, $values);
- } // end func process
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param object An HTML_QuickForm_Renderer object
- * @since 3.0
- * @access public
- * @return void
- */
- function accept(&$renderer)
- {
- $renderer->startForm($this);
- foreach (array_keys($this->_elements) as $key) {
- $element =& $this->_elements[$key];
- $elementName = $element->getName();
- $required = ($this->isElementRequired($elementName) && !$element->isFrozen());
- $error = $this->getElementError($elementName);
- $element->accept($renderer, $required, $error);
- }
- $renderer->finishForm($this);
- } // end func accept
-
- // }}}
- // {{{ defaultRenderer()
-
- /**
- * Returns a reference to default renderer object
- *
- * @access public
- * @since 3.0
- * @return object a default renderer object
- */
- function &defaultRenderer()
- {
- if (!isset($GLOBALS['_HTML_QuickForm_default_renderer'])) {
- include_once('HTML/QuickForm/Renderer/Default.php');
- $GLOBALS['_HTML_QuickForm_default_renderer'] = new HTML_QuickForm_Renderer_Default();
- }
- return $GLOBALS['_HTML_QuickForm_default_renderer'];
- } // end func defaultRenderer
-
- // }}}
- // {{{ toHtml ()
-
- /**
- * Returns an HTML version of the form
- *
- * @param string $in_data (optional) Any extra data to insert right
- * before form is rendered. Useful when using templates.
- *
- * @return string Html version of the form
- * @since 1.0
- * @access public
- */
- function toHtml ($in_data = null)
- {
- if (!is_null($in_data)) {
- $this->addElement('html', $in_data);
- }
- $renderer =& $this->defaultRenderer();
- $this->accept($renderer);
- return $renderer->toHtml();
- } // end func toHtml
-
- // }}}
- // {{{ getValidationScript()
-
- /**
- * Returns the client side validation script
- *
- * @since 2.0
- * @access public
- * @return string Javascript to perform validation, empty string if no 'client' rules were added
- */
- function getValidationScript()
- {
- if (empty($this->_rules) || empty($this->_attributes['onsubmit'])) {
- return '';
- }
-
- include_once('HTML/QuickForm/RuleRegistry.php');
- $registry =& HTML_QuickForm_RuleRegistry::singleton();
- $test = array();
- $js_escape = array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- );
-
- foreach ($this->_rules as $elementName => $rules) {
- foreach ($rules as $rule) {
- if ('client' == $rule['validation']) {
- unset($element);
-
- $dependent = isset($rule['dependent']) && is_array($rule['dependent']);
- $rule['message'] = strtr($rule['message'], $js_escape);
-
- if (isset($rule['group'])) {
- $group =& $this->getElement($rule['group']);
- // No JavaScript validation for frozen elements
- if ($group->isFrozen()) {
- continue 2;
- }
- $elements =& $group->getElements();
- foreach (array_keys($elements) as $key) {
- if ($elementName == $group->getElementName($key)) {
- $element =& $elements[$key];
- break;
- }
- }
- } elseif ($dependent) {
- $element = array();
- $element[] =& $this->getElement($elementName);
- foreach ($rule['dependent'] as $elName) {
- $element[] =& $this->getElement($elName);
- }
- } else {
- $element =& $this->getElement($elementName);
- }
- // No JavaScript validation for frozen elements
- if (is_object($element) && $element->isFrozen()) {
- continue 2;
- } elseif (is_array($element)) {
- foreach (array_keys($element) as $key) {
- if ($element[$key]->isFrozen()) {
- continue 3;
- }
- }
- }
-
- $test[] = $registry->getValidationScript($element, $elementName, $rule);
- }
- }
- }
- if (count($test) > 0) {
- return
- "\n<script type=\"text/javascript\">\n" .
- "//<![CDATA[\n" .
- "function validate_" . $this->_attributes['id'] . "(frm) {\n" .
- " var value = '';\n" .
- " var errFlag = new Array();\n" .
- " var _qfGroups = {};\n" .
- " _qfMsg = '';\n\n" .
- join("\n", $test) .
- "\n if (_qfMsg != '') {\n" .
- " _qfMsg = '" . strtr($this->_jsPrefix, $js_escape) . "' + _qfMsg;\n" .
- " _qfMsg = _qfMsg + '\\n" . strtr($this->_jsPostfix, $js_escape) . "';\n" .
- " alert(_qfMsg);\n" .
- " return false;\n" .
- " }\n" .
- " return true;\n" .
- "}\n" .
- "//]]>\n" .
- "</script>";
- }
- return '';
- } // end func getValidationScript
-
- // }}}
- // {{{ getSubmitValues()
-
- /**
- * Returns the values submitted by the form
- *
- * @since 2.0
- * @access public
- * @param bool Whether uploaded files should be returned too
- * @return array
- */
- function getSubmitValues($mergeFiles = false)
- {
- return $mergeFiles? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles): $this->_submitValues;
- } // end func getSubmitValues
-
- // }}}
- // {{{ toArray()
-
- /**
- * Returns the form's contents in an array.
- *
- * The description of the array structure is in HTML_QuickForm_Renderer_Array docs
- *
- * @since 2.0
- * @access public
- * @param bool Whether to collect hidden elements (passed to the Renderer's constructor)
- * @return array of form contents
- */
- function toArray($collectHidden = false)
- {
- include_once 'HTML/QuickForm/Renderer/Array.php';
- $renderer = new HTML_QuickForm_Renderer_Array($collectHidden);
- $this->accept($renderer);
- return $renderer->toArray();
- } // end func toArray
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Returns a 'safe' element's value
- *
- * This method first tries to find a cleaned-up submitted value,
- * it will return a value set by setValue()/setDefaults()/setConstants()
- * if submitted value does not exist for the given element.
- *
- * @param string Name of an element
- * @access public
- * @return mixed
- * @throws HTML_QuickForm_Error
- */
- function exportValue($element)
- {
- if (!isset($this->_elementIndex[$element])) {
- return PEAR::raiseError(null, QUICKFORM_NONEXIST_ELEMENT, null, E_USER_WARNING, "Element '$element' does not exist in HTML_QuickForm::getElementValue()", 'HTML_QuickForm_Error', true);
- }
- $value = $this->_elements[$this->_elementIndex[$element]]->exportValue($this->_submitValues, false);
- if (isset($this->_duplicateIndex[$element])) {
- foreach ($this->_duplicateIndex[$element] as $index) {
- if (null !== ($v = $this->_elements[$index]->exportValue($this->_submitValues, false))) {
- if (is_array($value)) {
- $value[] = $v;
- } else {
- $value = (null === $value)? $v: array($value, $v);
- }
- }
- }
- }
- return $value;
- }
-
- // }}}
- // {{{ exportValues()
-
- /**
- * Returns 'safe' elements' values
- *
- * Unlike getSubmitValues(), this will return only the values
- * corresponding to the elements present in the form.
- *
- * @param mixed Array/string of element names, whose values we want. If not set then return all elements.
- * @access public
- * @return array An assoc array of elements' values
- * @throws HTML_QuickForm_Error
- */
- function exportValues($elementList = null)
- {
- $values = array();
- if (null === $elementList) {
- // iterate over all elements, calling their exportValue() methods
- foreach (array_keys($this->_elements) as $key) {
- $value = $this->_elements[$key]->exportValue($this->_submitValues, true);
- if (is_array($value)) {
- // This shit throws a bogus warning in PHP 4.3.x
- $values = HTML_QuickForm::arrayMerge($values, $value);
- }
- }
- } else {
- if (!is_array($elementList)) {
- $elementList = array_map('trim', explode(',', $elementList));
- }
- foreach ($elementList as $elementName) {
- $value = $this->exportValue($elementName);
- if (PEAR::isError($value)) {
- return $value;
- }
- $values[$elementName] = $value;
- }
- }
- return $values;
- }
-
- // }}}
- // {{{ isSubmitted()
-
- /**
- * Tells whether the form was already submitted
- *
- * This is useful since the _submitFiles and _submitValues arrays
- * may be completely empty after the trackSubmit value is removed.
- *
- * @access public
- * @return bool
- */
- function isSubmitted()
- {
- return $this->_flagSubmitted;
- }
-
-
- // }}}
- // {{{ isError()
-
- /**
- * Tell whether a result from a QuickForm method is an error (an instance of HTML_QuickForm_Error)
- *
- * @access public
- * @param mixed result code
- * @return bool whether $value is an error
- * @static
- */
- function isError($value)
- {
- return (is_object($value) && is_a($value, 'html_quickform_error'));
- } // end func isError
-
- // }}}
- // {{{ errorMessage()
-
- /**
- * Return a textual error message for an QuickForm error code
- *
- * @access public
- * @param int error code
- * @return string error message
- * @static
- */
- function errorMessage($value)
- {
- // make the variable static so that it only has to do the defining on the first call
- static $errorMessages;
-
- // define the varies error messages
- if (!isset($errorMessages)) {
- $errorMessages = array(
- QUICKFORM_OK => 'no error',
- QUICKFORM_ERROR => 'unknown error',
- QUICKFORM_INVALID_RULE => 'the rule does not exist as a registered rule',
- QUICKFORM_NONEXIST_ELEMENT => 'nonexistent html element',
- QUICKFORM_INVALID_FILTER => 'invalid filter',
- QUICKFORM_UNREGISTERED_ELEMENT => 'unregistered element',
- QUICKFORM_INVALID_ELEMENT_NAME => 'element already exists',
- QUICKFORM_INVALID_PROCESS => 'process callback does not exist',
- QUICKFORM_DEPRECATED => 'method is deprecated',
- QUICKFORM_INVALID_DATASOURCE => 'datasource is not an object'
- );
- }
-
- // If this is an error object, then grab the corresponding error code
- if (HTML_QuickForm::isError($value)) {
- $value = $value->getCode();
- }
-
- // return the textual error message corresponding to the code
- return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[QUICKFORM_ERROR];
- } // end func errorMessage
-
- // }}}
-} // end class HTML_QuickForm
-
-/**
- * Class for errors thrown by HTML_QuickForm package
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- */
-class HTML_QuickForm_Error extends PEAR_Error {
-
- // {{{ properties
-
- /**
- * Prefix for all error messages
- * @var string
- */
- var $error_message_prefix = 'QuickForm Error: ';
-
- // }}}
- // {{{ constructor
-
- /**
- * Creates a quickform error object, extending the PEAR_Error class
- *
- * @param int $code the error code
- * @param int $mode the reaction to the error, either return, die or trigger/callback
- * @param int $level intensity of the error (PHP error code)
- * @param mixed $debuginfo any information that can inform user as to nature of the error
- */
- function HTML_QuickForm_Error($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- if (is_int($code)) {
- $this->PEAR_Error(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
- } else {
- $this->PEAR_Error("Invalid error code: $code", QUICKFORM_ERROR, $mode, $level, $debuginfo);
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_Error
-?>
+++ /dev/null
-<?php
-/**
- * DHTML replacement for the standard JavaScript alert window for client-side
- * validation
- *
- * LICENSE:
- *
- * Copyright (c) 2005-2007, Mark Wiesemann <wiesemann@php.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The names of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category HTML
- * @package HTML_QuickForm_DHTMLRulesTableless
- * @author Alexey Borzov <borz_off@cs.msu.su>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Justin Patrin <papercrane@gmail.com>
- * @author Mark Wiesemann <wiesemann@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: DHTMLRulesTableless.php,v 1.10 2007/10/24 20:36:11 wiesemann Exp $
- * @link http://pear.php.net/package/HTML_QuickForm_DHTMLRulesTableless
- */
-
-require_once 'HTML/QuickForm.php';
-
-/**
- * This is a DHTML replacement for the standard JavaScript alert window for
- * client-side validation of forms built with HTML_QuickForm
- *
- * @category HTML
- * @package HTML_QuickForm_DHTMLRulesTableless
- * @author Alexey Borzov <borz_off@cs.msu.su>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Justin Patrin <papercrane@gmail.com>
- * @author Mark Wiesemann <wiesemann@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 0.3.3
- * @link http://pear.php.net/package/HTML_QuickForm_DHTMLRulesTableless
- */
-class HTML_QuickForm_DHTMLRulesTableless extends HTML_QuickForm {
- // {{{ getValidationScript()
-
- /**
- * Returns the client side validation script
- *
- * The code here was copied from HTML_QuickForm and slightly modified to run rules per-element
- *
- * @access public
- * @return string Javascript to perform validation, empty string if no 'client' rules were added
- */
- function getValidationScript()
- {
- if (empty($this->_rules) || empty($this->_attributes['onsubmit'])) {
- return '';
- }
-
- include_once('HTML/QuickForm/RuleRegistry.php');
- $registry =& HTML_QuickForm_RuleRegistry::singleton();
- $test = array();
- $js_escape = array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- );
-
- foreach ($this->_rules as $elementName => $rules) {
- foreach ($rules as $rule) {
- if ('client' == $rule['validation']) {
- unset($element);
-
- $dependent = isset($rule['dependent']) && is_array($rule['dependent']);
- $rule['message'] = strtr($rule['message'], $js_escape);
-
- if (isset($rule['group'])) {
- $group =& $this->getElement($rule['group']);
- // No JavaScript validation for frozen elements
- if ($group->isFrozen()) {
- continue 2;
- }
- $elements =& $group->getElements();
- foreach (array_keys($elements) as $key) {
- if ($elementName == $group->getElementName($key)) {
- $element =& $elements[$key];
- break;
- }
- }
- } elseif ($dependent) {
- $element = array();
- $element[] =& $this->getElement($elementName);
- foreach ($rule['dependent'] as $idx => $elName) {
- $element[] =& $this->getElement($elName);
- }
- } else {
- $element =& $this->getElement($elementName);
- }
- // No JavaScript validation for frozen elements
- if (is_object($element) && $element->isFrozen()) {
- continue 2;
- } elseif (is_array($element)) {
- foreach (array_keys($element) as $key) {
- if ($element[$key]->isFrozen()) {
- continue 3;
- }
- }
- }
-
- $test[$elementName][] = $registry->getValidationScript($element, $elementName, $rule);
- }
- }
- }
- $js = '
-<script type="text/javascript"><!--//--><![CDATA[//><!--
-qf_errorHandler = function(element, _qfMsg) {
- div = element.parentNode;
- var elementName = element.name.replace(/\[/, "_____");
- var elementName = elementName.replace(/\]/, "_____");
- if (_qfMsg != \'\') {
- span = document.createElement("span");
- span.className = "error";
- _qfMsg = _qfMsg.substring(4);
- span.appendChild(document.createTextNode(_qfMsg));
- br = document.createElement("br");
-
- var errorDiv = document.getElementById(elementName + \'_errorDiv\');
- if (!errorDiv) {
- errorDiv = document.createElement("div");
- errorDiv.id = elementName + \'_errorDiv\';
- } else {
- if ( div.firstChild.textContent == \'\'
- || _qfMsg == div.firstChild.textContent
- ) {
- return false;
- }
- }
- while (errorDiv.firstChild) {
- errorDiv.removeChild(errorDiv.firstChild);
- }
-
- errorDiv.insertBefore(br, errorDiv.firstChild);
- errorDiv.insertBefore(span, errorDiv.firstChild);
-
- errorDivInserted = false;
- for (var i = element.parentNode.childNodes.length - 1; i >= 0; i--) {
- j = i - 1;
- if (j >= 0 && element.parentNode.childNodes[j].nodeName == "DIV") {
- element.parentNode.insertBefore(errorDiv, element.parentNode.childNodes[i]);
- errorDivInserted = true;
- break;
- }
- }
- if (!errorDivInserted) {
- element.parentNode.insertBefore(errorDiv, element.parentNode.firstChild);
- }
-
- if (div.className.substr(div.className.length - 6, 6) != " error"
- && div.className != "error") {
- div.className += " error";
- }
-
- return false;
- } else {
- var errorDiv = document.getElementById(elementName + \'_errorDiv\');
- if (errorDiv) {
- errorDiv.parentNode.removeChild(errorDiv);
- }
-
- // do not remove the error style from the div tag if there is still an error
- // message
- if (div.firstChild.innerHTML != "") {
- return true;
- }
-
- if (div.className.substr(div.className.length - 6, 6) == " error") {
- div.className = div.className.substr(0, div.className.length - 6);
- } else if (div.className == "error") {
- div.className = "";
- }
-
- return true;
- }
-}';
- $validateJS = '';
- foreach ($test as $elementName => $jsArr) {
- // remove group element part of the element name to avoid JS errors
- $singleElementName = $elementName;
- $shortNameForJS = str_replace(array('[', ']'), '__', $elementName);
- $bracketPos = strpos($elementName, '[');
- if ($bracketPos !== false) {
- $singleElementName = substr($elementName, 0, $bracketPos);
- $groupElementName = substr($elementName, $bracketPos + 1, -1);
- }
- if ($bracketPos === false || !$this->elementExists($singleElementName)) {
- $groupElementName = $elementName;
- $singleElementName = $elementName;
- }
- $id = str_replace('-', '_', $this->_attributes['id']);
- $js .= '
-validate_' . $id . '_' . $shortNameForJS . ' = function(element) {
- var value = \'\';
- var errFlag = new Array();
- var _qfGroups = {};
- var _qfMsg = \'\';
- var frm = element.parentNode;
- while (frm && frm.nodeName != "FORM") {
- frm = frm.parentNode;
- }
-' . join("\n", $jsArr) . '
- return qf_errorHandler(element, _qfMsg);
-}
-';
- unset($element);
- $element =& $this->getElement($singleElementName);
- $elementNameForJS = 'frm.elements[\'' . $elementName . '\']';
- if ($element->getType() === 'group' && $singleElementName === $elementName) {
- $elementNameForJS = 'document.getElementById(\'' . $element->_elements[0]->getAttribute('id') . '\')';
- }
- $validateJS .= '
- ret = validate_' . $id . '_' . $shortNameForJS . '('. $elementNameForJS . ') && ret;';
- if ($element->getType() !== 'group') { // not a group
- $valFunc = 'validate_' . $id . '_' . $shortNameForJS . '(this)';
- $onBlur = $element->getAttribute('onBlur');
- $onChange = $element->getAttribute('onChange');
- $element->updateAttributes(array('onBlur' => $onBlur . $valFunc,
- 'onChange' => $onChange . $valFunc));
- } else { // group
- $elements =& $element->getElements();
- for ($i = 0; $i < count($elements); $i++) {
- // $groupElementName is a substring of attribute name of the element
- if (strpos($elements[$i]->getAttribute('name'), $groupElementName) === 0) {
- $valFunc = 'validate_' . $id . '_' . $shortNameForJS . '(this)';
- $onBlur = $elements[$i]->getAttribute('onBlur');
- $onChange = $elements[$i]->getAttribute('onChange');
- $elements[$i]->updateAttributes(array('onBlur' => $onBlur . $valFunc,
- 'onChange' => $onChange . $valFunc));
- }
- }
- }
- }
- $js .= '
-validate_' . $id . ' = function(frm) {
- var ret = true;
-' . $validateJS . ';
- return ret;
-}
-//--><!]]></script>';
- return $js;
- } // end func getValidationScript
-
- // }}}
-
- function display() {
- $this->getValidationScript();
- return parent::display();
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * DHTML replacement for the standard JavaScript alert window for client-side
- * validation
- *
- * LICENSE:
- *
- * Copyright (c) 2005-2007, Mark Wiesemann <wiesemann@php.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The names of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category HTML
- * @package HTML_QuickForm_DHTMLRulesTableless
- * @author Alexey Borzov <borz_off@cs.msu.su>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Justin Patrin <papercrane@gmail.com>
- * @author Mark Wiesemann <wiesemann@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: PageDHTMLRulesTableless.php,v 1.3 2007/10/24 20:36:11 wiesemann Exp $
- * @link http://pear.php.net/package/HTML_QuickForm_DHTMLRulesTableless
- */
-
-require_once 'HTML/QuickForm/Page.php';
-
-/**
- * This is a DHTML replacement for the standard JavaScript alert window for
- * client-side validation of forms built with HTML_QuickForm
- *
- * @category HTML
- * @package HTML_QuickForm_DHTMLRulesTableless
- * @author Alexey Borzov <borz_off@cs.msu.su>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Justin Patrin <papercrane@gmail.com>
- * @author Mark Wiesemann <wiesemann@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 0.3.3
- * @link http://pear.php.net/package/HTML_QuickForm_DHTMLRulesTableless
- */
-class HTML_QuickForm_PageDHTMLRulesTableless extends HTML_QuickForm_Page
-{
- /**
- * Class constructor
- *
- * @access public
- */
- function HTML_QuickForm_PageDHTMLRulesTableless($formName, $method = 'post',
- $target = '', $attributes = null)
- {
- $this->HTML_QuickForm_Page($formName, $method, '', $target, $attributes);
- }
-
- // {{{ getValidationScript()
-
- /**
- * Returns the client side validation script
- *
- * The code here was copied from HTML_QuickForm and slightly modified to run rules per-element
- *
- * @access public
- * @return string Javascript to perform validation, empty string if no 'client' rules were added
- */
- function getValidationScript()
- {
- if (empty($this->_rules) || empty($this->_attributes['onsubmit'])) {
- return '';
- }
-
- include_once('HTML/QuickForm/RuleRegistry.php');
- $registry =& HTML_QuickForm_RuleRegistry::singleton();
- $test = array();
- $js_escape = array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- );
-
- foreach ($this->_rules as $elementName => $rules) {
- foreach ($rules as $rule) {
- if ('client' == $rule['validation']) {
- unset($element);
-
- $dependent = isset($rule['dependent']) && is_array($rule['dependent']);
- $rule['message'] = strtr($rule['message'], $js_escape);
-
- if (isset($rule['group'])) {
- $group =& $this->getElement($rule['group']);
- // No JavaScript validation for frozen elements
- if ($group->isFrozen()) {
- continue 2;
- }
- $elements =& $group->getElements();
- foreach (array_keys($elements) as $key) {
- if ($elementName == $group->getElementName($key)) {
- $element =& $elements[$key];
- break;
- }
- }
- } elseif ($dependent) {
- $element = array();
- $element[] =& $this->getElement($elementName);
- foreach ($rule['dependent'] as $idx => $elName) {
- $element[] =& $this->getElement($elName);
- }
- } else {
- $element =& $this->getElement($elementName);
- }
- // No JavaScript validation for frozen elements
- if (is_object($element) && $element->isFrozen()) {
- continue 2;
- } elseif (is_array($element)) {
- foreach (array_keys($element) as $key) {
- if ($element[$key]->isFrozen()) {
- continue 3;
- }
- }
- }
-
- $test[$elementName][] = $registry->getValidationScript($element, $elementName, $rule);
- }
- }
- }
- $js = '
-<script type="text/javascript"><!--//--><![CDATA[//><!--
-qf_errorHandler = function(element, _qfMsg) {
- div = element.parentNode;
- var elementName = element.name.replace(/\[/, "_____");
- var elementName = elementName.replace(/\]/, "_____");
- if (_qfMsg != \'\') {
- span = document.createElement("span");
- span.className = "error";
- _qfMsg = _qfMsg.substring(4);
- span.appendChild(document.createTextNode(_qfMsg));
- br = document.createElement("br");
-
- var errorDiv = document.getElementById(elementName + \'_errorDiv\');
- if (!errorDiv) {
- errorDiv = document.createElement("div");
- errorDiv.id = elementName + \'_errorDiv\';
- } else {
- if ( div.firstChild.textContent == \'\'
- || _qfMsg == div.firstChild.textContent
- ) {
- return false;
- }
- }
- while (errorDiv.firstChild) {
- errorDiv.removeChild(errorDiv.firstChild);
- }
-
- errorDiv.insertBefore(br, errorDiv.firstChild);
- errorDiv.insertBefore(span, errorDiv.firstChild);
-
- errorDivInserted = false;
- for (var i = element.parentNode.childNodes.length - 1; i >= 0; i--) {
- j = i - 1;
- if (j >= 0 && element.parentNode.childNodes[j].nodeName == "DIV") {
- element.parentNode.insertBefore(errorDiv, element.parentNode.childNodes[i]);
- errorDivInserted = true;
- break;
- }
- }
- if (!errorDivInserted) {
- element.parentNode.insertBefore(errorDiv, element.parentNode.firstChild);
- }
-
- if (div.className.substr(div.className.length - 6, 6) != " error"
- && div.className != "error") {
- div.className += " error";
- }
-
- return false;
- } else {
- var errorDiv = document.getElementById(elementName + \'_errorDiv\');
- if (errorDiv) {
- errorDiv.parentNode.removeChild(errorDiv);
- }
-
- // do not remove the error style from the div tag if there is still an error
- // message
- if (div.firstChild.innerHTML != "") {
- return true;
- }
-
- if (div.className.substr(div.className.length - 6, 6) == " error") {
- div.className = div.className.substr(0, div.className.length - 6);
- } else if (div.className == "error") {
- div.className = "";
- }
-
- return true;
- }
-}';
- $validateJS = '';
- foreach ($test as $elementName => $jsArr) {
- // remove group element part of the element name to avoid JS errors
- $singleElementName = $elementName;
- $shortNameForJS = str_replace(array('[', ']'), '__', $elementName);
- $bracketPos = strpos($elementName, '[');
- if ($bracketPos !== false) {
- $singleElementName = substr($elementName, 0, $bracketPos);
- $groupElementName = substr($elementName, $bracketPos + 1, -1);
- }
- if ($bracketPos === false || !$this->elementExists($singleElementName)) {
- $groupElementName = $elementName;
- $singleElementName = $elementName;
- }
- $id = str_replace('-', '_', $this->_attributes['id']);
- $js .= '
-validate_' . $id . '_' . $shortNameForJS . ' = function(element) {
- var value = \'\';
- var errFlag = new Array();
- var _qfGroups = {};
- var _qfMsg = \'\';
- var frm = element.parentNode;
- while (frm && frm.nodeName != "FORM") {
- frm = frm.parentNode;
- }
-' . join("\n", $jsArr) . '
- return qf_errorHandler(element, _qfMsg);
-}
-';
- unset($element);
- $element =& $this->getElement($singleElementName);
- $elementNameForJS = 'frm.elements[\'' . $elementName . '\']';
- if ($element->getType() === 'group' && $singleElementName === $elementName) {
- $elementNameForJS = 'document.getElementById(\'' . $element->_elements[0]->getAttribute('id') . '\')';
- }
- $validateJS .= '
- ret = validate_' . $id . '_' . $shortNameForJS . '('. $elementNameForJS . ') && ret;';
- if ($element->getType() !== 'group') { // not a group
- $valFunc = 'validate_' . $id . '_' . $shortNameForJS . '(this)';
- $onBlur = $element->getAttribute('onBlur');
- $onChange = $element->getAttribute('onChange');
- $element->updateAttributes(array('onBlur' => $onBlur . $valFunc,
- 'onChange' => $onChange . $valFunc));
- } else { // group
- $elements =& $element->getElements();
- for ($i = 0; $i < count($elements); $i++) {
- // $groupElementName is a substring of attribute name of the element
- if (strpos($elements[$i]->getAttribute('name'), $groupElementName) === 0) {
- $valFunc = 'validate_' . $id . '_' . $shortNameForJS . '(this)';
- $onBlur = $elements[$i]->getAttribute('onBlur');
- $onChange = $elements[$i]->getAttribute('onChange');
- $elements[$i]->updateAttributes(array('onBlur' => $onBlur . $valFunc,
- 'onChange' => $onChange . $valFunc));
- }
- }
- }
- }
- $js .= '
-validate_' . $id . ' = function (frm) {
- var ret = true;
-' . $validateJS . ';
- return ret;
-}
-//--><!]]></script>';
- return $js;
- } // end func getValidationScript
-
- // }}}
-
- function display() {
- $this->getValidationScript();
- return parent::display();
- }
-}
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * An abstract base class for QuickForm renderers
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- *
- * The class implements a Visitor design pattern
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.0
- * @abstract
- */
-class HTML_QuickForm_Renderer
-{
- /**
- * Constructor
- *
- * @access public
- */
- function HTML_QuickForm_Renderer()
- {
- } // end constructor
-
- /**
- * Called when visiting a form, before processing any form elements
- *
- * @param HTML_QuickForm a form being visited
- * @access public
- * @return void
- * @abstract
- */
- function startForm(&$form)
- {
- return;
- } // end func startForm
-
- /**
- * Called when visiting a form, after processing all form elements
- *
- * @param HTML_QuickForm a form being visited
- * @access public
- * @return void
- * @abstract
- */
- function finishForm(&$form)
- {
- return;
- } // end func finishForm
-
- /**
- * Called when visiting a header element
- *
- * @param HTML_QuickForm_header a header element being visited
- * @access public
- * @return void
- * @abstract
- */
- function renderHeader(&$header)
- {
- return;
- } // end func renderHeader
-
- /**
- * Called when visiting an element
- *
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- * @abstract
- */
- function renderElement(&$element, $required, $error)
- {
- return;
- } // end func renderElement
-
- /**
- * Called when visiting a hidden element
- *
- * @param HTML_QuickForm_element a hidden element being visited
- * @access public
- * @return void
- * @abstract
- */
- function renderHidden(&$element)
- {
- return;
- } // end func renderHidden
-
- /**
- * Called when visiting a raw HTML/text pseudo-element
- *
- * Only implemented in Default renderer. Usage of 'html' elements is
- * discouraged, templates should be used instead.
- *
- * @param HTML_QuickForm_html a 'raw html' element being visited
- * @access public
- * @return void
- * @abstract
- */
- function renderHtml(&$data)
- {
- return;
- } // end func renderHtml
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param HTML_QuickForm_group A group being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- * @abstract
- */
- function startGroup(&$group, $required, $error)
- {
- return;
- } // end func startGroup
-
- /**
- * Called when visiting a group, after processing all group elements
- *
- * @param HTML_QuickForm_group A group being visited
- * @access public
- * @return void
- * @abstract
- */
- function finishGroup(&$group)
- {
- return;
- } // end func finishGroup
-} // end class HTML_QuickForm_Renderer
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an array of form contents
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- */
-require_once 'HTML/QuickForm/Renderer.php';
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an array of form contents
- *
- * Based on old HTML_QuickForm::toArray() code.
- *
- * The form array structure is the following:
- * <pre>
- * array(
- * 'frozen' => 'whether the form is frozen',
- * 'javascript' => 'javascript for client-side validation',
- * 'attributes' => 'attributes for <form> tag',
- * 'requirednote => 'note about the required elements',
- * // if we set the option to collect hidden elements
- * 'hidden' => 'collected html of all hidden elements',
- * // if there were some validation errors:
- * 'errors' => array(
- * '1st element name' => 'Error for the 1st element',
- * ...
- * 'nth element name' => 'Error for the nth element'
- * ),
- * // if there are no headers in the form:
- * 'elements' => array(
- * element_1,
- * ...
- * element_N
- * )
- * // if there are headers in the form:
- * 'sections' => array(
- * array(
- * 'header' => 'Header text for the first header',
- * 'name' => 'Header name for the first header',
- * 'elements' => array(
- * element_1,
- * ...
- * element_K1
- * )
- * ),
- * ...
- * array(
- * 'header' => 'Header text for the Mth header',
- * 'name' => 'Header name for the Mth header',
- * 'elements' => array(
- * element_1,
- * ...
- * element_KM
- * )
- * )
- * )
- * );
- * </pre>
- *
- * where element_i is an array of the form:
- * <pre>
- * array(
- * 'name' => 'element name',
- * 'value' => 'element value',
- * 'type' => 'type of the element',
- * 'frozen' => 'whether element is frozen',
- * 'label' => 'label for the element',
- * 'required' => 'whether element is required',
- * 'error' => 'error associated with the element',
- * 'style' => 'some information about element style (e.g. for Smarty)',
- * // if element is not a group
- * 'html' => 'HTML for the element'
- * // if element is a group
- * 'separator' => 'separator for group elements',
- * 'elements' => array(
- * element_1,
- * ...
- * element_N
- * )
- * );
- * </pre>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @version Release: 3.2.16
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_Array extends HTML_QuickForm_Renderer
-{
- /**#@+
- * @access private
- */
- /**
- * An array being generated
- * @var array
- */
- var $_ary;
-
- /**
- * Number of sections in the form (i.e. number of headers in it)
- * @var integer
- */
- var $_sectionCount;
-
- /**
- * Current section number
- * @var integer
- */
- var $_currentSection;
-
- /**
- * Array representing current group
- * @var array
- */
- var $_currentGroup = null;
-
- /**
- * Additional style information for different elements
- * @var array
- */
- var $_elementStyles = array();
-
- /**
- * true: collect all hidden elements into string; false: process them as usual form elements
- * @var bool
- */
- var $_collectHidden = false;
-
- /**
- * true: render an array of labels to many labels, $key 0 named 'label', the rest "label_$key"
- * false: leave labels as defined
- * @var bool
- */
- var $_staticLabels = false;
- /**#@-*/
-
- /**
- * Constructor
- *
- * @param bool true: collect all hidden elements into string; false: process them as usual form elements
- * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
- * @access public
- */
- function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false)
- {
- $this->HTML_QuickForm_Renderer();
- $this->_collectHidden = $collectHidden;
- $this->_staticLabels = $staticLabels;
- } // end constructor
-
-
- /**
- * Returns the resultant array
- *
- * @access public
- * @return array
- */
- function toArray()
- {
- return $this->_ary;
- }
-
-
- function startForm(&$form)
- {
- $this->_ary = array(
- 'frozen' => $form->isFrozen(),
- 'javascript' => $form->getValidationScript(),
- 'attributes' => $form->getAttributes(true),
- 'requirednote' => $form->getRequiredNote(),
- 'errors' => array()
- );
- if ($this->_collectHidden) {
- $this->_ary['hidden'] = '';
- }
- $this->_elementIdx = 1;
- $this->_currentSection = null;
- $this->_sectionCount = 0;
- } // end func startForm
-
-
- function renderHeader(&$header)
- {
- $this->_ary['sections'][$this->_sectionCount] = array(
- 'header' => $header->toHtml(),
- 'name' => $header->getName()
- );
- $this->_currentSection = $this->_sectionCount++;
- } // end func renderHeader
-
-
- function renderElement(&$element, $required, $error)
- {
- $elAry = $this->_elementToArray($element, $required, $error);
- if (!empty($error)) {
- $this->_ary['errors'][$elAry['name']] = $error;
- }
- $this->_storeArray($elAry);
- } // end func renderElement
-
-
- function renderHidden(&$element)
- {
- if ($this->_collectHidden) {
- $this->_ary['hidden'] .= $element->toHtml() . "\n";
- } else {
- $this->renderElement($element, false, null);
- }
- } // end func renderHidden
-
-
- function startGroup(&$group, $required, $error)
- {
- $this->_currentGroup = $this->_elementToArray($group, $required, $error);
- if (!empty($error)) {
- $this->_ary['errors'][$this->_currentGroup['name']] = $error;
- }
- } // end func startGroup
-
-
- function finishGroup(&$group)
- {
- $this->_storeArray($this->_currentGroup);
- $this->_currentGroup = null;
- } // end func finishGroup
-
-
- /**
- * Creates an array representing an element
- *
- * @access private
- * @param HTML_QuickForm_element element being processed
- * @param bool Whether an element is required
- * @param string Error associated with the element
- * @return array
- */
- function _elementToArray(&$element, $required, $error)
- {
- $ret = array(
- 'name' => $element->getName(),
- 'value' => $element->getValue(),
- 'type' => $element->getType(),
- 'frozen' => $element->isFrozen(),
- 'required' => $required,
- 'error' => $error
- );
- // render label(s)
- $labels = $element->getLabel();
- if (is_array($labels) && $this->_staticLabels) {
- foreach($labels as $key => $label) {
- $key = is_int($key)? $key + 1: $key;
- if (1 === $key) {
- $ret['label'] = $label;
- } else {
- $ret['label_' . $key] = $label;
- }
- }
- } else {
- $ret['label'] = $labels;
- }
-
- // set the style for the element
- if (isset($this->_elementStyles[$ret['name']])) {
- $ret['style'] = $this->_elementStyles[$ret['name']];
- }
- if ('group' == $ret['type']) {
- $ret['separator'] = $element->_separator;
- $ret['elements'] = array();
- } else {
- $ret['html'] = $element->toHtml();
- }
- return $ret;
- }
-
-
- /**
- * Stores an array representation of an element in the form array
- *
- * @access private
- * @param array Array representation of an element
- * @return void
- */
- function _storeArray($elAry)
- {
- // where should we put this element...
- if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
- $this->_currentGroup['elements'][] = $elAry;
- } elseif (isset($this->_currentSection)) {
- $this->_ary['sections'][$this->_currentSection]['elements'][] = $elAry;
- } else {
- $this->_ary['elements'][] = $elAry;
- }
- }
-
-
- /**
- * Sets a style to use for element rendering
- *
- * @param mixed element name or array ('element name' => 'style name')
- * @param string style name if $elementName is not an array
- * @access public
- * @return void
- */
- function setElementStyle($elementName, $styleName = null)
- {
- if (is_array($elementName)) {
- $this->_elementStyles = array_merge($this->_elementStyles, $elementName);
- } else {
- $this->_elementStyles[$elementName] = $styleName;
- }
- }
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A static renderer for HTML_QuickForm, makes an array of form content
- * useful for a Smarty template
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an array of form contents
- */
-require_once 'HTML/QuickForm/Renderer/Array.php';
-
-/**
- * A static renderer for HTML_QuickForm, makes an array of form content
- * useful for a Smarty template
- *
- * Based on old HTML_QuickForm::toArray() code and ITStatic renderer.
- *
- * The form array structure is the following:
- * <pre>
- * Array (
- * [frozen] => whether the complete form is frozen'
- * [javascript] => javascript for client-side validation
- * [attributes] => attributes for <form> tag
- * [hidden] => html of all hidden elements
- * [requirednote] => note about the required elements
- * [errors] => Array
- * (
- * [1st_element_name] => Error for the 1st element
- * ...
- * [nth_element_name] => Error for the nth element
- * )
- *
- * [header] => Array
- * (
- * [1st_header_name] => Header text for the 1st header
- * ...
- * [nth_header_name] => Header text for the nth header
- * )
- *
- * [1st_element_name] => Array for the 1st element
- * ...
- * [nth_element_name] => Array for the nth element
- * </pre>
- *
- * where an element array has the form:
- * <pre>
- * (
- * [name] => element name
- * [value] => element value,
- * [type] => type of the element
- * [frozen] => whether element is frozen
- * [label] => label for the element
- * [required] => whether element is required
- * // if element is not a group:
- * [html] => HTML for the element
- * // if element is a group:
- * [separator] => separator for group elements
- * [1st_gitem_name] => Array for the 1st element in group
- * ...
- * [nth_gitem_name] => Array for the nth element in group
- * )
- * )
- * </pre>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Thomas Schulz <ths@4bconsult.de>
- * @version Release: 3.2.16
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_ArraySmarty extends HTML_QuickForm_Renderer_Array
-{
- /**#@+
- * @access private
- */
- /**
- * The Smarty template engine instance
- * @var object
- */
- var $_tpl = null;
-
- /**
- * Current element index
- * @var integer
- */
- var $_elementIdx = 0;
-
- /**
- * The current element index inside a group
- * @var integer
- */
- var $_groupElementIdx = 0;
-
- /**
- * How to handle the required tag for required fields
- * @var string
- * @see setRequiredTemplate()
- */
- var $_required = '';
-
- /**
- * How to handle error messages in form validation
- * @var string
- * @see setErrorTemplate()
- */
- var $_error = '';
- /**#@-*/
-
- /**
- * Constructor
- *
- * @param Smarty reference to the Smarty template engine instance
- * @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
- * @param bool true: collect all hidden elements into string; false: process them as usual form elements
- * @access public
- */
- function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false, $collectHidden = true)
- {
- $this->HTML_QuickForm_Renderer_Array($collectHidden, $staticLabels);
- $this->_tpl =& $tpl;
- } // end constructor
-
- /**
- * Called when visiting a header element
- *
- * @param HTML_QuickForm_header header element being visited
- * @access public
- * @return void
- */
- function renderHeader(&$header)
- {
- if ($name = $header->getName()) {
- $this->_ary['header'][$name] = $header->toHtml();
- } else {
- $this->_ary['header'][$this->_sectionCount] = $header->toHtml();
- }
- $this->_currentSection = $this->_sectionCount++;
- } // end func renderHeader
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param HTML_QuickForm_group group being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function startGroup(&$group, $required, $error)
- {
- parent::startGroup($group, $required, $error);
- $this->_groupElementIdx = 1;
- } // end func startGroup
-
- /**
- * Creates an array representing an element containing
- * the key for storing this
- *
- * @access private
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string Error associated with the element
- * @return array
- */
- function _elementToArray(&$element, $required, $error)
- {
- $ret = parent::_elementToArray($element, $required, $error);
-
- if ('group' == $ret['type']) {
- $ret['html'] = $element->toHtml();
- // we don't need the elements, see the array structure
- unset($ret['elements']);
- }
- if (($required || $error) && !empty($this->_required)){
- $this->_renderRequired($ret['label'], $ret['html'], $required, $error);
- }
- if ($error && !empty($this->_error)) {
- $this->_renderError($ret['label'], $ret['html'], $error);
- $ret['error'] = $error;
- }
- // create keys for elements grouped by native group or name
- if (strstr($ret['name'], '[') or $this->_currentGroup) {
- // Fix for bug #8123: escape backslashes and quotes to prevent errors
- // in eval(). The code below seems to handle the case where element
- // name has unbalanced square brackets. Dunno whether we really
- // need this after the fix for #8123, but I'm wary of making big
- // changes to this code.
- preg_match('/([^]]*)\\[([^]]*)\\]/', $ret['name'], $matches);
- if (isset($matches[1])) {
- $sKeysSub = substr_replace($ret['name'], '', 0, strlen($matches[1]));
- $sKeysSub = str_replace(
- array('\\', '\'', '[' , ']', '[\'\']'),
- array('\\\\', '\\\'', '[\'', '\']', '[]' ),
- $sKeysSub
- );
- $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $matches[1]) . '\']' . $sKeysSub;
- } else {
- $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']';
- }
- // special handling for elements in native groups
- if ($this->_currentGroup) {
- // skip unnamed group items unless radios: no name -> no static access
- // identification: have the same key string as the parent group
- if ($this->_currentGroup['keys'] == $sKeys and 'radio' != $ret['type']) {
- return false;
- }
- // reduce string of keys by remove leading group keys
- if (0 === strpos($sKeys, $this->_currentGroup['keys'])) {
- $sKeys = substr_replace($sKeys, '', 0, strlen($this->_currentGroup['keys']));
- }
- }
- // element without a name
- } elseif ($ret['name'] == '') {
- $sKeys = '[\'element_' . $this->_elementIdx . '\']';
- // other elements
- } else {
- $sKeys = '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['name']) . '\']';
- }
- // for radios: add extra key from value
- if ('radio' == $ret['type'] and substr($sKeys, -2) != '[]') {
- $sKeys .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret['value']) . '\']';
- }
- $this->_elementIdx++;
- $ret['keys'] = $sKeys;
- return $ret;
- } // end func _elementToArray
-
- /**
- * Stores an array representation of an element in the form array
- *
- * @access private
- * @param array Array representation of an element
- * @return void
- */
- function _storeArray($elAry)
- {
- if ($elAry) {
- $sKeys = $elAry['keys'];
- unset($elAry['keys']);
- // where should we put this element...
- if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
- $toEval = '$this->_currentGroup' . $sKeys . ' = $elAry;';
- } else {
- $toEval = '$this->_ary' . $sKeys . ' = $elAry;';
- }
- eval($toEval);
- }
- return;
- }
-
- /**
- * Called when an element is required
- *
- * This method will add the required tag to the element label and/or the element html
- * such as defined with the method setRequiredTemplate.
- *
- * @param string The element label
- * @param string The element html rendering
- * @param boolean The element required
- * @param string The element error
- * @see setRequiredTemplate()
- * @access private
- * @return void
- */
- function _renderRequired(&$label, &$html, &$required, &$error)
- {
- $this->_tpl->assign(array(
- 'label' => $label,
- 'html' => $html,
- 'required' => $required,
- 'error' => $error
- ));
- if (!empty($label) && strpos($this->_required, $this->_tpl->left_delimiter . '$label') !== false) {
- $label = $this->_tplFetch($this->_required);
- }
- if (!empty($html) && strpos($this->_required, $this->_tpl->left_delimiter . '$html') !== false) {
- $html = $this->_tplFetch($this->_required);
- }
- $this->_tpl->clear_assign(array('label', 'html', 'required'));
- } // end func _renderRequired
-
- /**
- * Called when an element has a validation error
- *
- * This method will add the error message to the element label or the element html
- * such as defined with the method setErrorTemplate. If the error placeholder is not found
- * in the template, the error will be displayed in the form error block.
- *
- * @param string The element label
- * @param string The element html rendering
- * @param string The element error
- * @see setErrorTemplate()
- * @access private
- * @return void
- */
- function _renderError(&$label, &$html, &$error)
- {
- $this->_tpl->assign(array('label' => '', 'html' => '', 'error' => $error));
- $error = $this->_tplFetch($this->_error);
- $this->_tpl->assign(array('label' => $label, 'html' => $html));
-
- if (!empty($label) && strpos($this->_error, $this->_tpl->left_delimiter . '$label') !== false) {
- $label = $this->_tplFetch($this->_error);
- } elseif (!empty($html) && strpos($this->_error, $this->_tpl->left_delimiter . '$html') !== false) {
- $html = $this->_tplFetch($this->_error);
- }
- $this->_tpl->clear_assign(array('label', 'html', 'error'));
- } // end func _renderError
-
- /**
- * Process an template sourced in a string with Smarty
- *
- * Smarty has no core function to render a template given as a string.
- * So we use the smarty eval plugin function to do this.
- *
- * @param string The template source
- * @access private
- * @return void
- */
- function _tplFetch($tplSource)
- {
- if (!function_exists('smarty_function_eval')) {
- require SMARTY_DIR . '/plugins/function.eval.php';
- }
- return smarty_function_eval(array('var' => $tplSource), $this->_tpl);
- }// end func _tplFetch
-
- /**
- * Sets the way required elements are rendered
- *
- * You can use {$label} or {$html} placeholders to let the renderer know where
- * where the element label or the element html are positionned according to the
- * required tag. They will be replaced accordingly with the right value. You
- * can use the full smarty syntax here, especially a custom modifier for I18N.
- * For example:
- * {if $required}<span style="color: red;">*</span>{/if}{$label|translate}
- * will put a red star in front of the label if the element is required and
- * translate the label.
- *
- *
- * @param string The required element template
- * @access public
- * @return void
- */
- function setRequiredTemplate($template)
- {
- $this->_required = $template;
- } // end func setRequiredTemplate
-
- /**
- * Sets the way elements with validation errors are rendered
- *
- * You can use {$label} or {$html} placeholders to let the renderer know where
- * where the element label or the element html are positionned according to the
- * error message. They will be replaced accordingly with the right value.
- * The error message will replace the {$error} placeholder.
- * For example:
- * {if $error}<span style="color: red;">{$error}</span>{/if}<br />{$html}
- * will put the error message in red on top of the element html.
- *
- * If you want all error messages to be output in the main error block, use
- * the {$form.errors} part of the rendered array that collects all raw error
- * messages.
- *
- * If you want to place all error messages manually, do not specify {$html}
- * nor {$label}.
- *
- * Groups can have special layouts. With this kind of groups, you have to
- * place the formated error message manually. In this case, use {$form.group.error}
- * where you want the formated error message to appear in the form.
- *
- * @param string The element error template
- * @access public
- * @return void
- */
- function setErrorTemplate($template)
- {
- $this->_error = $template;
- } // end func setErrorTemplate
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- */
-require_once 'HTML/QuickForm/Renderer.php';
-
-/**
- * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_Default extends HTML_QuickForm_Renderer
-{
- /**
- * The HTML of the form
- * @var string
- * @access private
- */
- var $_html;
-
- /**
- * Header Template string
- * @var string
- * @access private
- */
- var $_headerTemplate =
- "\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #CCCCCC;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{header}</b></td>\n\t</tr>";
-
- /**
- * Element template string
- * @var string
- * @access private
- */
- var $_elementTemplate =
- "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required --><span style=\"color: #ff0000\">*</span><!-- END required --><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!-- END error -->\t{element}</td>\n\t</tr>";
-
- /**
- * Form template string
- * @var string
- * @access private
- */
- var $_formTemplate =
- "\n<form{attributes}>\n<div>\n{hidden}<table border=\"0\">\n{content}\n</table>\n</div>\n</form>";
-
- /**
- * Required Note template string
- * @var string
- * @access private
- */
- var $_requiredNoteTemplate =
- "\n\t<tr>\n\t\t<td></td>\n\t<td align=\"left\" valign=\"top\">{requiredNote}</td>\n\t</tr>";
-
- /**
- * Array containing the templates for customised elements
- * @var array
- * @access private
- */
- var $_templates = array();
-
- /**
- * Array containing the templates for group wraps.
- *
- * These templates are wrapped around group elements and groups' own
- * templates wrap around them. This is set by setGroupTemplate().
- *
- * @var array
- * @access private
- */
- var $_groupWraps = array();
-
- /**
- * Array containing the templates for elements within groups
- * @var array
- * @access private
- */
- var $_groupTemplates = array();
-
- /**
- * True if we are inside a group
- * @var bool
- * @access private
- */
- var $_inGroup = false;
-
- /**
- * Array with HTML generated for group elements
- * @var array
- * @access private
- */
- var $_groupElements = array();
-
- /**
- * Template for an element inside a group
- * @var string
- * @access private
- */
- var $_groupElementTemplate = '';
-
- /**
- * HTML that wraps around the group elements
- * @var string
- * @access private
- */
- var $_groupWrap = '';
-
- /**
- * HTML for the current group
- * @var string
- * @access private
- */
- var $_groupTemplate = '';
-
- /**
- * Collected HTML of the hidden fields
- * @var string
- * @access private
- */
- var $_hiddenHtml = '';
-
- /**
- * Constructor
- *
- * @access public
- */
- function HTML_QuickForm_Renderer_Default()
- {
- $this->HTML_QuickForm_Renderer();
- } // end constructor
-
- /**
- * returns the HTML generated for the form
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- // _hiddenHtml is cleared in finishForm(), so this only matters when
- // finishForm() was not called (e.g. group::toHtml(), bug #3511)
- return $this->_hiddenHtml . $this->_html;
- } // end func toHtml
-
- /**
- * Called when visiting a form, before processing any form elements
- *
- * @param HTML_QuickForm form object being visited
- * @access public
- * @return void
- */
- function startForm(&$form)
- {
- $this->_html = '';
- $this->_hiddenHtml = '';
- } // end func startForm
-
- /**
- * Called when visiting a form, after processing all form elements
- * Adds required note, form attributes, validation javascript and form content.
- *
- * @param HTML_QuickForm form object being visited
- * @access public
- * @return void
- */
- function finishForm(&$form)
- {
- // add a required note, if one is needed
- if (!empty($form->_required) && !$form->_freezeAll) {
- $this->_html .= str_replace('{requiredNote}', $form->getRequiredNote(), $this->_requiredNoteTemplate);
- }
- // add form attributes and content
- $html = str_replace('{attributes}', $form->getAttributes(true), $this->_formTemplate);
- if (strpos($this->_formTemplate, '{hidden}')) {
- $html = str_replace('{hidden}', $this->_hiddenHtml, $html);
- } else {
- $this->_html .= $this->_hiddenHtml;
- }
- $this->_hiddenHtml = '';
- $this->_html = str_replace('{content}', $this->_html, $html);
- // add a validation script
- if ('' != ($script = $form->getValidationScript())) {
- $this->_html = $script . "\n" . $this->_html;
- }
- } // end func finishForm
-
- /**
- * Called when visiting a header element
- *
- * @param HTML_QuickForm_header header element being visited
- * @access public
- * @return void
- */
- function renderHeader(&$header)
- {
- $name = $header->getName();
- if (!empty($name) && isset($this->_templates[$name])) {
- $this->_html .= str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
- } else {
- $this->_html .= str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
- }
- } // end func renderHeader
-
- /**
- * Helper method for renderElement
- *
- * @param string Element name
- * @param mixed Element label (if using an array of labels, you should set the appropriate template)
- * @param bool Whether an element is required
- * @param string Error message associated with the element
- * @access private
- * @see renderElement()
- * @return string Html for element
- */
- function _prepareTemplate($name, $label, $required, $error)
- {
- if (is_array($label)) {
- $nameLabel = array_shift($label);
- } else {
- $nameLabel = $label;
- }
- if (isset($this->_templates[$name])) {
- $html = str_replace('{label}', $nameLabel, $this->_templates[$name]);
- } else {
- $html = str_replace('{label}', $nameLabel, $this->_elementTemplate);
- }
- if ($required) {
- $html = str_replace('<!-- BEGIN required -->', '', $html);
- $html = str_replace('<!-- END required -->', '', $html);
- } else {
- $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->.*<!-- END required -->([ \t\n\r]*)?/isU", '', $html);
- }
- if (isset($error)) {
- $html = str_replace('{error}', $error, $html);
- $html = str_replace('<!-- BEGIN error -->', '', $html);
- $html = str_replace('<!-- END error -->', '', $html);
- } else {
- $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN error -->.*<!-- END error -->([ \t\n\r]*)?/isU", '', $html);
- }
- if (is_array($label)) {
- foreach($label as $key => $text) {
- $key = is_int($key)? $key + 2: $key;
- $html = str_replace("{label_{$key}}", $text, $html);
- $html = str_replace("<!-- BEGIN label_{$key} -->", '', $html);
- $html = str_replace("<!-- END label_{$key} -->", '', $html);
- }
- }
- if (strpos($html, '{label_')) {
- $html = preg_replace('/\s*<!-- BEGIN label_(\S+) -->.*<!-- END label_\1 -->\s*/is', '', $html);
- }
- return $html;
- } // end func _prepareTemplate
-
- /**
- * Renders an element Html
- * Called when visiting an element
- *
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- */
- function renderElement(&$element, $required, $error)
- {
- if (!$this->_inGroup) {
- $html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error);
- $this->_html .= str_replace('{element}', $element->toHtml(), $html);
-
- } elseif (!empty($this->_groupElementTemplate)) {
- $html = str_replace('{label}', $element->getLabel(), $this->_groupElementTemplate);
- if ($required) {
- $html = str_replace('<!-- BEGIN required -->', '', $html);
- $html = str_replace('<!-- END required -->', '', $html);
- } else {
- $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->.*<!-- END required -->([ \t\n\r]*)?/isU", '', $html);
- }
- $this->_groupElements[] = str_replace('{element}', $element->toHtml(), $html);
-
- } else {
- $this->_groupElements[] = $element->toHtml();
- }
- } // end func renderElement
-
- /**
- * Renders an hidden element
- * Called when visiting a hidden element
- *
- * @param HTML_QuickForm_element form element being visited
- * @access public
- * @return void
- */
- function renderHidden(&$element)
- {
- $this->_hiddenHtml .= $element->toHtml() . "\n";
- } // end func renderHidden
-
- /**
- * Called when visiting a raw HTML/text pseudo-element
- *
- * @param HTML_QuickForm_html element being visited
- * @access public
- * @return void
- */
- function renderHtml(&$data)
- {
- $this->_html .= $data->toHtml();
- } // end func renderHtml
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param HTML_QuickForm_group group being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function startGroup(&$group, $required, $error)
- {
- $name = $group->getName();
- $this->_groupTemplate = $this->_prepareTemplate($name, $group->getLabel(), $required, $error);
- $this->_groupElementTemplate = empty($this->_groupTemplates[$name])? '': $this->_groupTemplates[$name];
- $this->_groupWrap = empty($this->_groupWraps[$name])? '': $this->_groupWraps[$name];
- $this->_groupElements = array();
- $this->_inGroup = true;
- } // end func startGroup
-
- /**
- * Called when visiting a group, after processing all group elements
- *
- * @param HTML_QuickForm_group group being visited
- * @access public
- * @return void
- */
- function finishGroup(&$group)
- {
- $separator = $group->_separator;
- if (is_array($separator)) {
- $count = count($separator);
- $html = '';
- for ($i = 0; $i < count($this->_groupElements); $i++) {
- $html .= (0 == $i? '': $separator[($i - 1) % $count]) . $this->_groupElements[$i];
- }
- } else {
- if (is_null($separator)) {
- $separator = ' ';
- }
- $html = implode((string)$separator, $this->_groupElements);
- }
- if (!empty($this->_groupWrap)) {
- $html = str_replace('{content}', $html, $this->_groupWrap);
- }
- $this->_html .= str_replace('{element}', $html, $this->_groupTemplate);
- $this->_inGroup = false;
- } // end func finishGroup
-
- /**
- * Sets element template
- *
- * @param string The HTML surrounding an element
- * @param string (optional) Name of the element to apply template for
- * @access public
- * @return void
- */
- function setElementTemplate($html, $element = null)
- {
- if (is_null($element)) {
- $this->_elementTemplate = $html;
- } else {
- $this->_templates[$element] = $html;
- }
- } // end func setElementTemplate
-
-
- /**
- * Sets template for a group wrapper
- *
- * This template is contained within a group-as-element template
- * set via setTemplate() and contains group's element templates, set
- * via setGroupElementTemplate()
- *
- * @param string The HTML surrounding group elements
- * @param string Name of the group to apply template for
- * @access public
- * @return void
- */
- function setGroupTemplate($html, $group)
- {
- $this->_groupWraps[$group] = $html;
- } // end func setGroupTemplate
-
- /**
- * Sets element template for elements within a group
- *
- * @param string The HTML surrounding an element
- * @param string Name of the group to apply template for
- * @access public
- * @return void
- */
- function setGroupElementTemplate($html, $group)
- {
- $this->_groupTemplates[$group] = $html;
- } // end func setGroupElementTemplate
-
- /**
- * Sets header template
- *
- * @param string The HTML surrounding the header
- * @access public
- * @return void
- */
- function setHeaderTemplate($html)
- {
- $this->_headerTemplate = $html;
- } // end func setHeaderTemplate
-
- /**
- * Sets form template
- *
- * @param string The HTML surrounding the form tags
- * @access public
- * @return void
- */
- function setFormTemplate($html)
- {
- $this->_formTemplate = $html;
- } // end func setFormTemplate
-
- /**
- * Sets the note indicating required fields template
- *
- * @param string The HTML surrounding the required note
- * @access public
- * @return void
- */
- function setRequiredNoteTemplate($html)
- {
- $this->_requiredNoteTemplate = $html;
- } // end func setRequiredNoteTemplate
-
- /**
- * Clears all the HTML out of the templates that surround notes, elements, etc.
- * Useful when you want to use addData() to create a completely custom form look
- *
- * @access public
- * @return void
- */
- function clearAllTemplates()
- {
- $this->setElementTemplate('{element}');
- $this->setFormTemplate("\n\t<form{attributes}>{content}\n\t</form>\n");
- $this->setRequiredNoteTemplate('');
- $this->_templates = array();
- } // end func clearAllTemplates
-} // end class HTML_QuickForm_Renderer_Default
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A concrete renderer for HTML_QuickForm, using Integrated Templates.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- */
-require_once 'HTML/QuickForm/Renderer.php';
-
-/**
- * A concrete renderer for HTML_QuickForm, using Integrated Templates.
- *
- * This is a "dynamic" renderer, which means that concrete form look
- * is defined at runtime. This also means that you can define
- * <b>one</b> template file for <b>all</b> your forms. That template
- * should contain a block for every element 'look' appearing in your
- * forms and also some special blocks (consult the examples). If a
- * special block is not set for an element, the renderer falls back to
- * a default one.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_ITDynamic extends HTML_QuickForm_Renderer
-{
- /**#@+
- * @access private
- */
- /**
- * A template class (HTML_Template_ITX or HTML_Template_Sigma) instance
- * @var HTML_Template_ITX|HTML_Template_Sigma
- */
- var $_tpl = null;
-
- /**
- * The errors that were not shown near concrete fields go here
- * @var array
- */
- var $_errors = array();
-
- /**
- * Show the block with required note?
- * @var bool
- */
- var $_showRequired = false;
-
- /**
- * A separator for group elements
- * @var mixed
- */
- var $_groupSeparator = null;
-
- /**
- * The current element index inside a group
- * @var integer
- */
- var $_groupElementIdx = 0;
-
- /**
- * Blocks to use for different elements
- * @var array
- */
- var $_elementBlocks = array();
-
- /**
- * Block to use for headers
- * @var string
- */
- var $_headerBlock = null;
- /**#@-*/
-
-
- /**
- * Constructor
- *
- * @param HTML_Template_ITX|HTML_Template_Sigma Template object to use
- */
- function HTML_QuickForm_Renderer_ITDynamic(&$tpl)
- {
- $this->HTML_QuickForm_Renderer();
- $this->_tpl =& $tpl;
- $this->_tpl->setCurrentBlock('qf_main_loop');
- }
-
-
- function finishForm(&$form)
- {
- // display errors above form
- if (!empty($this->_errors) && $this->_tpl->blockExists('qf_error_loop')) {
- foreach ($this->_errors as $error) {
- $this->_tpl->setVariable('qf_error', $error);
- $this->_tpl->parse('qf_error_loop');
- }
- }
- // show required note
- if ($this->_showRequired) {
- $this->_tpl->setVariable('qf_required_note', $form->getRequiredNote());
- }
- // assign form attributes
- $this->_tpl->setVariable('qf_attributes', $form->getAttributes(true));
- // assign javascript validation rules
- $this->_tpl->setVariable('qf_javascript', $form->getValidationScript());
- }
-
-
- function renderHeader(&$header)
- {
- $blockName = $this->_matchBlock($header);
- if ('qf_header' == $blockName && isset($this->_headerBlock)) {
- $blockName = $this->_headerBlock;
- }
- $this->_tpl->setVariable('qf_header', $header->toHtml());
- $this->_tpl->parse($blockName);
- $this->_tpl->parse('qf_main_loop');
- }
-
-
- function renderElement(&$element, $required, $error)
- {
- $blockName = $this->_matchBlock($element);
- // are we inside a group?
- if ('qf_main_loop' != $this->_tpl->currentBlock) {
- if (0 != $this->_groupElementIdx && $this->_tpl->placeholderExists('qf_separator', $blockName)) {
- if (is_array($this->_groupSeparator)) {
- $this->_tpl->setVariable('qf_separator', $this->_groupSeparator[($this->_groupElementIdx - 1) % count($this->_groupSeparator)]);
- } else {
- $this->_tpl->setVariable('qf_separator', (string)$this->_groupSeparator);
- }
- }
- $this->_groupElementIdx++;
-
- } elseif(!empty($error)) {
- // show the error message or keep it for later use
- if ($this->_tpl->blockExists($blockName . '_error')) {
- $this->_tpl->setVariable('qf_error', $error);
- } else {
- $this->_errors[] = $error;
- }
- }
- // show an '*' near the required element
- if ($required) {
- $this->_showRequired = true;
- if ($this->_tpl->blockExists($blockName . '_required')) {
- $this->_tpl->touchBlock($blockName . '_required');
- }
- }
- // Prepare multiple labels
- $labels = $element->getLabel();
- if (is_array($labels)) {
- $mainLabel = array_shift($labels);
- } else {
- $mainLabel = $labels;
- }
- // render the element itself with its main label
- $this->_tpl->setVariable('qf_element', $element->toHtml());
- if ($this->_tpl->placeholderExists('qf_label', $blockName)) {
- $this->_tpl->setVariable('qf_label', $mainLabel);
- }
- // render extra labels, if any
- if (is_array($labels)) {
- foreach($labels as $key => $label) {
- $key = is_int($key)? $key + 2: $key;
- if ($this->_tpl->blockExists($blockName . '_label_' . $key)) {
- $this->_tpl->setVariable('qf_label_' . $key, $label);
- }
- }
- }
- $this->_tpl->parse($blockName);
- $this->_tpl->parseCurrentBlock();
- }
-
-
- function renderHidden(&$element)
- {
- $this->_tpl->setVariable('qf_hidden', $element->toHtml());
- $this->_tpl->parse('qf_hidden_loop');
- }
-
-
- function startGroup(&$group, $required, $error)
- {
- $blockName = $this->_matchBlock($group);
- $this->_tpl->setCurrentBlock($blockName . '_loop');
- $this->_groupElementIdx = 0;
- $this->_groupSeparator = is_null($group->_separator)? ' ': $group->_separator;
- // show an '*' near the required element
- if ($required) {
- $this->_showRequired = true;
- if ($this->_tpl->blockExists($blockName . '_required')) {
- $this->_tpl->touchBlock($blockName . '_required');
- }
- }
- // show the error message or keep it for later use
- if (!empty($error)) {
- if ($this->_tpl->blockExists($blockName . '_error')) {
- $this->_tpl->setVariable('qf_error', $error);
- } else {
- $this->_errors[] = $error;
- }
- }
- $this->_tpl->setVariable('qf_group_label', $group->getLabel());
- }
-
-
- function finishGroup(&$group)
- {
- $this->_tpl->parse($this->_matchBlock($group));
- $this->_tpl->setCurrentBlock('qf_main_loop');
- $this->_tpl->parseCurrentBlock();
- }
-
-
- /**
- * Returns the name of a block to use for element rendering
- *
- * If a name was not explicitly set via setElementBlock(), it tries
- * the names '{prefix}_{element type}' and '{prefix}_{element}', where
- * prefix is either 'qf' or the name of the current group's block
- *
- * @param HTML_QuickForm_element form element being rendered
- * @access private
- * @return string block name
- */
- function _matchBlock(&$element)
- {
- $name = $element->getName();
- $type = $element->getType();
- if (isset($this->_elementBlocks[$name]) && $this->_tpl->blockExists($this->_elementBlocks[$name])) {
- if (('group' == $type) || ($this->_elementBlocks[$name] . '_loop' != $this->_tpl->currentBlock)) {
- return $this->_elementBlocks[$name];
- }
- }
- if ('group' != $type && 'qf_main_loop' != $this->_tpl->currentBlock) {
- $prefix = substr($this->_tpl->currentBlock, 0, -5); // omit '_loop' postfix
- } else {
- $prefix = 'qf';
- }
- if ($this->_tpl->blockExists($prefix . '_' . $type)) {
- return $prefix . '_' . $type;
- } elseif ($this->_tpl->blockExists($prefix . '_' . $name)) {
- return $prefix . '_' . $name;
- } else {
- return $prefix . '_element';
- }
- }
-
-
- /**
- * Sets the block to use for element rendering
- *
- * @param mixed element name or array ('element name' => 'block name')
- * @param string block name if $elementName is not an array
- * @access public
- * @return void
- */
- function setElementBlock($elementName, $blockName = null)
- {
- if (is_array($elementName)) {
- $this->_elementBlocks = array_merge($this->_elementBlocks, $elementName);
- } else {
- $this->_elementBlocks[$elementName] = $blockName;
- }
- }
-
-
- /**
- * Sets the name of a block to use for header rendering
- *
- * @param string block name
- * @access public
- * @return void
- */
- function setHeaderBlock($blockName)
- {
- $this->_headerBlock = $blockName;
- }
-}
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A static renderer for HTML_QuickForm compatible
- * with HTML_Template_IT and HTML_Template_Sigma.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- */
-require_once 'HTML/QuickForm/Renderer.php';
-
-/**
- * A static renderer for HTML_QuickForm compatible
- * with HTML_Template_IT and HTML_Template_Sigma.
- *
- * As opposed to the dynamic renderer, this renderer needs
- * every elements and labels in the form to be specified by
- * placeholders at the position you want them to be displayed.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.0
- */
-class HTML_QuickForm_Renderer_ITStatic extends HTML_QuickForm_Renderer
-{
- /**#@+
- * @access private
- */
- /**
- * An HTML_Template_IT or some other API compatible Template instance
- * @var object
- */
- var $_tpl = null;
-
- /**
- * Rendered form name
- * @var string
- */
- var $_formName = 'form';
-
- /**
- * The errors that were not shown near concrete fields go here
- * @var array
- */
- var $_errors = array();
-
- /**
- * Show the block with required note?
- * @var bool
- */
- var $_showRequired = false;
-
- /**
- * Which group are we currently parsing ?
- * @var string
- */
- var $_inGroup;
-
- /**
- * Index of the element in its group
- * @var int
- */
- var $_elementIndex = 0;
-
- /**
- * If elements have been added with the same name
- * @var array
- */
- var $_duplicateElements = array();
-
- /**
- * How to handle the required tag for required fields
- * @var string
- */
- var $_required = '{label}<font size="1" color="red">*</font>';
-
- /**
- * How to handle error messages in form validation
- * @var string
- */
- var $_error = '<font color="red">{error}</font><br />{html}';
-
- /**
- * Collected HTML for hidden elements, if needed
- * @var string
- */
- var $_hidden = '';
- /**#@-*/
-
- /**
- * Constructor
- *
- * @param HTML_Template_IT|HTML_Template_Sigma Template object to use
- */
- function HTML_QuickForm_Renderer_ITStatic(&$tpl)
- {
- $this->HTML_QuickForm_Renderer();
- $this->_tpl =& $tpl;
- } // end constructor
-
- /**
- * Called when visiting a form, before processing any form elements
- *
- * @param HTML_QuickForm form object being visited
- * @access public
- * @return void
- */
- function startForm(&$form)
- {
- $this->_formName = $form->getAttribute('id');
-
- if (count($form->_duplicateIndex) > 0) {
- // Take care of duplicate elements
- foreach ($form->_duplicateIndex as $elementName => $indexes) {
- $this->_duplicateElements[$elementName] = 0;
- }
- }
- } // end func startForm
-
- /**
- * Called when visiting a form, after processing all form elements
- *
- * @param HTML_QuickForm form object being visited
- * @access public
- * @return void
- */
- function finishForm(&$form)
- {
- // display errors above form
- if (!empty($this->_errors) && $this->_tpl->blockExists($this->_formName.'_error_loop')) {
- foreach ($this->_errors as $error) {
- $this->_tpl->setVariable($this->_formName.'_error', $error);
- $this->_tpl->parse($this->_formName.'_error_loop');
- }
- }
- // show required note
- if ($this->_showRequired) {
- $this->_tpl->setVariable($this->_formName.'_required_note', $form->getRequiredNote());
- }
- // add hidden elements, if collected
- if (!empty($this->_hidden)) {
- $this->_tpl->setVariable($this->_formName . '_hidden', $this->_hidden);
- }
- // assign form attributes
- $this->_tpl->setVariable($this->_formName.'_attributes', $form->getAttributes(true));
- // assign javascript validation rules
- $this->_tpl->setVariable($this->_formName.'_javascript', $form->getValidationScript());
- } // end func finishForm
-
- /**
- * Called when visiting a header element
- *
- * @param HTML_QuickForm_header header element being visited
- * @access public
- * @return void
- */
- function renderHeader(&$header)
- {
- $name = $header->getName();
- $varName = $this->_formName.'_header';
-
- // Find placeHolder
- if (!empty($name) && $this->_tpl->placeHolderExists($this->_formName.'_header_'.$name)) {
- $varName = $this->_formName.'_header_'.$name;
- }
- $this->_tpl->setVariable($varName, $header->toHtml());
- } // end func renderHeader
-
- /**
- * Called when visiting an element
- *
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- */
- function renderElement(&$element, $required, $error)
- {
- $name = $element->getName();
-
- // are we inside a group?
- if (!empty($this->_inGroup)) {
- $varName = $this->_formName.'_'.str_replace(array('[', ']'), '_', $name);
- if (substr($varName, -2) == '__') {
- // element name is of type : group[]
- $varName = $this->_inGroup.'_'.$this->_elementIndex.'_';
- $this->_elementIndex++;
- }
- if ($varName != $this->_inGroup) {
- $varName .= '_' == substr($varName, -1)? '': '_';
- // element name is of type : group[name]
- $label = $element->getLabel();
- $html = $element->toHtml();
-
- if ($required && !$element->isFrozen()) {
- $this->_renderRequired($label, $html);
- $this->_showRequired = true;
- }
- if (!empty($label)) {
- if (is_array($label)) {
- foreach ($label as $key => $value) {
- $this->_tpl->setVariable($varName.'label_'.$key, $value);
- }
- } else {
- $this->_tpl->setVariable($varName.'label', $label);
- }
- }
- $this->_tpl->setVariable($varName.'html', $html);
- }
-
- } else {
-
- $name = str_replace(array('[', ']'), array('_', ''), $name);
-
- if (isset($this->_duplicateElements[$name])) {
- // Element is a duplicate
- $varName = $this->_formName.'_'.$name.'_'.$this->_duplicateElements[$name];
- $this->_duplicateElements[$name]++;
- } else {
- $varName = $this->_formName.'_'.$name;
- }
-
- $label = $element->getLabel();
- $html = $element->toHtml();
-
- if ($required) {
- $this->_showRequired = true;
- $this->_renderRequired($label, $html);
- }
- if (!empty($error)) {
- $this->_renderError($label, $html, $error);
- }
- if (is_array($label)) {
- foreach ($label as $key => $value) {
- $this->_tpl->setVariable($varName.'_label_'.$key, $value);
- }
- } else {
- $this->_tpl->setVariable($varName.'_label', $label);
- }
- $this->_tpl->setVariable($varName.'_html', $html);
- }
- } // end func renderElement
-
- /**
- * Called when visiting a hidden element
- *
- * @param HTML_QuickForm_element hidden element being visited
- * @access public
- * @return void
- */
- function renderHidden(&$element)
- {
- if ($this->_tpl->placeholderExists($this->_formName . '_hidden')) {
- $this->_hidden .= $element->toHtml();
- } else {
- $name = $element->getName();
- $name = str_replace(array('[', ']'), array('_', ''), $name);
- $this->_tpl->setVariable($this->_formName.'_'.$name.'_html', $element->toHtml());
- }
- } // end func renderHidden
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param HTML_QuickForm_group group being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function startGroup(&$group, $required, $error)
- {
- $name = $group->getName();
- $varName = $this->_formName.'_'.$name;
-
- $this->_elementIndex = 0;
-
- $html = $this->_tpl->placeholderExists($varName.'_html') ? $group->toHtml() : '';
- $label = $group->getLabel();
-
- if ($required) {
- $this->_renderRequired($label, $html);
- }
- if (!empty($error)) {
- $this->_renderError($label, $html, $error);
- }
- if (!empty($html)) {
- $this->_tpl->setVariable($varName.'_html', $html);
- } else {
- // Uses error blocks to set the special groups layout error
- // <!-- BEGIN form_group_error -->{form_group_error}<!-- END form_group_error -->
- if (!empty($error)) {
- if ($this->_tpl->placeholderExists($varName.'_error')) {
- if ($this->_tpl->blockExists($this->_formName . '_error_block')) {
- $this->_tpl->setVariable($this->_formName . '_error', $error);
- $error = $this->_getTplBlock($this->_formName . '_error_block');
- } elseif (strpos($this->_error, '{html}') !== false || strpos($this->_error, '{label}') !== false) {
- $error = str_replace('{error}', $error, $this->_error);
- }
- }
- $this->_tpl->setVariable($varName . '_error', $error);
- array_pop($this->_errors);
- }
- }
- if (is_array($label)) {
- foreach ($label as $key => $value) {
- $this->_tpl->setVariable($varName.'_label_'.$key, $value);
- }
- } else {
- $this->_tpl->setVariable($varName.'_label', $label);
- }
- $this->_inGroup = $varName;
- } // end func startGroup
-
- /**
- * Called when visiting a group, after processing all group elements
- *
- * @param HTML_QuickForm_group group being visited
- * @access public
- * @return void
- */
- function finishGroup(&$group)
- {
- $this->_inGroup = '';
- } // end func finishGroup
-
- /**
- * Sets the way required elements are rendered
- *
- * You can use {label} or {html} placeholders to let the renderer know where
- * where the element label or the element html are positionned according to the
- * required tag. They will be replaced accordingly with the right value.
- * For example:
- * <font color="red">*</font>{label}
- * will put a red star in front of the label if the element is required.
- *
- * @param string The required element template
- * @access public
- * @return void
- */
- function setRequiredTemplate($template)
- {
- $this->_required = $template;
- } // end func setRequiredTemplate
-
- /**
- * Sets the way elements with validation errors are rendered
- *
- * You can use {label} or {html} placeholders to let the renderer know where
- * where the element label or the element html are positionned according to the
- * error message. They will be replaced accordingly with the right value.
- * The error message will replace the {error} place holder.
- * For example:
- * <font color="red">{error}</font><br />{html}
- * will put the error message in red on top of the element html.
- *
- * If you want all error messages to be output in the main error block, do not specify
- * {html} nor {label}.
- *
- * Groups can have special layouts. With this kind of groups, the renderer will need
- * to know where to place the error message. In this case, use error blocks like:
- * <!-- BEGIN form_group_error -->{form_group_error}<!-- END form_group_error -->
- * where you want the error message to appear in the form.
- *
- * @param string The element error template
- * @access public
- * @return void
- */
- function setErrorTemplate($template)
- {
- $this->_error = $template;
- } // end func setErrorTemplate
-
- /**
- * Called when an element is required
- *
- * This method will add the required tag to the element label and/or the element html
- * such as defined with the method setRequiredTemplate
- *
- * @param string The element label
- * @param string The element html rendering
- * @see setRequiredTemplate()
- * @access private
- * @return void
- */
- function _renderRequired(&$label, &$html)
- {
- if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_required_block')) {
- if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) {
- $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label);
- if (is_array($label)) {
- $label[0] = $this->_getTplBlock($tplBlock);
- } else {
- $label = $this->_getTplBlock($tplBlock);
- }
- }
- if (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) {
- $this->_tpl->setVariable($this->_formName . '_html', $html);
- $html = $this->_getTplBlock($tplBlock);
- }
- } else {
- if (!empty($label) && strpos($this->_required, '{label}') !== false) {
- if (is_array($label)) {
- $label[0] = str_replace('{label}', $label[0], $this->_required);
- } else {
- $label = str_replace('{label}', $label, $this->_required);
- }
- }
- if (!empty($html) && strpos($this->_required, '{html}') !== false) {
- $html = str_replace('{html}', $html, $this->_required);
- }
- }
- } // end func _renderRequired
-
- /**
- * Called when an element has a validation error
- *
- * This method will add the error message to the element label or the element html
- * such as defined with the method setErrorTemplate. If the error placeholder is not found
- * in the template, the error will be displayed in the form error block.
- *
- * @param string The element label
- * @param string The element html rendering
- * @param string The element error
- * @see setErrorTemplate()
- * @access private
- * @return void
- */
- function _renderError(&$label, &$html, $error)
- {
- if ($this->_tpl->blockExists($tplBlock = $this->_formName . '_error_block')) {
- $this->_tpl->setVariable($this->_formName . '_error', $error);
- if (!empty($label) && $this->_tpl->placeholderExists($this->_formName . '_label', $tplBlock)) {
- $this->_tpl->setVariable($this->_formName . '_label', is_array($label)? $label[0]: $label);
- if (is_array($label)) {
- $label[0] = $this->_getTplBlock($tplBlock);
- } else {
- $label = $this->_getTplBlock($tplBlock);
- }
- } elseif (!empty($html) && $this->_tpl->placeholderExists($this->_formName . '_html', $tplBlock)) {
- $this->_tpl->setVariable($this->_formName . '_html', $html);
- $html = $this->_getTplBlock($tplBlock);
- }
- // clean up after ourselves
- $this->_tpl->setVariable($this->_formName . '_error', null);
- } elseif (!empty($label) && strpos($this->_error, '{label}') !== false) {
- if (is_array($label)) {
- $label[0] = str_replace(array('{label}', '{error}'), array($label[0], $error), $this->_error);
- } else {
- $label = str_replace(array('{label}', '{error}'), array($label, $error), $this->_error);
- }
- } elseif (!empty($html) && strpos($this->_error, '{html}') !== false) {
- $html = str_replace(array('{html}', '{error}'), array($html, $error), $this->_error);
- } else {
- $this->_errors[] = $error;
- }
- }// end func _renderError
-
-
- /**
- * Returns the block's contents
- *
- * The method is needed because ITX and Sigma implement clearing
- * the block contents on get() a bit differently
- *
- * @param string Block name
- * @return string Block contents
- */
- function _getTplBlock($block)
- {
- $this->_tpl->parse($block);
- if (is_a($this->_tpl, 'html_template_sigma')) {
- $ret = $this->_tpl->get($block, true);
- } else {
- $oldClear = $this->_tpl->clearCache;
- $this->_tpl->clearCache = true;
- $ret = $this->_tpl->get($block);
- $this->_tpl->clearCache = $oldClear;
- }
- return $ret;
- }
-} // end class HTML_QuickForm_Renderer_ITStatic
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an object from form contents
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Ron McClain <ron@humaniq.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * An abstract base class for QuickForm renderers
- */
-require_once 'HTML/QuickForm/Renderer.php';
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an object from form contents
- *
- * Based on HTML_Quickform_Renderer_Array code
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Ron McClain <ron@humaniq.com>
- * @version Release: 3.2.16
- * @since 3.1.1
- */
-class HTML_QuickForm_Renderer_Object extends HTML_QuickForm_Renderer
-{
- /**#@+
- * @access private
- */
- /**
- * The object being generated
- * @var QuickformForm
- */
- var $_obj= null;
-
- /**
- * Number of sections in the form (i.e. number of headers in it)
- * @var integer $_sectionCount
- */
- var $_sectionCount;
-
- /**
- * Current section number
- * @var integer $_currentSection
- */
- var $_currentSection;
-
- /**
- * Object representing current group
- * @var object $_currentGroup
- */
- var $_currentGroup = null;
-
- /**
- * Class of Element Objects
- * @var object $_elementType
- */
- var $_elementType = 'QuickFormElement';
-
- /**
- * Additional style information for different elements
- * @var array $_elementStyles
- */
- var $_elementStyles = array();
-
- /**
- * true: collect all hidden elements into string; false: process them as usual form elements
- * @var bool $_collectHidden
- */
- var $_collectHidden = false;
- /**#@-*/
-
-
- /**
- * Constructor
- *
- * @param bool true: collect all hidden elements
- * @access public
- */
- function HTML_QuickForm_Renderer_Object($collecthidden = false)
- {
- $this->HTML_QuickForm_Renderer();
- $this->_collectHidden = $collecthidden;
- $this->_obj = new QuickformForm;
- }
-
- /**
- * Return the rendered Object
- * @access public
- */
- function toObject()
- {
- return $this->_obj;
- }
-
- /**
- * Set the class of the form elements. Defaults to QuickformElement.
- * @param string Name of element class
- * @access public
- */
- function setElementType($type)
- {
- $this->_elementType = $type;
- }
-
- function startForm(&$form)
- {
- $this->_obj->frozen = $form->isFrozen();
- $this->_obj->javascript = $form->getValidationScript();
- $this->_obj->attributes = $form->getAttributes(true);
- $this->_obj->requirednote = $form->getRequiredNote();
- $this->_obj->errors = new StdClass;
-
- if($this->_collectHidden) {
- $this->_obj->hidden = '';
- }
- $this->_elementIdx = 1;
- $this->_currentSection = null;
- $this->_sectionCount = 0;
- } // end func startForm
-
- function renderHeader(&$header)
- {
- $hobj = new StdClass;
- $hobj->header = $header->toHtml();
- $this->_obj->sections[$this->_sectionCount] = $hobj;
- $this->_currentSection = $this->_sectionCount++;
- }
-
- function renderElement(&$element, $required, $error)
- {
- $elObj = $this->_elementToObject($element, $required, $error);
- if(!empty($error)) {
- $name = $elObj->name;
- $this->_obj->errors->$name = $error;
- }
- $this->_storeObject($elObj);
- } // end func renderElement
-
- function renderHidden(&$element)
- {
- if($this->_collectHidden) {
- $this->_obj->hidden .= $element->toHtml() . "\n";
- } else {
- $this->renderElement($element, false, null);
- }
- } //end func renderHidden
-
- function startGroup(&$group, $required, $error)
- {
- $this->_currentGroup = $this->_elementToObject($group, $required, $error);
- if(!empty($error)) {
- $name = $this->_currentGroup->name;
- $this->_obj->errors->$name = $error;
- }
- } // end func startGroup
-
- function finishGroup(&$group)
- {
- $this->_storeObject($this->_currentGroup);
- $this->_currentGroup = null;
- } // end func finishGroup
-
- /**
- * Creates an object representing an element
- *
- * @access private
- * @param HTML_QuickForm_element form element being rendered
- * @param required bool Whether an element is required
- * @param error string Error associated with the element
- * @return object
- */
- function _elementToObject(&$element, $required, $error)
- {
- if($this->_elementType) {
- $ret = new $this->_elementType;
- }
- $ret->name = $element->getName();
- $ret->value = $element->getValue();
- $ret->type = $element->getType();
- $ret->frozen = $element->isFrozen();
- $labels = $element->getLabel();
- if (is_array($labels)) {
- $ret->label = array_shift($labels);
- foreach ($labels as $key => $label) {
- $key = is_int($key)? $key + 2: $key;
- $ret->{'label_' . $key} = $label;
- }
- } else {
- $ret->label = $labels;
- }
- $ret->required = $required;
- $ret->error = $error;
-
- if(isset($this->_elementStyles[$ret->name])) {
- $ret->style = $this->_elementStyles[$ret->name];
- $ret->styleTemplate = "styles/". $ret->style .".html";
- }
- if($ret->type == 'group') {
- $ret->separator = $element->_separator;
- $ret->elements = array();
- } else {
- $ret->html = $element->toHtml();
- }
- return $ret;
- }
-
- /**
- * Stores an object representation of an element in the form array
- *
- * @access private
- * @param QuickformElement Object representation of an element
- * @return void
- */
- function _storeObject($elObj)
- {
- $name = $elObj->name;
- if(is_object($this->_currentGroup) && $elObj->type != 'group') {
- $this->_currentGroup->elements[] = $elObj;
- } elseif (isset($this->_currentSection)) {
- $this->_obj->sections[$this->_currentSection]->elements[] = $elObj;
- } else {
- $this->_obj->elements[] = $elObj;
- }
- }
-
- function setElementStyle($elementName, $styleName = null)
- {
- if(is_array($elementName)) {
- $this->_elementStyles = array_merge($this->_elementStyles, $elementName);
- } else {
- $this->_elementStyles[$elementName] = $styleName;
- }
- }
-
-} // end class HTML_QuickForm_Renderer_Object
-
-
-
-/**
- * Convenience class for the form object passed to outputObject()
- *
- * Eg.
- * <pre>
- * {form.outputJavaScript():h}
- * {form.outputHeader():h}
- * <table>
- * <tr>
- * <td>{form.name.label:h}</td><td>{form.name.html:h}</td>
- * </tr>
- * </table>
- * </form>
- * </pre>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Ron McClain <ron@humaniq.com>
- * @version Release: 3.2.16
- * @since 3.1.1
- */
-class QuickformForm
-{
- /**
- * Whether the form has been frozen
- * @var boolean $frozen
- */
- var $frozen;
-
- /**
- * Javascript for client-side validation
- * @var string $javascript
- */
- var $javascript;
-
- /**
- * Attributes for form tag
- * @var string $attributes
- */
- var $attributes;
-
- /**
- * Note about required elements
- * @var string $requirednote
- */
- var $requirednote;
-
- /**
- * Collected html of all hidden variables
- * @var string $hidden
- */
- var $hidden;
-
- /**
- * Set if there were validation errors.
- * StdClass object with element names for keys and their
- * error messages as values
- * @var object $errors
- */
- var $errors;
-
- /**
- * Array of QuickformElementObject elements. If there are headers in the form
- * this will be empty and the elements will be in the
- * separate sections
- * @var array $elements
- */
- var $elements;
-
- /**
- * Array of sections contained in the document
- * @var array $sections
- */
- var $sections;
-
- /**
- * Output <form> header
- * {form.outputHeader():h}
- * @return string <form attributes>
- */
- function outputHeader()
- {
- return "<form " . $this->attributes . ">\n";
- }
-
- /**
- * Output form javascript
- * {form.outputJavaScript():h}
- * @return string Javascript
- */
- function outputJavaScript()
- {
- return $this->javascript;
- }
-} // end class QuickformForm
-
-
-/**
- * Convenience class describing a form element.
- *
- * The properties defined here will be available from
- * your flexy templates by referencing
- * {form.zip.label:h}, {form.zip.html:h}, etc.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Ron McClain <ron@humaniq.com>
- * @version Release: 3.2.16
- * @since 3.1.1
- */
-class QuickformElement
-{
- /**
- * Element name
- * @var string $name
- */
- var $name;
-
- /**
- * Element value
- * @var mixed $value
- */
- var $value;
-
- /**
- * Type of element
- * @var string $type
- */
- var $type;
-
- /**
- * Whether the element is frozen
- * @var boolean $frozen
- */
- var $frozen;
-
- /**
- * Label for the element
- * @var string $label
- */
- var $label;
-
- /**
- * Whether element is required
- * @var boolean $required
- */
- var $required;
-
- /**
- * Error associated with the element
- * @var string $error
- */
- var $error;
-
- /**
- * Some information about element style
- * @var string $style
- */
- var $style;
-
- /**
- * HTML for the element
- * @var string $html
- */
- var $html;
-
- /**
- * If element is a group, the group separator
- * @var mixed $separator
- */
- var $separator;
-
- /**
- * If element is a group, an array of subelements
- * @var array $elements
- */
- var $elements;
-
- function isType($type)
- {
- return ($this->type == $type);
- }
-
- function notFrozen()
- {
- return !$this->frozen;
- }
-
- function isButton()
- {
- return ($this->type == "submit" || $this->type == "reset");
- }
-
-
- /**
- * XXX: why does it use Flexy when all other stuff here does not depend on it?
- */
- function outputStyle()
- {
- ob_start();
- HTML_Template_Flexy::staticQuickTemplate('styles/' . $this->style . '.html', $this);
- $ret = ob_get_contents();
- ob_end_clean();
- return $ret;
- }
-} // end class QuickformElement
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * QuickForm renderer for Flexy template engine, static version.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Ron McClain <ron@humaniq.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * A concrete renderer for HTML_QuickForm, makes an object from form contents
- */
-require_once 'HTML/QuickForm/Renderer/Object.php';
-
-/**
- * QuickForm renderer for Flexy template engine, static version.
- *
- * A static renderer for HTML_Quickform. Makes a QuickFormFlexyObject
- * from the form content suitable for use with a Flexy template
- *
- * Usage:
- * <code>
- * $form =& new HTML_QuickForm('form', 'POST');
- * $template =& new HTML_Template_Flexy();
- * $renderer =& new HTML_QuickForm_Renderer_ObjectFlexy(&$template);
- * $renderer->setHtmlTemplate("html.html");
- * $renderer->setLabelTemplate("label.html");
- * $form->accept($renderer);
- * $view = new StdClass;
- * $view->form = $renderer->toObject();
- * $template->compile("mytemplate.html");
- * </code>
- *
- * Based on the code for HTML_QuickForm_Renderer_ArraySmarty
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Ron McClain <ron@humaniq.com>
- * @version Release: 3.2.16
- * @since 3.1.1
- */
-class HTML_QuickForm_Renderer_ObjectFlexy extends HTML_QuickForm_Renderer_Object
-{
- /**#@+
- * @access private
- */
- /**
- * HTML_Template_Flexy instance
- * @var object $_flexy
- */
- var $_flexy;
-
- /**
- * Current element index
- * @var integer $_elementIdx
- */
- var $_elementIdx;
-
- /**
- * The current element index inside a group
- * @var integer $_groupElementIdx
- */
- var $_groupElementIdx = 0;
-
- /**
- * Name of template file for form html
- * @var string $_html
- * @see setRequiredTemplate()
- */
- var $_html = '';
-
- /**
- * Name of template file for form labels
- * @var string $label
- * @see setErrorTemplate()
- */
- var $label = '';
-
- /**
- * Class of the element objects, so you can add your own
- * element methods
- * @var string $_elementType
- */
- var $_elementType = 'QuickformFlexyElement';
- /**#@-*/
-
- /**
- * Constructor
- *
- * @param HTML_Template_Flexy template object to use
- * @public
- */
- function HTML_QuickForm_Renderer_ObjectFlexy(&$flexy)
- {
- $this->HTML_QuickForm_Renderer_Object(true);
- $this->_obj = new QuickformFlexyForm();
- $this->_flexy =& $flexy;
- } // end constructor
-
- function renderHeader(&$header)
- {
- if($name = $header->getName()) {
- $this->_obj->header->$name = $header->toHtml();
- } else {
- $this->_obj->header[$this->_sectionCount] = $header->toHtml();
- }
- $this->_currentSection = $this->_sectionCount++;
- } // end func renderHeader
-
- function startGroup(&$group, $required, $error)
- {
- parent::startGroup($group, $required, $error);
- $this->_groupElementIdx = 1;
- } //end func startGroup
-
- /**
- * Creates an object representing an element containing
- * the key for storing this
- *
- * @access private
- * @param HTML_QuickForm_element form element being rendered
- * @param bool Whether an element is required
- * @param string Error associated with the element
- * @return object
- */
- function _elementToObject(&$element, $required, $error)
- {
- $ret = parent::_elementToObject($element, $required, $error);
- if($ret->type == 'group') {
- $ret->html = $element->toHtml();
- unset($ret->elements);
- }
- if(!empty($this->_label)) {
- $this->_renderLabel($ret);
- }
-
- if(!empty($this->_html)) {
- $this->_renderHtml($ret);
- $ret->error = $error;
- }
-
- // Create an element key from the name
- if (false !== ($pos = strpos($ret->name, '[')) || is_object($this->_currentGroup)) {
- if (!$pos) {
- $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}';
- } else {
- $keys = '->{\'' . str_replace(
- array('\\', '\'', '[', ']'), array('\\\\', '\\\'', '\'}->{\'', ''),
- $ret->name
- ) . '\'}';
- }
- // special handling for elements in native groups
- if (is_object($this->_currentGroup)) {
- // skip unnamed group items unless radios: no name -> no static access
- // identification: have the same key string as the parent group
- if ($this->_currentGroup->keys == $keys && 'radio' != $ret->type) {
- return false;
- }
- // reduce string of keys by remove leading group keys
- if (0 === strpos($keys, $this->_currentGroup->keys)) {
- $keys = substr_replace($keys, '', 0, strlen($this->_currentGroup->keys));
- }
- }
- } elseif (0 == strlen($ret->name)) {
- $keys = '->{\'element_' . $this->_elementIdx . '\'}';
- } else {
- $keys = '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->name) . '\'}';
- }
- // for radios: add extra key from value
- if ('radio' == $ret->type && '[]' != substr($keys, -2)) {
- $keys .= '->{\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $ret->value) . '\'}';
- }
- $ret->keys = $keys;
- $this->_elementIdx++;
- return $ret;
- }
-
- /**
- * Stores an object representation of an element in the
- * QuickformFormObject instance
- *
- * @access private
- * @param QuickformElement Object representation of an element
- * @return void
- */
- function _storeObject($elObj)
- {
- if ($elObj) {
- $keys = $elObj->keys;
- unset($elObj->keys);
- if(is_object($this->_currentGroup) && ('group' != $elObj->type)) {
- $code = '$this->_currentGroup' . $keys . ' = $elObj;';
- } else {
- $code = '$this->_obj' . $keys . ' = $elObj;';
- }
- eval($code);
- }
- }
-
- /**
- * Set the filename of the template to render html elements.
- * In your template, {html} is replaced by the unmodified html.
- * If the element is required, {required} will be true.
- * Eg.
- * <pre>
- * {if:error}
- * <font color="red" size="1">{error:h}</font><br />
- * {end:}
- * {html:h}
- * </pre>
- *
- * @access public
- * @param string Filename of template
- * @return void
- */
- function setHtmlTemplate($template)
- {
- $this->_html = $template;
- }
-
- /**
- * Set the filename of the template to render form labels
- * In your template, {label} is replaced by the unmodified label.
- * {error} will be set to the error, if any. {required} will
- * be true if this is a required field
- * Eg.
- * <pre>
- * {if:required}
- * <font color="orange" size="1">*</font>
- * {end:}
- * {label:h}
- * </pre>
- *
- * @access public
- * @param string Filename of template
- * @return void
- */
- function setLabelTemplate($template)
- {
- $this->_label = $template;
- }
-
- function _renderLabel(&$ret)
- {
- $this->_flexy->compile($this->_label);
- $ret->label = $this->_flexy->bufferedOutputObject($ret);
- }
-
- function _renderHtml(&$ret)
- {
- $this->_flexy->compile($this->_html);
- $ret->html = $this->_flexy->bufferedOutputObject($ret);
- }
-} // end class HTML_QuickForm_Renderer_ObjectFlexy
-
-/**
- * Adds nothing to QuickformForm, left for backwards compatibility
- *
- * @category HTML
- * @package HTML_QuickForm
- * @ignore
- */
-class QuickformFlexyForm extends QuickformForm
-{
-}
-
-/**
- * Adds nothing to QuickformElement, left for backwards compatibility
- *
- * @category HTML
- * @package HTML_QuickForm
- * @ignore
- */
-class QuickformFlexyElement extends QuickformElement
-{
-}
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A renderer that makes it quick and easy to create customized forms.
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Jason Rust <jrust@rustyparts.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one
- */
-require_once 'HTML/QuickForm/Renderer/Default.php';
-
-/**
- * A renderer that makes it quick and easy to create customized forms.
- *
- * This renderer has three main distinctives: an easy way to create
- * custom-looking forms, the ability to separate the creation of form
- * elements from their display, and being able to use QuickForm in
- * widget-based template systems. See the online docs for more info.
- * For a usage example see: docs/renderers/QuickHtml_example.php
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Jason Rust <jrust@rustyparts.com>
- * @version Release: 3.2.16
- * @since 3.1.1
- */
-class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default {
- // {{{ properties
-
- /**
- * The array of rendered elements
- * @var array
- */
- var $renderedElements = array();
-
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- *
- * @access public
- * @return void
- */
- function HTML_QuickForm_Renderer_QuickHtml()
- {
- $this->HTML_QuickForm_Renderer_Default();
- // The default templates aren't used for this renderer
- $this->clearAllTemplates();
- } // end constructor
-
- // }}}
- // {{{ toHtml()
-
- /**
- * returns the HTML generated for the form
- *
- * @param string $data (optional) Any extra data to put before the end of the form
- *
- * @access public
- * @return string
- */
- function toHtml($data = '')
- {
- // Render any elements that haven't been rendered explicitly by elementToHtml()
- foreach (array_keys($this->renderedElements) as $key) {
- if (!$this->renderedElements[$key]['rendered']) {
- $this->renderedElements[$key]['rendered'] = true;
- $data .= $this->renderedElements[$key]['html'] . "\n";
- }
- }
-
- // Insert the extra data and form elements at the end of the form
- $this->_html = str_replace('</form>', $data . "\n</form>", $this->_html);
- return $this->_html;
- } // end func toHtml
-
- // }}}
- // {{{ elementToHtml()
-
- /**
- * Gets the html for an element and marks it as rendered.
- *
- * @param string $elementName The element name
- * @param string $elementValue (optional) The value of the element. This is only useful
- * for elements that have the same name (i.e. radio and checkbox), but
- * different values
- *
- * @access public
- * @return string The html for the QuickForm element
- * @throws HTML_QuickForm_Error
- */
- function elementToHtml($elementName, $elementValue = null)
- {
- $elementKey = null;
- // Find the key for the element
- foreach ($this->renderedElements as $key => $data) {
- if ($data['name'] == $elementName &&
- // See if the value must match as well
- (is_null($elementValue) ||
- $data['value'] == $elementValue)) {
- $elementKey = $key;
- break;
- }
- }
-
- if (is_null($elementKey)) {
- $msg = is_null($elementValue) ? "Element $elementName does not exist." :
- "Element $elementName with value of $elementValue does not exist.";
- return PEAR::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true);
- } else {
- if ($this->renderedElements[$elementKey]['rendered']) {
- $msg = is_null($elementValue) ? "Element $elementName has already been rendered." :
- "Element $elementName with value of $elementValue has already been rendered.";
- return PEAR::raiseError(null, QUICKFORM_ERROR, null, E_USER_WARNING, $msg, 'HTML_QuickForm_Error', true);
- } else {
- $this->renderedElements[$elementKey]['rendered'] = true;
- return $this->renderedElements[$elementKey]['html'];
- }
- }
- } // end func elementToHtml
-
- // }}}
- // {{{ renderElement()
-
- /**
- * Gets the html for an element and adds it to the array by calling
- * parent::renderElement()
- *
- * @param HTML_QuickForm_element form element being visited
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- *
- * @access public
- * @return mixed HTML string of element if $immediateRender is set, else we just add the
- * html to the global _html string
- */
- function renderElement(&$element, $required, $error)
- {
- $this->_html = '';
- parent::renderElement($element, $required, $error);
- if (!$this->_inGroup) {
- $this->renderedElements[] = array(
- 'name' => $element->getName(),
- 'value' => $element->getValue(),
- 'html' => $this->_html,
- 'rendered' => false);
- }
- $this->_html = '';
- } // end func renderElement
-
- // }}}
- // {{{ renderHidden()
-
- /**
- * Gets the html for a hidden element and adds it to the array.
- *
- * @param HTML_QuickForm_element hidden form element being visited
- * @access public
- * @return void
- */
- function renderHidden(&$element)
- {
- $this->renderedElements[] = array(
- 'name' => $element->getName(),
- 'value' => $element->getValue(),
- 'html' => $element->toHtml(),
- 'rendered' => false);
- } // end func renderHidden
-
- // }}}
- // {{{ finishGroup()
-
- /**
- * Gets the html for the group element and adds it to the array by calling
- * parent::finishGroup()
- *
- * @param HTML_QuickForm_group group being visited
- * @access public
- * @return void
- */
- function finishGroup(&$group)
- {
- $this->_html = '';
- parent::finishGroup($group);
- $this->renderedElements[] = array(
- 'name' => $group->getName(),
- 'value' => $group->getValue(),
- 'html' => $this->_html,
- 'rendered' => false);
- $this->_html = '';
- } // end func finishGroup
-
- // }}}
-} // end class HTML_QuickForm_Renderer_QuickHtml
-?>
+++ /dev/null
-<?php
-/**
- * Replacement for the default renderer of HTML_QuickForm that uses only XHTML
- * and CSS but no table tags, and generates fully valid XHTML output
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 2005-2007, Mark Wiesemann <wiesemann@php.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The names of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category HTML
- * @package HTML_QuickForm_Renderer_Tableless
- * @author Alexey Borzov <borz_off@cs.msu.su>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Mark Wiesemann <wiesemann@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Tableless.php 271939 2008-12-26 20:22:30Z wiesemann $
- * @link http://pear.php.net/package/HTML_QuickForm_Renderer_Tableless
- */
-
-require_once 'HTML/QuickForm/Renderer/Default.php';
-
-/**
- * Replacement for the default renderer of HTML_QuickForm that uses only XHTML
- * and CSS but no table tags, and generates fully valid XHTML output
- *
- * You need to specify a stylesheet like the one that you find in
- * data/stylesheet.css to make this work.
- *
- * @category HTML
- * @package HTML_QuickForm_Renderer_Tableless
- * @author Alexey Borzov <borz_off@cs.msu.su>
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Mark Wiesemann <wiesemann@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 0.6.2
- * @link http://pear.php.net/package/HTML_QuickForm_Renderer_Tableless
- */
-class HTML_QuickForm_Renderer_Tableless extends HTML_QuickForm_Renderer_Default
-{
- /**
- * Header Template string
- * @var string
- * @access private
- */
- var $_headerTemplate = "\n\t\t<legend>{header}</legend>\n\t\t<ol>";
-
- /**
- * Element template string
- * @var string
- * @access private
- */
- var $_elementTemplate =
- "\n\t\t\t<li><label class=\"element\"><!-- BEGIN required --><span class=\"required\">*</span><!-- END required -->{label}</label><div class=\"element<!-- BEGIN error --> error<!-- END error -->\"><!-- BEGIN error --><span class=\"error\">{error}</span><br /><!-- END error -->{element}</div></li>";
-
- /**
- * Form template string
- * @var string
- * @access private
- */
- var $_formTemplate =
- "\n<form{attributes}>\n\t<div style=\"display: none;\">\n{hidden}\t</div>\n{content}\n</form>";
-
- /**
- * Template used when opening a fieldset
- * @var string
- * @access private
- */
- var $_openFieldsetTemplate = "\n\t<fieldset{id}{attributes}>";
-
- /**
- * Template used when opening a hidden fieldset
- * (i.e. a fieldset that is opened when there is no header element)
- * @var string
- * @access private
- */
- var $_openHiddenFieldsetTemplate = "\n\t<fieldset class=\"hidden{class}\">\n\t\t<ol>";
-
- /**
- * Template used when closing a fieldset
- * @var string
- * @access private
- */
- var $_closeFieldsetTemplate = "\n\t\t</ol>\n\t</fieldset>";
-
- /**
- * Required Note template string
- * @var string
- * @access private
- */
- var $_requiredNoteTemplate =
- "\n\t\t\t<li class=\"reqnote\"><label class=\"element\"> </label>{requiredNote}</li>";
-
- /**
- * How many fieldsets are open
- * @var integer
- * @access private
- */
- var $_fieldsetsOpen = 0;
-
- /**
- * Array of element names that indicate the end of a fieldset
- * (a new one will be opened when the next header element occurs)
- * @var array
- * @access private
- */
- var $_stopFieldsetElements = array();
-
- /**
- * Name of the currently active group
- * @var string
- * @access private
- */
- var $_currentGroupName = '';
-
- /**
- * Constructor
- *
- * @access public
- */
- function HTML_QuickForm_Renderer_Tableless()
- {
- $this->HTML_QuickForm_Renderer_Default();
- } // end constructor
-
- /**
- * Called when visiting a header element
- *
- * @param object An HTML_QuickForm_header element being visited
- * @access public
- * @return void
- */
- function renderHeader(&$header)
- {
- $name = $header->getName();
- $id = empty($name) ? '' : ' id="' . $name . '"';
- if (!empty($name) && isset($this->_templates[$name])) {
- $header_html = str_replace('{header}', $header->toHtml(), $this->_templates[$name]);
- } else {
- $header_html = str_replace('{header}', $header->toHtml(), $this->_headerTemplate);
- }
- $attributes = $header->getAttributes();
- $strAttr = '';
- if (is_array($attributes)) {
- $charset = HTML_Common::charset();
- foreach ($attributes as $key => $value) {
- if ($key == 'name') {
- continue;
- }
- $strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"';
- }
- }
- if ($this->_fieldsetsOpen > 0) {
- $this->_html .= $this->_closeFieldsetTemplate;
- $this->_fieldsetsOpen--;
- }
- $openFieldsetTemplate = str_replace('{id}', $id, $this->_openFieldsetTemplate);
- $openFieldsetTemplate = str_replace('{attributes}',
- $strAttr,
- $openFieldsetTemplate);
- $this->_html .= $openFieldsetTemplate . $header_html;
- $this->_fieldsetsOpen++;
- } // end func renderHeader
-
- /**
- * Renders an element Html
- * Called when visiting an element
- *
- * @param object An HTML_QuickForm_element object being visited
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- */
- function renderElement(&$element, $required, $error)
- {
- $this->_handleStopFieldsetElements($element->getName());
- if (!$this->_inGroup) {
- $html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error);
- // the following lines (until the "elseif") were changed / added
- // compared to the default renderer
- $element_html = $element->toHtml();
- if (!is_null($element->getAttribute('id'))) {
- $id = $element->getAttribute('id');
- } else {
- $id = $element->getName();
- }
- if ($element->getType() != 'static' && !empty($id)) {
- $html = str_replace('<label', '<label for="' . $id . '"', $html);
- $element_html = preg_replace(preg_quote('#name="' . $id . '#'),
- 'id="' . $id . '" name="' . $id,
- $element_html,
- 1);
- }
- $this->_html .= str_replace('{element}', $element_html, $html);
- } elseif (!empty($this->_groupElementTemplate)) {
- $html = str_replace('{label}', $element->getLabel(), $this->_groupElementTemplate);
- if ($required) {
- $html = str_replace('<!-- BEGIN required -->', '', $html);
- $html = str_replace('<!-- END required -->', '', $html);
- } else {
- $html = preg_replace("/([ \t\n\r]*)?<!-- BEGIN required -->(\s|\S)*<!-- END required -->([ \t\n\r]*)?/i", '', $html);
- }
- $this->_groupElements[] = str_replace('{element}', $element->toHtml(), $html);
-
- } else {
- $element_html = $element->toHtml();
- // add "id" attribute to first element of the group
- if (count($this->_groupElements) === 0) {
- if (!is_null($element->getAttribute('id'))) {
- $id = $element->getAttribute('id');
- } else {
- $id = $element->getName();
- }
- $groupId = $this->_currentGroupName;
- if ($element->getType() != 'static' && !empty($id)) {
- $element_html = preg_replace(preg_quote('#name="' . $id . '#'),
- 'id="' . $groupId . '" name="' . $id,
- $element_html,
- 1);
- }
- }
- $this->_groupElements[] = $element_html;
- }
- } // end func renderElement
-
- /**
- * Renders an hidden element
- * Called when visiting a hidden element
- *
- * @param object An HTML_QuickForm_hidden object being visited
- * @access public
- * @return void
- */
- function renderHidden(&$element)
- {
- if (!is_null($element->getAttribute('id'))) {
- $id = $element->getAttribute('id');
- } else {
- $id = $element->getName();
- }
- $html = $element->toHtml();
- if (!empty($id)) {
- $html = str_replace('name="' . $id,
- 'id="' . $id . '" name="' . $id,
- $html);
- }
- $this->_hiddenHtml .= $html . "\n";
- } // end func renderHidden
-
- /**
- * Called when visiting a group, before processing any group elements
- *
- * @param object An HTML_QuickForm_group object being visited
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function startGroup(&$group, $required, $error)
- {
- $this->_handleStopFieldsetElements($group->getName());
- $name = $group->getName();
- $this->_groupTemplate = $this->_prepareTemplate($name, $group->getLabel(), $required, $error);
- $this->_groupTemplate = str_replace('<label', '<label for="' . $name . '"', $this->_groupTemplate);
- $this->_groupElementTemplate = empty($this->_groupTemplates[$name])? '': $this->_groupTemplates[$name];
- $this->_groupWrap = empty($this->_groupWraps[$name])? '': $this->_groupWraps[$name];
- $this->_groupElements = array();
- $this->_inGroup = true;
- $this->_currentGroupName = $name;
- } // end func startGroup
-
- /**
- * Called when visiting a group, after processing all group elements
- *
- * @param object An HTML_QuickForm_group object being visited
- * @access public
- * @return void
- */
- function finishGroup(&$group)
- {
- $separator = $group->_separator;
- if (is_array($separator)) {
- $count = count($separator);
- $html = '';
- for ($i = 0; $i < count($this->_groupElements); $i++) {
- $html .= (0 == $i? '': $separator[($i - 1) % $count]) . $this->_groupElements[$i];
- }
- } else {
- if (is_null($separator)) {
- $separator = ' ';
- }
- $html = implode((string)$separator, $this->_groupElements);
- }
- if (!empty($this->_groupWrap)) {
- $html = str_replace('{content}', $html, $this->_groupWrap);
- }
- if (!is_null($group->getAttribute('id'))) {
- $id = $group->getAttribute('id');
- } else {
- $id = $group->getName();
- }
- $groupTemplate = $this->_groupTemplate;
-
- $this->_html .= str_replace('{element}', $html, $groupTemplate);
- $this->_inGroup = false;
- } // end func finishGroup
-
- /**
- * Called when visiting a form, before processing any form elements
- *
- * @param object An HTML_QuickForm object being visited
- * @access public
- * @return void
- */
- function startForm(&$form)
- {
- $this->_fieldsetsOpen = 0;
- parent::startForm($form);
- } // end func startForm
-
- /**
- * Called when visiting a form, after processing all form elements
- * Adds required note, form attributes, validation javascript and form content.
- *
- * @param object An HTML_QuickForm object being visited
- * @access public
- * @return void
- */
- function finishForm(&$form)
- {
- // add a required note, if one is needed
- if (!empty($form->_required) && !$form->_freezeAll) {
- $requiredNote = $form->getRequiredNote();
- // replace default required note by DOM/XHTML optimized note
- if ($requiredNote == '<span style="font-size:80%; color:#ff0000;">*</span><span style="font-size:80%;"> denotes required field</span>') {
- $requiredNote = '<span class="required">*</span> denotes required field';
- }
- $this->_html .= str_replace('{requiredNote}', $requiredNote, $this->_requiredNoteTemplate);
- }
- // close the open fieldset
- if ($this->_fieldsetsOpen > 0) {
- $this->_html .= $this->_closeFieldsetTemplate;
- $this->_fieldsetsOpen--;
- }
- // add form attributes and content
- $html = str_replace('{attributes}', $form->getAttributes(true), $this->_formTemplate);
- if (strpos($this->_formTemplate, '{hidden}')) {
- $html = str_replace('{hidden}', $this->_hiddenHtml, $html);
- } else {
- $this->_html .= $this->_hiddenHtml;
- }
- $this->_hiddenHtml = '';
- $this->_html = str_replace('{content}', $this->_html, $html);
- $this->_html = str_replace('></label>', '> </label>', $this->_html);
- // add a validation script
- if ('' != ($script = $form->getValidationScript())) {
- $this->_html = $script . "\n" . $this->_html;
- }
- } // end func finishForm
-
- /**
- * Sets the template used when opening a fieldset
- *
- * @param string The HTML used when opening a fieldset
- * @access public
- * @return void
- */
- function setOpenFieldsetTemplate($html)
- {
- $this->_openFieldsetTemplate = $html;
- } // end func setOpenFieldsetTemplate
-
- /**
- * Sets the template used when opening a hidden fieldset
- * (i.e. a fieldset that is opened when there is no header element)
- *
- * @param string The HTML used when opening a hidden fieldset
- * @access public
- * @return void
- */
- function setOpenHiddenFieldsetTemplate($html)
- {
- $this->_openHiddenFieldsetTemplate = $html;
- } // end func setOpenHiddenFieldsetTemplate
-
- /**
- * Sets the template used when closing a fieldset
- *
- * @param string The HTML used when closing a fieldset
- * @access public
- * @return void
- */
- function setCloseFieldsetTemplate($html)
- {
- $this->_closeFieldsetTemplate = $html;
- } // end func setCloseFieldsetTemplate
-
- /**
- * Adds one or more element names that indicate the end of a fieldset
- * (a new one will be opened when a the next header element occurs)
- *
- * @param mixed Element name(s) (as array or string)
- * @param string (optional) Class name for the fieldset(s)
- * @access public
- * @return void
- */
- function addStopFieldsetElements($element, $class = '')
- {
- if (is_array($element)) {
- $elements = array();
- foreach ($element as $name) {
- $elements[$name] = $class;
- }
- $this->_stopFieldsetElements = array_merge($this->_stopFieldsetElements,
- $elements);
- } else {
- $this->_stopFieldsetElements[$element] = $class;
- }
- } // end func addStopFieldsetElements
-
- /**
- * Handle element/group names that indicate the end of a group
- *
- * @param string The name of the element or group
- * @access private
- * @return void
- */
- function _handleStopFieldsetElements($element)
- {
- // if the element/group name indicates the end of a fieldset, close
- // the fieldset
- if ( array_key_exists($element, $this->_stopFieldsetElements)
- && $this->_fieldsetsOpen > 0
- ) {
- $this->_html .= $this->_closeFieldsetTemplate;
- $this->_fieldsetsOpen--;
- }
- // if no fieldset was opened, we need to open a hidden one here to get
- // XHTML validity
- if ($this->_fieldsetsOpen === 0) {
- $replace = '';
- if ( array_key_exists($element, $this->_stopFieldsetElements)
- && $this->_stopFieldsetElements[$element] != ''
- ) {
- $replace = ' ' . $this->_stopFieldsetElements[$element];
- }
- $this->_html .= str_replace('{class}', $replace,
- $this->_openHiddenFieldsetTemplate);
- $this->_fieldsetsOpen++;
- }
- } // end func _handleStopFieldsetElements
-
- /**
- * Sets element template
- *
- * @param string The HTML surrounding an element
- * @param mixed (optional) Name(s) of the element to apply template
- * for (either single element name as string or multiple
- * element names as an array)
- * @access public
- * @return void
- */
- function setElementTemplate($html, $element = null)
- {
- if (is_null($element)) {
- $this->_elementTemplate = $html;
- } elseif (is_array($element)) {
- foreach ($element as $name) {
- $this->_templates[$name] = $html;
- }
- } else {
- $this->_templates[$element] = $html;
- }
- } // end func setElementTemplate
-
-} // end class HTML_QuickForm_Renderer_Default
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Abstract base class for QuickForm validation rules
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.2
- * @abstract
- */
-class HTML_QuickForm_Rule
-{
- /**
- * Name of the rule to use in validate method
- *
- * This property is used in more global rules like Callback and Regex
- * to determine which callback and which regex is to be used for validation
- *
- * @var string
- * @access public
- */
- var $name;
-
- /**
- * Validates a value
- *
- * @access public
- * @abstract
- */
- function validate($value)
- {
- return true;
- }
-
- /**
- * Sets the rule name
- *
- * @param string rule name
- * @access public
- */
- function setName($ruleName)
- {
- $this->name = $ruleName;
- }
-
- /**
- * Returns the javascript test (the test should return true if the value is INVALID)
- *
- * @param mixed Options for the rule
- * @access public
- * @return array first element is code to setup validation, second is the check itself
- * @abstract
- */
- function getValidationScript($options = null)
- {
- return array('', '');
- }
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Validates values using callback functions or methods
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Validates values using callback functions or methods
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Callback extends HTML_QuickForm_Rule
-{
- /**
- * Array of callbacks
- *
- * Array is in the format:
- * $_data['rulename'] = array('functionname', 'classname');
- * If the callback is not a method, then the class name is not set.
- *
- * @var array
- * @access private
- */
- var $_data = array();
-
- /**
- * Whether to use BC mode for specific rules
- *
- * Previous versions of QF passed element's name as a first parameter
- * to validation functions, but not to validation methods. This behaviour
- * is emulated if you are using 'function' as rule type when registering.
- *
- * @var array
- * @access private
- */
- var $_BCMode = array();
-
- /**
- * Validates a value using a callback
- *
- * @param string $value Value to be checked
- * @param mixed $options Options for callback
- * @access public
- * @return boolean true if value is valid
- */
- function validate($value, $options = null)
- {
- if (isset($this->_data[$this->name])) {
- $callback = $this->_data[$this->name];
- if (isset($callback[1])) {
- return call_user_func(array($callback[1], $callback[0]), $value, $options);
- } elseif ($this->_BCMode[$this->name]) {
- return $callback[0]('', $value, $options);
- } else {
- return $callback[0]($value, $options);
- }
- } elseif (is_callable($options)) {
- return call_user_func($options, $value);
- } else {
- return true;
- }
- } // end func validate
-
- /**
- * Adds new callbacks to the callbacks list
- *
- * @param string $name Name of rule
- * @param string $callback Name of function or method
- * @param string $class Name of class containing the method
- * @param bool $BCMode Backwards compatibility mode
- * @access public
- */
- function addData($name, $callback, $class = null, $BCMode = false)
- {
- if (!empty($class)) {
- $this->_data[$name] = array($callback, $class);
- } else {
- $this->_data[$name] = array($callback);
- }
- $this->_BCMode[$name] = $BCMode;
- } // end func addData
-
-
- function getValidationScript($options = null)
- {
- if (isset($this->_data[$this->name])) {
- $callback = $this->_data[$this->name][0];
- $params = ($this->_BCMode[$this->name]? "'', {jsVar}": '{jsVar}') .
- (isset($options)? ", '{$options}'": '');
- } else {
- $callback = is_array($options)? $options[1]: $options;
- $params = '{jsVar}';
- }
- return array('', "{jsVar} != '' && !{$callback}({$params})");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Callback
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Rule to compare two form fields
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Rule to compare two form fields
- *
- * The most common usage for this is to ensure that the password
- * confirmation field matches the password field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
-{
- /**
- * Possible operators to use
- * @var array
- * @access private
- */
- var $_operators = array(
- 'eq' => '===',
- 'neq' => '!==',
- 'gt' => '>',
- 'gte' => '>=',
- 'lt' => '<',
- 'lte' => '<=',
- '==' => '===',
- '!=' => '!=='
- );
-
-
- /**
- * Returns the operator to use for comparing the values
- *
- * @access private
- * @param string operator name
- * @return string operator to use for validation
- */
- function _findOperator($name)
- {
- if (empty($name)) {
- return '===';
- } elseif (isset($this->_operators[$name])) {
- return $this->_operators[$name];
- } elseif (in_array($name, $this->_operators)) {
- return $name;
- } else {
- return '===';
- }
- }
-
-
- function validate($values, $operator = null)
- {
- $operator = $this->_findOperator($operator);
- if ('===' != $operator && '!==' != $operator) {
- $compareFn = create_function('$a, $b', 'return floatval($a) ' . $operator . ' floatval($b);');
- } else {
- $compareFn = create_function('$a, $b', 'return strval($a) ' . $operator . ' strval($b);');
- }
-
- return $compareFn($values[0], $values[1]);
- }
-
-
- function getValidationScript($operator = null)
- {
- $operator = $this->_findOperator($operator);
- if ('===' != $operator && '!==' != $operator) {
- $check = "!(Number({jsVar}[0]) {$operator} Number({jsVar}[1]))";
- } else {
- $check = "!(String({jsVar}[0]) {$operator} String({jsVar}[1]))";
- }
- return array('', "'' != {jsVar}[0] && {$check}");
- }
-}
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Email validation rule
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Email validation rule
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Email extends HTML_QuickForm_Rule
-{
- var $regex = '/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/';
-
- /**
- * Validates an email address
- *
- * @param string $email Email address
- * @param boolean $checkDomain True if dns check should be performed
- * @access public
- * @return boolean true if email is valid
- */
- function validate($email, $checkDomain = false)
- {
- // Fix for bug #10799: add 'D' modifier to regex
- if (preg_match($this->regex . 'D', $email)) {
- if ($checkDomain && function_exists('checkdnsrr')) {
- $tokens = explode('@', $email);
- if (checkdnsrr($tokens[1], 'MX') || checkdnsrr($tokens[1], 'A')) {
- return true;
- }
- return false;
- }
- return true;
- }
- return false;
- } // end func validate
-
-
- function getValidationScript($options = null)
- {
- return array(" var regex = " . $this->regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Email
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Checks that the length of value is within range
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Checks that the length of value is within range
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Range extends HTML_QuickForm_Rule
-{
- /**
- * Validates a value using a range comparison
- *
- * @param string $value Value to be checked
- * @param mixed $options Int for length, array for range
- * @access public
- * @return boolean true if value is valid
- */
- function validate($value, $options = null)
- {
- $length = strlen($value);
- switch ($this->name) {
- case 'minlength': return ($length >= $options);
- case 'maxlength': return ($length <= $options);
- default: return ($length >= $options[0] && $length <= $options[1]);
- }
- } // end func validate
-
-
- function getValidationScript($options = null)
- {
- switch ($this->name) {
- case 'minlength':
- $test = '{jsVar}.length < '.$options;
- break;
- case 'maxlength':
- $test = '{jsVar}.length > '.$options;
- break;
- default:
- $test = '({jsVar}.length < '.$options[0].' || {jsVar}.length > '.$options[1].')';
- }
- return array('', "{jsVar} != '' && {$test}");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Range
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Validates values using regular expressions
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Validates values using regular expressions
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Regex extends HTML_QuickForm_Rule
-{
- /**
- * Array of regular expressions
- *
- * Array is in the format:
- * $_data['rulename'] = 'pattern';
- *
- * @var array
- * @access private
- */
- var $_data = array(
- 'lettersonly' => '/^[a-zA-Z]+$/',
- 'alphanumeric' => '/^[a-zA-Z0-9]+$/',
- 'numeric' => '/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/',
- 'nopunctuation' => '/^[^().\/\*\^\?#!@$%+=,\"\'><~\[\]{}]+$/',
- 'nonzero' => '/^-?[1-9][0-9]*/'
- );
-
- /**
- * Validates a value using a regular expression
- *
- * @param string $value Value to be checked
- * @param string $regex Regular expression
- * @access public
- * @return boolean true if value is valid
- */
- function validate($value, $regex = null)
- {
- // Fix for bug #10799: add 'D' modifier to regex
- if (isset($this->_data[$this->name])) {
- if (!preg_match($this->_data[$this->name] . 'D', $value)) {
- return false;
- }
- } else {
- if (!preg_match($regex . 'D', $value)) {
- return false;
- }
- }
- return true;
- } // end func validate
-
- /**
- * Adds new regular expressions to the list
- *
- * @param string $name Name of rule
- * @param string $pattern Regular expression pattern
- * @access public
- */
- function addData($name, $pattern)
- {
- $this->_data[$name] = $pattern;
- } // end func addData
-
-
- function getValidationScript($options = null)
- {
- $regex = isset($this->_data[$this->name]) ? $this->_data[$this->name] : $options;
-
- // bug #12376, converting unicode escapes and stripping 'u' modifier
- if ($pos = strpos($regex, 'u', strrpos($regex, '/'))) {
- $regex = substr($regex, 0, $pos) . substr($regex, $pos + 1);
- $regex = preg_replace('/(?<!\\\\)(?>\\\\\\\\)*\\\\x{([a-fA-F0-9]+)}/', '\\u$1', $regex);
- }
-
- return array(" var regex = " . $regex . ";\n", "{jsVar} != '' && !regex.test({jsVar})");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Regex
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Required elements validation
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Abstract base class for QuickForm validation rules
- */
-require_once 'HTML/QuickForm/Rule.php';
-
-/**
- * Required elements validation
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_Rule_Required extends HTML_QuickForm_Rule
-{
- /**
- * Checks if an element is empty
- *
- * @param string $value Value to check
- * @param mixed $options Not used yet
- * @access public
- * @return boolean true if value is not empty
- */
- function validate($value, $options = null)
- {
- if (is_array($value)) {
- return (bool) $value;
- } else if ((string)$value == '') {
- return false;
- }
- return true;
- } // end func validate
-
-
- function getValidationScript($options = null)
- {
- return array('', "{jsVar} == ''");
- } // end func getValidationScript
-
-} // end class HTML_QuickForm_Rule_Required
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Registers rule objects and uses them for validation
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Registers rule objects and uses them for validation
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_RuleRegistry
-{
- /**
- * Array containing references to used rules
- * @var array
- * @access private
- */
- var $_rules = array();
-
-
- /**
- * Returns a singleton of HTML_QuickForm_RuleRegistry
- *
- * Usually, only one RuleRegistry object is needed, this is the reason
- * why it is recommended to use this method to get the validation object.
- *
- * @access public
- * @static
- * @return HTML_QuickForm_RuleRegistry
- */
- function &singleton()
- {
- static $obj;
- if (!isset($obj)) {
- $obj = new HTML_QuickForm_RuleRegistry();
- }
- return $obj;
- } // end func singleton
-
- /**
- * Registers a new validation rule
- *
- * In order to use a custom rule in your form, you need to register it
- * first. For regular expressions, one can directly use the 'regex' type
- * rule in addRule(), this is faster than registering the rule.
- *
- * Functions and methods can be registered. Use the 'function' type.
- * When registering a method, specify the class name as second parameter.
- *
- * You can also register an HTML_QuickForm_Rule subclass with its own
- * validate() method.
- *
- * @param string $ruleName Name of validation rule
- * @param string $type Either: 'regex', 'function' or null
- * @param string $data1 Name of function, regular expression or
- * HTML_QuickForm_Rule object class name
- * @param string $data2 Object parent of above function or HTML_QuickForm_Rule file path
- * @access public
- * @return void
- */
- function registerRule($ruleName, $type, $data1, $data2 = null)
- {
- $type = strtolower($type);
- if ($type == 'regex') {
- // Regular expression
- $rule =& $this->getRule('regex');
- $rule->addData($ruleName, $data1);
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['regex'];
-
- } elseif ($type == 'function' || $type == 'callback') {
- // Callback function
- $rule =& $this->getRule('callback');
- $rule->addData($ruleName, $data1, $data2, 'function' == $type);
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['callback'];
-
- } elseif (is_object($data1)) {
- // An instance of HTML_QuickForm_Rule
- $this->_rules[strtolower(get_class($data1))] = $data1;
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower(get_class($data1)), null);
-
- } else {
- // Rule class name
- $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower($data1), $data2);
- }
- } // end func registerRule
-
- /**
- * Returns a reference to the requested rule object
- *
- * @param string $ruleName Name of the requested rule
- * @access public
- * @return HTML_QuickForm_Rule
- */
- function &getRule($ruleName)
- {
- list($class, $path) = $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName];
-
- if (!isset($this->_rules[$class])) {
- if (!empty($path)) {
- include_once($path);
- }
- $this->_rules[$class] = new $class();
- }
- $this->_rules[$class]->setName($ruleName);
- return $this->_rules[$class];
- } // end func getRule
-
- /**
- * Performs validation on the given values
- *
- * @param string $ruleName Name of the rule to be used
- * @param mixed $values Can be a scalar or an array of values
- * to be validated
- * @param mixed $options Options used by the rule
- * @param mixed $multiple Whether to validate an array of values altogether
- * @access public
- * @return mixed true if no error found, int of valid values (when an array of values is given) or false if error
- */
- function validate($ruleName, $values, $options = null, $multiple = false)
- {
- $rule =& $this->getRule($ruleName);
-
- if (is_array($values) && !$multiple) {
- $result = 0;
- foreach ($values as $value) {
- if ($rule->validate($value, $options) === true) {
- $result++;
- }
- }
- return ($result == 0) ? false : $result;
- } else {
- return $rule->validate($values, $options);
- }
- } // end func validate
-
- /**
- * Returns the validation test in javascript code
- *
- * @param array|HTML_QuickForm_element Element(s) the rule applies to
- * @param string Element name, in case $element is
- * not an array
- * @param array Rule data
- * @access public
- * @return string JavaScript for the rule
- */
- function getValidationScript(&$element, $elementName, $ruleData)
- {
- $reset = (isset($ruleData['reset'])) ? $ruleData['reset'] : false;
- $rule =& $this->getRule($ruleData['type']);
- if (!is_array($element)) {
- list($jsValue, $jsReset) = $this->_getJsValue($element, $elementName, $reset, null);
- } else {
- $jsValue = " value = new Array();\n";
- $jsReset = '';
- for ($i = 0; $i < count($element); $i++) {
- list($tmp_value, $tmp_reset) = $this->_getJsValue($element[$i], $element[$i]->getName(), $reset, $i);
- $jsValue .= "\n" . $tmp_value;
- $jsReset .= $tmp_reset;
- }
- }
- $jsField = isset($ruleData['group'])? $ruleData['group']: $elementName;
- list ($jsPrefix, $jsCheck) = $rule->getValidationScript($ruleData['format']);
- if (!isset($ruleData['howmany'])) {
- $js = $jsValue . "\n" . $jsPrefix .
- " if (" . str_replace('{jsVar}', 'value', $jsCheck) . " && !errFlag['{$jsField}']) {\n" .
- " errFlag['{$jsField}'] = true;\n" .
- " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" .
- $jsReset .
- " }\n";
- } else {
- $js = $jsValue . "\n" . $jsPrefix .
- " var res = 0;\n" .
- " for (var i = 0; i < value.length; i++) {\n" .
- " if (!(" . str_replace('{jsVar}', 'value[i]', $jsCheck) . ")) {\n" .
- " res++;\n" .
- " }\n" .
- " }\n" .
- " if (res < {$ruleData['howmany']} && !errFlag['{$jsField}']) {\n" .
- " errFlag['{$jsField}'] = true;\n" .
- " _qfMsg = _qfMsg + '\\n - {$ruleData['message']}';\n" .
- $jsReset .
- " }\n";
- }
- return $js;
- } // end func getValidationScript
-
-
- /**
- * Returns JavaScript to get and to reset the element's value
- *
- * @access private
- * @param HTML_QuickForm_element element being processed
- * @param string element's name
- * @param bool whether to generate JavaScript to reset
- * the value
- * @param integer value's index in the array (only used for
- * multielement rules)
- * @return array first item is value javascript, second is reset
- */
- function _getJsValue(&$element, $elementName, $reset = false, $index = null)
- {
- $jsIndex = isset($index)? '[' . $index . ']': '';
- $tmp_reset = $reset? " var field = frm.elements['$elementName'];\n": '';
- if (is_a($element, 'html_quickform_group')) {
- $value = " _qfGroups['{$elementName}'] = {";
- $elements =& $element->getElements();
- for ($i = 0, $count = count($elements); $i < $count; $i++) {
- $append = ($elements[$i]->getType() == 'select' && $elements[$i]->getMultiple())? '[]': '';
- $value .= "'" . $element->getElementName($i) . $append . "': true" .
- ($i < $count - 1? ', ': '');
- }
- $value .=
- "};\n" .
- " value{$jsIndex} = new Array();\n" .
- " var valueIdx = 0;\n" .
- " for (var i = 0; i < frm.elements.length; i++) {\n" .
- " var _element = frm.elements[i];\n" .
- " if (_element.name in _qfGroups['{$elementName}']) {\n" .
- " switch (_element.type) {\n" .
- " case 'checkbox':\n" .
- " case 'radio':\n" .
- " if (_element.checked) {\n" .
- " value{$jsIndex}[valueIdx++] = _element.value;\n" .
- " }\n" .
- " break;\n" .
- " case 'select-one':\n" .
- " if (-1 != _element.selectedIndex) {\n" .
- " value{$jsIndex}[valueIdx++] = _element.options[_element.selectedIndex].value;\n" .
- " }\n" .
- " break;\n" .
- " case 'select-multiple':\n" .
- " var tmpVal = new Array();\n" .
- " var tmpIdx = 0;\n" .
- " for (var j = 0; j < _element.options.length; j++) {\n" .
- " if (_element.options[j].selected) {\n" .
- " tmpVal[tmpIdx++] = _element.options[j].value;\n" .
- " }\n" .
- " }\n" .
- " if (tmpIdx > 0) {\n" .
- " value{$jsIndex}[valueIdx++] = tmpVal;\n" .
- " }\n" .
- " break;\n" .
- " default:\n" .
- " value{$jsIndex}[valueIdx++] = _element.value;\n" .
- " }\n" .
- " }\n" .
- " }\n";
- if ($reset) {
- $tmp_reset =
- " for (var i = 0; i < frm.elements.length; i++) {\n" .
- " var _element = frm.elements[i];\n" .
- " if (_element.name in _qfGroups['{$elementName}']) {\n" .
- " switch (_element.type) {\n" .
- " case 'checkbox':\n" .
- " case 'radio':\n" .
- " _element.checked = _element.defaultChecked;\n" .
- " break;\n" .
- " case 'select-one':\n" .
- " case 'select-multiple':\n" .
- " for (var j = 0; j < _element.options.length; j++) {\n" .
- " _element.options[j].selected = _element.options[j].defaultSelected;\n" .
- " }\n" .
- " break;\n" .
- " default:\n" .
- " _element.value = _element.defaultValue;\n" .
- " }\n" .
- " }\n" .
- " }\n";
- }
-
- } elseif ($element->getType() == 'select') {
- if ($element->getMultiple()) {
- $elementName .= '[]';
- $value =
- " value{$jsIndex} = new Array();\n" .
- " var valueIdx = 0;\n" .
- " for (var i = 0; i < frm.elements['{$elementName}'].options.length; i++) {\n" .
- " if (frm.elements['{$elementName}'].options[i].selected) {\n" .
- " value{$jsIndex}[valueIdx++] = frm.elements['{$elementName}'].options[i].value;\n" .
- " }\n" .
- " }\n";
- } else {
- $value = " value{$jsIndex} = frm.elements['{$elementName}'].selectedIndex == -1? '': frm.elements['{$elementName}'].options[frm.elements['{$elementName}'].selectedIndex].value;\n";
- }
- if ($reset) {
- $tmp_reset .=
- " for (var i = 0; i < field.options.length; i++) {\n" .
- " field.options[i].selected = field.options[i].defaultSelected;\n" .
- " }\n";
- }
-
- } elseif ($element->getType() == 'checkbox') {
- if (is_a($element, 'html_quickform_advcheckbox')) {
- $value = " value{$jsIndex} = frm.elements['$elementName'][1].checked? frm.elements['$elementName'][1].value: frm.elements['$elementName'][0].value;\n";
- $tmp_reset .= $reset ? " field[1].checked = field[1].defaultChecked;\n" : '';
- } else {
- $value = " value{$jsIndex} = frm.elements['$elementName'].checked? '1': '';\n";
- $tmp_reset .= $reset ? " field.checked = field.defaultChecked;\n" : '';
- }
-
- } elseif ($element->getType() == 'radio') {
- $value = " value{$jsIndex} = '';\n" .
- // Fix for bug #5644
- " var els = 'length' in frm.elements['$elementName']? frm.elements['$elementName']: [ frm.elements['$elementName'] ];\n" .
- " for (var i = 0; i < els.length; i++) {\n" .
- " if (els[i].checked) {\n" .
- " value{$jsIndex} = els[i].value;\n" .
- " }\n" .
- " }";
- if ($reset) {
- $tmp_reset .= " for (var i = 0; i < field.length; i++) {\n" .
- " field[i].checked = field[i].defaultChecked;\n" .
- " }";
- }
-
- } else {
- $value = " value{$jsIndex} = frm.elements['$elementName'].value;";
- $tmp_reset .= ($reset) ? " field.value = field.defaultValue;\n" : '';
- }
- return array($value, $tmp_reset);
- }
-} // end class HTML_QuickForm_RuleRegistry
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an advanced checkbox type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Jason Rust <jrust@php.net>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for a checkbox type field
- */
-require_once 'HTML/QuickForm/checkbox.php';
-
-/**
- * HTML class for an advanced checkbox type field
- *
- * Basically this fixes a problem that HTML has had
- * where checkboxes can only pass a single value (the
- * value of the checkbox when checked). A value for when
- * the checkbox is not checked cannot be passed, and
- * furthermore the checkbox variable doesn't even exist if
- * the checkbox was submitted unchecked.
- *
- * It works by prepending a hidden field with the same name and
- * another "unchecked" value to the checbox. If the checkbox is
- * checked, PHP overwrites the value of the hidden field with
- * its value.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Jason Rust <jrust@php.net>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 2.0
- */
-class HTML_QuickForm_advcheckbox extends HTML_QuickForm_checkbox
-{
- // {{{ properties
-
- /**
- * The values passed by the hidden elment
- *
- * @var array
- * @access private
- */
- var $_values = null;
-
- /**
- * The default value
- *
- * @var boolean
- * @access private
- */
- var $_currentValue = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label
- * @param string $text (optional)Text to put after the checkbox
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @param mixed $values (optional)Values to pass if checked or not checked
- *
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
- {
- $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
- $this->setValues($values);
- } //end constructor
-
- // }}}
- // {{{ getPrivateName()
-
- /**
- * Gets the private name for the element
- *
- * @param string $elementName The element name to make private
- *
- * @access public
- * @return string
- *
- * @deprecated Deprecated since 3.2.6, both generated elements have the same name
- */
- function getPrivateName($elementName)
- {
- return '__'.$elementName;
- }
-
- // }}}
- // {{{ getOnclickJs()
-
- /**
- * Create the javascript for the onclick event which will
- * set the value of the hidden field
- *
- * @param string $elementName The element name
- *
- * @access public
- * @return string
- *
- * @deprecated Deprecated since 3.2.6, this element no longer uses any javascript
- */
- function getOnclickJs($elementName)
- {
- $onclickJs = 'if (this.checked) { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[1], '\'').'\'; }';
- $onclickJs .= 'else { this.form[\''.$elementName.'\'].value=\''.addcslashes($this->_values[0], '\'').'\'; }';
- return $onclickJs;
- }
-
- // }}}
- // {{{ setValues()
-
- /**
- * Sets the values used by the hidden element
- *
- * @param mixed $values The values, either a string or an array
- *
- * @access public
- * @return void
- */
- function setValues($values)
- {
- if (empty($values)) {
- // give it default checkbox behavior
- $this->_values = array('', 1);
- } elseif (is_scalar($values)) {
- // if it's string, then assume the value to
- // be passed is for when the element is checked
- $this->_values = array('', $values);
- } else {
- $this->_values = $values;
- }
- $this->updateAttributes(array('value' => $this->_values[1]));
- $this->setChecked($this->_currentValue == $this->_values[1]);
- }
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the element's value
- *
- * @param mixed Element's value
- * @access public
- */
- function setValue($value)
- {
- $this->setChecked(isset($this->_values[1]) && $value == $this->_values[1]);
- $this->_currentValue = $value;
- }
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the element's value
- *
- * @access public
- * @return mixed
- */
- function getValue()
- {
- if (is_array($this->_values)) {
- return $this->_values[$this->getChecked()? 1: 0];
- } else {
- return null;
- }
- }
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the checkbox element in HTML
- * and the additional hidden element in HTML
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return parent::toHtml();
- } else {
- return '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $this->getName(),
- 'value' => $this->_values[0]
- )) . ' />' . parent::toHtml();
-
- }
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Unlike checkbox, this has to append a hidden input in both
- * checked and non-checked states
- */
- function getFrozenHtml()
- {
- return ($this->getChecked()? '<tt>[x]</tt>': '<tt>[ ]</tt>') .
- $this->_getPersistantData();
- }
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormLoad
-
- // }}}
- // {{{ exportValue()
-
- /**
- * This element has a value even if it is not checked, thus we override
- * checkbox's behaviour here
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getValue();
- } elseif (is_array($this->_values) && ($value != $this->_values[0]) && ($value != $this->_values[1])) {
- $value = null;
- }
- return $this->_prepareValue($value, $assoc);
- }
- // }}}
-} //end class HTML_QuickForm_advcheckbox
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an autocomplete element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Matteo Di Giovinazzo <matteodg@infinito.it>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for a text field
- */
-require_once 'HTML/QuickForm/text.php';
-
-/**
- * HTML class for an autocomplete element
- *
- * Creates an HTML input text element that
- * at every keypressed javascript event checks in an array of options
- * if there's a match and autocompletes the text in case of match.
- *
- * For the JavaScript code thanks to Martin Honnen and Nicholas C. Zakas
- * See {@link http://www.faqts.com/knowledge_base/view.phtml/aid/13562} and
- * {@link http://www.sitepoint.com/article/1220}
- *
- * Example:
- * <code>
- * $autocomplete =& $form->addElement('autocomplete', 'fruit', 'Favourite fruit:');
- * $options = array("Apple", "Orange", "Pear", "Strawberry");
- * $autocomplete->setOptions($options);
- * </code>
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Matteo Di Giovinazzo <matteodg@infinito.it>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_autocomplete extends HTML_QuickForm_text
-{
- // {{{ properties
-
- /**
- * Options for the autocomplete input text element
- *
- * @var array
- * @access private
- */
- var $_options = array();
-
- /**
- * "One-time" javascript (containing functions), see bug #4611
- *
- * @var string
- * @access private
- */
- var $_js = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label in form
- * @param array $options (optional)Autocomplete options
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array. Date format is passed along the attributes.
- * @access public
- * @return void
- */
- function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null)
- {
- $this->HTML_QuickForm_text($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'autocomplete';
- if (isset($options)) {
- $this->setOptions($options);
- }
- } //end constructor
-
- // }}}
- // {{{ setOptions()
-
- /**
- * Sets the options for the autocomplete input text element
- *
- * @param array $options Array of options for the autocomplete input text element
- * @access public
- * @return void
- */
- function setOptions($options)
- {
- $this->_options = array_values($options);
- } // end func setOptions
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns Html for the autocomplete input text element
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- // prevent problems with grouped elements
- $arrayName = str_replace(array('[', ']'), array('__', ''), $this->getName()) . '_values';
-
- $this->updateAttributes(array(
- 'onkeypress' => 'return window.autocomplete(this, event, ' . $arrayName . ');'
- ));
- if ($this->_flagFrozen) {
- $js = '';
- } else {
- $js = "<script type=\"text/javascript\">\n//<![CDATA[\n";
- if (!defined('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS')) {
- $this->_js .= <<<EOS
-
-/* begin javascript for autocomplete */
-function setSelectionRange(input, selectionStart, selectionEnd) {
- if (input.setSelectionRange) {
- input.setSelectionRange(selectionStart, selectionEnd);
- }
- else if (input.createTextRange) {
- var range = input.createTextRange();
- range.collapse(true);
- range.moveEnd("character", selectionEnd);
- range.moveStart("character", selectionStart);
- range.select();
- }
- input.focus();
-}
-
-function setCaretToPosition(input, position) {
- setSelectionRange(input, position, position);
-}
-
-function replaceSelection (input, replaceString) {
- var len = replaceString.length;
- if (input.setSelectionRange) {
- var selectionStart = input.selectionStart;
- var selectionEnd = input.selectionEnd;
-
- input.value = input.value.substring(0, selectionStart) + replaceString + input.value.substring(selectionEnd);
- input.selectionStart = selectionStart + len;
- input.selectionEnd = selectionStart + len;
- }
- else if (document.selection) {
- var range = document.selection.createRange();
- var saved_range = range.duplicate();
-
- if (range.parentElement() == input) {
- range.text = replaceString;
- range.moveEnd("character", saved_range.selectionStart + len);
- range.moveStart("character", saved_range.selectionStart + len);
- range.select();
- }
- }
- input.focus();
-}
-
-
-function autocompleteMatch (text, values) {
- for (var i = 0; i < values.length; i++) {
- if (values[i].toUpperCase().indexOf(text.toUpperCase()) == 0) {
- return values[i];
- }
- }
-
- return null;
-}
-
-function autocomplete(textbox, event, values) {
- if (textbox.setSelectionRange || textbox.createTextRange) {
- switch (event.keyCode) {
- case 38: // up arrow
- case 40: // down arrow
- case 37: // left arrow
- case 39: // right arrow
- case 33: // page up
- case 34: // page down
- case 36: // home
- case 35: // end
- case 13: // enter
- case 9: // tab
- case 27: // esc
- case 16: // shift
- case 17: // ctrl
- case 18: // alt
- case 20: // caps lock
- case 8: // backspace
- case 46: // delete
- return true;
- break;
-
- default:
- var c = String.fromCharCode(
- (event.charCode == undefined) ? event.keyCode : event.charCode
- );
- replaceSelection(textbox, c);
- sMatch = autocompleteMatch(textbox.value, values);
- var len = textbox.value.length;
-
- if (sMatch != null) {
- textbox.value = sMatch;
- setSelectionRange(textbox, len, textbox.value.length);
- }
- return false;
- }
- }
- else {
- return true;
- }
-}
-/* end javascript for autocomplete */
-
-EOS;
- define('HTML_QUICKFORM_AUTOCOMPLETE_EXISTS', true);
- }
- $jsEscape = array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- );
-
- $js .= $this->_js;
- $js .= 'var ' . $arrayName . " = new Array();\n";
- for ($i = 0; $i < count($this->_options); $i++) {
- $js .= $arrayName . '[' . $i . "] = '" . strtr($this->_options[$i], $jsEscape) . "';\n";
- }
- $js .= "//]]>\n</script>";
- }
- return $js . parent::toHtml();
- }// end func toHtml
-
- // }}}
-} // end class HTML_QuickForm_autocomplete
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an <input type="button" /> elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for an <input type="button" /> elements
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_button extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $value (optional)Input field value
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->_persistantFreeze = false;
- $this->setValue($value);
- $this->setType('button');
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
-
-} //end class HTML_QuickForm_button
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a checkbox type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a checkbox type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_checkbox extends HTML_QuickForm_input
-{
- // {{{ properties
-
- /**
- * Checkbox display text
- * @var string
- * @since 1.1
- * @access private
- */
- var $_text = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field value
- * @param string $text (optional)Checkbox display text
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_text = $text;
- $this->setType('checkbox');
- $this->updateAttributes(array('value'=>1));
- $this->_generateId();
- } //end constructor
-
- // }}}
- // {{{ setChecked()
-
- /**
- * Sets whether a checkbox is checked
- *
- * @param bool $checked Whether the field is checked or not
- * @since 1.0
- * @access public
- * @return void
- */
- function setChecked($checked)
- {
- if (!$checked) {
- $this->removeAttribute('checked');
- } else {
- $this->updateAttributes(array('checked'=>'checked'));
- }
- } //end func setChecked
-
- // }}}
- // {{{ getChecked()
-
- /**
- * Returns whether a checkbox is checked
- *
- * @since 1.0
- * @access public
- * @return bool
- */
- function getChecked()
- {
- return (bool)$this->getAttribute('checked');
- } //end func getChecked
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the checkbox element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if (0 == strlen($this->_text)) {
- $label = '';
- } elseif ($this->_flagFrozen) {
- $label = $this->_text;
- } else {
- $label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
- }
- return HTML_QuickForm_input::toHtml() . $label;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- if ($this->getChecked()) {
- return '<tt>[x]</tt>' .
- $this->_getPersistantData();
- } else {
- return '<tt>[ ]</tt>';
- }
- } //end func getFrozenHtml
-
- // }}}
- // {{{ setText()
-
- /**
- * Sets the checkbox text
- *
- * @param string $text
- * @since 1.1
- * @access public
- * @return void
- */
- function setText($text)
- {
- $this->_text = $text;
- } //end func setText
-
- // }}}
- // {{{ getText()
-
- /**
- * Returns the checkbox text
- *
- * @since 1.1
- * @access public
- * @return string
- */
- function getText()
- {
- return $this->_text;
- } //end func getText
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param string $value Default value of the form element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- return $this->setChecked($value);
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return bool
- */
- function getValue()
- {
- return $this->getChecked();
- } // end func getValue
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- // if no boxes were checked, then there is no value in the array
- // yet we don't want to display default value in this case
- if ($caller->isSubmitted()) {
- $value = $this->_findValue($caller->_submitValues);
- } else {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value || $caller->isSubmitted()) {
- $this->setChecked($value);
- }
- break;
- case 'setGroupValue':
- $this->setChecked($arg);
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Return true if the checkbox is checked, null if it is not checked (getValue() returns false)
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getChecked()? true: null;
- }
- return $this->_prepareValue($value, $assoc);
- }
-
- // }}}
-} //end class HTML_QuickForm_checkbox
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class for a group of elements used to input dates (and times).
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Class for a group of form elements
- */
-require_once 'HTML/QuickForm/group.php';
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-
-/**
- * Class for a group of elements used to input dates (and times).
- *
- * Inspired by original 'date' element but reimplemented as a subclass
- * of HTML_QuickForm_group
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.1
- */
-class HTML_QuickForm_date extends HTML_QuickForm_group
-{
- // {{{ properties
-
- /**
- * Various options to control the element's display.
- *
- * @access private
- * @var array
- */
- var $_options = array(
- 'language' => 'en',
- 'format' => 'dMY',
- 'minYear' => 2001,
- 'maxYear' => null, // set in the constructor
- 'addEmptyOption' => false,
- 'emptyOptionValue' => '',
- 'emptyOptionText' => ' ',
- 'optionIncrement' => array('i' => 1, 's' => 1)
- );
-
- /**
- * These complement separators, they are appended to the resultant HTML
- * @access private
- * @var array
- */
- var $_wrap = array('', '');
-
- /**
- * Options in different languages
- *
- * Note to potential translators: to avoid encoding problems please send
- * your translations with "weird" letters encoded as HTML Unicode entities
- *
- * @access private
- * @var array
- */
- var $_locale = array(
- 'en' => array (
- 'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
- 'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
- 'months_long' => array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
- ),
- 'de' => array (
- 'weekdays_short'=> array ('So', 'Mon', 'Di', 'Mi', 'Do', 'Fr', 'Sa'),
- 'weekdays_long' => array ('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'),
- 'months_short' => array ('Jan', 'Feb', 'März', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'),
- 'months_long' => array ('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember')
- ),
- 'fr' => array (
- 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
- 'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
- 'months_short' => array ('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'),
- 'months_long' => array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre')
- ),
- 'hu' => array (
- 'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'),
- 'weekdays_long' => array ('vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'),
- 'months_short' => array ('jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'),
- 'months_long' => array ('január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december')
- ),
- 'pl' => array (
- 'weekdays_short'=> array ('Nie', 'Pn', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'),
- 'weekdays_long' => array ('Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'),
- 'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'),
- 'months_long' => array ('Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień')
- ),
- 'sl' => array (
- 'weekdays_short'=> array ('Ned', 'Pon', 'Tor', 'Sre', 'Cet', 'Pet', 'Sob'),
- 'weekdays_long' => array ('Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Cetrtek', 'Petek', 'Sobota'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December')
- ),
- 'ru' => array (
- 'weekdays_short'=> array ('Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'),
- 'weekdays_long' => array ('Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'),
- 'months_short' => array ('Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'),
- 'months_long' => array ('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь')
- ),
- 'es' => array (
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'),
- 'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'),
- 'months_short' => array ('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'),
- 'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre')
- ),
- 'da' => array (
- 'weekdays_short'=> array ('Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'),
- 'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December')
- ),
- 'is' => array (
- 'weekdays_short'=> array ('Sun', 'Mán', 'Þri', 'Mið', 'Fim', 'Fös', 'Lau'),
- 'weekdays_long' => array ('Sunnudagur', 'Mánudagur', 'Þriðjudagur', 'Miðvikudagur', 'Fimmtudagur', 'Föstudagur', 'Laugardagur'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maí', 'Jún', 'Júl', 'Ágú', 'Sep', 'Okt', 'Nóv', 'Des'),
- 'months_long' => array ('Janúar', 'Febrúar', 'Mars', 'Apríl', 'Maí', 'Júní', 'Júlí', 'Ágúst', 'September', 'Október', 'Nóvember', 'Desember')
- ),
- 'it' => array (
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'),
- 'weekdays_long' => array ('Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'),
- 'months_short' => array ('Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'),
- 'months_long' => array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre')
- ),
- 'sk' => array (
- 'weekdays_short'=> array ('Ned', 'Pon', 'Uto', 'Str', 'Štv', 'Pia', 'Sob'),
- 'weekdays_long' => array ('Nedeža', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December')
- ),
- 'cs' => array (
- 'weekdays_short'=> array ('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'),
- 'weekdays_long' => array ('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'),
- 'months_short' => array ('Led', 'Úno', 'Bře', 'Dub', 'Kvě', 'Čen', 'Čec', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'),
- 'months_long' => array ('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec')
- ),
- 'hy' => array (
- 'weekdays_short'=> array ('Կրկ', 'Երկ', 'Երք', 'Չրք', 'Հնգ', 'Ուր', 'Շբթ'),
- 'weekdays_long' => array ('Կիրակի', 'Երկուշաբթի', 'Երեքշաբթի', 'Չորեքշաբթի', 'Հինգշաբթի', 'Ուրբաթ', 'Շաբաթ'),
- 'months_short' => array ('Հնվ', 'Փտր', 'Մրտ', 'Ապր', 'Մյս', 'Հնս', 'Հլս', 'Օգս', 'Սպտ', 'Հկտ', 'Նյմ', 'Դկտ'),
- 'months_long' => array ('Հունվար', 'Փետրվար', 'Մարտ', 'Ապրիլ', 'Մայիս', 'Հունիս', 'Հուլիս', 'Օգոստոս', 'Սեպտեմբեր', 'Հոկտեմբեր', 'Նոյեմբեր', 'Դեկտեմբեր')
- ),
- 'nl' => array (
- 'weekdays_short'=> array ('Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'),
- 'weekdays_long' => array ('Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December')
- ),
- 'et' => array (
- 'weekdays_short'=> array ('P', 'E', 'T', 'K', 'N', 'R', 'L'),
- 'weekdays_long' => array ('Pühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'),
- 'months_short' => array ('Jaan', 'Veebr', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'),
- 'months_long' => array ('Jaanuar', 'Veebruar', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember')
- ),
- 'tr' => array (
- 'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'),
- 'weekdays_long' => array ('Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'),
- 'months_short' => array ('Ock', 'Şbt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'Ağst', 'Eyl', 'Ekm', 'Ksm', 'Arlk'),
- 'months_long' => array ('Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık')
- ),
- 'no' => array (
- 'weekdays_short'=> array ('Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'),
- 'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'),
- 'months_long' => array ('Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember')
- ),
- 'eo' => array (
- 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Ĵaŭ', 'Ven', 'Sab'),
- 'weekdays_long' => array ('Dimanĉo', 'Lundo', 'Mardo', 'Merkredo', 'Ĵaŭdo', 'Vendredo', 'Sabato'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aŭg', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'Aŭgusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro')
- ),
- 'ua' => array (
- 'weekdays_short'=> array('Ндл', 'Пнд', 'Втр', 'Срд', 'Чтв', 'Птн', 'Сбт'),
- 'weekdays_long' => array('Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'),
- 'months_short' => array('Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'),
- 'months_long' => array('Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень')
- ),
- 'ro' => array (
- 'weekdays_short'=> array ('Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'),
- 'weekdays_long' => array ('Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'),
- 'months_short' => array ('Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
- 'months_long' => array ('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie')
- ),
- 'he' => array (
- 'weekdays_short'=> array ('ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'),
- 'weekdays_long' => array ('יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'שבת'),
- 'months_short' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'),
- 'months_long' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר')
- ),
- 'sv' => array (
- 'weekdays_short'=> array ('Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'),
- 'weekdays_long' => array ('Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lördag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December')
- ),
- 'pt' => array (
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'),
- 'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'),
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
- ),
- 'tw' => array (
- 'weekdays_short'=> array ('週日','週一', '週二','週三', '週四','週五', '週六'),
- 'weekdays_long' => array ('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'),
- 'months_short' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'),
- 'months_long' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月')
- ),
- 'pt-br' => array (
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'),
- 'weekdays_long' => array ('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'),
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
- ),
- 'sr' => array (
- 'weekdays_short'=> array ('Нед', 'Пон', 'Уто', 'Сре', 'Чет', 'Пет', 'Суб'),
- 'weekdays_long' => array ('Недеља', 'Понедељак', 'Уторак', 'Среда', 'Четвртак', 'Петак', 'Субота'),
- 'months_short' => array ('Јан', 'Феб', 'Мар', 'Апр', 'Мај', 'Јун', 'Јул', 'Авг', 'Сеп', 'Окт', 'Нов', 'Дец'),
- 'months_long' => array ('Јануар', 'Фебруар', 'Март', 'Април', 'Мај', 'Јун', 'Јул', 'Август', 'Септембар', 'Октобар', 'Новембар', 'Децембар')
- ),
- 'el' => array (
- 'weekdays_short'=> array ('Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ', 'Κυρ'),
- 'weekdays_long' => array ('Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο', 'Κυριακή'),
- 'months_short' => array ('Ιαν', 'Φεβ', 'Μάρ', 'Απρ', 'Μάϊ', 'Ioύν', 'Ιούλ', 'Αύγ', 'Σεπ', 'Οκτ', 'Νοέ', 'Δεκ'),
- 'months_long' => array ('Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάϊος', 'Ιούνιος', 'Ioύλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος')
- )
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * The following keys may appear in $options array:
- * - 'language': date language
- * - 'format': Format of the date, based on PHP's date() function.
- * The following characters are currently recognised in format string:
- * <pre>
- * D => Short names of days
- * l => Long names of days
- * d => Day numbers
- * M => Short names of months
- * F => Long names of months
- * m => Month numbers
- * Y => Four digit year
- * y => Two digit year
- * h => 12 hour format
- * H => 23 hour format
- * i => Minutes
- * s => Seconds
- * a => am/pm
- * A => AM/PM
- * </pre>
- * - 'minYear': Minimum year in year select
- * - 'maxYear': Maximum year in year select
- * - 'addEmptyOption': Should an empty option be added to the top of
- * each select box?
- * - 'emptyOptionValue': The value passed by the empty option.
- * - 'emptyOptionText': The text displayed for the empty option.
- * - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
- *
- * @access public
- * @param string Element's name
- * @param mixed Label(s) for an element
- * @param array Options to control the element's display
- * @param mixed Either a typical HTML attribute string or an associative array
- */
- function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_appendName = true;
- $this->_type = 'date';
-
- // http://pear.php.net/bugs/bug.php?id=18171
- $this->_options['maxYear'] = date('Y');
-
- // set the options, do not bother setting bogus ones
- if (is_array($options)) {
- foreach ($options as $name => $value) {
- if ('language' == $name) {
- $this->_options['language'] = isset($this->_locale[$value])? $value: 'en';
- } elseif (isset($this->_options[$name])) {
- if (is_array($value) && is_array($this->_options[$name])) {
- $this->_options[$name] = @array_merge($this->_options[$name], $value);
- } else {
- $this->_options[$name] = $value;
- }
- }
- }
- }
- }
-
- // }}}
- // {{{ _createElements()
-
- function _createElements()
- {
- $this->_separator = $this->_elements = array();
- $separator = '';
- $locale =& $this->_locale[$this->_options['language']];
- $backslash = false;
- for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
- $sign = $this->_options['format']{$i};
- if ($backslash) {
- $backslash = false;
- $separator .= $sign;
- } else {
- $loadSelect = true;
- switch ($sign) {
- case 'D':
- // Sunday is 0 like with 'w' in date()
- $options = $locale['weekdays_short'];
- break;
- case 'l':
- $options = $locale['weekdays_long'];
- break;
- case 'd':
- $options = $this->_createOptionList(1, 31);
- break;
- case 'M':
- $options = $locale['months_short'];
- array_unshift($options , '');
- unset($options[0]);
- break;
- case 'm':
- $options = $this->_createOptionList(1, 12);
- break;
- case 'F':
- $options = $locale['months_long'];
- array_unshift($options , '');
- unset($options[0]);
- break;
- case 'Y':
- $options = $this->_createOptionList(
- $this->_options['minYear'],
- $this->_options['maxYear'],
- $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
- );
- break;
- case 'y':
- $options = $this->_createOptionList(
- $this->_options['minYear'],
- $this->_options['maxYear'],
- $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
- );
- array_walk($options, create_function('&$v,$k','$v = substr($v,-2);'));
- break;
- case 'h':
- $options = $this->_createOptionList(1, 12);
- break;
- case 'g':
- $options = $this->_createOptionList(1, 12);
- array_walk($options, create_function('&$v,$k', '$v = intval($v);'));
- break;
- case 'H':
- $options = $this->_createOptionList(0, 23);
- break;
- case 'i':
- $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['i']);
- break;
- case 's':
- $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['s']);
- break;
- case 'a':
- $options = array('am' => 'am', 'pm' => 'pm');
- break;
- case 'A':
- $options = array('AM' => 'AM', 'PM' => 'PM');
- break;
- case 'W':
- $options = $this->_createOptionList(1, 53);
- break;
- case '\\':
- $backslash = true;
- $loadSelect = false;
- break;
- default:
- $separator .= (' ' == $sign? ' ': $sign);
- $loadSelect = false;
- }
-
- if ($loadSelect) {
- if (0 < count($this->_elements)) {
- $this->_separator[] = $separator;
- } else {
- $this->_wrap[0] = $separator;
- }
- $separator = '';
- // Should we add an empty option to the top of the select?
- if (!is_array($this->_options['addEmptyOption']) && $this->_options['addEmptyOption'] ||
- is_array($this->_options['addEmptyOption']) && !empty($this->_options['addEmptyOption'][$sign])) {
-
- // Using '+' array operator to preserve the keys
- if (is_array($this->_options['emptyOptionText']) && !empty($this->_options['emptyOptionText'][$sign])) {
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText'][$sign]) + $options;
- } else {
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
- }
- }
- $this->_elements[] =& new HTML_QuickForm_select($sign, null, $options, $this->getAttributes());
- }
- }
- }
- $this->_wrap[1] = $separator . ($backslash? '\\': '');
- }
-
- // }}}
- // {{{ _createOptionList()
-
- /**
- * Creates an option list containing the numbers from the start number to the end, inclusive
- *
- * @param int The start number
- * @param int The end number
- * @param int Increment by this value
- * @access private
- * @return array An array of numeric options.
- */
- function _createOptionList($start, $end, $step = 1)
- {
- for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) {
- $options[$i] = sprintf('%02d', $i);
- }
- return $options;
- }
-
- // }}}
- // {{{ _trimLeadingZeros()
-
- /**
- * Trims leading zeros from the (numeric) string
- *
- * @param string A numeric string, possibly with leading zeros
- * @return string String with leading zeros removed
- */
- function _trimLeadingZeros($str)
- {
- if (0 == strcmp($str, $this->_options['emptyOptionValue'])) {
- return $str;
- }
- $trimmed = ltrim($str, '0');
- return strlen($trimmed)? $trimmed: '0';
- }
-
- // }}}
- // {{{ setValue()
-
- function setValue($value)
- {
- if (empty($value)) {
- $value = array();
- } elseif (is_scalar($value)) {
- if (!is_numeric($value)) {
- $value = strtotime($value);
- }
- // might be a unix epoch, then we fill all possible values
- $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
- $value = array(
- 'D' => $arr[0],
- 'l' => $arr[0],
- 'd' => $arr[1],
- 'M' => $arr[2],
- 'm' => $arr[2],
- 'F' => $arr[2],
- 'Y' => $arr[3],
- 'y' => $arr[3],
- 'h' => $arr[4],
- 'g' => $arr[4],
- 'H' => $arr[5],
- 'i' => $this->_trimLeadingZeros($arr[6]),
- 's' => $this->_trimLeadingZeros($arr[7]),
- 'a' => $arr[8],
- 'A' => $arr[9],
- 'W' => $this->_trimLeadingZeros($arr[10])
- );
- } else {
- $value = array_map(array($this, '_trimLeadingZeros'), $value);
- }
- parent::setValue($value);
- }
-
- // }}}
- // {{{ toHtml()
-
- function toHtml()
- {
- include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer =& new HTML_QuickForm_Renderer_Default();
- $renderer->setElementTemplate('{element}');
- parent::accept($renderer);
- return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1];
- }
-
- // }}}
- // {{{ accept()
-
- function accept(&$renderer, $required = false, $error = null)
- {
- $renderer->renderElement($this, $required, $error);
- }
-
- // }}}
- // {{{ onQuickFormEvent()
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' == $event) {
- // we need to call setValue(), 'cause the default/constant value
- // may be in fact a timestamp, not an array
- return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
- } else {
- return parent::onQuickFormEvent($event, $arg, $caller);
- }
- }
-
- // }}}
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Base class for form elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for all HTML classes
- */
-require_once 'HTML/Common.php';
-/**
- * Static utility methods
- */
-require_once 'HTML/QuickForm/utils.php';
-
-/**
- * Base class for form elements
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 1.0
- * @abstract
- */
-class HTML_QuickForm_element extends HTML_Common
-{
- // {{{ properties
-
- /**
- * Label of the field
- * @var string
- * @since 1.3
- * @access private
- */
- var $_label = '';
-
- /**
- * Form element type
- * @var string
- * @since 1.0
- * @access private
- */
- var $_type = '';
-
- /**
- * Flag to tell if element is frozen
- * @var boolean
- * @since 1.0
- * @access private
- */
- var $_flagFrozen = false;
-
- /**
- * Does the element support persistant data when frozen
- * @var boolean
- * @since 1.3
- * @access private
- */
- var $_persistantFreeze = false;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Name of the element
- * @param mixed Label(s) for the element
- * @param mixed Associative array of tag attributes or HTML attributes name="value" pairs
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_Common::HTML_Common($attributes);
- if (isset($elementName)) {
- $this->setName($elementName);
- }
- if (isset($elementLabel)) {
- $this->setLabel($elementLabel);
- }
- } //end constructor
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Returns the current API version
- *
- * @since 1.0
- * @access public
- * @return float
- */
- function apiVersion()
- {
- return 3.2;
- } // end func apiVersion
-
- // }}}
- // {{{ getType()
-
- /**
- * Returns element type
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getType()
- {
- return $this->_type;
- } // end func getType
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- // interface method
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- // interface method
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param string $value Default value of the form element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- // interface
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return mixed
- */
- function getValue()
- {
- // interface
- return null;
- } // end func getValue
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- $this->_flagFrozen = true;
- } //end func freeze
-
- // }}}
- // {{{ unfreeze()
-
- /**
- * Unfreezes the element so that it becomes editable
- *
- * @access public
- * @return void
- * @since 3.2.4
- */
- function unfreeze()
- {
- $this->_flagFrozen = false;
- }
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $value = $this->getValue();
- return (strlen($value)? htmlspecialchars($value): ' ') .
- $this->_getPersistantData();
- } //end func getFrozenHtml
-
- // }}}
- // {{{ _getPersistantData()
-
- /**
- * Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on
- *
- * @access private
- * @return string
- */
- function _getPersistantData()
- {
- if (!$this->_persistantFreeze) {
- return '';
- } else {
- $id = $this->getAttribute('id');
- return '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $this->getName(),
- 'value' => $this->getValue()
- ) + (isset($id)? array('id' => $id): array())) . ' />';
- }
- }
-
- // }}}
- // {{{ isFrozen()
-
- /**
- * Returns whether or not the element is frozen
- *
- * @since 1.3
- * @access public
- * @return bool
- */
- function isFrozen()
- {
- return $this->_flagFrozen;
- } // end func isFrozen
-
- // }}}
- // {{{ setPersistantFreeze()
-
- /**
- * Sets wether an element value should be kept in an hidden field
- * when the element is frozen or not
- *
- * @param bool $persistant True if persistant value
- * @since 2.0
- * @access public
- * @return void
- */
- function setPersistantFreeze($persistant=false)
- {
- $this->_persistantFreeze = $persistant;
- } //end func setPersistantFreeze
-
- // }}}
- // {{{ setLabel()
-
- /**
- * Sets display text for the element
- *
- * @param string $label Display text for the element
- * @since 1.3
- * @access public
- * @return void
- */
- function setLabel($label)
- {
- $this->_label = $label;
- } //end func setLabel
-
- // }}}
- // {{{ getLabel()
-
- /**
- * Returns display text for the element
- *
- * @since 1.3
- * @access public
- * @return string
- */
- function getLabel()
- {
- return $this->_label;
- } //end func getLabel
-
- // }}}
- // {{{ _findValue()
-
- /**
- * Tries to find the element value from the values array
- *
- * @since 2.7
- * @access private
- * @return mixed
- */
- function _findValue(&$values)
- {
- if (empty($values)) {
- return null;
- }
- $elementName = $this->getName();
- if (isset($values[$elementName])) {
- return $values[$elementName];
- } elseif (strpos($elementName, '[')) {
-
- $keys = str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $elementName
- );
- $arrayKeys = explode("']['", $keys);
- return HTML_QuickForm_utils::recursiveValue($values, $arrayKeys);
-
- } else {
- return null;
- }
- } //end func _findValue
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'createElement':
- $className = get_class($this);
- $this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
- break;
- case 'addElement':
- $this->onQuickFormEvent('createElement', $arg, $caller);
- $this->onQuickFormEvent('updateValue', null, $caller);
- break;
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- break;
- case 'setGroupValue':
- $this->setValue($arg);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool Whether an element is required
- * @param string An error message associated with an element
- * @access public
- * @return void
- */
- function accept(&$renderer, $required=false, $error=null)
- {
- $renderer->renderElement($this, $required, $error);
- } // end func accept
-
- // }}}
- // {{{ _generateId()
-
- /**
- * Automatically generates and assigns an 'id' attribute for the element.
- *
- * Currently used to ensure that labels work on radio buttons and
- * checkboxes. Per idea of Alexander Radivanovich.
- *
- * @access private
- * @return void
- */
- function _generateId()
- {
- static $idx = 1;
-
- if (!$this->getAttribute('id')) {
- $this->updateAttributes(array('id' => 'qf_' . substr(md5(microtime() . $idx++), 0, 6)));
- }
- } // end func _generateId
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Returns a 'safe' element's value
- *
- * @param array array of submitted values to search
- * @param bool whether to return the value as associative array
- * @access public
- * @return mixed
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getValue();
- }
- return $this->_prepareValue($value, $assoc);
- }
-
- // }}}
- // {{{ _prepareValue()
-
- /**
- * Used by exportValue() to prepare the value for returning
- *
- * @param mixed the value found in exportValue()
- * @param bool whether to return the value as associative array
- * @access private
- * @return mixed
- */
- function _prepareValue($value, $assoc)
- {
- if (null === $value) {
- return null;
- } elseif (!$assoc) {
- return $value;
- } else {
- $name = $this->getName();
- if (!strpos($name, '[')) {
- return array($name => $value);
- } else {
-
- $keys = str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $name
- );
- $keysArray = explode("']['", $keys);
- return HTML_QuickForm_utils::recursiveBuild($keysArray, $value);
- }
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_element
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a file upload field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-// register file-related rules
-if (class_exists('HTML_QuickForm')) {
- HTML_QuickForm::registerRule('uploadedfile', 'callback', '_ruleIsUploadedFile', 'HTML_QuickForm_file');
- HTML_QuickForm::registerRule('maxfilesize', 'callback', '_ruleCheckMaxFileSize', 'HTML_QuickForm_file');
- HTML_QuickForm::registerRule('mimetype', 'callback', '_ruleCheckMimeType', 'HTML_QuickForm_file');
- HTML_QuickForm::registerRule('filename', 'callback', '_ruleCheckFileName', 'HTML_QuickForm_file');
-}
-
-/**
- * HTML class for a file upload field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_file extends HTML_QuickForm_input
-{
- // {{{ properties
-
- /**
- * Uploaded file data, from $_FILES
- * @var array
- */
- var $_value = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param string Input field label
- * @param mixed (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- */
- function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->setType('file');
- } //end constructor
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets size of file element
- *
- * @param int Size of file element
- * @since 1.0
- * @access public
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size' => $size));
- } //end func setSize
-
- // }}}
- // {{{ getSize()
-
- /**
- * Returns size of file element
- *
- * @since 1.0
- * @access public
- * @return int
- */
- function getSize()
- {
- return $this->getAttribute('size');
- } //end func getSize
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return bool
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets value for file element.
- *
- * Actually this does nothing. The function is defined here to override
- * HTML_Quickform_input's behaviour of setting the 'value' attribute. As
- * no sane user-agent uses <input type="file">'s value for anything
- * (because of security implications) we implement file's value as a
- * read-only property with a special meaning.
- *
- * @param mixed Value for file element
- * @since 3.0
- * @access public
- */
- function setValue($value)
- {
- return null;
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns information about the uploaded file
- *
- * @since 3.0
- * @access public
- * @return array
- */
- function getValue()
- {
- return $this->_value;
- } // end func getValue
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string Name of event
- * @param mixed event arguments
- * @param object calling object
- * @since 1.0
- * @access public
- * @return bool
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- if ($caller->getAttribute('method') == 'get') {
- return PEAR::raiseError('Cannot add a file upload field to a GET method form');
- }
- $this->_value = $this->_findValue();
- $caller->updateAttributes(array('enctype' => 'multipart/form-data'));
- $caller->setMaxFileSize();
- break;
- case 'addElement':
- $this->onQuickFormEvent('createElement', $arg, $caller);
- return $this->onQuickFormEvent('updateValue', null, $caller);
- break;
- case 'createElement':
- $className = get_class($this);
- $this->$className($arg[0], $arg[1], $arg[2]);
- break;
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ moveUploadedFile()
-
- /**
- * Moves an uploaded file into the destination
- *
- * @param string Destination directory path
- * @param string New file name
- * @access public
- * @return bool Whether the file was moved successfully
- */
- function moveUploadedFile($dest, $fileName = '')
- {
- if ($dest != '' && substr($dest, -1) != '/') {
- $dest .= '/';
- }
- $fileName = ($fileName != '') ? $fileName : basename($this->_value['name']);
- return move_uploaded_file($this->_value['tmp_name'], $dest . $fileName);
- } // end func moveUploadedFile
-
- // }}}
- // {{{ isUploadedFile()
-
- /**
- * Checks if the element contains an uploaded file
- *
- * @access public
- * @return bool true if file has been uploaded, false otherwise
- */
- function isUploadedFile()
- {
- return $this->_ruleIsUploadedFile($this->_value);
- } // end func isUploadedFile
-
- // }}}
- // {{{ _ruleIsUploadedFile()
-
- /**
- * Checks if the given element contains an uploaded file
- *
- * @param array Uploaded file info (from $_FILES)
- * @access private
- * @return bool true if file has been uploaded, false otherwise
- */
- function _ruleIsUploadedFile($elementValue)
- {
- if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
- (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
- return is_uploaded_file($elementValue['tmp_name']);
- } else {
- return false;
- }
- } // end func _ruleIsUploadedFile
-
- // }}}
- // {{{ _ruleCheckMaxFileSize()
-
- /**
- * Checks that the file does not exceed the max file size
- *
- * @param array Uploaded file info (from $_FILES)
- * @param int Max file size
- * @access private
- * @return bool true if filesize is lower than maxsize, false otherwise
- */
- function _ruleCheckMaxFileSize($elementValue, $maxSize)
- {
- if (!empty($elementValue['error']) &&
- (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
- return false;
- }
- if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
- return true;
- }
- return ($maxSize >= @filesize($elementValue['tmp_name']));
- } // end func _ruleCheckMaxFileSize
-
- // }}}
- // {{{ _ruleCheckMimeType()
-
- /**
- * Checks if the given element contains an uploaded file of the right mime type
- *
- * @param array Uploaded file info (from $_FILES)
- * @param mixed Mime Type (can be an array of allowed types)
- * @access private
- * @return bool true if mimetype is correct, false otherwise
- */
- function _ruleCheckMimeType($elementValue, $mimeType)
- {
- if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
- return true;
- }
- if (is_array($mimeType)) {
- return in_array($elementValue['type'], $mimeType);
- }
- return $elementValue['type'] == $mimeType;
- } // end func _ruleCheckMimeType
-
- // }}}
- // {{{ _ruleCheckFileName()
-
- /**
- * Checks if the given element contains an uploaded file of the filename regex
- *
- * @param array Uploaded file info (from $_FILES)
- * @param string Regular expression
- * @access private
- * @return bool true if name matches regex, false otherwise
- */
- function _ruleCheckFileName($elementValue, $regex)
- {
- if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
- return true;
- }
- return (bool)preg_match($regex, $elementValue['name']);
- } // end func _ruleCheckFileName
-
- // }}}
- // {{{ _findValue()
-
- /**
- * Tries to find the element value from the values array
- *
- * Needs to be redefined here as $_FILES is populated differently from
- * other arrays when element name is of the form foo[bar]
- *
- * @param bool $sc1 unused, for signature compatibility
- *
- * @access private
- * @return mixed
- */
- function _findValue(&$sc1 = null)
- {
- if (empty($_FILES)) {
- return null;
- }
- $elementName = $this->getName();
- if (isset($_FILES[$elementName])) {
- return $_FILES[$elementName];
- } elseif (false !== ($pos = strpos($elementName, '['))) {
- $base = str_replace(
- array('\\', '\''), array('\\\\', '\\\''),
- substr($elementName, 0, $pos)
- );
- $idx = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- substr($elementName, $pos + 1, -1)
- ) . "']";
- $props = array('name', 'type', 'size', 'tmp_name', 'error');
- $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" .
- " return null;\n" .
- "} else {\n" .
- " \$value = array();\n";
- foreach ($props as $prop) {
- $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n";
- }
- return eval($code . " return \$value;\n}\n");
- } else {
- return null;
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_file
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a form element group
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * HTML class for a form element group
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_group extends HTML_QuickForm_element
-{
- // {{{ properties
-
- /**
- * Name of the element
- * @var string
- * @since 1.0
- * @access private
- */
- var $_name = '';
-
- /**
- * Array of grouped elements
- * @var array
- * @since 1.0
- * @access private
- */
- var $_elements = array();
-
- /**
- * String to separate elements
- * @var mixed
- * @since 2.5
- * @access private
- */
- var $_separator = null;
-
- /**
- * Required elements in this group
- * @var array
- * @since 2.5
- * @access private
- */
- var $_required = array();
-
- /**
- * Whether to change elements' names to $groupName[$elementName] or leave them as is
- * @var bool
- * @since 3.0
- * @access private
- */
- var $_appendName = true;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Group name
- * @param array $elementLabel (optional)Group label
- * @param array $elements (optional)Group elements
- * @param mixed $separator (optional)Use a string for one separator,
- * use an array to alternate the separators.
- * @param bool $appendName (optional)whether to change elements' names to
- * the form $groupName[$elementName] or leave
- * them as is.
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel);
- $this->_type = 'group';
- if (isset($elements) && is_array($elements)) {
- $this->setElements($elements);
- }
- if (isset($separator)) {
- $this->_separator = $separator;
- }
- if (isset($appendName)) {
- $this->_appendName = $appendName;
- }
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the group name
- *
- * @param string $name Group name
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->_name = $name;
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the group name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->_name;
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets values for group's elements
- *
- * @param mixed Values for group's elements
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->_createElementsIfNotExist();
- foreach (array_keys($this->_elements) as $key) {
- if (!$this->_appendName) {
- $v = $this->_elements[$key]->_findValue($value);
- if (null !== $v) {
- $this->_elements[$key]->onQuickFormEvent('setGroupValue', $v, $this);
- }
-
- } else {
- $elementName = $this->_elements[$key]->getName();
- $index = strlen($elementName) ? $elementName : $key;
- if (is_array($value)) {
- if (isset($value[$index])) {
- $this->_elements[$key]->onQuickFormEvent('setGroupValue', $value[$index], $this);
- }
- } elseif (isset($value)) {
- $this->_elements[$key]->onQuickFormEvent('setGroupValue', $value, $this);
- }
- }
- }
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the group
- *
- * @since 1.0
- * @access public
- * @return mixed
- */
- function getValue()
- {
- $value = null;
- foreach (array_keys($this->_elements) as $key) {
- $element =& $this->_elements[$key];
- switch ($element->getType()) {
- case 'radio':
- $v = $element->getChecked()? $element->getValue(): null;
- break;
- case 'checkbox':
- $v = $element->getChecked()? true: null;
- break;
- default:
- $v = $element->getValue();
- }
- if (null !== $v) {
- $elementName = $element->getName();
- if (is_null($elementName)) {
- $value = $v;
- } else {
- if (!is_array($value)) {
- $value = is_null($value)? array(): array($value);
- }
- if ('' === $elementName) {
- $value[] = $v;
- } else {
- $value[$elementName] = $v;
- }
- }
- }
- }
- return $value;
- } // end func getValue
-
- // }}}
- // {{{ setElements()
-
- /**
- * Sets the grouped elements
- *
- * @param array $elements Array of elements
- * @since 1.1
- * @access public
- * @return void
- */
- function setElements($elements)
- {
- $this->_elements = array_values($elements);
- if ($this->_flagFrozen) {
- $this->freeze();
- }
- } // end func setElements
-
- // }}}
- // {{{ getElements()
-
- /**
- * Gets the grouped elements
- *
- * @since 2.4
- * @access public
- * @return array
- */
- function &getElements()
- {
- $this->_createElementsIfNotExist();
- return $this->_elements;
- } // end func getElements
-
- // }}}
- // {{{ getGroupType()
-
- /**
- * Gets the group type based on its elements
- * Will return 'mixed' if elements contained in the group
- * are of different types.
- *
- * @access public
- * @return string group elements type
- */
- function getGroupType()
- {
- $this->_createElementsIfNotExist();
- $prevType = '';
- foreach (array_keys($this->_elements) as $key) {
- $type = $this->_elements[$key]->getType();
- if ($type != $prevType && $prevType != '') {
- return 'mixed';
- }
- $prevType = $type;
- }
- return $type;
- } // end func getGroupType
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns Html for the group
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer = new HTML_QuickForm_Renderer_Default();
- $renderer->setElementTemplate('{element}');
- $this->accept($renderer);
- return $renderer->toHtml();
- } //end func toHtml
-
- // }}}
- // {{{ getElementName()
-
- /**
- * Returns the element name inside the group such as found in the html form
- *
- * @param mixed $index Element name or element index in the group
- * @since 3.0
- * @access public
- * @return mixed string with element name, false if not found
- */
- function getElementName($index)
- {
- $this->_createElementsIfNotExist();
- $elementName = false;
- if (is_int($index) && isset($this->_elements[$index])) {
- $elementName = $this->_elements[$index]->getName();
- if (isset($elementName) && $elementName == '') {
- $elementName = $index;
- }
- if ($this->_appendName) {
- if (is_null($elementName)) {
- $elementName = $this->getName();
- } else {
- $elementName = $this->getName().'['.$elementName.']';
- }
- }
-
- } elseif (is_string($index)) {
- foreach (array_keys($this->_elements) as $key) {
- $elementName = $this->_elements[$key]->getName();
- if ($index == $elementName) {
- if ($this->_appendName) {
- $elementName = $this->getName().'['.$elementName.']';
- }
- break;
- } elseif ($this->_appendName && $this->getName().'['.$elementName.']' == $index) {
- break;
- }
- }
- }
- return $elementName;
- } //end func getElementName
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.3
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $flags = array();
- $this->_createElementsIfNotExist();
- foreach (array_keys($this->_elements) as $key) {
- if (false === ($flags[$key] = $this->_elements[$key]->isFrozen())) {
- $this->_elements[$key]->freeze();
- }
- }
- $html = $this->toHtml();
- foreach (array_keys($this->_elements) as $key) {
- if (!$flags[$key]) {
- $this->_elements[$key]->unfreeze();
- }
- }
- return $html;
- } //end func getFrozenHtml
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- $this->_createElementsIfNotExist();
- foreach (array_keys($this->_elements) as $key) {
- if ($this->_appendName) {
- $elementName = $this->_elements[$key]->getName();
- if (is_null($elementName)) {
- $this->_elements[$key]->setName($this->getName());
- } elseif ('' === $elementName) {
- $this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
- } else {
- $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
- }
- }
- $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller);
- if ($this->_appendName) {
- $this->_elements[$key]->setName($elementName);
- }
- }
- break;
-
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool Whether a group is required
- * @param string An error message associated with a group
- * @access public
- * @return void
- */
- function accept(&$renderer, $required = false, $error = null)
- {
- $this->_createElementsIfNotExist();
- $renderer->startGroup($this, $required, $error);
- $name = $this->getName();
- foreach (array_keys($this->_elements) as $key) {
- $element =& $this->_elements[$key];
-
- if ($this->_appendName) {
- $elementName = $element->getName();
- if (isset($elementName)) {
- $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']');
- } else {
- $element->setName($name);
- }
- }
-
- $required = !$element->isFrozen() && in_array($element->getName(), $this->_required);
-
- $element->accept($renderer, $required);
-
- // restore the element's name
- if ($this->_appendName) {
- $element->setName($elementName);
- }
- }
- $renderer->finishGroup($this);
- } // end func accept
-
- // }}}
- // {{{ exportValue()
-
- /**
- * As usual, to get the group's value we access its elements and call
- * their exportValue() methods
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = null;
- foreach (array_keys($this->_elements) as $key) {
- $elementName = $this->_elements[$key]->getName();
- if ($this->_appendName) {
- if (is_null($elementName)) {
- $this->_elements[$key]->setName($this->getName());
- } elseif ('' === $elementName) {
- $this->_elements[$key]->setName($this->getName() . '[' . $key . ']');
- } else {
- $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']');
- }
- }
- $v = $this->_elements[$key]->exportValue($submitValues, $assoc);
- if ($this->_appendName) {
- $this->_elements[$key]->setName($elementName);
- }
- if (null !== $v) {
- // Make $value an array, we will use it like one
- if (null === $value) {
- $value = array();
- }
- if ($assoc) {
- // just like HTML_QuickForm::exportValues()
- $value = HTML_QuickForm::arrayMerge($value, $v);
- } else {
- // just like getValue(), but should work OK every time here
- if (is_null($elementName)) {
- $value = $v;
- } elseif ('' === $elementName) {
- $value[] = $v;
- } else {
- $value[$elementName] = $v;
- }
- }
- }
- }
- // do not pass the value through _prepareValue, we took care of this already
- return $value;
- }
-
- // }}}
- // {{{ _createElements()
-
- /**
- * Creates the group's elements.
- *
- * This should be overriden by child classes that need to create their
- * elements. The method will be called automatically when needed, calling
- * it from the constructor is discouraged as the constructor is usually
- * called _twice_ on element creation, first time with _no_ parameters.
- *
- * @access private
- * @abstract
- */
- function _createElements()
- {
- // abstract
- }
-
- // }}}
- // {{{ _createElementsIfNotExist()
-
- /**
- * A wrapper around _createElements()
- *
- * This method calls _createElements() if the group's _elements array
- * is empty. It also performs some updates, e.g. freezes the created
- * elements if the group is already frozen.
- *
- * @access private
- */
- function _createElementsIfNotExist()
- {
- if (empty($this->_elements)) {
- $this->_createElements();
- if ($this->_flagFrozen) {
- $this->freeze();
- }
- }
- }
-
- // }}}
- // {{{ freeze()
-
- function freeze()
- {
- parent::freeze();
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->freeze();
- }
- }
-
- // }}}
- // {{{ unfreeze()
-
- function unfreeze()
- {
- parent::unfreeze();
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->unfreeze();
- }
- }
-
- // }}}
- // {{{ setPersistantFreeze()
-
- function setPersistantFreeze($persistant = false)
- {
- parent::setPersistantFreeze($persistant);
- foreach (array_keys($this->_elements) as $key) {
- $this->_elements[$key]->setPersistantFreeze($persistant);
- }
- }
-
- // }}}
-} //end class HTML_QuickForm_group
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A pseudo-element used for adding headers to form
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for static data
- */
-require_once 'HTML/QuickForm/static.php';
-
-/**
- * A pseudo-element used for adding headers to form
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.0
- */
-class HTML_QuickForm_header extends HTML_QuickForm_static
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName Header name
- * @param string $text Header text
- * @access public
- * @return void
- */
- function HTML_QuickForm_header($elementName = null, $text = null)
- {
- $this->HTML_QuickForm_static($elementName, null, $text);
- $this->_type = 'header';
- }
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool $sc1 unused, for signature compatibility
- * @param bool $sc2 unused, for signature compatibility
- * @access public
- * @return void
- */
- function accept(&$renderer, $sc1 = false, $sc2 = null)
- {
- $renderer->renderHeader($this);
- } // end func accept
-
- // }}}
-
-} //end class HTML_QuickForm_header
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a hidden type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a hidden type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_hidden extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $value (optional)Input field value
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setType('hidden');
- $this->setValue($value);
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool $sc1 unused, for signature compatibility
- * @param bool $sc2 unused, for signature compatibility
- * @access public
- * @return void
- */
- function accept(&$renderer, $sc1 = false, $sc2 = null)
- {
- $renderer->renderHidden($this);
- } // end func accept
-
- // }}}
-
-} //end class HTML_QuickForm_hidden
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Hidden select pseudo-element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Isaac Shepard <ishepard@bsiweb.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-
-/**
- * Hidden select pseudo-element
- *
- * This class takes the same arguments as a select element, but instead
- * of creating a select ring it creates hidden elements for all values
- * already selected with setDefault or setConstant. This is useful if
- * you have a select ring that you don't want visible, but you need all
- * selected values to be passed.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Isaac Shepard <ishepard@bsiweb.com>
- * @version Release: 3.2.16
- * @since 2.1
- */
-class HTML_QuickForm_hiddenselect extends HTML_QuickForm_select
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Select name attribute
- * @param mixed Label(s) for the select (not used)
- * @param mixed Data to be used to populate options
- * @param mixed Either a typical HTML attribute string or an associative array (not used)
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'hiddenselect';
- if (isset($options)) {
- $this->load($options);
- }
- } //end constructor
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the SELECT in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function toHtml()
- {
- if (empty($this->_values)) {
- return '';
- }
-
- $tabs = $this->_getTabs();
- $name = $this->getPrivateName();
- $strHtml = '';
-
- foreach ($this->_values as $key => $val) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if ($val == $this->_options[$i]['attr']['value']) {
- $strHtml .= $tabs . '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $name,
- 'value' => $val
- )) . " />\n" ;
- }
- }
- }
-
- return $strHtml;
- } //end func toHtml
-
- // }}}
- // {{{ accept()
-
- /**
- * This is essentially a hidden element and should be rendered as one
- *
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool $sc1 unused, for signature compatibility
- * @param bool $sc2 unused, for signature compatibility
- */
- function accept(&$renderer, $sc1 = false, $sc2 = null)
- {
- $renderer->renderHidden($this);
- }
-
- // }}}
-} //end class HTML_QuickForm_hiddenselect
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Hierarchical select element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Class for a group of form elements
- */
-require_once 'HTML/QuickForm/group.php';
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-/**
- * Static utility methods
- */
-require_once 'HTML/QuickForm/utils.php';
-
-/**
- * Hierarchical select element
- *
- * Class to dynamically create two or more HTML Select elements
- * The first select changes the content of the second select and so on.
- * This element is considered as a group. Selects will be named
- * groupName[0], groupName[1], groupName[2]...
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.1
- */
-class HTML_QuickForm_hierselect extends HTML_QuickForm_group
-{
- // {{{ properties
-
- /**
- * Options for all the select elements
- *
- * @see setOptions()
- * @var array
- * @access private
- */
- var $_options = array();
-
- /**
- * Number of select elements on this group
- *
- * @var int
- * @access private
- */
- var $_nbElements = 0;
-
- /**
- * The javascript used to set and change the options
- *
- * @var string
- * @access private
- */
- var $_js = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label in form
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array. Date format is passed along the attributes.
- * @param mixed $separator (optional)Use a string for one separator,
- * use an array to alternate the separators.
- * @access public
- * @return void
- */
- function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- if (isset($separator)) {
- $this->_separator = $separator;
- }
- $this->_type = 'hierselect';
- $this->_appendName = true;
- } //end constructor
-
- // }}}
- // {{{ setOptions()
-
- /**
- * Initialize the array structure containing the options for each select element.
- * Call the functions that actually do the magic.
- *
- * Format is a bit more complex than for a simple select as we need to know
- * which options are related to the ones in the previous select:
- *
- * Ex:
- * <code>
- * // first select
- * $select1[0] = 'Pop';
- * $select1[1] = 'Classical';
- * $select1[2] = 'Funeral doom';
- *
- * // second select
- * $select2[0][0] = 'Red Hot Chil Peppers';
- * $select2[0][1] = 'The Pixies';
- * $select2[1][0] = 'Wagner';
- * $select2[1][1] = 'Strauss';
- * $select2[2][0] = 'Pantheist';
- * $select2[2][1] = 'Skepticism';
- *
- * // If only need two selects
- * // - and using the deprecated functions
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setMainOptions($select1);
- * $sel->setSecOptions($select2);
- *
- * // - and using the new setOptions function
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setOptions(array($select1, $select2));
- *
- * // If you have a third select with prices for the cds
- * $select3[0][0][0] = '15.00$';
- * $select3[0][0][1] = '17.00$';
- * // etc
- *
- * // You can now use
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setOptions(array($select1, $select2, $select3));
- * </code>
- *
- * @param array $options Array of options defining each element
- * @access public
- * @return void
- */
- function setOptions($options)
- {
- $this->_options = $options;
-
- if (empty($this->_elements)) {
- $this->_nbElements = count($this->_options);
- $this->_createElements();
- } else {
- // setDefaults has probably been called before this function
- // check if all elements have been created
- $totalNbElements = count($this->_options);
- for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
- $this->_nbElements++;
- }
- }
-
- $this->_setOptions();
- } // end func setMainOptions
-
- // }}}
- // {{{ setMainOptions()
-
- /**
- * Sets the options for the first select element. Deprecated. setOptions() should be used.
- *
- * @param array $array Options for the first select element
- *
- * @access public
- * @deprecated Deprecated since release 3.2.2
- * @return void
- */
- function setMainOptions($array)
- {
- $this->_options[0] = $array;
-
- if (empty($this->_elements)) {
- $this->_nbElements = 2;
- $this->_createElements();
- }
- } // end func setMainOptions
-
- // }}}
- // {{{ setSecOptions()
-
- /**
- * Sets the options for the second select element. Deprecated. setOptions() should be used.
- * The main _options array is initialized and the _setOptions function is called.
- *
- * @param array $array Options for the second select element
- *
- * @access public
- * @deprecated Deprecated since release 3.2.2
- * @return void
- */
- function setSecOptions($array)
- {
- $this->_options[1] = $array;
-
- if (empty($this->_elements)) {
- $this->_nbElements = 2;
- $this->_createElements();
- } else {
- // setDefaults has probably been called before this function
- // check if all elements have been created
- $totalNbElements = 2;
- for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
- $this->_nbElements++;
- }
- }
-
- $this->_setOptions();
- } // end func setSecOptions
-
- // }}}
- // {{{ _setOptions()
-
- /**
- * Sets the options for each select element
- *
- * @access private
- * @return void
- */
- function _setOptions()
- {
- $arrayKeys = array();
- foreach (array_keys($this->_elements) AS $key) {
- if (isset($this->_options[$key])) {
- if ((empty($arrayKeys)) || HTML_QuickForm_utils::recursiveIsset($this->_options[$key], $arrayKeys)) {
- $array = empty($arrayKeys) ? $this->_options[$key] : HTML_QuickForm_utils::recursiveValue($this->_options[$key], $arrayKeys);
- if (is_array($array)) {
- $select =& $this->_elements[$key];
- $select->_options = array();
- $select->loadArray($array);
-
- $value = is_array($v = $select->getValue()) ? $v[0] : key($array);
- $arrayKeys[] = $value;
- }
- }
- }
- }
- } // end func _setOptions
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets values for group's elements
- *
- * @param array $value An array of 2 or more values, for the first,
- * the second, the third etc. select
- *
- * @access public
- * @return void
- */
- function setValue($value)
- {
- // fix for bug #6766. Hope this doesn't break anything more
- // after bug #7961. Forgot that _nbElements was used in
- // _createElements() called in several places...
- $this->_nbElements = max($this->_nbElements, count($value));
- parent::setValue($value);
- $this->_setOptions();
- } // end func setValue
-
- // }}}
- // {{{ _createElements()
-
- /**
- * Creates all the elements for the group
- *
- * @access private
- * @return void
- */
- function _createElements()
- {
- for ($i = 0; $i < $this->_nbElements; $i++) {
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
- }
- } // end func _createElements
-
- // }}}
- // {{{ toHtml()
-
- function toHtml()
- {
- $this->_js = '';
- if (!$this->_flagFrozen) {
- // set the onchange attribute for each element except last
- $keys = array_keys($this->_elements);
- $onChange = array();
- for ($i = 0; $i < count($keys) - 1; $i++) {
- $select =& $this->_elements[$keys[$i]];
- $onChange[$i] = $select->getAttribute('onchange');
- $select->updateAttributes(
- array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i])
- );
- }
-
- // create the js function to call
- if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
- $this->_js .= <<<JAVASCRIPT
-function _hs_findOptions(ary, keys)
-{
- if (ary == undefined) {
- return {};
- }
- var key = keys.shift();
- if (!key in ary) {
- return {};
- } else if (0 == keys.length) {
- return ary[key];
- } else {
- return _hs_findOptions(ary[key], keys);
- }
-}
-
-function _hs_findSelect(form, groupName, selectIndex)
-{
- if (groupName+'['+ selectIndex +']' in form) {
- return form[groupName+'['+ selectIndex +']'];
- } else {
- return form[groupName+'['+ selectIndex +'][]'];
- }
-}
-
-function _hs_unescapeEntities(str)
-{
- var div = document.createElement('div');
- div.innerHTML = str;
- return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
-}
-
-function _hs_replaceOptions(ctl, options)
-{
- var j = 0;
- ctl.options.length = 0;
- for (var i = 0; i < options.values.length; i++) {
- ctl.options[i] = new Option(
- (-1 == String(options.texts[i]).indexOf('&'))? options.texts[i]: _hs_unescapeEntities(options.texts[i]),
- options.values[i], false, false
- );
- }
-}
-
-function _hs_setValue(ctl, value)
-{
- var testValue = {};
- if (value instanceof Array) {
- for (var i = 0; i < value.length; i++) {
- testValue[value[i]] = true;
- }
- } else {
- testValue[value] = true;
- }
- for (var i = 0; i < ctl.options.length; i++) {
- if (ctl.options[i].value in testValue) {
- ctl.options[i].selected = true;
- }
- }
-}
-
-function _hs_swapOptions(form, groupName, selectIndex)
-{
- var hsValue = [];
- for (var i = 0; i <= selectIndex; i++) {
- hsValue[i] = _hs_findSelect(form, groupName, i).value;
- }
-
- _hs_replaceOptions(_hs_findSelect(form, groupName, selectIndex + 1),
- _hs_findOptions(_hs_options[groupName][selectIndex], hsValue));
- if (selectIndex + 1 < _hs_options[groupName].length) {
- _hs_swapOptions(form, groupName, selectIndex + 1);
- }
-}
-
-function _hs_onReset(form, groupNames)
-{
- for (var i = 0; i < groupNames.length; i++) {
- try {
- for (var j = 0; j <= _hs_options[groupNames[i]].length; j++) {
- _hs_setValue(_hs_findSelect(form, groupNames[i], j), _hs_defaults[groupNames[i]][j]);
- if (j < _hs_options[groupNames[i]].length) {
- _hs_replaceOptions(_hs_findSelect(form, groupNames[i], j + 1),
- _hs_findOptions(_hs_options[groupNames[i]][j], _hs_defaults[groupNames[i]].slice(0, j + 1)));
- }
- }
- } catch (e) {
- if (!(e instanceof TypeError)) {
- throw e;
- }
- }
- }
-}
-
-function _hs_setupOnReset(form, groupNames)
-{
- setTimeout(function() { _hs_onReset(form, groupNames); }, 25);
-}
-
-function _hs_onReload()
-{
- var ctl;
- for (var i = 0; i < document.forms.length; i++) {
- for (var j in _hs_defaults) {
- if (ctl = _hs_findSelect(document.forms[i], j, 0)) {
- for (var k = 0; k < _hs_defaults[j].length; k++) {
- _hs_setValue(_hs_findSelect(document.forms[i], j, k), _hs_defaults[j][k]);
- }
- }
- }
- }
-
- if (_hs_prevOnload) {
- _hs_prevOnload();
- }
-}
-
-var _hs_prevOnload = null;
-if (window.onload) {
- _hs_prevOnload = window.onload;
-}
-window.onload = _hs_onReload;
-
-var _hs_options = {};
-var _hs_defaults = {};
-
-JAVASCRIPT;
- define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
- }
- // option lists
- $jsParts = array();
- for ($i = 1; $i < $this->_nbElements; $i++) {
- $jsParts[] = $this->_convertArrayToJavascript($this->_prepareOptions($this->_options[$i], $i));
- }
- $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" .
- implode(",\n", $jsParts) .
- "\n];\n";
- // default value; if we don't actually have any values yet just use
- // the first option (for single selects) or empty array (for multiple)
- $values = array();
- foreach (array_keys($this->_elements) as $key) {
- if (is_array($v = $this->_elements[$key]->getValue())) {
- $values[] = count($v) > 1? $v: $v[0];
- } else {
- // XXX: accessing the supposedly private _options array
- $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])?
- array():
- $this->_elements[$key]->_options[0]['attr']['value'];
- }
- }
- $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " .
- $this->_convertArrayToJavascript($values) . ";\n";
- }
- include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer =& new HTML_QuickForm_Renderer_Default();
- $renderer->setElementTemplate('{element}');
- parent::accept($renderer);
-
- if (!empty($onChange)) {
- $keys = array_keys($this->_elements);
- for ($i = 0; $i < count($keys) - 1; $i++) {
- $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i]));
- }
- }
- return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") .
- $renderer->toHtml();
- } // end func toHtml
-
- // }}}
- // {{{ accept()
-
- function accept(&$renderer, $required = false, $error = null)
- {
- $renderer->renderElement($this, $required, $error);
- } // end func accept
-
- // }}}
- // {{{ onQuickFormEvent()
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' == $event) {
- // we need to call setValue() so that the secondary option
- // matches the main option
- return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
- } else {
- $ret = parent::onQuickFormEvent($event, $arg, $caller);
- // add onreset handler to form to properly reset hierselect (see bug #2970)
- if ('addElement' == $event) {
- $onReset = $caller->getAttribute('onreset');
- if (strlen($onReset)) {
- if (strpos($onReset, '_hs_setupOnReset')) {
- $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset)));
- } else {
- $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
- }
- } else {
- $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
- }
- }
- return $ret;
- }
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ _prepareOptions()
-
- /**
- * Prepares options for JS encoding
- *
- * We need to preserve order of options when adding them via javascript, so
- * cannot use object literal and for/in loop (see bug #16603). Therefore we
- * convert an associative array of options to two arrays of their values
- * and texts. Backport from HTML_QuickForm2.
- *
- * @param array Options array
- * @param int Depth within options array
- * @link http://pear.php.net/bugs/bug.php?id=16603
- * @return array
- * @access private
- */
- function _prepareOptions($ary, $depth)
- {
- if (!is_array($ary)) {
- $ret = $ary;
- } elseif (0 == $depth) {
- $ret = array('values' => array_keys($ary), 'texts' => array_values($ary));
- } else {
- $ret = array();
- foreach ($ary as $k => $v) {
- $ret[$k] = $this->_prepareOptions($v, $depth - 1);
- }
- }
- return $ret;
- }
-
- // }}}
- // {{{ _convertArrayToJavascript()
-
- /**
- * Converts PHP array to its Javascript analog
- *
- * @access private
- * @param array PHP array to convert
- * @return string Javascript representation of the value
- */
- function _convertArrayToJavascript($array)
- {
- if (!is_array($array)) {
- return $this->_convertScalarToJavascript($array);
- } elseif (count($array) && array_keys($array) != range(0, count($array) - 1)) {
- return '{' . implode(',', array_map(
- array($this, '_encodeNameValue'),
- array_keys($array), array_values($array)
- )) . '}';
- } else {
- return '[' . implode(',', array_map(
- array($this, '_convertArrayToJavascript'),
- $array
- )) . ']';
- }
- }
-
- // }}}
- // {{{ _encodeNameValue()
-
- /**
- * Callback for array_map used to generate JS name-value pairs
- *
- * @param mixed
- * @param mixed
- * @return string
- */
- function _encodeNameValue($name, $value)
- {
- return $this->_convertScalarToJavascript((string)$name) . ':'
- . $this->_convertArrayToJavascript($value);
- }
-
- // }}}
- // {{{ _convertScalarToJavascript()
-
- /**
- * Converts PHP's scalar value to its Javascript analog
- *
- * @access private
- * @param mixed PHP value to convert
- * @return string Javascript representation of the value
- */
- function _convertScalarToJavascript($val)
- {
- if (is_bool($val)) {
- return $val ? 'true' : 'false';
- } elseif (is_int($val) || is_double($val)) {
- return $val;
- } elseif (is_string($val)) {
- return "'" . $this->_escapeString($val) . "'";
- } elseif (is_null($val)) {
- return 'null';
- } else {
- // don't bother
- return '{}';
- }
- }
-
- // }}}
- // {{{ _escapeString()
-
- /**
- * Quotes the string so that it can be used in Javascript string constants
- *
- * @access private
- * @param string
- * @return string
- */
- function _escapeString($str)
- {
- return strtr($str,array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- ));
- }
-
- // }}}
-} // end class HTML_QuickForm_hierselect
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * A pseudo-element used for adding raw HTML to form
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for static data
- */
-require_once 'HTML/QuickForm/static.php';
-
-/**
- * A pseudo-element used for adding raw HTML to form
- *
- * Intended for use with the default renderer only, template-based
- * ones may (and probably will) completely ignore this
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.0
- * @deprecated Please use the templates rather than add raw HTML via this element
- */
-class HTML_QuickForm_html extends HTML_QuickForm_static
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $text raw HTML to add
- * @access public
- * @return void
- */
- function HTML_QuickForm_html($text = null)
- {
- $this->HTML_QuickForm_static(null, null, $text);
- $this->_type = 'html';
- }
-
- // }}}
- // {{{ accept()
-
- /**
- * Accepts a renderer
- *
- * @param HTML_QuickForm_Renderer renderer object (only works with Default renderer!)
- * @param bool $sc1 unused, for signature compatibility
- * @param bool $sc2 unused, for signature compatibility
- * @access public
- * @return void
- */
- function accept(&$renderer, $sc1 = false, $sc2 = null)
- {
- $renderer->renderHtml($this);
- } // end func accept
-
- // }}}
-
-} //end class HTML_QuickForm_html
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for an <input type="image" /> element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for an <input type="image" /> element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_image extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Element name attribute
- * @param string $src (optional)Image source
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_image($elementName=null, $src='', $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setType('image');
- $this->setSource($src);
- } // end class constructor
-
- // }}}
- // {{{ setSource()
-
- /**
- * Sets source for image element
- *
- * @param string $src source for image element
- * @since 1.0
- * @access public
- * @return void
- */
- function setSource($src)
- {
- $this->updateAttributes(array('src' => $src));
- } // end func setSource
-
- // }}}
- // {{{ setBorder()
-
- /**
- * Sets border size for image element
- *
- * @param string $border border for image element
- * @since 1.0
- * @access public
- * @return void
- */
- function setBorder($border)
- {
- $this->updateAttributes(array('border' => $border));
- } // end func setBorder
-
- // }}}
- // {{{ setAlign()
-
- /**
- * Sets alignment for image element
- *
- * @param string $align alignment for image element
- * @since 1.0
- * @access public
- * @return void
- */
- function setAlign($align)
- {
- $this->updateAttributes(array('align' => $align));
- } // end func setAlign
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
-
-} // end class HTML_QuickForm_image
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Base class for <input /> form elements
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * Base class for <input /> form elements
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- * @abstract
- */
-class HTML_QuickForm_input extends HTML_QuickForm_element
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param mixed Label(s) for the input field
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- } //end constructor
-
- // }}}
- // {{{ setType()
-
- /**
- * Sets the element type
- *
- * @param string $type Element type
- * @since 1.0
- * @access public
- * @return void
- */
- function setType($type)
- {
- $this->_type = $type;
- $this->updateAttributes(array('type'=>$type));
- } // end func setType
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param string $value Default value of the form element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->updateAttributes(array('value'=>$value));
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getValue()
- {
- return $this->getAttribute('value');
- } // end func getValue
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the input field in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return $this->getFrozenHtml();
- } else {
- return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />';
- }
- } //end func toHtml
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- // do not use submit values for button-type elements
- $type = $this->getType();
- if (('updateValue' != $event) ||
- ('submit' != $type && 'reset' != $type && 'image' != $type && 'button' != $type)) {
- parent::onQuickFormEvent($event, $arg, $caller);
- } else {
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ exportValue()
-
- /**
- * We don't need values from button-type elements (except submit) and files
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $type = $this->getType();
- if ('reset' == $type || 'image' == $type || 'button' == $type || 'file' == $type) {
- return null;
- } else {
- return parent::exportValue($submitValues, $assoc);
- }
- }
-
- // }}}
-} // end class HTML_QuickForm_element
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a link type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * HTML class for static data
- */
-require_once 'HTML/QuickForm/static.php';
-
-/**
- * HTML class for a link type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 2.0
- */
-class HTML_QuickForm_link extends HTML_QuickForm_static
-{
- // {{{ properties
-
- /**
- * Link display text
- * @var string
- * @since 1.0
- * @access private
- */
- var $_text = "";
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementLabel (optional)Link label
- * @param string $href (optional)Link href
- * @param string $text (optional)Link display text
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = false;
- $this->_type = 'link';
- $this->setHref($href);
- $this->_text = $text;
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets value for textarea element
- *
- * @param string $value Value for password element
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function setValue($value)
- {
- return;
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function getValue()
- {
- return;
- } // end func getValue
-
-
- // }}}
- // {{{ setHref()
-
- /**
- * Sets the links href
- *
- * @param string $href
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function setHref($href)
- {
- $this->updateAttributes(array('href'=>$href));
- } // end func setHref
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the textarea element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function toHtml()
- {
- $tabs = $this->_getTabs();
- $html = "$tabs<a".$this->_getAttrString($this->_attributes).">";
- $html .= $this->_text;
- $html .= "</a>";
- return $html;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags (in this case, value is changed to a mask)
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function getFrozenHtml()
- {
- return;
- } //end func getFrozenHtml
-
- // }}}
-
-} //end class HTML_QuickForm_textarea
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a password type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a password type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_password extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->setType('password');
- } //end constructor
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets size of password element
- *
- * @param string $size Size of password field
- * @since 1.0
- * @access public
- * @return void
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size'=>$size));
- } //end func setSize
-
- // }}}
- // {{{ setMaxlength()
-
- /**
- * Sets maxlength of password element
- *
- * @param string $maxlength Maximum length of password field
- * @since 1.0
- * @access public
- * @return void
- */
- function setMaxlength($maxlength)
- {
- $this->updateAttributes(array('maxlength'=>$maxlength));
- } //end func setMaxlength
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags (in this case, value is changed to a mask)
- *
- * @since 1.0
- * @access public
- * @return string
- * @throws
- */
- function getFrozenHtml()
- {
- $value = $this->getValue();
- return ('' != $value? '**********': ' ') .
- $this->_getPersistantData();
- } //end func getFrozenHtml
-
- // }}}
-
-} //end class HTML_QuickForm_password
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a radio type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a radio type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_radio extends HTML_QuickForm_input
-{
- // {{{ properties
-
- /**
- * Radio display text
- * @var string
- * @since 1.1
- * @access private
- */
- var $_text = '';
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param mixed Label(s) for a field
- * @param string Text to display near the radio
- * @param string Input field value
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null)
- {
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- if (isset($value)) {
- $this->setValue($value);
- }
- $this->_persistantFreeze = true;
- $this->setType('radio');
- $this->_text = $text;
- $this->_generateId();
- } //end constructor
-
- // }}}
- // {{{ setChecked()
-
- /**
- * Sets whether radio button is checked
- *
- * @param bool $checked Whether the field is checked or not
- * @since 1.0
- * @access public
- * @return void
- */
- function setChecked($checked)
- {
- if (!$checked) {
- $this->removeAttribute('checked');
- } else {
- $this->updateAttributes(array('checked'=>'checked'));
- }
- } //end func setChecked
-
- // }}}
- // {{{ getChecked()
-
- /**
- * Returns whether radio button is checked
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getChecked()
- {
- return $this->getAttribute('checked');
- } //end func getChecked
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the radio element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if (0 == strlen($this->_text)) {
- $label = '';
- } elseif ($this->_flagFrozen) {
- $label = $this->_text;
- } else {
- $label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
- }
- return HTML_QuickForm_input::toHtml() . $label;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- if ($this->getChecked()) {
- return '<tt>(x)</tt>' .
- $this->_getPersistantData();
- } else {
- return '<tt>( )</tt>';
- }
- } //end func getFrozenHtml
-
- // }}}
- // {{{ setText()
-
- /**
- * Sets the radio text
- *
- * @param string $text Text to display near the radio button
- * @since 1.1
- * @access public
- * @return void
- */
- function setText($text)
- {
- $this->_text = $text;
- } //end func setText
-
- // }}}
- // {{{ getText()
-
- /**
- * Returns the radio text
- *
- * @since 1.1
- * @access public
- * @return string
- */
- function getText()
- {
- return $this->_text;
- } //end func getText
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // constant values override both default and submitted ones
- // default values are overriden by submitted
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (!is_null($value) && $value == $this->getValue()) {
- $this->setChecked(true);
- } else {
- $this->setChecked(false);
- }
- break;
- case 'setGroupValue':
- if ($arg == $this->getValue()) {
- $this->setChecked(true);
- } else {
- $this->setChecked(false);
- }
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormLoad
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Returns the value attribute if the radio is checked, null if it is not
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (null === $value) {
- $value = $this->getChecked()? $this->getValue(): null;
- } elseif ($value != $this->getValue()) {
- $value = null;
- }
- return $this->_prepareValue($value, $assoc);
- }
-
- // }}}
-} //end class HTML_QuickForm_radio
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a reset type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a reset type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_reset extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $value (optional)Input field value
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setValue($value);
- $this->setType('reset');
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
-
-} //end class HTML_QuickForm_reset
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class to dynamically create an HTML SELECT
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * Class to dynamically create an HTML SELECT
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_select extends HTML_QuickForm_element {
-
- // {{{ properties
-
- /**
- * Contains the select options
- *
- * @var array
- * @since 1.0
- * @access private
- */
- var $_options = array();
-
- /**
- * Default values of the SELECT
- *
- * @var string
- * @since 1.0
- * @access private
- */
- var $_values = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Select name attribute
- * @param mixed Label(s) for the select
- * @param mixed Data to be used to populate options
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'select';
- if (isset($options)) {
- $this->load($options);
- }
- } //end constructor
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Returns the current API version
- *
- * @since 1.0
- * @access public
- * @return double
- */
- function apiVersion()
- {
- return 2.3;
- } //end func apiVersion
-
- // }}}
- // {{{ setSelected()
-
- /**
- * Sets the default values of the select box
- *
- * @param mixed $values Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return void
- */
- function setSelected($values)
- {
- if (is_string($values) && $this->getMultiple()) {
- $values = preg_split("/[ ]?,[ ]?/", $values);
- }
- if (is_array($values)) {
- $this->_values = array_values($values);
- } else {
- $this->_values = array($values);
- }
- } //end func setSelected
-
- // }}}
- // {{{ getSelected()
-
- /**
- * Returns an array of the selected values
- *
- * @since 1.0
- * @access public
- * @return array of selected values
- */
- function getSelected()
- {
- return $this->_values;
- } // end func getSelected
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name' => $name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ getPrivateName()
-
- /**
- * Returns the element name (possibly with brackets appended)
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getPrivateName()
- {
- if ($this->getAttribute('multiple')) {
- return $this->getName() . '[]';
- } else {
- return $this->getName();
- }
- } //end func getPrivateName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the value of the form element
- *
- * @param mixed $values Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->setSelected($value);
- } // end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns an array of the selected values
- *
- * @since 1.0
- * @access public
- * @return array of selected values
- */
- function getValue()
- {
- return $this->_values;
- } // end func getValue
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets the select field size, only applies to 'multiple' selects
- *
- * @param int $size Size of select field
- * @since 1.0
- * @access public
- * @return void
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size' => $size));
- } //end func setSize
-
- // }}}
- // {{{ getSize()
-
- /**
- * Returns the select field size
- *
- * @since 1.0
- * @access public
- * @return int
- */
- function getSize()
- {
- return $this->getAttribute('size');
- } //end func getSize
-
- // }}}
- // {{{ setMultiple()
-
- /**
- * Sets the select mutiple attribute
- *
- * @param bool $multiple Whether the select supports multi-selections
- * @since 1.2
- * @access public
- * @return void
- */
- function setMultiple($multiple)
- {
- if ($multiple) {
- $this->updateAttributes(array('multiple' => 'multiple'));
- } else {
- $this->removeAttribute('multiple');
- }
- } //end func setMultiple
-
- // }}}
- // {{{ getMultiple()
-
- /**
- * Returns the select mutiple attribute
- *
- * @since 1.2
- * @access public
- * @return bool true if multiple select, false otherwise
- */
- function getMultiple()
- {
- return (bool)$this->getAttribute('multiple');
- } //end func getMultiple
-
- // }}}
- // {{{ addOption()
-
- /**
- * Adds a new OPTION to the SELECT
- *
- * @param string $text Display text for the OPTION
- * @param string $value Value for the OPTION
- * @param mixed $attributes Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function addOption($text, $value, $attributes=null)
- {
- if (null === $attributes) {
- $attributes = array('value' => (string)$value);
- } else {
- $attributes = $this->_parseAttributes($attributes);
- if (isset($attributes['selected'])) {
- // the 'selected' attribute will be set in toHtml()
- $this->_removeAttr('selected', $attributes);
- if (is_null($this->_values)) {
- $this->_values = array($value);
- } elseif (!in_array($value, $this->_values)) {
- $this->_values[] = $value;
- }
- }
- $this->_updateAttrArray($attributes, array('value' => (string)$value));
- }
- $this->_options[] = array('text' => $text, 'attr' => $attributes);
- } // end func addOption
-
- // }}}
- // {{{ loadArray()
-
- /**
- * Loads the options from an associative array
- *
- * @param array $arr Associative array of options
- * @param mixed $values (optional) Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return PEAR_Error on error or true
- * @throws PEAR_Error
- */
- function loadArray($arr, $values=null)
- {
- if (!is_array($arr)) {
- return PEAR::raiseError('Argument 1 of HTML_Select::loadArray is not a valid array');
- }
- if (isset($values)) {
- $this->setSelected($values);
- }
- foreach ($arr as $key => $val) {
- // Warning: new API since release 2.3
- $this->addOption($val, $key);
- }
- return true;
- } // end func loadArray
-
- // }}}
- // {{{ loadDbResult()
-
- /**
- * Loads the options from DB_result object
- *
- * If no column names are specified the first two columns of the result are
- * used as the text and value columns respectively
- * @param object $result DB_result object
- * @param string $textCol (optional) Name of column to display as the OPTION text
- * @param string $valueCol (optional) Name of column to use as the OPTION value
- * @param mixed $values (optional) Array or comma delimited string of selected values
- * @since 1.0
- * @access public
- * @return PEAR_Error on error or true
- * @throws PEAR_Error
- */
- function loadDbResult(&$result, $textCol=null, $valueCol=null, $values=null)
- {
- if (!is_object($result) || !is_a($result, 'db_result')) {
- return PEAR::raiseError('Argument 1 of HTML_Select::loadDbResult is not a valid DB_result');
- }
- if (isset($values)) {
- $this->setValue($values);
- }
- $fetchMode = ($textCol && $valueCol) ? DB_FETCHMODE_ASSOC : DB_FETCHMODE_ORDERED;
- while (is_array($row = $result->fetchRow($fetchMode)) ) {
- if ($fetchMode == DB_FETCHMODE_ASSOC) {
- $this->addOption($row[$textCol], $row[$valueCol]);
- } else {
- $this->addOption($row[0], $row[1]);
- }
- }
- return true;
- } // end func loadDbResult
-
- // }}}
- // {{{ loadQuery()
-
- /**
- * Queries a database and loads the options from the results
- *
- * @param mixed $conn Either an existing DB connection or a valid dsn
- * @param string $sql SQL query string
- * @param string $textCol (optional) Name of column to display as the OPTION text
- * @param string $valueCol (optional) Name of column to use as the OPTION value
- * @param mixed $values (optional) Array or comma delimited string of selected values
- * @since 1.1
- * @access public
- * @return void
- * @throws PEAR_Error
- */
- function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null)
- {
- if (is_string($conn)) {
- require_once('DB.php');
- $dbConn = &DB::connect($conn, true);
- if (DB::isError($dbConn)) {
- return $dbConn;
- }
- } elseif (is_subclass_of($conn, "db_common")) {
- $dbConn = &$conn;
- } else {
- return PEAR::raiseError('Argument 1 of HTML_Select::loadQuery is not a valid type');
- }
- $result = $dbConn->query($sql);
- if (DB::isError($result)) {
- return $result;
- }
- $this->loadDbResult($result, $textCol, $valueCol, $values);
- $result->free();
- if (is_string($conn)) {
- $dbConn->disconnect();
- }
- return true;
- } // end func loadQuery
-
- // }}}
- // {{{ load()
-
- /**
- * Loads options from different types of data sources
- *
- * This method is a simulated overloaded method. The arguments, other than the
- * first are optional and only mean something depending on the type of the first argument.
- * If the first argument is an array then all arguments are passed in order to loadArray.
- * If the first argument is a db_result then all arguments are passed in order to loadDbResult.
- * If the first argument is a string or a DB connection then all arguments are
- * passed in order to loadQuery.
- * @param mixed $options Options source currently supports assoc array or DB_result
- * @param mixed $param1 (optional) See function detail
- * @param mixed $param2 (optional) See function detail
- * @param mixed $param3 (optional) See function detail
- * @param mixed $param4 (optional) See function detail
- * @since 1.1
- * @access public
- * @return PEAR_Error on error or true
- * @throws PEAR_Error
- */
- function load(&$options, $param1=null, $param2=null, $param3=null, $param4=null)
- {
- switch (true) {
- case is_array($options):
- return $this->loadArray($options, $param1);
- break;
- case (is_a($options, 'db_result')):
- return $this->loadDbResult($options, $param1, $param2, $param3);
- break;
- case (is_string($options) && !empty($options) || is_subclass_of($options, "db_common")):
- return $this->loadQuery($options, $param1, $param2, $param3, $param4);
- break;
- }
- } // end func load
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the SELECT in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return $this->getFrozenHtml();
- } else {
- $tabs = $this->_getTabs();
- $strHtml = '';
-
- if ($this->getComment() != '') {
- $strHtml .= $tabs . '<!-- ' . $this->getComment() . " //-->\n";
- }
-
- if (!$this->getMultiple()) {
- $attrString = $this->_getAttrString($this->_attributes);
- } else {
- $myName = $this->getName();
- $this->setName($myName . '[]');
- $attrString = $this->_getAttrString($this->_attributes);
- $this->setName($myName);
- }
- $strHtml .= $tabs . '<select' . $attrString . ">\n";
-
- $strValues = is_array($this->_values)? array_map('strval', $this->_values): array();
- foreach ($this->_options as $option) {
- if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) {
- $option['attr']['selected'] = 'selected';
- }
- $strHtml .= $tabs . "\t<option" . $this->_getAttrString($option['attr']) . '>' .
- $option['text'] . "</option>\n";
- }
-
- return $strHtml . $tabs . '</select>';
- }
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $value = array();
- if (is_array($this->_values)) {
- foreach ($this->_values as $key => $val) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if (0 == strcmp($val, $this->_options[$i]['attr']['value'])) {
- $value[$key] = $this->_options[$i]['text'];
- break;
- }
- }
- }
- }
- $html = empty($value)? ' ': join('<br />', $value);
- if ($this->_persistantFreeze) {
- $name = $this->getPrivateName();
- // Only use id attribute if doing single hidden input
- if (1 == count($value)) {
- $id = $this->getAttribute('id');
- $idAttr = isset($id)? array('id' => $id): array();
- } else {
- $idAttr = array();
- }
- foreach ($value as $key => $item) {
- $html .= '<input' . $this->_getAttrString(array(
- 'type' => 'hidden',
- 'name' => $name,
- 'value' => $this->_values[$key]
- ) + $idAttr) . ' />';
- }
- }
- return $html;
- } //end func getFrozenHtml
-
- // }}}
- // {{{ exportValue()
-
- /**
- * We check the options and return only the values that _could_ have been
- * selected. We also return a scalar value if select is not "multiple"
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- $value = $this->_findValue($submitValues);
- if (is_null($value)) {
- $value = $this->getValue();
- } elseif(!is_array($value)) {
- $value = array($value);
- }
- if (is_array($value) && !empty($this->_options)) {
- $cleanValue = null;
- foreach ($value as $v) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if (0 == strcmp($v, $this->_options[$i]['attr']['value'])) {
- $cleanValue[] = $v;
- break;
- }
- }
- }
- } else {
- $cleanValue = $value;
- }
- if (is_array($cleanValue) && !$this->getMultiple()) {
- return $this->_prepareValue($cleanValue[0], $assoc);
- } else {
- return $this->_prepareValue($cleanValue, $assoc);
- }
- }
-
- // }}}
- // {{{ onQuickFormEvent()
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' == $event) {
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_submitValues);
- // Fix for bug #4465 & #5269
- // XXX: should we push this to element::onQuickFormEvent()?
- if (null === $value && (!$caller->isSubmitted() || !$this->getMultiple())) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- return true;
- } else {
- return parent::onQuickFormEvent($event, $arg, $caller);
- }
- }
-
- // }}}
-} //end class HTML_QuickForm_select
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for static data
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * HTML class for static data
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Wojciech Gdela <eltehaem@poczta.onet.pl>
- * @version Release: 3.2.16
- * @since 2.7
- */
-class HTML_QuickForm_static extends HTML_QuickForm_element {
-
- // {{{ properties
-
- /**
- * Display text
- * @var string
- * @access private
- */
- var $_text = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementLabel (optional)Label
- * @param string $text (optional)Display text
- * @access public
- * @return void
- */
- function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel);
- $this->_persistantFreeze = false;
- $this->_type = 'static';
- $this->_text = $text;
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the element name
- *
- * @param string $name Element name
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setText()
-
- /**
- * Sets the text
- *
- * @param string $text
- * @access public
- * @return void
- */
- function setText($text)
- {
- $this->_text = $text;
- } // end func setText
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets the text (uses the standard setValue call to emulate a form element.
- *
- * @param string $text
- * @access public
- * @return void
- */
- function setValue($text)
- {
- $this->setText($text);
- } // end func setValue
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the static text element in HTML
- *
- * @access public
- * @return string
- */
- function toHtml()
- {
- return $this->_getTabs() . $this->_text;
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags
- *
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- return $this->toHtml();
- } //end func getFrozenHtml
-
- // }}}
- // {{{ onQuickFormEvent()
-
- /**
- * Called by HTML_QuickForm whenever form event is made on this element
- *
- * @param string $event Name of event
- * @param mixed $arg event arguments
- * @param object &$caller calling object
- * @since 1.0
- * @access public
- * @return void
- * @throws
- */
- function onQuickFormEvent($event, $arg, &$caller)
- {
- switch ($event) {
- case 'updateValue':
- // do NOT use submitted values for static elements
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- break;
- default:
- parent::onQuickFormEvent($event, $arg, $caller);
- }
- return true;
- } // end func onQuickFormEvent
-
- // }}}
- // {{{ exportValue()
-
- /**
- * We override this here because we don't want any values from static elements
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- return null;
- }
-
- // }}}
-} //end class HTML_QuickForm_static
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a submit type element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a submit type element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_submit extends HTML_QuickForm_input
-{
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param string Input field value
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
- $this->setValue($value);
- $this->setType('submit');
- } //end constructor
-
- // }}}
- // {{{ freeze()
-
- /**
- * Freeze the element so that only its value is returned
- *
- * @access public
- * @return void
- */
- function freeze()
- {
- return false;
- } //end func freeze
-
- // }}}
- // {{{ exportValue()
-
- /**
- * Only return the value if it is found within $submitValues (i.e. if
- * this particular submit button was clicked)
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- return $this->_prepareValue($this->_findValue($submitValues), $assoc);
- }
-
- // }}}
-} //end class HTML_QuickForm_submit
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a text field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
-
-/**
- * HTML class for a text field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_text extends HTML_QuickForm_input
-{
-
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string $elementName (optional)Input field name attribute
- * @param string $elementLabel (optional)Input field label
- * @param mixed $attributes (optional)Either a typical HTML attribute string
- * or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->setType('text');
- } //end constructor
-
- // }}}
- // {{{ setSize()
-
- /**
- * Sets size of text field
- *
- * @param string $size Size of text field
- * @since 1.3
- * @access public
- * @return void
- */
- function setSize($size)
- {
- $this->updateAttributes(array('size'=>$size));
- } //end func setSize
-
- // }}}
- // {{{ setMaxlength()
-
- /**
- * Sets maxlength of text field
- *
- * @param string $maxlength Maximum length of text field
- * @since 1.3
- * @access public
- * @return void
- */
- function setMaxlength($maxlength)
- {
- $this->updateAttributes(array('maxlength'=>$maxlength));
- } //end func setMaxlength
-
- // }}}
-
-} //end class HTML_QuickForm_text
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * HTML class for a textarea type field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * HTML class for a textarea type field
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Adam Daniel <adaniel1@eesus.jnj.com>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 3.2.16
- * @since 1.0
- */
-class HTML_QuickForm_textarea extends HTML_QuickForm_element
-{
- // {{{ properties
-
- /**
- * Field value
- * @var string
- * @since 1.0
- * @access private
- */
- var $_value = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * Class constructor
- *
- * @param string Input field name attribute
- * @param mixed Label(s) for a field
- * @param mixed Either a typical HTML attribute string or an associative array
- * @since 1.0
- * @access public
- * @return void
- */
- function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
- {
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
- $this->_persistantFreeze = true;
- $this->_type = 'textarea';
- } //end constructor
-
- // }}}
- // {{{ setName()
-
- /**
- * Sets the input field name
- *
- * @param string $name Input field name attribute
- * @since 1.0
- * @access public
- * @return void
- */
- function setName($name)
- {
- $this->updateAttributes(array('name'=>$name));
- } //end func setName
-
- // }}}
- // {{{ getName()
-
- /**
- * Returns the element name
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getName()
- {
- return $this->getAttribute('name');
- } //end func getName
-
- // }}}
- // {{{ setValue()
-
- /**
- * Sets value for textarea element
- *
- * @param string $value Value for textarea element
- * @since 1.0
- * @access public
- * @return void
- */
- function setValue($value)
- {
- $this->_value = $value;
- } //end func setValue
-
- // }}}
- // {{{ getValue()
-
- /**
- * Returns the value of the form element
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getValue()
- {
- return $this->_value;
- } // end func getValue
-
- // }}}
- // {{{ setWrap()
-
- /**
- * Sets wrap type for textarea element
- *
- * @param string $wrap Wrap type
- * @since 1.0
- * @access public
- * @return void
- */
- function setWrap($wrap)
- {
- $this->updateAttributes(array('wrap' => $wrap));
- } //end func setWrap
-
- // }}}
- // {{{ setRows()
-
- /**
- * Sets height in rows for textarea element
- *
- * @param string $rows Height expressed in rows
- * @since 1.0
- * @access public
- * @return void
- */
- function setRows($rows)
- {
- $this->updateAttributes(array('rows' => $rows));
- } //end func setRows
-
- // }}}
- // {{{ setCols()
-
- /**
- * Sets width in cols for textarea element
- *
- * @param string $cols Width expressed in cols
- * @since 1.0
- * @access public
- * @return void
- */
- function setCols($cols)
- {
- $this->updateAttributes(array('cols' => $cols));
- } //end func setCols
-
- // }}}
- // {{{ toHtml()
-
- /**
- * Returns the textarea element in HTML
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function toHtml()
- {
- if ($this->_flagFrozen) {
- return $this->getFrozenHtml();
- } else {
- return $this->_getTabs() .
- '<textarea' . $this->_getAttrString($this->_attributes) . '>' .
- // because we wrap the form later we don't want the text indented
- preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars($this->_value)) .
- '</textarea>';
- }
- } //end func toHtml
-
- // }}}
- // {{{ getFrozenHtml()
-
- /**
- * Returns the value of field without HTML tags (in this case, value is changed to a mask)
- *
- * @since 1.0
- * @access public
- * @return string
- */
- function getFrozenHtml()
- {
- $value = htmlspecialchars($this->getValue());
- if ($this->getAttribute('wrap') == 'off') {
- $html = $this->_getTabs() . '<pre>' . $value."</pre>\n";
- } else {
- $html = nl2br($value)."\n";
- }
- return $html . $this->_getPersistantData();
- } //end func getFrozenHtml
-
- // }}}
-
-} //end class HTML_QuickForm_textarea
-?>
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * utility functions
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Chuck Burgess <ashnazg@php.net>
- * @copyright 2001-2018 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Provides a collection of static methods for array manipulation.
- *
- * (courtesy of CiviCRM project (https://civicrm.org/)
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Chuck Burgess <ashnazg@php.net>
- * @version Release: 3.2.16
- * @since 3.2
- */
-class HTML_QuickForm_utils
-{
- /**
- * Get a single value from an array-tree.
- *
- * @param array $values Ex: ['foo' => ['bar' => 123]].
- * @param array $path Ex: ['foo', 'bar'].
- * @param mixed $default
- * @return mixed Ex 123.
- *
- * @access public
- * @static
- */
- function pathGet($values, $path, $default = NULL) {
- foreach ($path as $key) {
- if (!is_array($values) || !isset($values[$key])) {
- return $default;
- }
- $values = $values[$key];
- }
- return $values;
- }
-
- /**
- * Check if a key isset which may be several layers deep.
- *
- * This is a helper for when the calling function does not know how many layers deep
- * the path array is so cannot easily check.
- *
- * @param array $values
- * @param array $path
- * @return bool
- *
- * @access public
- * @static
- */
- function pathIsset($values, $path) {
- foreach ($path as $key) {
- if (!is_array($values) || !isset($values[$key])) {
- return FALSE;
- }
- $values = $values[$key];
- }
- return TRUE;
- }
-
- /**
- * Set a single value in an array tree.
- *
- * @param array $values Ex: ['foo' => ['bar' => 123]].
- * @param array $pathParts Ex: ['foo', 'bar'].
- * @param mixed $value Ex: 456.
- * @return void
- *
- * @access public
- * @static
- */
- function pathSet(&$values, $pathParts, $value) {
- $r = &$values;
- $last = array_pop($pathParts);
- foreach ($pathParts as $part) {
- if (!isset($r[$part])) {
- $r[$part] = array();
- }
- $r = &$r[$part];
- }
- $r[$last] = $value;
- }
-
- /**
- * Check if a key isset which may be several layers deep.
- *
- * This is a helper for when the calling function does not know how many layers deep the
- * path array is so cannot easily check.
- *
- * @param array $array
- * @param array $path
- * @return bool
- *
- * @access public
- * @static
- */
- function recursiveIsset($array, $path) {
- return self::pathIsset($array, $path);
- }
-
- /**
- * Check if a key isset which may be several layers deep.
- *
- * This is a helper for when the calling function does not know how many layers deep the
- * path array is so cannot easily check.
- *
- * @param array $array
- * @param array $path An array of keys,
- * e.g [0, 'bob', 8] where we want to check if $array[0]['bob'][8]
- * @param mixed $default Value to return if not found.
- * @return bool
- *
- * @access public
- * @static
- */
- function recursiveValue($array, $path, $default = NULL) {
- return self::pathGet($array, $path, $default);
- }
-
- /**
- * Append the value to the array using the key provided.
- *
- * e.g if value is 'llama' & path is [0, 'email', 'location'] result will be
- * [0 => ['email' => ['location' => 'llama']]
- *
- * @param $path
- * @param $value
- * @param array $source
- * @return array
- *
- * @access public
- * @static
- */
- function recursiveBuild($path, $value, $source = array()) {
- self::pathSet($source, $path, $value);
- return $source;
- }
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Class for HTML 4.0 <button> element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for form elements
- */
-require_once 'HTML/QuickForm/element.php';
-
-/**
- * Class for HTML 4.0 <button> element
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.2.3
- */
-class HTML_QuickForm_xbutton extends HTML_QuickForm_element
-{
- /**
- * Contents of the <button> tag
- * @var string
- * @access private
- */
- var $_content;
-
- /**
- * Class constructor
- *
- * @param string Button name
- * @param string Button content (HTML to add between <button></button> tags)
- * @param mixed Either a typical HTML attribute string or an associative array
- * @access public
- */
- function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null)
- {
- $this->HTML_QuickForm_element($elementName, null, $attributes);
- $this->setContent($elementContent);
- $this->setPersistantFreeze(false);
- $this->_type = 'xbutton';
- }
-
-
- function toHtml()
- {
- return '<button' . $this->getAttributes(true) . '>' . $this->_content . '</button>';
- }
-
-
- function getFrozenHtml()
- {
- return $this->toHtml();
- }
-
-
- function freeze()
- {
- return false;
- }
-
-
- function setName($name)
- {
- $this->updateAttributes(array(
- 'name' => $name
- ));
- }
-
-
- function getName()
- {
- return $this->getAttribute('name');
- }
-
-
- function setValue($value)
- {
- $this->updateAttributes(array(
- 'value' => $value
- ));
- }
-
-
- function getValue()
- {
- return $this->getAttribute('value');
- }
-
-
- /**
- * Sets the contents of the button element
- *
- * @param string Button content (HTML to add between <button></button> tags)
- */
- function setContent($content)
- {
- $this->_content = $content;
- }
-
-
- function onQuickFormEvent($event, $arg, &$caller)
- {
- if ('updateValue' != $event) {
- return parent::onQuickFormEvent($event, $arg, $caller);
- } else {
- $value = $this->_findValue($caller->_constantValues);
- if (null === $value) {
- $value = $this->_findValue($caller->_defaultValues);
- }
- if (null !== $value) {
- $this->setValue($value);
- }
- }
- return true;
- }
-
-
- /**
- * Returns a 'safe' element's value
- *
- * The value is only returned if the button's type is "submit" and if this
- * particlular button was clicked
- */
- function exportValue(&$submitValues, $assoc = false)
- {
- if ('submit' == $this->getAttribute('type')) {
- return $this->_prepareValue($this->_findValue($submitValues), $assoc);
- } else {
- return null;
- }
- }
-}
-?>
+++ /dev/null
-<?php
-session_start();
-require_once 'HTML/QuickForm.php';
-require_once 'HTML/QuickForm/DHTMLRulesTableless.php';
-require_once 'HTML/QuickForm/Renderer/Tableless.php';
-
-function process_data ($values) {
- echo '<h1>Thank you</h1>';
- echo 'Your report has been submitted';
- $email_body = 'OpenStreetMap - Claim of Copyright Infringement form:'."\n\n";
- $email_body .= 'Automated Email - Form Posted.'."\n\n";
- $email_body .= print_r($values, true);
- $reply_address = $values['name_first'].' '.$values['name_last'].' <'.$values['email'].'>';
- $email_body .= 'Formatted address: '.$reply_address."\n\n";
- $email_header = 'From: OSMF Copyright Form <dmca@osmfoundation.org>' . "\r\n" . 'Content-Type: text/plain; charset="utf-8"';
- mail('dmca@osmfoundation.org','OSM Claim of Copyright Infringement', $email_body, $email_header, '-fdmca@osmfoundation.org');
-}
-?>
-<!DOCTYPE html>
-<html>
-<head>
-<title>OpenStreetMap Legal - Claim of Copyright Infringement</title>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
- <link rel="stylesheet" type="text/css" href="/style.css" />
-</head>
-<body>
-<div class="regForm">
-<?php
-// Instantiate the HTML_QuickForm object
-$form = new HTML_QuickForm_DHTMLRulesTableless('osm_legal_claim_of_copyright');
-$renderer = new HTML_QuickForm_Renderer_Tableless();
-
-$form->addElement('header', null, 'OpenStreetMap: Claim of Copyright Infringement');
-
-$form->addElement('static', null, '<p>To file a copyright infringement notification with us, you will need to send a written communication that includes the following (please consult your legal counsel or see Section 512(c)(3) of the Digital Millennium Copyright Act to confirm these requirements):</p>
-<ul><li> A physical or electronic signature of a person authorized to act on behalf of the owner of an exclusive right that is allegedly infringed.
-<li>Identification of the copyrighted work claimed to have been infringed or, if multiple copyrighted works at a single online site are covered by a single notification, a representative list of such works at that site.
-<li>Identification of the material that is claimed to be infringing or to be the subject of infringing activity and that is to be removed or access to which is to be disabled, and information reasonably sufficient to permit the service provider to locate the material. Providing URLs in the body of an email is the best way to help us locate content quickly.
-<li>Information reasonably sufficient to permit the service provider to contact the complaining party, such as an address, telephone number, and, if available, an electronic mail address at which the complaining party may be contacted.
-<li>A statement that the complaining party has a good faith belief that use of the material in the manner complained of is not authorized by the copyright owner, its agent, or the law.
-<li>A statement that the information in the notification is accurate and, under penalty of perjury, that the complaining party is authorized to act on behalf of the owner of an exclusive right that is allegedly infringed.
-</ul><p>To expedite our ability to process your request, such written notice should be sent to our designated agent via our online copyright complaint form below.</p>
-<p>This form is only for cases where you believe that material on OpenStreetMap\'s websites or in its geodata database infringes your copyright or that of your clients. For example, you claim someone has copied material from a map belonging to you.</p>
-<p>If you have come here for reporting map inaccuracies, privacy issues or another reason, <a href="https://wiki.osmfoundation.org/wiki/Licence_and_Legal_FAQ/Takedown_procedure/When_To_Use_The_Form">Read here</a>.</p>');
-
-$form->addElement('text', 'url', 'URL of Allegedly Infringing Material', array('size' => 50, 'maxlength' => 255));
-$form->addRule('url', 'Please enter URL of Allegedly Infringing Material', 'required', null, 'client');
-
-$form->addElement('textarea', 'work', 'Describe the work allegedly infringed. For example, which map has been copied and what specifically has been copied.', array('rows' => 20, 'cols' => 70));
-$form->addRule('work', 'Please describe the work allegedly infringed', 'required', null, 'client');
-
-$form->addElement('text', 'territory', 'Territories where infringement occurred', array('size' => 50, 'maxlength' => 255));
-$form->addRule('territory', 'Please enter the territories where infringement occurred', 'required', null, 'client');
-
-$form->addElement('text', 'name_first', 'First Name', array('size' => 50, 'maxlength' => 255));
-$form->addRule('name_first', 'Please enter your First Name', 'required', null, 'client');
-
-$form->addElement('text', 'name_last', 'Last Name', array('size' => 50, 'maxlength' => 255));
-$form->addRule('name_last', 'Please enter your Last Name', 'required', null, 'client');
-
-
-$form->addElement('text', 'company', 'Company Name', array('size' => 50, 'maxlength' => 255));
-$form->addElement('text', 'company_tile', 'Title/Position');
-
-$form->addElement('text', 'address', 'Street Address');
-$form->addRule('address', 'Please enter Street Address', 'required', null, 'client');
-
-$form->addElement('text', 'city', 'City', array('size' => 50, 'maxlength' => 255));
-$form->addRule('city', 'Please enter City', 'required', null, 'client');
-
-$form->addElement('text', 'state', 'State/Province', array('size' => 50, 'maxlength' => 255));
-$form->addElement('text', 'postal_code', 'Zip/Postal Code', array('size' => 50, 'maxlength' => 255));
-
-$form->addElement('text', 'country', 'Country', array('size' => 50, 'maxlength' => 255));
-$form->addRule('country', 'Please enter Country', 'required', null, 'client');
-
-$form->addElement('text', 'phone_number', 'Phone Number', array('size' => 50, 'maxlength' => 255));
-$form->addRule('phone_number', 'Please enter Phone Number', 'required', null, 'client');
-
-$form->addElement('text', 'mobile_number', 'Mobile Number', array('size' => 50, 'maxlength' => 255));
-
-$form->addElement('text', 'email', 'Email Address', array('size' => 50, 'maxlength' => 255));
-$form->addRule('email', 'Please enter Email Address', 'required', null, 'client');
-$form->addRule('email', 'Please enter a valid Email Address', 'email', null, 'client');
-
-$form->addElement('text', 'fax', 'Fax', array('size' => 50, 'maxlength' => 255));
-
-$complaint_options = array();
-$complaint_options[] = &HTML_QuickForm::createElement('checkbox', '1_of_4_owner_or_authorised', null, 'I am the owner, or an agent authorized to act on behalf of the owner, of an exclusive right that is allegedly infringed.');
-$complaint_options[] = &HTML_QuickForm::createElement('checkbox', '2_of_4_good_faith', null, 'I have a good faith belief that the use of the material in the manner complained of is not authorized by the copyright owner, its agent, or the law; and');
-$complaint_options[] = &HTML_QuickForm::createElement('checkbox', '3_of_4_accurate', null, 'This notification is accurate.');
-$complaint_options[] = &HTML_QuickForm::createElement('checkbox', '4_of_4_not_misrepresent', null, 'I acknowledge that under Section 512(f) any person who knowingly materially misrepresents that material or activity is infringing may be subject to liability for damages.');
-
-$form->addGroup($complaint_options, 'complaint_confirm', 'By checking the following boxes, I state UNDER PENALTY OF PERJURY that (choose all of the options)', '<br />');
-
-$form->addElement('text', 'signature', 'Typing your full name in this box will act as your digital signature.', array('size' => 25, 'maxlength' => 255));
-$form->addRule('signature', 'Field is required', 'required', null, 'client');
-
-$form->addElement('submit', null, 'Send');
-
-$form->removeAttribute('name');
-$form->getValidationScript();
-
-if ($form->validate()) {
- // Do some stuff
- $form->freeze();
- $form->process('process_data', false);
-
-} else {
- // Output the form
- $form->accept($renderer);
- echo $renderer->toHtml();
-}
-?>
-</div>
-</body>
-</html>
+++ /dev/null
-User-agent: *
-Disallow: /
+++ /dev/null
-/* Forms
------------------------------------------------------------------------------*/
-
-.regForm {
- padding: 0;
- margin: 0;
- max-width: 730px;
-}
-
-.regForm fieldset {
- padding: 15px;
- border: 1px solid #747577;
- margin-top: 20px;
-}
-
-.regForm legend {
- padding: 0px 10px 0px 5px;
- font-size: 1.1em;
- color: #000000;
-}
-
-#regFormHeader {
- border-style: none;
- padding: 0px;
- margin: 10px 0px 2px 0px;
- font-size: 1.2em;
-}
-
-#regFormSubHeader {
- font-size: 1em;
- padding: 0px;
- margin: 0px 0px 2px 0px;
- border: none;
-}
-
-.regForm fieldset .inputbox {
- padding:0!important;
- padding-top:0!important;
- padding-bottom:0!important;
-}
-
-.regForm input {
- color: #747577;
- padding: 6px;
- margin-bottom: 0px;
- margin-top: 0px;
-
- -webkit-border-radius:5px;
- -moz-border-radius:5px;
- border-radius: 5px;
- border:1px solid #ccc;
- -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.5);
- -moz-box-shadow: 0 2px 4px rgba(0,0,0,0.5);
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
-}
-
-.regForm textarea {
- color: #747577;
- padding: 6px;
- margin-bottom: 5px;
-
- -webkit-border-radius:5px;
- -moz-border-radius:5px;
- border-radius: 5px;
- border:1px solid #ccc;
- -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.5);
- -moz-box-shadow: 0 2px 4px rgba(0,0,0,0.5);
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
-}
-
-.regForm select {
- color: #747577;
- padding: 6px;
- margin-bottom: 5px;
-
- -webkit-border-radius:5px;
- -moz-border-radius:5px;
- border-radius: 5px;
- border:1px solid #ccc;
- -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.5);
- -moz-box-shadow: 0 2px 4px rgba(0,0,0,0.5);
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- -webkit-box-sizing: border-box;
-}
-
-.regForm button {
- padding: 0px 5px 0px 0px;
-}
-
-.regForm ol > li {
- list-style: none;
- background-image: none;
- padding: 3px 0px 5px 0px;
- border-top: 1px solid #f0f0f0;
- color: #747577;
-}
-
-.regForm li.formList-top {
- border-top: none;
- font-size: .8em;
- padding: 10px 0px;
-}
-
-.regForm li.formList {
- font-size: .8em;
- padding: 10px 0px;
-}
-
-.regForm li.opt {
- border-top: 0;
- display: none;
-}
-
-.elementItem {
- padding: 0;
- display: block;
- clear: left;
- border-style: none;
-}
-
-.elementItemGroup {
- padding: 0;
- margin: 0;
- display: block;
- border-top: 2px solid #C0C0C0;
-}
-
-li.elementItemEnd {
- padding: 0;
- display: block;
- clear: left;
- border-style: none;
-}
-
-.elementGroup {
- padding: 0;
-}
-
-.elementGroup ul {
- float: left;
- margin-left: 0px;
- margin-top: 0px;
- padding: 0;
-}
-
-.elementGroup li {
- margin: 0;
- margin-left: 0px;
- margin-top: 2px;
- margin-right: 5px;
- padding: 2px 2px 2px 0px;
- border-style: none;
- min-width: 255px;
- list-style: none;
-}
-
-.elementGroupEnd {
- border-style: none;
- margin: 0;
- padding: 0;
- height: 1px;
-}
-
-.regForm ol {
- margin: 0px;
- padding: 0px;
-}
-
-.regForm p {
- font-size: 1.2em;
-}
-
-.regForm .error {
- color: #ff0000;
- font-weight: bold;
-}
-
-.regForm .required {
- color: #ff0000;
-}
-
-.regForm label.element {
- color: #000000;
- padding: 0px 5px 2px 0px;
- margin: 0px;
-}
-
-.regForm div.element {
- color: #747577;
- padding: 1px 0px 0px 0px;
-}
-
-.regForm div.element label {
- padding: 0px 15px 0px 4px;
-}
-
-.regForm input[type="submit"] {
-/* border: 1px solid #f0f0f0;*/
- color: #747577;
- margin: 10px 0px;
-}
-
-.regForm input[type="submit"]:hover {
- color: #CCCCCC;
- text-decoration: none;
-}
-
-.regForm option {
- color: #747577;
-}
-
-.regForm .reqnote {
- font-size: 90%;
- color: #747577;
- font-weight: bold;
-}
-
-.regForm input[type="radio"] {
- border: 0;
-}
-
apache_module "proxy"
apache_module "proxy_fcgi"
-directory "/srv/dmca.openstreetmap.org" do
- owner "root"
- group "root"
- mode "755"
+package "composer"
+
+git "/srv/dmca.openstreetmap.org" do
+ action :sync
+ repository "https://github.com/openstreetmap/dmca-website.git"
+ revision "main"
+ depth 1
+ notifies :run, "execute[/srv/dmca.openstreetmap.org/composer.json]", :immediately
end
-remote_directory "/srv/dmca.openstreetmap.org/html" do
- source "html"
- owner "root"
- group "root"
- mode "755"
- files_owner "root"
- files_group "root"
- files_mode "644"
+execute "/srv/dmca.openstreetmap.org/composer.json" do
+ action :nothing
+ command "composer install --no-dev"
+ cwd "/srv/dmca.openstreetmap.org/"
+ environment "COMPOSER_HOME" => "/srv/dmca.openstreetmap.org/"
end
ssl_certificate "dmca.openstreetmap.org" do
end
php_fpm "dmca.openstreetmap.org" do
- php_admin_values "open_basedir" => "/srv/dmca.openstreetmap.org/html/:/usr/share/php/:/tmp/",
+ php_admin_values "open_basedir" => "/srv/dmca.openstreetmap.org/:/usr/share/php/:/tmp/",
"disable_functions" => "exec,shell_exec,system,passthru,popen,proc_open"
prometheus_port 11201
end
CustomLog /var/log/apache2/<%= @name %>-access.log combined
ErrorLog /var/log/apache2/<%= @name %>-error.log
- DocumentRoot <%= @directory %>/html
+ DocumentRoot <%= @directory %>
Options -Indexes
</VirtualHost>
-<Directory <%= @directory %>/html>
+<Directory <%= @directory %>>
Require all granted
<FilesMatch ".+\.ph(ar|p|tml)$">
remote_file "/usr/local/bin/dnscontrol" do
action :create
- source "https://github.com/StackExchange/dnscontrol/releases/download/v3.5.0/dnscontrol-Linux"
+ source "https://github.com/StackExchange/dnscontrol/releases/download/v3.12.0/dnscontrol-Linux"
owner "root"
group "root"
mode "755"
variables :passwords => passwords
end
+template "/var/lib/dns/include/geo.js" do
+ source "geo.js.erb"
+ owner "git"
+ group "git"
+ mode "440"
+ variables :geoservers => geoservers
+ only_if { ::Dir.exist?("/var/lib/dns/include") }
+end
+
cookbook_file "#{node[:dns][:repository]}/hooks/post-receive" do
source "post-receive"
owner "git"
--- /dev/null
+var GEO_NS_RECORDS = [
+<% @geoservers.each do |server| -%>
+ NS("geo", "<%= server %>."),
+<% end -%>
+];
service "docker" do
action [:enable, :start]
subscribes :restart, "template[/etc/docker/daemon.json]"
- not_if { ENV["TEST_KITCHEN"] }
end
default[:exim][:daemon_smtp_ports] = [25]
default[:exim][:trusted_users] = []
default[:exim][:queue_run_max] = 1
+default[:exim][:smtp_accept_max] = 20
default[:exim][:smarthost_name] = nil
default[:exim][:smarthost_via] = "mail.openstreetmap.org:26"
default[:exim][:routes] = {}
--- /dev/null
+This is an automated response to your email, which was sent to an
+unattended address.
+
+You can not reply to this email, please use the
+community.openstreetmap.org web site instead.
+
+Thank you,
+
+OpenStreetMap Administrators
unattended address.
If you were trying to confirm your email address after signing
-up for an account, or after changing your email address, then you
+up for an account, or after changing your email address, then you
should click on the link in the original email you received.
If you need help using OpenStreetMap then you should try our
-question and answer site:
+community site:
- https://help.openstreetmap.org/
+ https://community.openstreetmap.org/
If you are having technical problems with the web site then please
contact support@openstreetmap.org for assistance.
queue_run_max = <%= node[:exim][:queue_run_max] %>
+# Maximum number of simultaneous SMTP connections
+
+smtp_accept_max = <%= node[:exim][:smtp_accept_max] %>
+
+
######################################################################
# ACL CONFIGURATION #
signed_smtp:
driver = smtp
+ connect_timeout = 1m
dkim_domain = ${lookup{${domain:$h_from:}}partial-lsearch{/etc/exim4/dkim-domains}{$value}}
dkim_selector = ${lookup{$dkim_domain}lsearch{/etc/exim4/dkim-selectors}{$value}}
dkim_private_key = /etc/exim4/dkim-keys/${dkim_domain}
to = $sender_address
subject = Re: $header_subject:
headers = MIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8
- file = /etc/exim4/noreply/$local_part_data
+ file = ${lookup{$local_part}dsearch,filter=file,ret=full{/etc/exim4/noreply}}
user = Debian-exim
group = Debian-exim
version "1.0.0"
supports "ubuntu"
depends "munin"
+depends "prometheus"
#
include_recipe "munin"
+include_recipe "prometheus"
-package "fail2ban"
+package %w[
+ fail2ban
+ ruby-webrick
+]
template "/etc/fail2ban/jail.d/00-default.conf" do
source "jail.default.erb"
end
munin_plugin "fail2ban"
+
+prometheus_exporter "fail2ban" do
+ port 9635
+end
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :filter, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :jail, :kind_of => String, :name_property => true
php-mysql
php-xml
php-apcu
- unzip
]
apache_module "env"
notifies :reload, "service[apache2]"
end
-remote_file "#{cache_dir}/air3_v0.8.zip" do
+remote_file "#{cache_dir}/air3_v0.8.tar.gz" do
action :create_if_missing
- source "https://fluxbb.org/resources/styles/air3/releases/0.8/air3_v0.8.zip"
+ source "https://github.com/natrius/air3/archive/refs/tags/v0.8.tar.gz"
owner "root"
group "root"
mode "644"
backup false
end
-execute "#{cache_dir}/air3_v0.8.zip" do
+archive_file "#{cache_dir}/air3_v0.8.tar.gz" do
action :nothing
- command "unzip -o -qq #{cache_dir}/air3_v0.8.zip Air3.css 'Air3/*'"
- cwd "/srv/forum.openstreetmap.org/html/style"
- user "forum"
+ destination "/srv/forum.openstreetmap.org/html/style"
+ strip_components 1
+ overwrite true
+ owner "forum"
group "forum"
- subscribes :run, "remote_file[#{cache_dir}/air3_v0.8.zip]", :immediately
+ subscribes :extract, "remote_file[#{cache_dir}/air3_v0.8.tar.gz]", :immediately
end
directory "/srv/forum.openstreetmap.org/html/cache/" do
depends "apache"
depends "git"
depends "mediawiki"
+depends "ruby"
email_sender "webmaster@openstreetmap.org"
email_sender_name "OSMF Board Wiki"
private_site true
- recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N"
- recaptcha_private_key passwords["board"]["recaptcha"]
- version "1.34"
+ version "1.37"
end
cookbook_file "/srv/board.osmfoundation.org/Wiki.png" do
email_sender "webmaster@openstreetmap.org"
email_sender_name "OSMF Board Wiki"
private_site true
- recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N"
- recaptcha_private_key passwords["dwg"]["recaptcha"]
- version "1.34"
+ version "1.37"
end
cookbook_file "/srv/dwg.osmfoundation.org/Wiki.png" do
email_sender "webmaster@openstreetmap.org"
email_sender_name "OSMF Board Wiki"
private_site true
- recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N"
- recaptcha_private_key passwords["mwg"]["recaptcha"]
- version "1.34"
+ version "1.37"
end
cookbook_file "/srv/mwg.osmfoundation.org/Wiki.png" do
include_recipe "apache"
include_recipe "git"
+include_recipe "ruby"
-package %w[
+package %W[
gcc
g++
make
- ruby
- ruby-dev
libssl-dev
zlib1g-dev
pkg-config
]
-gem_package "bundler" do
- version "1.17.3"
-end
-
git "/srv/operations.osmfoundation.org" do
action :sync
repository "https://github.com/openstreetmap/owg-website.git"
depth 1
user "root"
group "root"
- notifies :run, "execute[/srv/operations.osmfoundation.org/Gemfile]"
+ notifies :run, "bundle_install[/srv/operations.osmfoundation.org]"
end
directory "/srv/operations.osmfoundation.org/_site" do
group "nogroup"
end
-execute "/srv/operations.osmfoundation.org/Gemfile" do
+bundle_install "/srv/operations.osmfoundation.org" do
action :nothing
- command "bundle install --deployment"
- cwd "/srv/operations.osmfoundation.org"
+ options "--deployment"
user "root"
group "root"
- notifies :run, "execute[/srv/operations.osmfoundation.org]"
+ notifies :run, "bundle_exec[/srv/operations.osmfoundation.org]"
end
-execute "/srv/operations.osmfoundation.org" do
- command "bundle exec jekyll build --trace"
- cwd "/srv/operations.osmfoundation.org"
+bundle_exec "/srv/operations.osmfoundation.org" do
+ action :nothing
+ command "jekyll build --trace"
user "nobody"
group "nogroup"
end
database_password passwords["wiki"]["database"]
admin_password passwords["wiki"]["admin"]
skin "OSMFoundation"
- logo "/Wiki.png"
+ logo "/w/skins/OSMFoundation/img/logo.png"
email_contact "webmaster@openstreetmap.org"
email_sender "webmaster@openstreetmap.org"
email_sender_name "OSMF Wiki"
private_accounts true
- recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N"
- recaptcha_private_key passwords["wiki"]["recaptcha"]
extra_file_extensions ["mp3"]
- version "1.34"
+ version "1.37"
end
mediawiki_skin "osmf" do
include_recipe "geoipupdate"
+servers = search(:node, "roles:geodns").collect(&:name).sort
+
+servers << "dummy.example.com" if servers.empty?
+
package %w[
gdnsd
]
mode "755"
end
-%w[tile nominatim].each do |zone|
+%w[nominatim].each do |zone|
%w[map resource weighted].each do |type|
template "/etc/gdnsd/config.d/#{zone}.#{type}" do
action :create_if_missing
owner "root"
group "root"
mode "644"
+ variables :servers => servers
notifies :restart, "service[gdnsd]"
end
plugins => {
geoip => {
maps => {
- $include{config.d/tile.map}
$include{config.d/nominatim.map}
}
resources => {
- $include{config.d/tile.resource}
$include{config.d/nominatim.resource}
}
},
weighted => {
- $include{config.d/tile.weighted}
$include{config.d/nominatim.weighted}
}
}
$TTL 86400
-@ SOA saphira.openstreetmap.org. hostmaster.openstreetmap.org. (
+@ SOA <%= @servers.first %>. hostmaster.openstreetmap.org. (
3 ; serial
86400 ; refresh
7200 ; retry
3600 ; ncache
)
-@ 86400 NS balerion.openstreetmap.org.
-@ 86400 NS chrysophylax.openstreetmap.org.
-@ 86400 NS katie.openstreetmap.org.
-@ 86400 NS saphira.openstreetmap.org.
-@ 86400 NS stormfly-04.openstreetmap.org.
-@ 86400 NS ridgeback.openstreetmap.org.
+<% @servers.each do |server| -%>
+@ 86400 NS <%= server %>.
+<% end -%>
-tile 300 DYNC geoip!tile
nominatim 300 DYNC geoip!nominatim
default[:geoipupdate][:account] = "149244"
default[:geoipupdate][:editions] = %w[GeoLite2-ASN GeoLite2-City GeoLite2-Country]
+default[:geoipupdate][:directory] = "/usr/share/GeoIP"
default[:apt][:sources] |= ["maxmind"]
command "geoipupdate"
user "root"
group "root"
- not_if { ENV.key?("TEST_KITCHEN") || node[:geoipupdate][:editions].all? { |edition| ::File.exist?("/usr/share/GeoIP/#{edition}.mmdb") } }
+ not_if { kitchen? || node[:geoipupdate][:editions].all? { |edition| ::File.exist?("#{node[:geoipupdate][:directory]}/#{edition}.mmdb") } }
end
systemd_service "geoipupdate" do
private_devices true
protect_system "strict"
protect_home true
- read_write_paths "/usr/share/GeoIP"
+ read_write_paths node[:geoipupdate][:directory]
end
systemd_timer "geoipupdate" do
mode "2775"
end
+template "/etc/gitconfig" do
+ source "gitconfig.erb"
+ owner "root"
+ group "root"
+ mode "644"
+end
+
Dir.glob("#{git_directory}/*/*.git").each do |repository|
template "#{repository}/hooks/post-update" do
source "post-update.erb"
mode "644"
end
+template "/srv/#{git_site}/indextext.html" do
+ source "indextext.html.erb"
+ owner "root"
+ group "root"
+ mode "644"
+end
+
ssl_certificate git_site do
domains [git_site] + Array(node[:git][:aliases])
notifies :reload, "service[apache2]"
# KeepaliveTimeout longer than git config uploadpack.keepalive 5 second default
KeepAliveTimeout 20
+ RewriteEngine on
+ RewriteRule ^/cgimap\.git.* https://github.com/zerebubuth/openstreetmap-cgimap [QSD,L,R=permanent]
+ RewriteRule ^/planetdump\.git.* https://github.com/openstreetmap/planetdump [QSD,L,R=permanent]
+ RewriteRule ^/gpx-import\.git.* https://github.com/openstreetmap/gpx-import [QSD,L,R=permanent]
+ RewriteRule ^/potlatch2\.git.* https://github.com/openstreetmap/potlatch2 [QSD,L,R=permanent]
+
ScriptAlias /public /usr/lib/git-core/git-http-backend/public
ScriptAlias /private /usr/lib/git-core/git-http-backend/private
Alias /gitweb /usr/share/gitweb
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+[safe]
+ directory = /var/lib/chef/public
+ directory = /var/lib/chef/private
+ directory = /var/lib/dns
#$home_link = $my_uri || "/";
# html text to include at home page
-$home_text = "indextext.html";
+$home_text = "/srv/<%= node[:git][:host] %>/indextext.html";
# file with project list; by default, simply scan the projectroot dir.
$projects_list = $projectroot;
--- /dev/null
+<h2>Want to contribute to OpenStreetMap software?</h2>
+<p>Head over to <a href="https://github.com/openstreetmap/">github.com/openstreetmap/</a></p>
+<p>git.openstreetmap.org is an internal system we use as part of our deployment system.</p>
git "/srv/gps-tile.openstreetmap.org/import" do
action :sync
- repository "https://github.com/ericfischer/gpx-import.git"
+ repository "https://github.com/e-n-f/gpx-import.git"
revision "live"
depth 1
user "gpstile"
git "/srv/gps-tile.openstreetmap.org/datamaps" do
action :sync
- repository "https://github.com/ericfischer/datamaps.git"
+ repository "https://github.com/e-n-f/datamaps.git"
revision "live"
depth 1
user "gpstile"
git "/srv/gps-tile.openstreetmap.org/updater" do
action :sync
- repository "https://github.com/ericfischer/gpx-updater.git"
+ repository "https://github.com/openstreetmap/gpx-updater.git"
revision "live"
depth 1
user "gpstile"
default[:hardware][:modules] = %w[lp]
+default[:hardware][:blacklisted_modules] = %w[]
default[:hardware][:grub][:cmdline] = %w[nomodeset]
default[:hardware][:sensors] = {}
default[:hardware][:hwmon] = {}
default[:hardware][:ipmi][:excluded_sensors] = []
+default[:hardware][:ipmi][:custom_args] = []
if node[:dmi] && node[:dmi][:system]
case node[:dmi][:system][:manufacturer]
when "ProLiant DL360 G6", "ProLiant DL360 G7", "ProLiant SE326M1R2"
default[:hardware][:sensors][:"power_meter-*"][:power][:power1] = { :ignore => true }
end
+
+ case node[:dmi][:system][:product_name]
+ when "ProLiant DL360 G6", "ProLiant DL360 G7", "ProLiant SE326M1R2", "ProLiant DL360e Gen8", "ProLiant DL360p Gen8"
+ default[:hardware][:ipmi][:custom_args] |= ["--workaround-flags=discretereading"]
+ end
end
end
if node[:kernel][:modules].include?("ipmi_si")
default[:hardware][:modules] |= ["ipmi_devintf"]
+
+ if node[:kernel][:modules].include?("acpi_power_meter")
+ default[:hardware][:modules] |= ["acpi_ipmi"]
+ end
end
if File.exist?("/proc/xen")
default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/up_threshold"] = "25"
default[:sysfs][:cpufreq_ondemand][:parameters][:"devices/system/cpu/cpufreq/ondemand/sampling_down_factor"] = "100"
end
+
+energy_perf_bias = Dir.glob("/sys/devices/system/cpu/cpu*/power/energy_perf_bias")
+
+unless energy_perf_bias.empty?
+ default[:sysfs][:cpu_power_energy_perf_bias][:comment] = "Set CPU Energy-Performance Bias Preference to performance"
+
+ energy_perf_bias.sort.each do |path|
+ default[:sysfs][:cpu_power_energy_perf_bias][:parameters][path.sub(%r{^/sys/}, "")] = "0"
+ end
+end
when "HP"
package "hponcfg"
+ execute "update-ilo" do
+ action :nothing
+ command "/usr/sbin/hponcfg -f /etc/ilo-defaults.xml"
+ end
+
+ template "/etc/ilo-defaults.xml" do
+ source "ilo-defaults.xml.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ notifies :run, "execute[update-ilo]"
+ end
+
package "hp-health" do
action :install
notifies :restart, "service[hp-health]"
+ only_if { node[:lsb][:release].to_f < 22.04 }
end
service "hp-health" do
action [:enable, :start]
supports :status => true, :restart => true
+ only_if { node[:lsb][:release].to_f < 22.04 }
end
if product.end_with?("Gen8", "Gen9")
execute "update-grub" do
action :nothing
command "/usr/sbin/update-grub"
- not_if { ENV["TEST_KITCHEN"] }
+ not_if { kitchen? }
end
template "/etc/default/grub" do
supports :status => false, :restart => true, :reload => false
end
-# Link Layer Discovery Protocol Daemon
package "lldpd"
+
service "lldpd" do
action [:start, :enable]
supports :status => true, :restart => true, :reload => true
end
+ohai_plugin "lldp" do
+ template "lldp.rb.erb"
+end
+
tools_packages = []
status_packages = {}
when "mpt2sas", "mpt3sas"
tools_packages << "sas2ircu"
status_packages["sas2ircu-status"] ||= []
- when "megaraid_mm"
- tools_packages << "megactl"
- status_packages["megaraid-status"] ||= []
when "megaraid_sas"
tools_packages << "megacli"
status_packages["megaclisas-status"] ||= []
depth 1
user "root"
group "root"
- not_if { ENV["TEST_KITCHEN"] }
+ not_if { kitchen? }
end
else
directory "/opt/areca" do
end
end
-%w[cciss-vol-status mpt-status sas2ircu-status megaraid-status megaclisas-status aacraid-status].each do |status_package|
+%w[cciss-vol-status mpt-status sas2ircu-status megaclisas-status aacraid-status].each do |status_package|
if status_packages.include?(status_package)
package status_package
[]
end
+unless nvmes.empty?
+ package "nvme-cli"
+end
+
intel_nvmes = nvmes.select { |pci| pci[:vendor_name] == "Intel Corporation" }
if !intel_ssds.empty? || !intel_nvmes.empty?
package "unzip"
- intel_mas_tool_version = "1.6"
- intel_mas_package_version = "#{intel_mas_tool_version}.122-0"
+ intel_mas_tool_version = "1.10"
+ intel_mas_package_version = "#{intel_mas_tool_version}.155-0"
remote_file "#{Chef::Config[:file_cache_path]}/Intel_MAS_CLI_Tool_#{intel_mas_tool_version}_Linux.zip" do
- source "https://downloadmirror.intel.com/30259/eng/Intel%C2%AE_MAS_CLI_Tool_Linux_#{intel_mas_tool_version}.zip"
+ source "https://downloadmirror.intel.com/646992/Intel_MAS_CLI_Tool_Linux_#{intel_mas_tool_version}-v2.zip"
end
execute "#{Chef::Config[:file_cache_path]}/Intel_MAS_CLI_Tool_#{intel_mas_tool_version}_Linux.zip" do
end
end
-template "/etc/modules" do
- source "modules.erb"
- owner "root"
- group "root"
- mode "644"
+file "/etc/modules" do
+ action :delete
end
-service "kmod" do
- action :nothing
- subscribes :start, "template[/etc/modules]"
+node[:hardware][:modules].each do |module_name|
+ kernel_module module_name do
+ action :install
+ not_if { kitchen? }
+ end
+end
+
+node[:hardware][:blacklisted_modules].each do |module_name|
+ kernel_module module_name do
+ action :blacklist
+ end
end
if node[:hardware][:watchdog]
notifies :run, "execute[remount-dev-shm]"
end
end
+
+prometheus_collector "ohai" do
+ interval "15m"
+end
--- /dev/null
+<RIBCL VERSION="2.0">
+ <LOGIN USER_LOGIN="admin" PASSWORD="password">
+ <SERVER_INFO mode="write">
+ <!-- Set Server Name -->
+ <SERVER_NAME VALUE="<%= node[:fqdn] %>"/>
+ </SERVER_INFO>
+ <SERVER_INFO mode="write">
+ <!-- 1 Operating system control mode -->
+ <!-- 2 HP Static Low Power mode -->
+ <!-- 3 HP Dynamic Power Savings mode -->
+ <!-- 4 HP Static High Performance mode -->
+ <SET_HOST_POWER_SAVER HOST_POWER_SAVER="3"/>
+ </SERVER_INFO>
+ <SERVER_INFO mode="write">
+ <!-- Set Auto Power Yes -->
+ <SERVER_AUTO_PWR VALUE="Yes"/>
+ </SERVER_INFO>
+ <SERVER_INFO mode="write">
+ <!-- Set Auto Power after random delay -->
+ <SERVER_AUTO_PWR VALUE="RANDOM"/>
+ <!-- Unset max power cap -->
+ <!-- Disable for now -->
+ <!-- SET_POWER_CAP POWER_CAP="0" -->
+ </SERVER_INFO>
+ </LOGIN>
+</RIBCL>
- ipmi
- dcmi
- chassis
+ custom_args:
+ ipmi:
+<% node[:hardware][:ipmi][:custom_args].each do |arg| -%>
+ - <%= arg %>
+<% end -%>
exclude_sensor_ids:
<% node[:hardware][:ipmi][:excluded_sensors].each do |sensor| -%>
- <%= sensor %>
--- /dev/null
+require "json"
+
+Ohai.plugin(:Lldp) do
+ provides "lldp"
+
+ collect_data(:default) do
+ lldp Mash.new
+
+ json = JSON.parse(%x(/usr/sbin/lldpctl -f json))
+
+ interfaces = if json["lldp"]["interface"].is_a?(Array)
+ json["lldp"]["interface"]
+ else
+ [json["lldp"]["interface"]]
+ end
+
+ interfaces.each do |interface|
+ interface.each do |name, details|
+ lldp[name] = details
+ end
+ end
+
+ lldp
+ end
+end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-<% node[:hardware][:modules].each do |m| -%>
-<%= m %>
-<% end -%>
array = nil
File.new("/proc/mdstat", "r").each do |line|
- if line =~ /^(md\d+) : active raid(\d+)((?: (?:sd[a-z]|nvme\d+n\d+)\d*\[\d+\](?:\([A-Z]\))*)+)$/
+ if line =~ /^(md\d+) : active raid(\d+)((?: (?:sd[a-z]\d*|nvme\d+n\d+(?:p\d+)?)\[\d+\](?:\([A-Z]\))*)+)$/
array = {
:id => devices[:arrays].count,
:device => "/dev/#{Regexp.last_match(1)}",
+ :status => "optimal",
:raid_level => Regexp.last_match(2),
:disks => []
}
- Regexp.last_match(3).scan(/ (sd[a-z]+|nvme\d+n\d+)\d*\[\d+\](?:\([A-Z]\))*/).flatten.each do |device|
- if disk = devices[:disks].find { |d| d[:device] == "/dev/#{device}" }
- disk[:arrays] << array[:id]
- array[:disks] << disk[:id]
+ Regexp.last_match(3).split(" ").each do |member|
+ if member =~ /^(sd[a-z]+|nvme\d+n\d+).*/
+ device = Regexp.last_match(1)
+
+ if disk = devices[:disks].find { |d| d[:device] == "/dev/#{device}" }
+ if member =~ /\(F\)/
+ disk[:status] = "failed"
+ elsif member =~ /\(S\)/
+ disk[:status] = "hotspare"
+ else
+ disk[:status] = "online"
+ end
+
+ disk[:arrays] << array[:id]
+ array[:disks] << disk[:id]
+ end
end
end
devices[:arrays] << array
- elsif array && line =~ /^\s+(\d+) blocks/
+ elsif array && line =~ /^\s+(\d+) blocks.*(?:\[([U_]+)\])?/
array[:size] = format_disk_size(Regexp.last_match(1).to_i)
+ array[:status] = "degraded" if Regexp.last_match(2) =~ /_/
+ elsif array && line =~ /^\s+\[.*\]\s+(\S+)\s+=/
+ case Regexp.last_match(1)
+ when "recovery" then array[:status] = "rebuilding"
+ when "resync" then array[:status] = "rebuilding"
+ when "checking" then array[:status] = "checking"
+ end
end
end
end
disk = nil
IO.popen(%w(ssacli controller all show config detail)).each do |line|
+ next unless line.valid_encoding?
+
if line =~ /^Smart (?:Array|HBA) (\S+) /
controller = {
:id => devices[:controllers].count,
+ :type => "hp",
:model => Regexp.last_match(1),
:arrays => [],
:disks => []
array[:disks] << disk[:id]
elsif disk && line =~ /^ (\S[^:]+):\s+(.*\S)\s*$/
case Regexp.last_match(1)
+ when "Status" then disk[:status] = Regexp.last_match(2)
+ when "Drive Type" then disk[:drive_type] = Regexp.last_match(2)
when "Interface Type" then disk[:interface] = Regexp.last_match(2)
when "Size" then disk[:size] = Regexp.last_match(2)
when "Rotational Speed" then disk[:rpm] = Regexp.last_match(2)
when "Serial Number" then disk[:serial_number] = Regexp.last_match(2)
when "Model" then disk[:model] = Regexp.last_match(2)
end
+ elsif array && line =~ /^ Status:\s+(.*\S)\s*$/
+ case Regexp.last_match(1)
+ when "OK" then array[:status] = "optimal"
+ when "Interim Recovery Mode" then array[:status] = "degraded"
+ else array[:status] = "unknown"
+ end
elsif array && line =~ /^ (\S[^:]+):\s+(.*\S)\s*$/
case Regexp.last_match(1)
when "Size" then array[:size] = Regexp.last_match(2)
when "Fault Tolerance" then array[:raid_level] = Regexp.last_match(2)
+ when "Status" then array[:status] = Regexp.last_match(2)
when "Disk Name" then array[:device] = Regexp.last_match(2).strip
when "Mount Points" then array[:mount_point] = Regexp.last_match(2).split.first
when "Unique Identifier" then array[:wwn] = Regexp.last_match(2)
end
devices[:disks].each do |disk|
- disk[:smart_device] = "cciss,#{disks.find_index(disk[:location])}"
+ disk[:smart_device] = "cciss,#{disks.find_index(disk[:location])}"
+
+ if disk[:status] == "Failed"
+ disk[:status] = "failed"
+ elsif disk[:status] == "Predictive Failure"
+ disk[:status] = "failed"
+ elsif disk[:status] == "OK" && disk[:drive_type] == "Data Drive"
+ disk[:status] = "online"
+ elsif disk[:status] == "OK" && disk[:drive_type] == "Spare Drive"
+ disk[:status] = "hotspare"
+ elsif disk[:drive_type] == "Unassigned Drive"
+ disk[:status] = "unconfigured"
+ else
+ disk[:status] = "unknown"
+ end
+
+ disk.delete(:drive_type)
end
end
if line =~ /^PCI information for Controller (\d+)$/
controller = {
:id => devices[:controllers].count,
+ :type => "megaraid",
:arrays => [],
:disks => []
}
devices[:controllers] << controller
controllers << controller
- elsif line =~ /^Bus Number\s+:\s+(\d+)$/
+ elsif line =~ /^Bus Number\s+:\s+([0-9a-f]+)$/i
controller[:pci_slot] = format "0000:%02x", Integer("0x#{Regexp.last_match(1)}")
- elsif line =~ /^Device Number\s+:\s+(\d+)$/
+ elsif line =~ /^Device Number\s+:\s+([0-9a-f]+)$/i
controller[:pci_slot] = format "%s:%02x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}")
- elsif line =~ /^Function Number\s+:\s+(\d+)$/
+ elsif line =~ /^Function Number\s+:\s+([0-9a-f]+)$/i
controller[:pci_slot] = format "%s.%01x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}")
end
end
devices[:disks] << disk
controller[:disks] << disk[:id]
array[:disks] << disk[:id]
- elsif disk && line =~ /^Firmware state:\s+(.*\S)\s*$/
- Regexp.last_match(1).split(/,\s*/).each do |state|
- case state
- when "Unconfigured(bad)" then disk[:status] = "unconfigured"
- when "Online" then disk[:status] = "online"
- when "Hotspare" then disk[:status] = "hotspare"
- when "Failed" then disk[:status] = "failed"
- when "Spun Up" then disk[:state] = "spun_up"
- when "Spun down" then disk[:state] = "spun_down"
- end
+ elsif disk && line =~ /^Firmware state:\s+(\S.*)$/
+ status, state = Regexp.last_match(1).split(/,\s*/)
+ case status
+ when "Unconfigured(good)" then disk[:status] = "unconfigured"
+ when "Unconfigured(bad)" then disk[:status] = "unconfigured"
+ when "Hotspare" then disk[:status] = "hotspare"
+ when "Offline" then disk[:status] = "offline"
+ when "Online" then disk[:status] = "online"
+ when "Rebuild" then disk[:status] = "rebuilding"
+ when "Failed" then disk[:status] = "failed"
+ when "Copyback" then disk[:status] = "rebuilding"
+ else disk[:status] = "unknown"
+ end
+ case state
+ when "Spun Up" then disk[:state] = "spun_up"
+ when "Spun down" then disk[:state] = "spun_down"
+ else disk[:state] = "unknown"
end
elsif disk && line =~ /^(\S.*\S)\s*:\s+(\S.*)$/
case Regexp.last_match(1)
when "Raw Size" then disk[:size] = memory_to_disk_size(Regexp.last_match(2).sub(/\s*\[.*\]$/, ""))
when "Inquiry Data" then disk[:vendor], disk[:model], disk[:serial_number] = Regexp.last_match(2).split
end
+ elsif array && line =~ /^State\s*:\s+(.*\S)\s*$/
+ case Regexp.last_match(1)
+ when "Partially Degraded" then array[:status] = "degraded"
+ when "Degraded" then array[:status] = "degraded"
+ when "Optimal" then array[:status] = "optimal"
+ when "Consistency Check" then array[:status] = "checking"
+ when "Background Initialization" then array[:status] = "initialising"
+ when "Initialization" then array[:status] = "initialising"
+ when "Reconstruction" then array[:status] = "rebuilding"
+ else array[:status] = "unknown"
+ end
elsif array && line =~ /^(\S.*\S)\s*:\s+(\S.*)$/
case Regexp.last_match(1)
when "RAID Level" then array[:raid_level] = Regexp.last_match(2).scan(/Primary-(\d+)/).first.first
devices[:disks] << disk
end
- elsif disk && line =~ /^Firmware state:\s+(.*\S)\s*$/
- Regexp.last_match(1).split(/,\s*/).each do |state|
- case state
- when "Unconfigured(bad)" then disk[:status] = "unconfigured"
- when "Online" then disk[:status] = "online"
- when "Hotspare" then disk[:status] = "hotspare"
- when "Failed" then disk[:status] = "failed"
- when "Spun Up" then disk[:state] = "spun_up"
- when "Spun down" then disk[:state] = "spun_down"
- end
+ elsif disk && line =~ /^Firmware state:\s+(\S.*)$/
+ status, state = Regexp.last_match(1).split(/,\s*/)
+ case status
+ when "Unconfigured(good)" then disk[:status] = "unconfigured"
+ when "Unconfigured(bad)" then disk[:status] = "unconfigured"
+ when "Hotspare" then disk[:status] = "hotspare"
+ when "Offline" then disk[:status] = "offline"
+ when "Online" then disk[:status] = "online"
+ when "Rebuild" then disk[:status] = "rebuilding"
+ when "Failed" then disk[:status] = "failed"
+ when "Copyback" then disk[:status] = "rebuilding"
+ else disk[:status] = "unknown"
+ end
+ case state
+ when "Spun Up" then disk[:state] = "spun_up"
+ when "Spun down" then disk[:state] = "spun_down"
+ else disk[:state] = "unknown"
end
elsif disk && line =~ /^(\S.*\S)\s*:\s+(\S.*)$/
case Regexp.last_match(1)
if line =~ /^\/proc\/mpt\/ioc(\d+)\s+LSI Logic\s+(\S+)\s+/
controller = {
:id => devices[:controllers].count,
+ :type => "mpt1",
:model => Regexp.last_match(1),
:arrays => [],
:disks => []
next unless line =~ /^\s+(\d+)\s+(\S+)\s+\h+h\s+\h+h\s+(\S+)\s+\h+h\s+\h+h\s*$/
controllers[Regexp.last_match(1).to_i] = {
:id => devices[:controllers].count,
+ :type => "mpt2",
:model => Regexp.last_match(2),
:pci_slot => Regexp.last_match(3).sub(/^(\h{2})h:(\h{2})h:(\h{2})h:0(\h)h$/, "00\\1:\\2:\\3.\\4"),
:arrays => [],
controller[:disks] << disk[:id]
disks << disk
+ elsif disk && line =~ /^ State\s+:\s+(.*\S)\s*$/
+ Regexp.last_match(1).split(/,\s*/).each do |state|
+ case state
+ when "Online (ONL)" then disk[:status] = "online"
+ when "Hot Spare (HSP)" then disk[:status] = "hotspare"
+ when "Ready (RDY)" then disk[:status] = "unconfigured"
+ when "Available (AVL)" then disk[:status] = "unconfigured"
+ when "Failed (FLD)" then disk[:status] = "failed"
+ when "Missing (MIS)" then disk[:status] = "missing"
+ when "Standby (SBY)" then disk[:status] = "unconfigured"
+ when "Out of Sync (OSY)" then disk[:status] = "degraded"
+ when "Degraded (DGD)" then disk[:status] = "degraded"
+ when "Rebuilding (RBLD)" then disk[:status] = "rebuilding"
+ when "Optimal (OPT)" then disk[:status] = "online"
+ else disk[:status] = "unknown"
+ end
+ end
elsif disk && line =~ /^ (\S.*\S)\s+:\s+(.*\S)\s*$/
case Regexp.last_match(1)
when "Enclosure #" then disk[:location] = Regexp.last_match(2)
end
elsif array && line =~ /^ PHY\[\d+\] Enclosure#\/Slot#\s+:\s+(\d+:\d+)\s*$/
array[:disks] << Regexp.last_match(1)
+ elsif array && line =~ /^ Status of volume\s+:\s+(.*\S)\s*$/
+ Regexp.last_match(1).split(/,\s*/).each do |state|
+ case state
+ when "Okay (OKY)" then array[:status] = "optimal"
+ when "Degraded (DGD)" then array[:status] = "degraded"
+ when "Failed (FLD)" then array[:status] = "failed"
+ when "Missing (MIS)" then array[:status] = "missing"
+ when "Initializing (INIT)" then array[:status] = "initialising"
+ when "Online (ONL)" then array[:status] = "optimal"
+ else array[:status] = "unknown"
+ end
+ end
elsif array && line =~ /^ (\S.*\S)\s+:\s+(.*\S)\s*$/
case Regexp.last_match(1)
when "Volume wwid" then array[:device] = find_sas_device(Regexp.last_match(2))
controller = {
:id => devices[:controllers].count,
:number => controller_number,
+ :type => "adaptec",
:arrays => [],
:disks => []
}
elsif disk && line =~ /^ Reported Channel,Device\(T:L\)\s*:\s+(\d+),(\d+)\(\d+:0\)\s*$/
disk[:channel_number] = Regexp.last_match(1)
disk[:device_number] = Regexp.last_match(2)
+ elsif disk && line =~ /^ State\s*:\s+(\S.*\S)\s*$/
+ case Regexp.last_match(1)
+ when "Online" then disk[:status] = "online"
+ when "Online (JBOD)" then disk[:status] = "online"
+ when "Hot Spare" then disk[:status] = "hotspare"
+ when "Ready" then disk[:status] = "unconfigured"
+ when "Global Hot-Spare" then disk[:status] = "hostspare"
+ when "Dedicated Hot-Spare" then disk[:status] = "hotspare"
+ else disk[:status] = "unknown"
+ end
elsif disk && line =~ /^ (\S.*\S)\s*:\s+(\S.*\S)\s*$/
case Regexp.last_match(1)
when "Reported Location" then disk[:location] = Regexp.last_match(2)
end
elsif array && line =~ / Present \(.*((?:Connector|Enclosure):\d+,\s*(?:Device|Slot):\d+)\) /
array[:disks] << Regexp.last_match(1).tr(":", " ").gsub(/,\s*/, ", ")
+ elsif array && line =~ /^ Status of Logical Device\s*:\s+(\S.*\S)\s*$/
+ case Regexp.last_match(1)
+ when "Optimal" then array[:status] = "optimal"
+ else array[:status] = "unknown"
+ end
elsif array && line =~ /^ (\S.*\S)\s*:\s+(\S.*\S)\s*$/
case Regexp.last_match(1)
when "RAID level" then array[:raid_level] = Regexp.last_match(2)
def find_areca_disks(devices)
controller = {
:id => devices[:controllers].count,
+ :type => "areca",
:arrays => [],
:disks => []
}
device = Dir.glob("/sys/bus/pci/devices/#{pci_slot}/host*/target*:0:0/0:#{channel}:#{id}:#{lun}/block/*").first
array[:device] = "/dev/#{File.basename(device)}"
+ elsif line =~ /^Volume State\s+:\s+(.*\S)\s*$/
+ case Regexp.last_match(1)
+ when "Normal" then array[:status] = "optimal"
+ else array[:status] = "unknown"
+ end
elsif line =~ /^(\S.*\S)\s+:\s+(.*\S)\s*$/
case Regexp.last_match(1)
when "Volume Set Name" then array[:volume_set] = Regexp.last_match(2)
disk[:smart_device] = "areca,#{Regexp.last_match(1)}"
elsif line =~ /^Device Location\s+:\s+Enclosure#(\d+) Slot#?\s*0*(\d+)\s*$/i
disk[:smart_device] = "areca,#{Regexp.last_match(2)}/#{Regexp.last_match(1)}"
+ elsif line =~ /^Device State\s+:\s+(.*\S)\s*$/
+ case Regexp.last_match(1)
+ when "NORMAL" then disk[:status] = "online"
+ else disk[:status] = "unknown"
+ end
elsif line =~ /^(\S.*\S)\s+:\s+(.*\S)\s*$/
case Regexp.last_match(1)
when "Model Name" then disk[:vendor], disk[:model] = Regexp.last_match(2).split
not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") }
end
-execute "unzip-ostn02-ntv2-data" do
- command "unzip -q #{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip"
- cwd "/srv/imagery/common/ostn02-ntv2-data"
- user "root"
+archive_file "#{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip" do
+ destination "/srv/imagery/common/ostn02-ntv2-data"
+ owner "root"
group "root"
not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") }
end
overlay true
end
-imagery_layer "gb_os_om_local_2020_04" do
- site "os.openstreetmap.org"
- title "OS OpenMap Local - April 2020"
- projection "EPSG:27700"
- source "/data/imagery/gb/openmap-local/2020-04/os-openmap-local-2020-04-combined-sea-average-zstd22.vrt"
- copyright "Contains OS data © Crown copyright and database right 2020"
- revision 2
- background_colour "213 244 248" # OS OpenMap Local Water Blue
- extension "os_om_local_png"
- url_aliases ["/om-local-2020-04", "/om-local"]
- default_layer true
-end
-
imagery_layer "gb_os_om_local_2016_10" do
site "os.openstreetmap.org"
title "OS OpenMap Local - October 2016"
background_colour "213 244 248" # OS OpenMap Local Water Blue
extension "os_om_local_png"
end
+
+imagery_layer "gb_os_om_local_2020_04" do
+ site "os.openstreetmap.org"
+ title "OS OpenMap Local - April 2020"
+ projection "EPSG:27700"
+ source "/data/imagery/gb/openmap-local/2020-04/os-openmap-local-2020-04-combined-sea-average-zstd22.vrt"
+ copyright "Contains OS data © Crown copyright and database right 2020"
+ revision 2
+ background_colour "213 244 248" # OS OpenMap Local Water Blue
+ extension "os_om_local_png"
+end
+
+imagery_layer "gb_os_om_local_2020_10" do
+ site "os.openstreetmap.org"
+ title "OS OpenMap Local - October 2020"
+ projection "EPSG:27700"
+ source "/data/imagery/gb/openmap-local/2020-10/os-openmap-local-2020-10.vrt"
+ copyright "Contains OS data © Crown copyright and database right 2020"
+ background_colour "213 244 248" # OS OpenMap Local Water Blue
+ extension "os_om_local_png"
+end
+
+imagery_layer "gb_os_om_local_2021_04" do
+ site "os.openstreetmap.org"
+ title "OS OpenMap Local - April 2021"
+ projection "EPSG:27700"
+ source "/data/imagery/gb/openmap-local/2021-04/os-openmap-local-2021-04.vrt"
+ copyright "Contains OS data © Crown copyright and database right 2021"
+ background_colour "213 244 248" # OS OpenMap Local Water Blue
+ extension "os_om_local_png"
+end
+
+imagery_layer "gb_os_om_local_2021_10" do
+ site "os.openstreetmap.org"
+ title "OS OpenMap Local - October 2021"
+ projection "EPSG:27700"
+ source "/data/imagery/gb/openmap-local/2021-10/os-openmap-local-2021-10.vrt"
+ copyright "Contains OS data © Crown copyright and database right 2021"
+ background_colour "213 244 248" # OS OpenMap Local Water Blue
+ extension "os_om_local_png"
+end
+
+imagery_layer "gb_os_om_local_2022_04" do
+ site "os.openstreetmap.org"
+ title "OS OpenMap Local - April 2022"
+ projection "EPSG:27700"
+ source "/data/imagery/gb/openmap-local/2022-04/os-openmap-local-2022-04.vrt"
+ copyright "Contains OS data © Crown copyright and database right 2022"
+ background_colour "213 244 248" # OS OpenMap Local Water Blue
+ extension "os_om_local_png"
+ url_aliases ["/om-local-2022-04", "/om-local"]
+ default_layer true
+end
require "yaml"
+unified_mode true
+
default_action :create
property :layer, String, :name_property => true
require "yaml"
+unified_mode true
+
default_action :create
property :site, String, :name_property => true
base_domains = [new_resource.site] + Array(new_resource.aliases)
tile_domains = base_domains.flat_map { |d| [d, "a.#{d}", "b.#{d}", "c.#{d}"] }
- %w[0 1 2 3 4 5 6 7].each do |index|
- systemd_service "mapserv-fcgi-#{new_resource.site}-#{index}" do
- description "Map server for #{new_resource.site} layer"
- environment "MS_MAP_PATTERN" => "^/srv/imagery/mapserver/",
- "MS_DEBUGLEVEL" => "0",
- "MS_ERRORFILE" => "stderr",
- "GDAL_CACHEMAX" => "512"
- limit_nofile 16384
- limit_cpu 180
- memory_high "512M"
- memory_max "1G"
- user "imagery"
- group "imagery"
- exec_start_pre "/bin/rm -f /run/mapserver-fastcgi/layer-#{new_resource.site}-#{index}.socket"
- exec_start "/usr/bin/spawn-fcgi -n -b 8192 -s /run/mapserver-fastcgi/layer-#{new_resource.site}-#{index}.socket -M 0666 -P /run/mapserver-fastcgi/layer-#{new_resource.site}-#{index}.pid -- /usr/lib/cgi-bin/mapserv"
- private_tmp true
- private_devices true
- private_network true
- protect_system "full"
- protect_home true
- no_new_privileges true
- restart "always"
- pid_file "/run/mapserver-fastcgi/layer-#{new_resource.site}-#{index}.pid"
- end
-
- service "mapserv-fcgi-#{new_resource.site}-#{index}" do
- provider Chef::Provider::Service::Systemd
- action [:enable, :start]
- supports :status => true, :restart => true, :reload => false
- subscribes :restart, "systemd_service[mapserv-fcgi-#{new_resource.site}-#{index}]"
- end
+ systemd_service "mapserv-fcgi-#{new_resource.site}" do
+ description "Map server for #{new_resource.site} layer"
+ environment "MS_MAP_PATTERN" => "^/srv/imagery/mapserver/",
+ "=" => "0",
+ "MS_ERRORFILE" => "stderr",
+ "GDAL_CACHEMAX" => "512"
+ limit_nofile 16384
+ memory_high "1G"
+ memory_max "2G"
+ user "imagery"
+ group "imagery"
+ exec_start "/usr/bin/multiwatch -f 12 --signal=TERM -- /usr/lib/cgi-bin/mapserv"
+ standard_input "socket"
+ private_tmp true
+ private_devices true
+ private_network true
+ protect_system "full"
+ protect_home true
+ no_new_privileges true
+ # Terminate service after 5mins. Service is socket activated
+ runtime_max_sec 300
+ end
+
+ systemd_socket "mapserv-fcgi-#{new_resource.site}" do
+ description "Map server for #{new_resource.site} layer socket"
+ socket_user "imagery"
+ socket_group "imagery"
+ listen_stream "/run/mapserver-fastcgi/layer-#{new_resource.site}.socket"
+ end
+
+ # Ensure service is stopped because otherwise the socket cannot reload
+ service "mapserv-fcgi-#{new_resource.site}" do
+ provider Chef::Provider::Service::Systemd
+ action :nothing
+ subscribes :stop, "systemd_service[mapserv-fcgi-#{new_resource.site}]"
+ subscribes :stop, "systemd_socket[mapserv-fcgi-#{new_resource.site}]"
+ end
+
+ systemd_unit "mapserv-fcgi-#{new_resource.site}.socket" do
+ action [:enable, :start]
+ subscribes :restart, "systemd_socket[mapserv-fcgi-#{new_resource.site}]"
end
ssl_certificate new_resource.site do
end
action :delete do
- %w[0 1 2 3 4 5 6 7].each do |index|
- service "mapserv-fcgi-#{new_resource.site}-#{index}" do
- provider Chef::Provider::Service::Systemd
- action [:stop, :disable]
- end
-
- systemd_service "mapserv-fcgi-#{new_resource.site}-#{index}" do
- action :delete
- end
+ service "mapserv-fcgi-#{new_resource.site}" do
+ provider Chef::Provider::Service::Systemd
+ action [:stop, :disable]
+ end
+
+ systemd_service "mapserv-fcgi-#{new_resource.site}" do
+ action :delete
end
nginx_site new_resource.site do
// Add the permalink control
map.addControl(new L.Control.Permalink());
+ var lc = L.control.locate({
+ position: 'topright'
+ }).addTo(map);
+
return map;
}
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title><%= @title %></title>
<link rel="stylesheet" href="imagery.css" type="text/css" media="all" />
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.css" integrity="sha256-SHMGCYmST46SoyGgo4YR/9AlK1vf3ff84Aq9yK4hdqM=" crossorigin="anonymous" />
- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.js" integrity="sha256-fNoRrwkP2GuYPbNSJmMJOCyfRB2DhPQe0rGTgzRsyso=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-plugins/3.3.1/control/Permalink.min.js" integrity="sha256-gz/xcf8U9RgwWUhQK8SgCuS024ACmdXf+eWrglT2KDE=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-plugins/3.3.1/control/Permalink.Layer.min.js" integrity="sha256-IR3dLMDgW61PPbrjYPe8eD7ou3RBAaVyoD4CNcq+8tw=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-plugins/3.3.1/control/Permalink.Overlay.min.js" integrity="sha256-xoP/txAKIYDr3MjZh1f2qtNn8lEa6zmhhkPxoejGgQM=" crossorigin="anonymous"></script>
+
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.8.0/leaflet.min.css" integrity="sha512-oIQ0EBio8LJupRpgmDsIsvm0Fsr6c3XNHLB7at5xb+Cf6eQuCX9xuX8XXGRIcokNgdqL1ms7nqbQ6ryXMGxXpg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.8.0/leaflet.min.js" integrity="sha512-TL+GX2RsOUlTndpkgHVnSQ9r6zldqHzfyECrdabkpucdFroZ3/HAhMmP2WYaPjsJCoot+0McmdPOLjmmicG9qg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-plugins/3.4.0/control/Permalink.min.js" integrity="sha512-wEr+4N2qhQn/6/YACFWVAaKzS2vLeZCWyUJ14MfXGTfHG718QBvOqv9t5xhex+Fnd3VZVd0EWcn9nzRbTLL9bg==" crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-plugins/3.4.0/control/Permalink.Layer.min.js" integrity="sha512-m7ds5hujMwIiJ9yPLnJDR4C3bFeURlrFeHnW+QpsDweqYs8hu0/cYdJFBYtRkWGFpvmF6HkOWSGy7vYP1Rg+BA==" crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-plugins/3.4.0/control/Permalink.Overlay.min.js" integrity="sha512-dIzyCLt0Sg0QpDfLXJZfgwmkbjl5s+ND7uFGW6A7itxuKA241Fzp6fKmCnPLhadqqmjz5i9/1W6aCFPLNSIIXA==" crossorigin="anonymous"></script>
+
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol@0.76.1/dist/L.Control.Locate.min.css" integrity="sha256-9ouZwdHZxE1t+iXfxZD90z8xHQrynHnPJk1UgEPXolI=" crossorigin="anonymous" referrerpolicy="no-referrer" />
+ <script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol@0.76.1/dist/L.Control.Locate.min.js" charset="utf-8" integrity="sha256-PJ29AcM0ZkANjcOdpF1jAwZ/eq324NP2cQ05f2wABE0=" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+
<script type="text/javascript" src="imagery.js"></script>
<style type="text/css">
@media print {
server {
listen 80 deferred backlog=16384 reuseport default_server;
listen 443 ssl deferred backlog=16384 reuseport http2; # No default_server here unless certificate specified here too.
+ listen [::]:80 deferred backlog=16384 reuseport default_server;
+ listen [::]:443 ssl deferred backlog=16384 reuseport http2; # No default_server here unless certificate specified here too.
server_name _;
default_type text/html;
server {
listen 80;
+ listen [::]:80;
server_name <%= @name %> a.<%= @name %> b.<%= @name %> c.<%= @name %><% @aliases.each do |alias_name| %> <%= alias_name %> a.<%= alias_name %> b.<%= alias_name %> c.<%= alias_name %><%- end -%>;
rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent;
}
upstream <%= @name %>_fastcgi {
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-0.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-1.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-2.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-3.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-4.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-5.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-6.socket" max_fails=0;
- server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>-7.socket" max_fails=0;
+ server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>.socket" max_fails=0;
# Use default round-robin to distribute requests, rather than pick "fast" but maybe faulty.
# Do not use keepalive
server {
listen 443 ssl http2;
+ listen [::]:443 ssl http2;
server_name <%= @name %> a.<%= @name %> b.<%= @name %> c.<%= @name %><% @aliases.each do |alias_name| %> <%= alias_name %> a.<%= alias_name %> b.<%= alias_name %> c.<%= alias_name %><%- end -%>;
ssl_certificate /etc/ssl/certs/<%= @name %>.pem;
mode "755"
end
-execute "unzip-kibana-#{version}" do
- command "tar --gunzip --extract --strip-components=1 --file=#{Chef::Config[:file_cache_path]}/kibana-#{version}.tar.gz"
- cwd "/opt/kibana-#{version}"
- user "root"
+archive_file "#{Chef::Config[:file_cache_path]}/kibana-#{version}.tar.gz" do
+ destination "/opt/kibana-#{version}"
+ overwrite true
+ strip_components 1
+ owner "root"
group "root"
not_if { ::File.exist?("/opt/kibana-#{version}/bin/kibana") }
end
file.puts JSON.generate(bag)
file.close
-system("/usr/bin/knife", "data", "bag", "from", "file", "letsencrypt", file.path)
+system("/opt/chef/embedded/bin/knife", "data", "bag", "from", "file", "letsencrypt", file.path)
supports "ubuntu"
depends "accounts"
depends "apache"
+depends "chef"
include_recipe "accounts"
include_recipe "apache"
+include_recipe "chef::knife"
keys = data_bag_item("chef", "keys")
user "letsencrypt"
group "letsencrypt"
subscribes :run, "template[/srv/acme.openstreetmap.org/requests/#{name}]"
- not_if { ENV["TEST_KITCHEN"] }
+ not_if { kitchen? }
end
end
default[:logstash][:forwarder]["output.logstash"]["hosts"] = ["logstash.openstreetmap.org:5044"]
default[:logstash][:forwarder]["output.logstash"]["ssl.certificate_authorities"] = "/etc/filebeat/filebeat.crt"
default[:logstash][:forwarder]["output.logstash"]["ssl.verification_mode"] = "none"
-default[:logstash][:forwarder]["filebeat.prospectors"] = []
+default[:logstash][:forwarder]["filebeat.inputs"] = []
default[:elasticsearch][:cluster][:name] = "logstash"
supports "ubuntu"
depends "apache"
depends "chef"
+depends "prometheus"
require "securerandom"
include_recipe "apache"
+include_recipe "prometheus"
package %w[
locales-all
mailman
+ ruby-webrick
]
subscribe_form_secret = persistent_token("mailman", "subscribe_form_secret")
group "root"
mode "755"
end
+
+prometheus_exporter "mailman" do
+ port 8083
+ user "list"
+end
RedirectMatch ^/$ /listinfo
RedirectMatch ^/cgi-bin/mailman/(.*)$ /$1
+ # Redact list archive entries per request of talk moderators
+ RedirectMatch 451 ^/pipermail/talk/2022-July/(087645|087647)\.html$
+
<Directory /var/lib/mailman/archives/>
Options Indexes FollowSymLinks
AllowOverride None
ScriptAlias /subscribe /usr/lib/cgi-bin/mailman/subscribe
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
- <Location ~ "/pipermail/([^/]+)/(2004|2005|2006|2007|2008|2009|2010|2011|2012|2013|2014|2015|2016|2017|2018)">
+ <Location ~ "/pipermail/([^/]+)/(2004|2005|2006|2007|2008|2009|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|2020|2021)">
ExpiresActive On
ExpiresDefault "access plus 180 days"
</Location>
export RSYNC_RSH="ssh -ax"
-nice tar --create --dereference --warning=no-file-changed --directory=$T lists-$D | nice gzip --rsyncable -9 > $T/$B
+nice tar --create --dereference --warning=no-file-changed --warning=no-file-removed --directory=$T lists-$D | nice gzip --rsyncable -9 > $T/$B
nice rsync --preallocate --fuzzy $T/$B backup::backup
rm -rf $T
--- /dev/null
+# Matomo Cookbook
+
+This cookbook installs and configures the Matomo server-side software used for
+analytics on openstreetmap.org
--- /dev/null
+default[:matomo][:version] = "4.10.1"
+default[:matomo][:plugins] = {
+ "Actions" => nil,
+ "Annotations" => nil,
+ "API" => nil,
+ "BulkTracking" => nil,
+ "Contents" => nil,
+ "CoreAdminHome" => nil,
+ "CoreConsole" => nil,
+ "CoreHome" => nil,
+ "CorePluginsAdmin" => nil,
+ "CoreUpdater" => nil,
+ "CoreVisualizations" => nil,
+ "CoreVue" => nil,
+ "CustomJsTracker" => nil,
+ "Dashboard" => nil,
+ "DBStats" => nil,
+ "DeviceFeatureWebGL" => "4.0.1",
+ "DevicePlugins" => nil,
+ "DevicesDetection" => nil,
+ "Diagnostics" => nil,
+ "Ecommerce" => nil,
+ "Events" => nil,
+ "Feedback" => nil,
+ "GeoIp2" => nil,
+ "Goals" => nil,
+ "Heartbeat" => nil,
+ "ImageGraph" => nil,
+ "Insights" => nil,
+ "Installation" => nil,
+ "Intl" => nil,
+ "IntranetMeasurable" => nil,
+ "LanguagesManager" => nil,
+ "Live" => nil,
+ "Login" => nil,
+ "Marketplace" => nil,
+ "MobileAppMeasurable" => nil,
+ "MobileMessaging" => nil,
+ "Monolog" => nil,
+ "Morpheus" => nil,
+ "MultiSites" => nil,
+ "Overlay" => nil,
+ "PagePerformance" => nil,
+ "PrivacyManager" => nil,
+ "ProfessionalServices" => nil,
+ "Proxy" => nil,
+ "Referrers" => nil,
+ "Resolution" => nil,
+ "RssWidget" => nil,
+ "ScheduledReports" => nil,
+ "SegmentEditor" => nil,
+ "SEO" => nil,
+ "SitesManager" => nil,
+ "Tour" => nil,
+ "Transitions" => nil,
+ "TwoFactorAuth" => nil,
+ "UserCountry" => nil,
+ "UserCountryMap" => nil,
+ "UserId" => nil,
+ "UserLanguage" => nil,
+ "UsersManager" => nil,
+ "VisitFrequency" => nil,
+ "VisitorInterest" => nil,
+ "VisitsSummary" => nil,
+ "VisitTime" => nil,
+ "WebsiteMeasurable" => nil,
+ "Widgetize" => nil,
+}
+
+default[:mysql][:settings][:mysqld][:secure_file_priv] = "/opt/matomo-#{node[:matomo][:version]}/matomo/tmp/assets"
-name "piwik"
+name "matomo"
maintainer "OpenStreetMap Administrators"
maintainer_email "admins@openstreetmap.org"
license "Apache-2.0"
-description "Installs and configures Piwik"
+description "Installs and configures Matomo"
version "1.0.0"
supports "ubuntu"
--- /dev/null
+#
+# Cookbook:: matomo
+# Recipe:: default
+#
+# Copyright:: 2011, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "apache"
+include_recipe "geoipupdate"
+include_recipe "mysql"
+include_recipe "php::fpm"
+
+passwords = data_bag_item("matomo", "passwords")
+
+package %w[
+ php-cli
+ php-curl
+ php-mbstring
+ php-mysql
+ php-gd
+ php-xml
+ php-apcu
+]
+
+apache_module "expires"
+apache_module "rewrite"
+
+version = node[:matomo][:version]
+
+geoip_directory = node[:geoipupdate][:directory]
+
+directory "/opt/matomo-#{version}" do
+ owner "root"
+ group "root"
+ mode "0755"
+end
+
+remote_file "#{Chef::Config[:file_cache_path]}/matomo-#{version}.zip" do
+ source "https://builds.matomo.org/matomo-#{version}.zip"
+end
+
+archive_file "#{Chef::Config[:file_cache_path]}/matomo-#{version}.zip" do
+ action :nothing
+ destination "/opt/matomo-#{version}"
+ overwrite true
+ owner "root"
+ group "root"
+ subscribes :extract, "remote_file[#{Chef::Config[:file_cache_path]}/matomo-#{version}.zip]", :immediately
+ notifies :run, "notify_group[matomo-updated]"
+end
+
+node[:matomo][:plugins].each do |plugin_name, plugin_version|
+ next if plugin_version.nil?
+
+ remote_file "#{Chef::Config[:file_cache_path]}/matomo-#{plugin_name}-#{plugin_version}.zip" do
+ source "https://plugins.matomo.org/api/2.0/plugins/#{plugin_name}/download/#{plugin_version}"
+ end
+
+ archive_file "#{Chef::Config[:file_cache_path]}/matomo-#{plugin_name}-#{plugin_version}.zip" do
+ action :nothing
+ destination "/opt/matomo-#{version}/matomo/plugins"
+ overwrite true
+ owner "root"
+ group "root"
+ subscribes :extract, "remote_file[#{Chef::Config[:file_cache_path]}/matomo-#{plugin_name}-#{plugin_version}.zip]", :immediately
+ notifies :run, "notify_group[matomo-updated]"
+ end
+end
+
+directory "/opt/matomo-#{version}/matomo/config" do
+ owner "www-data"
+ group "www-data"
+ mode "0755"
+end
+
+template "/opt/matomo-#{version}/matomo/config/config.ini.php" do
+ source "config.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ variables :passwords => passwords,
+ :directory => "/opt/matomo-#{version}/matomo",
+ :plugins => node[:matomo][:plugins].keys.sort
+ notifies :run, "notify_group[matomo-updated]"
+end
+
+directory "/opt/matomo-#{version}/matomo/tmp" do
+ owner "www-data"
+ group "www-data"
+ mode "0755"
+end
+
+directory "/opt/matomo-#{version}/matomo/tmp/assets" do
+ owner "www-data"
+ group "mysql"
+ mode "0750"
+end
+
+directory "/opt/matomo-#{version}/matomo/tmp/cache" do
+ owner "www-data"
+ group "www-data"
+ mode "0750"
+end
+
+link "/opt/matomo-#{version}/matomo/misc/GeoLite2-ASN.mmdb" do
+ to "#{geoip_directory}/GeoLite2-ASN.mmdb"
+end
+
+link "/opt/matomo-#{version}/matomo/misc/GeoLite2-City.mmdb" do
+ to "#{geoip_directory}/GeoLite2-City.mmdb"
+end
+
+link "/opt/matomo-#{version}/matomo/misc/GeoLite2-Country.mmdb" do
+ to "#{geoip_directory}/GeoLite2-Country.mmdb"
+end
+
+mysql_user "piwik@localhost" do
+ password passwords["database"]
+end
+
+mysql_database "piwik" do
+ permissions "piwik@localhost" => :all
+end
+
+notify_group "matomo-updated"
+
+if File.symlink?("/srv/matomo.openstreetmap.org")
+ execute "core:update" do
+ action :nothing
+ command "/opt/matomo-#{version}/matomo/console core:update --yes"
+ user "www-data"
+ group "www-data"
+ subscribes :run, "notify_group[matomo-updated]"
+ end
+
+ execute "custom-matomo-js:update" do
+ action :nothing
+ command "/opt/matomo-#{version}/matomo/console custom-matomo-js:update"
+ user "root"
+ group "root"
+ subscribes :run, "execute[core:update]"
+ end
+
+ execute "/opt/matomo-#{version}/matomo/matomo.js" do
+ action :nothing
+ command "gzip -k -9 /opt/matomo-#{version}/matomo/matomo.js"
+ cwd "/opt/matomo-#{version}"
+ user "root"
+ group "root"
+ subscribes :run, "execute[custom-matomo-js:update]"
+ end
+
+ execute "/opt/matomo-#{version}/matomo/piwik.js" do
+ action :nothing
+ command "gzip -k -9 /opt/matomo-#{version}/matomo/piwik.js"
+ cwd "/opt/matomo-#{version}"
+ user "root"
+ group "root"
+ subscribes :run, "execute[custom-matomo-js:update]"
+ end
+end
+
+link "/srv/matomo.openstreetmap.org" do
+ to "/opt/matomo-#{version}/matomo"
+ notifies :restart, "service[php#{node[:php][:version]}-fpm]"
+end
+
+ssl_certificate "matomo.openstreetmap.org" do
+ domains ["matomo.openstreetmap.org", "matomo.osm.org",
+ "piwik.openstreetmap.org", "piwik.osm.org"]
+ notifies :reload, "service[apache2]"
+end
+
+php_fpm "matomo.openstreetmap.org" do
+ prometheus_port 9253
+end
+
+apache_site "matomo.openstreetmap.org" do
+ template "apache.erb"
+end
+
+cron_d "matomo" do
+ minute "5"
+ user "www-data"
+ command "/usr/bin/php /srv/matomo.openstreetmap.org/console core:archive --quiet --url=https://matomo.openstreetmap.org/"
+end
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+<VirtualHost *:443>
+ ServerName matomo.openstreetmap.org
+ ServerAdmin webmaster@openstreetmap.org
+
+ SSLEngine on
+ SSLCertificateFile /etc/ssl/certs/matomo.openstreetmap.org.pem
+ SSLCertificateKeyFile /etc/ssl/private/matomo.openstreetmap.org.key
+
+ CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined
+ ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
+
+ Options -Indexes
+
+ DocumentRoot /srv/matomo.openstreetmap.org
+
+ Redirect 403 /core/
+ Redirect 403 /config/
+ Redirect 403 /lang/
+ Redirect 403 /tmp/
+</VirtualHost>
+
+<VirtualHost *:443>
+ ServerName matomo.osm.org
+ ServerAlias piwik.openstreetmap.org
+ ServerAlias piwik.osm.org
+ ServerAdmin webmaster@openstreetmap.org
+
+ SSLEngine on
+ SSLCertificateFile /etc/ssl/certs/matomo.openstreetmap.org.pem
+ SSLCertificateKeyFile /etc/ssl/private/matomo.openstreetmap.org.key
+
+ CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined
+ ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
+
+ RedirectPermanent / https://matomo.openstreetmap.org/
+</VirtualHost>
+
+<VirtualHost *:80>
+ ServerName matomo.openstreetmap.org
+ ServerAlias matomo.osm.org
+ ServerAlias piwik.openstreetmap.org
+ ServerAlias piwik.osm.org
+ ServerAdmin webmaster@openstreetmap.org
+
+ CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined
+ ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
+
+ RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+ RedirectPermanent / https://matomo.openstreetmap.org/
+</VirtualHost>
+
+<Directory /srv/matomo.openstreetmap.org>
+ Require all granted
+
+ ExpiresActive On
+ RewriteEngine on
+
+ RewriteCond "%{HTTP:Accept-encoding}" "gzip"
+ RewriteCond "%{REQUEST_FILENAME}\.gz" -s
+ RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
+
+ RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
+
+ <FilesMatch "\.js\.gz$">
+ Header append Content-Encoding gzip
+ Header append Vary Accept-Encoding
+ </FilesMatch>
+
+ <FilesMatch "(\.js|\.js\.gz)$">
+ ExpiresDefault "access plus 1 week"
+ Header set Cache-Control "max-age=604800"
+ </FilesMatch>
+
+ <FilesMatch ".+\.ph(ar|p|tml)$">
+ SetHandler "proxy:unix:/run/php/matomo.openstreetmap.org.sock|fcgi://127.0.0.1"
+ </FilesMatch>
+</Directory>
; <?php exit; ?> DO NOT REMOVE THIS LINE
-; file automatically generated or modified by Piwik; you can manually override the default values in global.ini.php by redefining them in this file.
+; file automatically generated or modified by Matomo; you can manually override the default values in global.ini.php by redefining them in this file.
[database]
host = "localhost"
username = "piwik"
password = "<%= @passwords['database'] %>"
dbname = "piwik"
tables_prefix = "piwik_"
-charset = "utf8"
+charset = "utf8mb4"
[General]
force_ssl = 1
force_ssl_login = 1
login_allowlist_apply_to_reporting_api_requests = "0"
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
+trusted_hosts[] = "matomo.openstreetmap.org"
trusted_hosts[] = "piwik.openstreetmap.org"
salt = "<%= @passwords['salt'] %>"
[Tracker]
-ignore_visits_cookie_name = "piwik_ignore"
+ignore_visits_cookie_name = "matomo_ignore"
[Plugins]
<% @plugins.each do |plugin| -%>
-# Add the mediawiki APT source
-default[:apt][:sources] = node[:apt][:sources] | ["mediawiki"]
-
# Default to enabling the "wiki" role
default[:accounts][:users][:wiki][:status] = :role
# Mediawiki packages for VisualEditor support
package %w[
curl
- parsoid
]
# Mediawiki packages for SyntaxHighight support
package "python3-pygments"
-file "/etc/mediawiki/parsoid/settings.js" do
- action :delete
-end
-
-template "/etc/mediawiki/parsoid/config.yaml" do
- action :nothing
- source "parsoid-config.yaml.erb"
- owner "root"
- group "root"
- mode "644"
-end
-
-notify_group "parsoid-config" do
- action :run
- notifies :create, "template[/etc/mediawiki/parsoid/config.yaml]"
-end
-
-service "parsoid" do
- action [:enable]
- supports :status => false, :restart => true, :reload => false
- subscribes :restart, "file[/etc/mediawiki/parsoid/settings.js]"
- subscribes :restart, "template[/etc/mediawiki/parsoid/config.yaml]"
-end
-
link "/etc/php/#{node[:php][:version]}/fpm/conf.d/20-wikidiff2.ini" do
to "../../mods-available/wikidiff2.ini"
end
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :extension, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :site, :kind_of => String, :name_property => true
property :aliases, :kind_of => [String, Array]
property :directory, :kind_of => String
-property :version, :kind_of => String, :default => "1.35"
+property :version, :kind_of => String, :default => "1.37"
property :database_name, :kind_of => String, :required => true
property :database_user, :kind_of => String, :required => [:create, :update]
property :database_password, :kind_of => String, :required => [:create, :update]
property :admin_password, :kind_of => String, :required => [:create]
property :private_accounts, :kind_of => [TrueClass, FalseClass], :default => false
property :private_site, :kind_of => [TrueClass, FalseClass], :default => false
-property :recaptcha_public_key, :kind_of => String
-property :recaptcha_private_key, :kind_of => String
+property :hcaptcha_public_key, :kind_of => String, :default => ""
+property :hcaptcha_private_key, :kind_of => String, :default => ""
property :extra_file_extensions, :kind_of => [String, Array], :default => []
property :fpm_max_children, :kind_of => Integer, :default => 5
property :fpm_start_servers, :kind_of => Integer, :default => 2
end
end
- execute "#{mediawiki_directory}/maintenance/install.php" do
- action :nothing
- # Use metanamespace as Site Name to ensure correct set namespace
- command "php maintenance/install.php --server '#{name}' --dbtype 'mysql' --dbname '#{new_resource.database_name}' --dbuser '#{new_resource.database_user}' --dbpass '#{new_resource.database_password}' --dbserver 'localhost' --scriptpath /w --pass '#{new_resource.admin_password}' '#{new_resource.metanamespace}' '#{new_resource.admin_user}'"
- cwd mediawiki_directory
- user node[:mediawiki][:user]
- group node[:mediawiki][:group]
- not_if do
- ::File.exist?("#{mediawiki_directory}/LocalSettings-install.php")
- end
- notifies :run, "ruby_block[rename-installer-localsettings]", :immediately
- end
-
- execute "#{mediawiki_directory}/maintenance/update.php" do
- action :nothing
- command "php maintenance/update.php --quick"
- cwd mediawiki_directory
- user node[:mediawiki][:user]
- group node[:mediawiki][:group]
- end
-
declare_resource :directory, site_directory do
owner node[:mediawiki][:user]
group node[:mediawiki][:group]
notifies :run, "execute[#{mediawiki_directory}/maintenance/update.php]"
end
+ template "#{mediawiki_directory}/composer.local.json" do
+ cookbook "mediawiki"
+ source "composer.local.json.erb"
+ owner node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ mode "664"
+ end
+
execute "#{mediawiki_directory}/composer.json" do
action :nothing
command "composer update --no-dev"
environment "COMPOSER_HOME" => site_directory
end
- template "#{mediawiki_directory}/composer.local.json" do
- cookbook "mediawiki"
- source "composer.local.json.erb"
- owner node[:mediawiki][:user]
+ execute "#{mediawiki_directory}/maintenance/install.php" do
+ action :nothing
+ # Use metanamespace as Site Name to ensure correct set namespace
+ command "php maintenance/install.php --server '#{name}' --dbtype 'mysql' --dbname '#{new_resource.database_name}' --dbuser '#{new_resource.database_user}' --dbpass '#{new_resource.database_password}' --dbserver 'localhost' --scriptpath /w --pass '#{new_resource.admin_password}' '#{new_resource.metanamespace}' '#{new_resource.admin_user}'"
+ cwd mediawiki_directory
+ user node[:mediawiki][:user]
+ group node[:mediawiki][:group]
+ not_if do
+ ::File.exist?("#{mediawiki_directory}/LocalSettings-install.php")
+ end
+ notifies :run, "ruby_block[rename-installer-localsettings]", :immediately
+ end
+
+ execute "#{mediawiki_directory}/maintenance/update.php" do
+ action :nothing
+ command "php maintenance/update.php --quick"
+ cwd mediawiki_directory
+ user node[:mediawiki][:user]
group node[:mediawiki][:group]
- mode "664"
end
# Safety catch if git doesn't update but install.php hasn't run
mediawiki_extension "ConfirmEdit" do
site new_resource.site
template "mw-ext-ConfirmEdit.inc.php.erb"
- variables :public_key => new_resource.recaptcha_public_key,
- :private_key => new_resource.recaptcha_private_key
+ variables :public_key => new_resource.hcaptcha_public_key,
+ :private_key => new_resource.hcaptcha_private_key
update_site false
end
end
update_site false
end
+ mediawiki_extension "CategoryTree" do
+ site new_resource.site
+ update_site false
+ end
+
mediawiki_extension "cldr" do
site new_resource.site
template "mw-ext-cldr.inc.php.erb"
mediawiki_extension "osmtaginfo" do
site new_resource.site
- template "mw-ext-osmtaginfo.inc.php.erb"
repository "https://github.com/Firefishy/osmtaginfo.git"
tag "live"
update_site false
repository "https://github.com/Firefishy/SimpleMap.git"
tag "live"
update_site false
+ action :delete
end
mediawiki_extension "SlippyMap" do
mediawiki_extension "VisualEditor" do
site new_resource.site
template "mw-ext-VisualEditor.inc.php.erb"
+ variables :version => new_resource.version
update_site false
end
update_site false
end
+ # Broken Extension - 3 April 2022 - Remove. See https://github.com/openstreetmap/chef/pull/491#issuecomment-1086759504
+ mediawiki_extension "QuickInstantCommons" do
+ site new_resource.site
+ update_site false
+ action :delete
+ end
+
cookbook_file "#{site_directory}/cc-wiki.png" do
cookbook "mediawiki"
owner node[:mediawiki][:user]
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :skin, :kind_of => String, :name_property => true
$wgMaxShellWallClockTime = 360;
# Allow some more upload extensions
-$wgFileExtensions[] = 'doc';
$wgFileExtensions[] = 'pdf';
$wgFileExtensions[] = 'odt';
$wgFileExtensions[] = 'odp';
$wgFileExtensions[] = 'ods';
$wgFileExtensions[] = 'svg';
$wgFileExtensions[] = 'osm';
+$wgFileExtensions[] = 'odg';
<% @mediawiki[:extra_file_extensions].each do |mw_extra_file_extension| -%>
$wgFileExtensions[] = '<%= mw_extra_file_extension %>';
<% end -%>
$wgSVGConverter = 'rsvg';
$wgSVGMaxSize = 2000;
-# InstantCommons allows wiki to use images from https://commons.wikimedia.org
<% if @mediawiki[:commons] -%>
-$wgUseInstantCommons = true;
-<% else -%>
-$wgUseInstantCommons = false;
+# Enable use of images from https://commons.wikimedia.org
+$wgForeignFileRepos[] = [
+ 'class' => ForeignAPIRepo::class,
+ 'name' => 'wikimediacommons',
+ 'apibase' => 'https://commons.wikimedia.org/w/api.php',
+ 'url' => 'https://upload.wikimedia.org/wikipedia/commons',
+ 'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
+ 'hashLevels' => 2,
+ 'transformVia404' => true,
+ 'fetchDescription' => true,
+ 'descriptionCacheExpiry' => 604800,
+ 'apiThumbCacheExpiry' => 604800,
+];
<% end -%>
## If you use ImageMagick (or any other shell command) on a
# Only Allow Signed-in users to edit
$wgGroupPermissions['*']['edit'] = false;
-# Only allow autoconfirmed for a few actions
-$wgGroupPermissions['user']['move'] = false;
-$wgGroupPermissions['user']['movefile'] = false;
-$wgGroupPermissions['user']['move-categorypages'] = false;
-$wgGroupPermissions['user']['upload'] = false;
-$wgGroupPermissions['autoconfirmed']['move'] = true;
-$wgGroupPermissions['autoconfirmed']['movefile'] = true;
-$wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
-$wgGroupPermissions['autoconfirmed']['upload'] = true;
-
# Allow bureaucrat group access to oversight options
$wgGroupPermissions['bureaucrat']['hideuser'] = true;
$wgGroupPermissions['bureaucrat']['deletelogentry'] = true;
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['user']['createaccount'] = true;
<% end -%>
-<% if @mediawiki[:private_site] -%>
+<% if @mediawiki[:private_site] -%>
# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;
# Extend autoblock period
$wgAutoblockExpiry = 7776000; // 90 days
-# Spam filter regex
-$wgSpamRegex = '/\b(gmail|dell|asus|eps(o|0)n|br(o|0)ther|can(o|0)n|hp|k(o|0)dak|lexmark|mcafee|bitdefender|n(o|0)rt(o|0)n( 360)?|avira|kaspersky|avg|avast|micr(o|0)s(o|0)ft|(o|0)utl(o|0)(o|0)k|printer|netgear( r(o|0)uter)?|quickb(o|0)(o|0)ks( payr(o|0)ll)?)( antivirus)?( helpline| cust(o|0)mer|( technical| tech)| cust(o|0)mer service)? (supp(o|0)rt number|ph(o|0)ne number|supp(o|0)rt ph(o|0)ne number|care number|helpdesk number)\b/i';
-
-# Autopromote users to autoconfirmed
-$wgAutoConfirmAge = 345600; // 4 days
-$wgAutoConfirmCount = 10;
-
# Disable Hit Counter for Performance
$wgDisableCounters = TRUE;
# Disable IP in Header to avoid cache issue
$wgReadOnly = "<%= @mediawiki[:site_readonly] %>";
<% end -%>
+# load extensions
<% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%>
<%= "require_once('#{file}');" %>
<% end -%>
+
+<% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%>
+# require user confirmation for certain actions
+$wgGroupPermissions['user']['move'] = false;
+$wgGroupPermissions['user']['movefile'] = false;
+$wgGroupPermissions['user']['move-categorypages'] = false;
+$wgGroupPermissions['user']['upload'] = false;
+$wgGroupPermissions['autoconfirmed']['move'] = true;
+$wgGroupPermissions['autoconfirmed']['movefile'] = true;
+$wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
+$wgGroupPermissions['autoconfirmed']['upload'] = true;
+# Autopromote users to autoconfirmed
+$wgAutoConfirmAge = 345600; // 4 days
+$wgAutoConfirmCount = 10;
+
+# user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops
+$wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed'];
+$wgAddGroups['sysop'][] = 'confirmed';
+$wgRemoveGroups['sysop'][] = 'confirmed';
+<% end -%>
+
+<% if @mediawiki[:private_accounts] or @mediawiki[:private_site] -%>
+# disable automatic confirmation of users, grant all "autoconfirmed" rights to all users
+$wgAutoConfirmAge = 0;
+$wgAutoConfirmCount = 0;
+$wgGroupPermissions['user'] = array_merge( $wgGroupPermissions['user'], $wgGroupPermissions['autoconfirmed'] );
+
+unset( $wgGroupPermissions['autoconfirmed'] );
+unset( $wgRevokePermissions['autoconfirmed'] );
+unset( $wgAddGroups['autoconfirmed'] );
+unset( $wgRemoveGroups['autoconfirmed'] );
+unset( $wgGroupsAddToSelf['autoconfirmed'] );
+unset( $wgGroupsRemoveFromSelf['autoconfirmed'] );
+<% end -%>
DocumentRoot <%= @directory %>
+ AllowEncodedSlashes NoDecode
+
ProxyTimeout 300
RewriteCond %{SERVER_NAME} !=<%= @name %>
echo 'password=<%= @database_params[:password] %>' >> $T/mysqldump.opts
mysqldump --defaults-file=$T/mysqldump.opts --opt --skip-lock-tables --single-transaction --no-tablespaces "<%= @database_params[:name] %>" | lz4 -9 > $T/wiki-<%= @name %>-$D/wiki.sql.lz4
ln -s <%= @directory %> $T/wiki-<%= @name %>-$D/www
-nice tar --create --dereference --directory=$T --warning=no-file-changed --exclude=wiki-<%= @name %>-$D/www/w/images/thumb --exclude=wiki-<%= @name %>-$D/www/w/.git --exclude=wiki-<%= @name %>-$D/www/w/extensions/*/.git wiki-<%= @name %>-$D | nice gzip --rsyncable -9 > $T/$B
+nice tar --create --dereference --directory=$T --warning=no-file-changed --warning=no-file-removed --exclude=wiki-<%= @name %>-$D/www/w/images/thumb --exclude=wiki-<%= @name %>-$D/www/w/.git --exclude=wiki-<%= @name %>-$D/www/w/extensions/*/.git wiki-<%= @name %>-$D | nice gzip --rsyncable -9 > $T/$B
nice rsync --preallocate --fuzzy $T/$B backup::backup
rm -rf $T
<?php
# DO NOT EDIT - This file is being maintained by Chef
-wfLoadExtensions( array( 'ConfirmEdit', 'ConfirmEdit/ReCaptchaNoCaptcha' ) );
-$wgCaptchaClass = 'ReCaptchaNoCaptcha';
-$wgReCaptchaSendRemoteIP = true;
-$wgReCaptchaSiteKey = '<%= @public_key %>';
-$wgReCaptchaSecretKey = '<%= @private_key %>';
-
-$wgCaptchaTriggers['addurl'] = true;
-$wgCaptchaTriggers['create'] = true;
+wfLoadExtensions( array( 'ConfirmEdit', 'ConfirmEdit/hCaptcha' ) );
+$wgHCaptchaSendRemoteIP = true;
+$wgHCaptchaSiteKey = '<%= @public_key %>';
+$wgHCaptchaSecretKey = '<%= @private_key %>';
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true;
+$wgGroupPermissions['bot' ]['skipcaptcha'] = true;
+$wgGroupPermissions['sysop' ]['skipcaptcha'] = true;
+
+$wgRateLimits['badcaptcha']['newbie'] = [ 100, 86400 ];
+++ /dev/null
-<?php
-# DO NOT EDIT - This file is being maintained by Chef
-require_once($IP .'/extensions/SimpleMap/SimpleMap.php');
$wgSpamBlacklistFiles = array(
'https://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1'
);
+# log hits, but allow only administrators to view them
+$wgLogSpamBlacklistHits = true;
+$wgGroupPermissions['user']['spamblacklistlog'] = false;
+$wgGroupPermissions['sysop']['spamblacklistlog'] = true;
'src' => 'https://meta.wikimedia.org/w/index.php?title=Title_blacklist&action=raw',
),
);
+# log hits, but allow only administrators to view them
+$wgTitleBlacklistLogHits = true;
+$wgGroupPermissions['user']['titleblacklistlog'] = false;
+$wgGroupPermissions['sysop']['titleblacklistlog'] = true;
<?php
-$wgVirtualRestConfig['modules']['parsoid'] = array(
- 'url' => 'http://localhost:8142'
-);
-$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
-
-require_once($IP .'/extensions/VisualEditor/VisualEditor.php');
-
-// Enable by default for everybody
-$wgDefaultUserOptions['visualeditor-enable'] = 1;
-
-// Don't allow users to disable it
-// $wgHiddenPrefs[] = 'visualeditor-enable';
+wfLoadExtension( 'VisualEditor' );
+++ /dev/null
-<?php
-# DO NOT EDIT - This file is being maintained by Chef
-require_once($IP .'/extensions/osmtaginfo/osmtaginfo.php');
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-worker_heartbeat_timeout: 300000
-
-logging:
- level: info
-
-#metrics:
-# type: log
-
-services:
- - module: src/lib/index.js
- entrypoint: apiServiceWorker
- conf:
- # For backwards compatibility, and to continue to support non-static
- # configs for the time being, optionally provide a path to a
- # localsettings.js file. See localsettings.example.js
- #localsettings: ./localsettings.js
-
- # Set your own user-agent string
- # Otherwise, defaults to:
- # 'Parsoid/<current-version-defined-in-package.json>'
- #userAgent: 'My-User-Agent-String'
-
- # Configure Parsoid to point to your MediaWiki instances.
- mwApis:
- # - # This is the only required parameter,
- # the URL of you MediaWiki API endpoint.
- # uri: 'http://localhost/w/api.php'
- # The "domain" is used for communication with Visual Editor
- # and RESTBase. It defaults to the hostname portion of
- # the `uri` property below, but you can manually set it
- # to an arbitrary string.
- # domain: 'localhost' # optional
- # To specify a proxy (or proxy headers) specific to this prefix
- # (which overrides defaultAPIProxyURI). Alternatively, set `proxy`
- # to `null` to override and force no proxying when a default proxy
- # has been set.
- #proxy:
- # uri: 'http://my.proxy:1234/'
- # headers: # optional
- # 'X-Forwarded-Proto': 'https'
-<% node[:mediawiki][:sites].keys.sort.each do |site_url| -%>
- - # This is the only required parameter,
- uri: 'https://<%= site_url %>/w/api.php'
-<% end -%>
-
- # We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly
- # for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
- # 'enwikivoyage' etc.
- # The default for this is false. Uncomment the line below if you want
- # to load WMF's config for wikipedias, etc.
- #loadWMF: true
-
- # A default proxy to connect to the API endpoints.
- # Default: undefined (no proxying).
- # Overridden by per-wiki proxy config in setMwApi.
- #defaultAPIProxyURI: 'http://proxy.example.org:8080'
-
- # Enable debug mode (prints extra debugging messages)
- #debug: true
-
- # Use the PHP preprocessor to expand templates via the MW API (default true)
- #usePHPPreProcessor: false
-
- # Use selective serialization (default false)
- useSelser: true
-
- # Allow cross-domain requests to the API (default '*')
- # Sets Access-Control-Allow-Origin header
- # disable:
- #allowCORS: false
- # restrict:
- #allowCORS: 'some.domain.org'
-
- # Allow override of port/interface:
- #serverPort: 8000
- #serverInterface: '127.0.0.1'
-
- # Enable linting of some wikitext errors to the log
- #linting: true
- # Send lint errors to MW API instead of to the log
- #linterSendAPI: false
-
- # Require SSL certificates to be valid (default true)
- # Set to false when using self-signed SSL certificates
- #strictSSL: false
-
- # Use a different server for CSS style modules.
- # Leaving it undefined (the default) will use the same URI as the MW API,
- # changing api.php for load.php.
- #modulesLoadURI: 'http://example.org/load.php'
require "json"
-nodes = JSON.parse(IO.popen(["knife", "status", "-c", "/var/lib/chef/.chef/knife.rb", "-F", "json"]).read).sort_by { |node| node["name"] }
+nodes = JSON.parse(IO.popen(["/opt/chef/embedded/bin/knife", "status", "-c", "/var/lib/chef/.chef/knife.rb", "-F", "json"]).read).sort_by { |node| node["name"] }
if ARGV[0] == "config"
puts "graph_title Chef node status"
+++ /dev/null
-#!/bin/sh
-#
-# Plugin to monitor the number of IPs being slowed down by Squid delay pools
-# This monitors the number of IPs being delayed in the last 128 pools, which
-# are the normal requests.
-#
-# Parameters:
-#
-# config (required)
-# autoconf (optional - used by munin-config)
-#
-
-if [ "$1" = "config" ]; then
-
- echo 'graph_title IPs being delayed with referer'
- echo 'graph_args --base 1000 -l 0'
- echo 'graph_vlabel IPs'
- echo 'graph_category squid'
- echo 'squid_delay1.label IPs'
- echo 'squid_delay1.min 0'
- echo 'squid_delay1.draw AREA'
-
- exit 0
-fi
-
-req0=`squidclient -h 127.0.0.1 mgr:delay|awk '\$1 == "Pool:" && \$2 < 128 { pr = 0; } \$1 == "Pool:" && \$2 >= 128 { pr = 1; } { if (pr) { print \$0; } }'|fgrep Current|egrep --count '[0-9]{1,3}:-?[0-9]{1,3} '`
-
-echo "squid_delay1.value " `expr 0 + $req0`
+++ /dev/null
-#!/bin/sh
-#
-# Plugin to monitor the number of IPs being slowed down by Squid delay pools
-# This monitors the number of IPs being delayed in the first 128 pools, which
-# are the ones which have no referer.
-#
-# Parameters:
-#
-# config (required)
-# autoconf (optional - used by munin-config)
-#
-
-if [ "$1" = "config" ]; then
-
- echo 'graph_title No-referer IPs being delayed'
- echo 'graph_args --base 1000 -l 0'
- echo 'graph_vlabel IPs'
- echo 'graph_category squid'
- echo 'squid_delay2.label IPs'
- echo 'squid_delay2.min 0'
- echo 'squid_delay2.draw AREA'
-
- exit 0
-fi
-
-req0=`squidclient -h 127.0.0.1 mgr:delay|awk '\$1 == "Pool:" && \$2 < 128 { pr = 1; } \$1 == "Pool:" && \$2 >= 128 { pr = 0; } { if (pr) { print \$0; } }'|fgrep Current|egrep --count '[0-9]{1,3}:-?[0-9]{1,3} '`
-
-echo "squid_delay2.value " `expr 0 + $req0`
+++ /dev/null
-#!/usr/bin/perl -w
-# -*- perl -*-
-
-=head1 NAME
-
-squid_icp - Plugin to graph traffic to the ICP peers
-
-=head1 CONFIGURATION
-
-The following configuration variables are used by this plugin:
-
- [squid_icp]
- env.squidhost - host (default "localhost")
- env.squidport - port (default "3128")
- env.squiduser - username (default "")
- env.squidpasswd - password (default "")
-
-=head1 ABOUT
-
-When using squid as a "load balancer" (of sorts), who gets the
-request?
-
-=head1 AUTHORS
-
-Copyright (C) 2004 Jimmy Olsen
-
-=head1 LICENSE
-
-Gnu GPLv2
-
-=begin comment
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; version 2 dated June, 1991.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-=end comment
-
-=head1 MAGIC MARKERS
-
- #%# family=manual
- #%# capabilities=autoconf
-
-=cut
-
-my $ret = undef;
-
-if (! eval "require IO::Socket;")
-{
- $ret = "IO::Socket not found";
-}
-if (! eval "require MIME::Base64;")
-{
- $ret = "MIME::Base64 not found";
-}
-if (! eval "require Net::hostent;")
-{
- $ret = "Net::hostent not found";
-}
-
-$squid_host = $ENV{squidhost} || "localhost";
-$squid_port = $ENV{squidport} || 3128;
-$user = $ENV{squiduser} || "";
-$passwd = $ENV{squidpasswd} || "";
-
-if($ARGV[0] and $ARGV[0] eq "autoconf") {
- &autoconf($squid_host, $squid_port, $user, $passwd);
-}
-
-sub autoconf {
- my ($host, $port, $user, $passwd) = @_;
-
- if ($ret)
- {
- print "no ($ret)\n";
- exit 0;
- }
-
- my $cachemgr = IO::Socket::INET->new(PeerAddr => $host,
- PeerPort => $port,
- Proto => 'tcp',
- Timeout => 5);
-
- if (!$cachemgr)
- {
- print "no (could not connect: $!)\n";
- exit 0;
- }
-
- my $request = "GET cache_object://$host/counters HTTP/1.0\r\n" .
- "Accept: */*\r\n" .
- &make_auth_header($user, $passwd) .
- "\r\n";
-
- $cachemgr->syswrite($request, length($request));
- my @lines = $cachemgr->getlines();
-
- print "yes\n";
- exit 0;
-}
-
-sub make_auth_header {
- my ($user, $passwd) = @_;
-
- if(!defined $passwd || $passwd eq "") {
- return "";
- } else {
- my $auth = MIME::Base64::encode_base64(($user ? $user : "") . ":$passwd", "");
- return "Authorization: Basic $auth\r\n" .
- "Proxy-Authorization: Basic $auth\r\n";
- }
-}
-
-
-sub query_squid {
- my ($host, $port, $user, $passwd) = @_;
- my $ret;
-
- my $cachemgr = IO::Socket::INET->new(PeerAddr => $host,
- PeerPort => $port,
- Proto => 'tcp') or die($!);
-
-
-
- my $request = "GET cache_object://$host/server_list HTTP/1.0\r\n" .
- "Accept: */*\r\n" .
- &make_auth_header($user, $passwd) .
- "\r\n";
-
- $cachemgr->syswrite($request, length($request));
- my @lines = $cachemgr->getlines();
- my $id = "";
- for(my $i = 0; $i <= $#lines; $i++) {
- chomp $lines[$i];
- if($lines[$i] =~ /Host[^:]+:\s*(\S+)\/\d+\/\d+\s*$/) {
- my $host = $1;
- $id = $host;
- $id =~ s/\./_/g;
-
- unless(exists($ret->{$id})) {
- $ret->{$id}->{host} = $host;
- $ret->{$id}->{fetches} = 0;
- }
- }
- elsif($lines[$i] =~ /FETCHES\s*:\s*(\d+)/) {
- $ret->{$id}->{fetches} += $1;
- }
- }
- return $ret;
-}
-
-my $hosts = &query_squid($squid_host, $squid_port, $user, $passwd);
-
-if($ARGV[0] and $ARGV[0] eq "config") {
- my $first = 1;
- print "graph_title Squid relay statistics\n";
- print "graph_vlabel requests / \${graph_period}\n";
- print "graph_args -l 0 --base 1000\n";
- print "graph_total total\n";
- print "graph_category squid\n";
- foreach my $i (sort keys %{$hosts}) {
- print "$i.label ", $hosts->{$i}->{host}, "\n";
- print "$i.type DERIVE\n";
- print "$i.max 500000\n";
- print "$i.min 0\n";
- if ($first) {
- print "$i.draw AREA\n";
- $first = 0;
- } else {
- print "$i.draw STACK\n";
- }
- }
- exit 0;
-}
-
-foreach my $i (keys %{$hosts}) {
- print "$i.value ", $hosts->{$i}->{fetches}, "\n";
-}
-
-# vim:syntax=perl
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2008 Olivier DELHOMME. All rights reserved.
-# License GPL V2 or higher
-#
-# Abstract
-# munin plugin that logs the cache mean services times
-#
-# Authors
-# . Olivier Delhomme <olivierdelhomme at gmail dot com>
-# . Grant Slater
-#
-#%# family=auto
-#%# capabilities=autoconf
-
-if [ "$1" = "autoconf" ]; then
- SQUID_STATS=$(squidclient -h 127.0.0.1 cache_object://localhost/info)
- if [ -n "${SQUID_STATS}" ]; then
- echo yes
- exit 0
- else
- echo "no (HTTP GET failed)"
- exit 1
- fi
-fi
-
-if [ "$1" = "config" ]; then
- echo 'graph_title Squid Median Services Times'
- echo 'graph_info This graph shows the proxy median services response times.'
- echo 'graph_category squid'
- echo 'graph_args --lower-limit 0'
- echo 'graph_vlabel median reponse times (s)'
-
- echo 'mean_http.label Http'
- echo 'mean_cmis.label Cache misses'
- echo 'mean_chits.label Cache hits'
- echo 'mean_nhits.label Near hits'
- echo 'mean_nmr.label Not-modified replies'
- echo 'mean_dnsl.label Dns lookups'
- echo 'mean_icpq.label Icp queries'
-
- exit 0
-fi
-
-SQUID_TIME=$(squidclient -h 127.0.0.1 cache_object://localhost/info)
-
-SQUID_TIME_HTTP=$(echo "$SQUID_TIME" | grep "HTTP Requests (All)" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-SQUID_TIME_CACHE_MISSES=$(echo "$SQUID_TIME" | grep "Cache Misses" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-SQUID_TIME_CACHE_HITS=$(echo "$SQUID_TIME" | grep "Cache Hits" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-SQUID_TIME_NEAR_HITS=$(echo "$SQUID_TIME" | grep "Near Hits" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-SQUID_TIME_NM_REPLIES=$(echo "$SQUID_TIME" | grep "Not-Modified Replies" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-SQUID_TIME_DNS_LOOKUPS=$(echo "$SQUID_TIME" | grep "DNS Lookups" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-SQUID_TIME_ICP_QUERIES=$(echo "$SQUID_TIME" | grep "ICP Queries" | cut -d':' -f2 | sed -e "s/^\ *//" | cut -d' ' -f1)
-
-echo "mean_http.value $SQUID_TIME_HTTP"
-echo "mean_cmis.value $SQUID_TIME_CACHE_MISSES"
-echo "mean_chits.value $SQUID_TIME_CACHE_HITS"
-echo "mean_nhits.value $SQUID_TIME_NEAR_HITS"
-echo "mean_nmr.value $SQUID_TIME_NM_REPLIES"
-echo "mean_dnsl.value $SQUID_TIME_DNS_LOOKUPS"
-echo "mean_icpq.value $SQUID_TIME_ICP_QUERIES"
munin_plugin "memory"
munin_plugin "netstat"
-if node[:kernel][:modules].include?("nfsv3")
- munin_plugin "nfs_client"
-else
- munin_plugin "nfs_client" do
- action :delete
- end
+munin_plugin "nfs_client" do
+ action :delete
end
-if node[:kernel][:modules].include?("nfsv4")
- munin_plugin "nfs4_client"
-else
- munin_plugin "nfs4_client" do
- action :delete
- end
+munin_plugin "nfs4_client" do
+ action :delete
end
-if node[:kernel][:modules].include?("nfsd")
- munin_plugin "nfsd"
- munin_plugin "nfsd4"
-else
- munin_plugin "nfsd" do
- action :delete
- end
+munin_plugin "nfsd" do
+ action :delete
+end
- munin_plugin "nfsd4" do
- action :delete
- end
+munin_plugin "nfsd4" do
+ action :delete
end
munin_plugin "open_files"
frontends = search(:node, "recipes:web\\:\\:frontend").reject { |n| Time.now - Time.at(n[:ohai_time]) > expiry_time }.sort_by(&:name).map do |n|
{ :name => n.name.split(".").first, :interface => n.interfaces(:role => :external).first[:interface].tr(".", "_") }
end
-tilecaches = search(:node, "roles:tilecache").reject { |n| Time.now - Time.at(n[:ohai_time]) > expiry_time }.sort_by(&:name).map do |n|
- { :name => n.name.split(".").first, :interface => n.interfaces(:role => :external).first[:interface].tr(".", "_") }
-end
renderers = search(:node, "roles:tile").reject { |n| Time.now - Time.at(n[:ohai_time]) > expiry_time }.sort_by(&:name).map do |n|
{ :name => n.name.split(".").first, :interface => n.interfaces(:role => :external).first[:interface].tr(".", "_") }
end
mode "644"
variables :expiry_time => expiry_time, :clients => clients,
:frontends => frontends, :geocoders => geocoders,
- :tilecaches => tilecaches, :renderers => renderers
+ :renderers => renderers
end
apache_module "fcgid"
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :plugin, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :plugin_conf, :kind_of => String, :name_property => true
# Use rrdcached
rrdcached_socket /var/run/rrdcached.sock
-# Configure alert targets
-contact.admins.command mail -s "Munin Notification for ${var:host}" admins@openstreetmap.org
-contact.admins.always_send invalid
-contact.null.command cat > /dev/null
-contact.null.always_send invalid
-
-# Send alerts to the admins by default
-contacts admins
-
# Ignore uncontactable hosts for twelve hours
unknown_limit 144
<% @clients.sort { |a,b| a.name <=> b.name }.each do |client| -%>
memcached_multi_bytes.bytes_written.label Traffic in (-) / out (+)
memcached_multi_bytes.bytes_written.cdef bytes_written,8,*
<% end -%>
-<% unless @tilecaches.empty? -%>
-
-# Configure compound graphs for tile.openstreetmap.org
-[tile.openstreetmap.org]
- update no
- network_in.graph_title Inbound network traffic
- network_in.graph_vlabel bits in per ${graph_period}
- network_in.graph_category network
- network_in.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:if_%%interface%%.down", @tilecaches %>
- network_in.graph_total total
- network_in.graph_args --lower-limit 0
-<% @tilecaches.each do |tc| -%>
- network_in.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
- network_in.<%= tc[:name].tr("-", "_") %>.cdef <%= tc[:name].tr("-", "_") %>,8,*
- network_in.<%= tc[:name].tr("-", "_") %>.draw AREASTACK
- network_in.<%= tc[:name].tr("-", "_") %>.min 0
-<% end -%>
- network_out.graph_title Outbound network traffic
- network_out.graph_vlabel bits out per ${graph_period}
- network_out.graph_category network
- network_out.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:if_%%interface%%.up", @tilecaches %>
- network_out.graph_total total
- network_out.graph_args --lower-limit 0
-<% @tilecaches.each do |tc| -%>
- network_out.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
- network_out.<%= tc[:name].tr("-", "_") %>.cdef <%= tc[:name].tr("-", "_") %>,8,*
- network_out.<%= tc[:name].tr("-", "_") %>.draw AREASTACK
- network_out.<%= tc[:name].tr("-", "_") %>.min 0
-<% end -%>
- squid_delay_pools.graph_title IPs being delayed with referer
- squid_delay_pools.graph_args --base 1000 -l 0
- squid_delay_pools.graph_vlabel IPs
- squid_delay_pools.graph_order squid_delay1
- squid_delay_pools.graph_category squid
- squid_delay_pools.squid_delay1.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:squid_delay_pools.squid_delay1", @tilecaches %>
- squid_delay_pools.squid_delay1.label IPs
- squid_delay_pools.squid_delay1.min 0
- squid_delay_pools.squid_delay1.draw AREA
- squid_delay_pools_noreferer.graph_title No-referer IPs being delayed
- squid_delay_pools_noreferer.graph_args --base 1000 -l 0
- squid_delay_pools_noreferer.graph_vlabel IPs
- squid_delay_pools_noreferer.graph_order squid_delay2
- squid_delay_pools_noreferer.graph_category squid
- squid_delay_pools_noreferer.squid_delay2.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:squid_delay_pools_noreferer.squid_delay2", @tilecaches %>
- squid_delay_pools_noreferer.squid_delay2.label IPs
- squid_delay_pools_noreferer.squid_delay2.min 0
- squid_delay_pools_noreferer.squid_delay2.draw AREA
- squid_requests.graph_title Squid client requests
- squid_requests.graph_args --base 1000 -l 0
- squid_requests.graph_vlabel requests / ${graph_period}
- squid_requests.graph_order <%= Chef::Munin.expand "%%%name%%%_hits=%%name%%.openstreetmap.org:squid_requests.hits %%%name%%%_errors=%%name%%.openstreetmap.org:squid_requests.errors %%%name%%%_requests=%%name%%.openstreetmap.org:squid_requests.requests", @tilecaches %> hits=<%= @tilecaches.first[:name] %>.openstreetmap.org:squid_requests.hits errors=<%= @tilecaches.first[:name] %>.openstreetmap.org:squid_requests.errors requests=<%= @tilecaches.first[:name] %>.openstreetmap.org:squid_requests.requests
- squid_requests.graph_total total
- squid_requests.graph_category squid
-<% @tilecaches.each do |tc| -%>
- squid_requests.<%= tc[:name].tr("-", "_") %>_hits.graph no
- squid_requests.<%= tc[:name].tr("-", "_") %>_errors.graph no
- squid_requests.<%= tc[:name].tr("-", "_") %>_requests.graph no
-<% end -%>
- squid_requests.hits.cdef 0,<%= Chef::Munin.expand "%%%name%%%_hits", @tilecaches, ",+," %>,+
- squid_requests.hits.label hits
- squid_requests.hits.draw AREA
- squid_requests.errors.cdef 0,<%= Chef::Munin.expand "%%%name%%%_errors", @tilecaches, ",+," %>,+
- squid_requests.errors.label errors
- squid_requests.errors.draw STACK
- squid_requests.requests.cdef 0,<%= Chef::Munin.expand "%%%name%%%_requests", @tilecaches, ",+," %>,+,hits,-,errors,-
- squid_requests.requests.label misses
- squid_requests.requests.draw STACK
- squid_traffic.graph_title Squid traffic status
- squid_traffic.graph_args --base 1000
- squid_traffic.graph_vlabel bits per ${graph_period}
- squid_traffic.graph_order kbytes_in kbytes_out hit_kbytes_out
- squid_traffic.graph_category squid
- squid_traffic.kbytes_in.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:squid_traffic.kbytes_in", @tilecaches %>
- squid_traffic.kbytes_in.label received
- squid_traffic.kbytes_in.cdef kbytes_in,8096,*
- squid_traffic.kbytes_out.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:squid_traffic.kbytes_out", @tilecaches %>
- squid_traffic.kbytes_out.label sent
- squid_traffic.kbytes_out.cdef kbytes_out,8096,*
- squid_traffic.hit_kbytes_out.sum <%= Chef::Munin.expand "%%name%%.openstreetmap.org:squid_traffic.hit_kbytes_out", @tilecaches %>
- squid_traffic.hit_kbytes_out.label from cache
- squid_traffic.hit_kbytes_out.cdef hit_kbytes_out,8096,*
- squid_times_http.graph_title Squid Http Service Times
- squid_times_http.graph_category squid
- squid_times_http.graph_args --lower-limit 0
- squid_times_http.graph_vlabel median reponse times (s)
- squid_times_http.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:squid_times.mean_http", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_times_http.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
-<% end -%>
- squid_times_cmis.graph_title Squid Cache Miss Service Times
- squid_times_cmis.graph_category squid
- squid_times_cmis.graph_args --lower-limit 0
- squid_times_cmis.graph_vlabel median reponse times (s)
- squid_times_cmis.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:squid_times.mean_cmis", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_times_cmis.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
-<% end -%>
- squid_times_chits.graph_title Squid Cache Hit Service Times
- squid_times_chits.graph_category squid
- squid_times_chits.graph_args --lower-limit 0
- squid_times_chits.graph_vlabel median reponse times (s)
- squid_times_chits.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:squid_times.mean_chits", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_times_chits.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
-<% end -%>
- squid_times_nhits.graph_title Squid Cache Near Hit Service Times
- squid_times_nhits.graph_category squid
- squid_times_nhits.graph_args --lower-limit 0
- squid_times_nhits.graph_vlabel median reponse times (s)
- squid_times_nhits.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:squid_times.mean_nhits", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_times_nhits.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
-<% end -%>
- squid_times_nmr.graph_title Squid Cache Not Modified Service Times
- squid_times_nmr.graph_category squid
- squid_times_nmr.graph_args --lower-limit 0
- squid_times_nmr.graph_vlabel median reponse times (s)
- squid_times_nmr.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:squid_times.mean_nmr", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_times_nmr.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
-<% end -%>
- squid_times_dnsl.graph_title Squid Cache DNS Lookup Service Times
- squid_times_dnsl.graph_category squid
- squid_times_dnsl.graph_args --lower-limit 0
- squid_times_dnsl.graph_vlabel median reponse times (s)
- squid_times_dnsl.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:squid_times.mean_dnsl", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_times_dnsl.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
-<% end -%>
- squid_request_hitrates.graph_title Squid Cache Request Hit Rates
- squid_request_hitrates.graph_category squid
- squid_request_hitrates.graph_args --lower-limit 0 --upper-limit 100
- squid_request_hitrates.graph_vlabel %
- squid_request_hitrates.graph_order <%= Chef::Munin.expand "%%%name%%%_total=%%name%%.openstreetmap.org:squid_requests.requests %%%name%%%_hits=%%name%%.openstreetmap.org:squid_requests.hits", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_request_hitrates.<%= tc[:name].tr("-", "_") %>_total.graph no
- squid_request_hitrates.<%= tc[:name].tr("-", "_") %>_hits.cdef <%= tc[:name].tr("-", "_") %>_hits,<%= tc[:name].tr("-", "_") %>_total,/,100,*
- squid_request_hitrates.<%= tc[:name].tr("-", "_") %>_hits.label <%= tc[:name] %>
- squid_request_hitrates.<%= tc[:name].tr("-", "_") %>_hits.draw LINE1
-<% end -%>
- squid_byte_hitrates.graph_title Squid Cache Byte Hit Rates
- squid_byte_hitrates.graph_category squid
- squid_byte_hitrates.graph_args --lower-limit 0 --upper-limit 100
- squid_byte_hitrates.graph_vlabel %
- squid_byte_hitrates.graph_order <%= Chef::Munin.expand "%%%name%%%_total=%%name%%.openstreetmap.org:squid_traffic.kbytes_out %%%name%%%_hits=%%name%%.openstreetmap.org:squid_traffic.hit_kbytes_out", @tilecaches %>
-<% @tilecaches.each do |tc| -%>
- squid_byte_hitrates.<%= tc[:name].tr("-", "_") %>_total.graph no
- squid_byte_hitrates.<%= tc[:name].tr("-", "_") %>_hits.cdef <%= tc[:name].tr("-", "_") %>_hits,<%= tc[:name].tr("-", "_") %>_total,/,100,*
- squid_byte_hitrates.<%= tc[:name].tr("-", "_") %>_hits.label <%= tc[:name] %>
- squid_byte_hitrates.<%= tc[:name].tr("-", "_") %>_hits.draw LINE1
-<% end -%>
- nginx_requests.graph_title Nginx requests
- nginx_requests.graph_vlabel Requests per ${graph_period}
- nginx_requests.graph_category nginx
- nginx_requests.graph_order <%= Chef::Munin.expand "%%%name%%%=%%name%%.openstreetmap.org:nginx_request.request", @tilecaches %>
- nginx_requests.graph_total total
- nginx_requests.graph_args --lower-limit 0
-<% @tilecaches.each do |tc| -%>
- nginx_requests.<%= tc[:name].tr("-", "_") %>.label <%= tc[:name] %>
- nginx_requests.<%= tc[:name].tr("-", "_") %>.draw AREASTACK
- nginx_requests.<%= tc[:name].tr("-", "_") %>.min 0
-<% end -%>
-<% end -%>
<% unless @renderers.empty? -%>
# Configure compound graphs for render.openstreetmap.org
notifies :restart, "service[mysql]"
end
+service "apparmor" do
+ action :nothing
+end
+
+template "/etc/apparmor.d/local/usr.sbin.mysqld" do
+ source "apparmor.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ notifies :restart, "service[apparmor]"
+ only_if { ::Dir.exist?("/sys/kernel/security/apparmor") }
+end
+
package "libdbd-mysql-perl"
package "libcache-cache-perl"
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :database, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :user, :kind_of => String, :name_property => true
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+<% if node[:mysql][:settings][:mysqld]&.dig(:secure_file_priv) -%>
+<%= node[:mysql][:settings][:mysqld][:secure_file_priv] %>/* rw,
+<% end -%>
default[:networking][:firewall][:mangle] = true
default[:networking][:roles] = {}
default[:networking][:interfaces] = {}
-default[:networking][:nameservers] = %w[1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001]
+default[:networking][:nameservers] = %w[8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844]
default[:networking][:search] = []
default[:networking][:dnssec] = "allow-downgrade"
default[:networking][:hostname] = node.name
default[:networking][:wireguard][:enabled] = true
-default[:networking][:wireguard][:keepalive] = false
+default[:networking][:wireguard][:keepalive] = 180
default[:networking][:wireguard][:peers] = []
deviceplan["parameters"]["lacp-rate"] = interface[:bond][:lacprate] if interface[:bond][:lacprate]
end
- if interface[:gateway]
+ if interface[:gateway] && interface[:gateway] != interface[:address]
if interface[:family] == "inet"
default_route = "0.0.0.0/0"
elsif interface[:family] == "inet6"
netplan["network"]["bonds"].each_value do |bond|
bond["interfaces"].each do |interface|
- netplan["network"]["ethernets"][interface] ||= { "accept-ra" => false }
+ netplan["network"]["ethernets"][interface] ||= { "accept-ra" => false, "optional" => true }
end
end
end
end
+file "/etc/netplan/00-installer-config.yaml" do
+ action :delete
+end
+
file "/etc/netplan/01-netcfg.yaml" do
action :delete
end
:allowed_ips => "10.0.16.1/32",
:endpoint => "gate.compton.nu:51820"
}
+
+ # Grant home
+ node.default[:networking][:wireguard][:peers] << {
+ :public_key => "RofATnvlWxP3mt87+QKRXFE5MVxtoCcTsJ+yftZYEE4=",
+ :allowed_ips => "10.89.122.1/32",
+ :endpoint => "gate.firefishy.com:51820"
+ }
+
+ # Grant roaming
+ node.default[:networking][:wireguard][:peers] << {
+ :public_key => "YbUkREE9TAmomqgL/4Fh2e5u2Hh7drN/2o5qg3ndRxg=",
+ :allowed_ips => "10.89.123.1/32",
+ :endpoint => "roaming.firefishy.com:51820"
+ }
end
template "/etc/systemd/network/wireguard.netdev" do
action :nothing
subscribes :restart, "template[/etc/systemd/network/wireguard.netdev]"
subscribes :restart, "template[/etc/systemd/network/wireguard.network]"
- not_if { ENV.key?("TEST_KITCHEN") }
+ not_if { kitchen? }
end
else
execute "networkctl-delete-wg0" do
command "networkctl reload"
subscribes :run, "template[/etc/systemd/network/wireguard.netdev]"
subscribes :run, "template[/etc/systemd/network/wireguard.network]"
- not_if { ENV.key?("TEST_KITCHEN") }
+ not_if { kitchen? }
end
end
end
execute "hostnamectl-set-hostname" do
command "hostnamectl set-hostname #{node[:networking][:hostname]}"
notifies :reload, "ohai[reload-hostname]"
- not_if { ENV.key?("TEST_KITCHEN") || node[:hostnamectl][:static_hostname] == node[:networking][:hostname] }
+ not_if { kitchen? || node[:hostnamectl][:static_hostname] == node[:networking][:hostname] }
end
template "/etc/hosts" do
owner "root"
group "root"
mode "644"
- not_if { ENV["TEST_KITCHEN"] }
+ not_if { kitchen? }
end
service "systemd-resolved" do
package "shorewall"
+systemd_service "shorewall-docker" do
+ service "shorewall"
+ dropin "docker"
+ exec_stop "/sbin/shorewall $OPTIONS stop"
+ notifies :restart, "service[shorewall]"
+end
+
template "/etc/default/shorewall" do
source "shorewall-default.erb"
owner "root"
notifies :restart, "service[shorewall]"
end
+template "/etc/shorewall/stoppedrules" do
+ source "shorewall-stoppedrules.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ notifies :restart, "service[shorewall]"
+end
+
if node[:networking][:firewall][:enabled]
service "shorewall" do
action [:enable, :start]
end
end
+file "/etc/shorewall/masq" do
+ action :delete
+end
+
+file "/etc/shorewall/masq.bak" do
+ action :delete
+end
+
if node[:roles].include?("gateway")
- template "/etc/shorewall/masq" do
- source "shorewall-masq.erb"
+ template "/etc/shorewall/snat" do
+ source "shorewall-snat.erb"
owner "root"
group "root"
mode "644"
notifies :restart, "service[shorewall]"
end
else
- file "/etc/shorewall/masq" do
+ file "/etc/shorewall/snat" do
action :delete
notifies :restart, "service[shorewall]"
end
resource_name :firewall_rule
provides :firewall_rule
+unified_mode true
+
default_action :nothing
property :rule, :kind_of => String, :name_property => true
<% end -%>
<% end -%>
loc wg+ nosmurfs,tcpflags
+dock docker0 bridge
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-# INTERFACE SOURCE ADDRESS
-<% node.interfaces(:role => :external).each do |external| -%>
-<% node.interfaces(:role => :internal).each do |internal| -%>
-<%= external[:interface] %> <%= internal[:network] %>/<%= internal[:prefix] %> detect
-<% end -%>
-<% end -%>
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+# ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
+<% node.interfaces(:role => :external).each do |external| -%>
+<% node.interfaces(:role => :internal).each do |internal| -%>
+SNAT(detect) <%= internal[:network] %>/<%= internal[:prefix] %> <%= external[:interface] %>
+<% end -%>
+<% end -%>
--- /dev/null
+ACCEPT - -
+ACCEPT - $FW
fw firewall
loc <%= @type %>
net <%= @type %>
+dock <%= @type %>
osm:net <%= @type %>
ucl:osm <%= @type %>
ams:osm <%= @type %>
bm:osm <%= @type %>
+dub:osm <%= @type %>
DISABLE_IPV6=No
-DOCKER=No
+DOCKER=Yes
DONT_LOAD=
PrivateKeyFile=/var/lib/systemd/wireguard/private.key
<% end -%>
ListenPort=51820
-<% node[:networking][:wireguard][:peers].each do |peer| -%>
+<% node[:networking][:wireguard][:peers].sort_by { |p| p[:public_key] }.each do |peer| -%>
[WireGuardPeer]
PublicKey=<%= peer[:public_key] %>
[Route]
Destination=fd43:e709:ea6d:1::/64
-<% node[:networking][:wireguard][:peers].each do |peer| -%>
+<% node[:networking][:wireguard][:peers].sort_by { |p| p[:public_key] }.each do |peer| -%>
<% Array(peer[:allowed_ips]).sort.each do |ip| -%>
<% unless ip =~ /^fd43:e709:ea6d:1::/ -%>
+++ /dev/null
-# NFS Cookbook
-
-This cookbook configures NFS (the Network File System) which is used on
-various servers. There are two recipes:
-
-* default: configures NFS clients based on node attributes.
-* server: configures the central NFS server.
+++ /dev/null
-default[:nfs] = {}
+++ /dev/null
-#
-# Cookbook:: nfs
-# Recipe:: default
-#
-# Copyright:: 2010, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-package "nfs-common"
-
-node[:nfs].each do |mountpoint, details|
- mount_options = if details[:readonly]
- "ro,bg,soft,tcp,rsize=8192,wsize=8192,nfsvers=4"
- else
- "rw,bg,tcp,rsize=8192,wsize=8192,nfsvers=4"
- end
-
- directory mountpoint do
- owner "root"
- group "root"
- mode "755"
- recursive true
- not_if { ::File.exist?(mountpoint) }
- end
-
- mount mountpoint do
- action [:mount, :enable]
- device "#{details[:host]}:#{details[:path]}"
- fstype "nfs"
- options mount_options
- ignore_failure true
- end
-end
+++ /dev/null
-#
-# Cookbook:: nfs
-# Recipe:: server
-#
-# Copyright:: 2010, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-package "nfs-kernel-server"
-
-service "rpcbind" do
- action [:enable, :start]
-end
-
-service "nfs-server" do
- action [:enable, :start]
-end
-
-exports = {}
-
-search(:node, "*:*") do |client|
- next unless client[:nfs]
-
- client[:nfs].each_value do |mount|
- next unless mount[:host] == node[:hostname]
-
- client.ipaddresses do |address|
- exports[mount[:path]] ||= {}
-
- exports[mount[:path]][address] = if mount[:readonly]
- "ro"
- else
- "rw"
- end
- end
- end
-end
-
-execute "exportfs" do
- action :nothing
- command "/usr/sbin/exportfs -ra"
-end
-
-template "/etc/exports" do
- source "exports.erb"
- owner "root"
- group "root"
- mode "644"
- variables :exports => exports
- notifies :run, "execute[exportfs]"
-end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-<% @exports.sort.each do |directory,clients| -%>
-<% clients.sort.each do |address,options| -%>
-<%= directory -%> -sync,subtree_check,<%= options %> <%= address %>
-<% end -%>
-<% end -%>
-/store/planet -sync,subtree_check,rw 10.0.48.50 10.0.48.5
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :site, :kind_of => String, :name_property => true
g++
make
]
+
+template "/usr/local/bin/yarn" do
+ source "yarn.erb"
+ owner "root"
+ group "root"
+ mode "755"
+end
require "json"
+unified_mode true
+
default_action :install
property :package, :kind_of => String, :name_property => true
--- /dev/null
+#!/bin/sh
+
+<% if node[:lsb][:release].to_f < 22.04 -%>
+exec /usr/bin/yarnpkg --ignore-engines "$@"
+<% else -%>
+exec /usr/bin/yarnpkg "$@"
+<% end -%>
# Nominatim Cookbook
This cookbook installs and configures the Nominatim geocoding service.
-
-It contains three recipes:
-* default: sets up a complete Nominatim installation including postgres backend
- and apache frontend
-* master: defines additional attributes for running the server as DB master
-* slave: defines additional attributes for running the server as DB slave
default[:nominatim][:state] = "off" # or: standalone, master, slave
default[:nominatim][:dbadmins] = []
-default[:nominatim][:dbcluster] = "12/main"
+default[:nominatim][:dbcluster] = "14/main"
default[:nominatim][:dbname] = "nominatim"
default[:nominatim][:tablespaces] = []
-default[:nominatim][:postgis] = "2.5"
+default[:nominatim][:postgis] = "3"
default[:nominatim][:logdir] = "/var/log/nominatim"
default[:nominatim][:repository] = "https://git.openstreetmap.org/public/nominatim.git"
default[:nominatim][:revision] = "master"
default[:nominatim][:enable_backup] = false
default[:nominatim][:enable_git_updates] = true
+default[:nominatim][:enable_qa_tiles] = false
default[:nominatim][:ui_repository] = "https://git.openstreetmap.org/public/nominatim-ui.git"
default[:nominatim][:ui_revision] = "master"
+default[:nominatim][:qa_repository] = "https://github.com/osm-search/Nominatim-Data-Analyser"
+default[:nominatim][:qa_revision] = "main"
default[:nominatim][:fpm_pools] = {
"nominatim.openstreetmap.org" => {
}
}
+default[:nominatim][:config] = {
+ :tokenizer => "icu"
+}
+
default[:nominatim][:redirects] = {}
default[:postgresql][:versions] |= [node[:nominatim][:dbcluster].split("/").first]
depends "nginx"
depends "php"
depends "postgresql"
+depends "prometheus"
depends "python"
depends "systemd"
include_recipe "accounts"
include_recipe "munin"
include_recipe "php::fpm"
+include_recipe "prometheus"
basedir = data_bag_item("accounts", "nominatim")["home"]
email_errors = data_bag_item("accounts", "lonvia")["email"]
recursive true
end
+## Log directory setup
+
directory node[:nominatim][:logdir] do
owner "nominatim"
group "nominatim"
mode "664"
end
-# exception granted for a limited time so that they can set up their own server
-firewall_rule "increase-limits-gnome-proxy" do
- action :accept
- family "inet"
- source "net:8.43.85.23"
- dest "fw"
- proto "tcp:syn"
- dest_ports "https"
- rate_limit "s:10/sec:30"
-end
-
## Postgresql
include_recipe "postgresql"
end
end
-if node[:nominatim][:state] == "master"
- postgresql_user "replication" do
- cluster node[:nominatim][:dbcluster]
- password data_bag_item("nominatim", "passwords")["replication"]
- replication true
- end
-
- directory node[:rsyncd][:modules][:archive][:path] do
- owner "postgres"
- group "postgres"
- mode "700"
- end
-
- template "/usr/local/bin/clean-db-nominatim" do
- source "clean-db-nominatim.erb"
- owner "root"
- group "root"
- mode "755"
- variables :archive_dir => node[:rsyncd][:modules][:archive][:path],
- :update_stop_file => "#{basedir}/status/updates_disabled",
- :streaming_clients => search(:node, "nominatim_state:slave").map { |slave| slave[:fqdn] }.join(" ")
- end
-end
-
## Nominatim backend
include_recipe "git"
libboost-filesystem-dev
libexpat1-dev
zlib1g-dev
- libxml2-dev
libbz2-dev
libpq-dev
- libgeos++-dev
libproj-dev
python3-pyosmium
- pyosmium
python3-psycopg2
python3-dotenv
python3-psutil
python3-jinja2
+ python3-icu
+ python3-datrie
+ python3-yaml
php-pgsql
php-intl
- php-symfony-dotenv
+ ruby
+ ruby-file-tail
+ ruby-pg
+ ruby-webrick
]
-source_directory = "#{basedir}/nominatim"
-build_directory = "#{basedir}/bin"
+source_directory = "#{basedir}/src/nominatim"
+build_directory = "#{basedir}/src/build"
+project_directory = "#{basedir}/planet-project"
+bin_directory = "#{basedir}/bin"
+cfg_directory = "#{basedir}/etc"
ui_directory = "#{basedir}/ui"
+qa_bin_directory = "#{basedir}/src/Nominatim-Data-Analyser"
+qa_data_directory = "#{basedir}/qa-data"
+
+[basedir, "#{basedir}/src", cfg_directory, bin_directory, build_directory, project_directory].each do |path|
+ directory path do
+ owner "nominatim"
+ group "nominatim"
+ mode "755"
+ recursive true
+ end
+end
-directory build_directory do
+directory "#{bin_directory}/maintenance" do
owner "nominatim"
group "nominatim"
- mode "755"
- recursive true
+ mode "775"
+end
+
+if node[:nominatim][:flatnode_file]
+ directory File.dirname(node[:nominatim][:flatnode_file]) do
+ recursive true
+ end
end
# Normally syncing via chef is a bad idea because syncing might involve
user "nominatim"
cwd build_directory
command "cmake #{source_directory} && make"
+ notifies :run, "execute[install_nominatim]"
end
-template "#{source_directory}/.git/hooks/post-merge" do
- source "git-post-merge-hook.erb"
- owner "nominatim"
- group "nominatim"
- mode "755"
- variables :srcdir => source_directory,
- :builddir => build_directory,
- :dbname => node[:nominatim][:dbname]
+execute "install_nominatim" do
+ action :nothing
+ cwd build_directory
+ command "make install"
end
-template "#{build_directory}/.env" do
+# Project directory
+
+template "#{project_directory}/.env" do
source "nominatim.env.erb"
owner "nominatim"
group "nominatim"
variables :base_url => node[:nominatim][:state] == "off" ? node[:fqdn] : "nominatim.openstreetmap.org",
:dbname => node[:nominatim][:dbname],
:flatnode_file => node[:nominatim][:flatnode_file],
- :log_file => "#{node[:nominatim][:logdir]}/query.log"
-end
-
-git ui_directory do
- action :sync
- repository node[:nominatim][:ui_repository]
- revision node[:nominatim][:ui_revision]
- user "nominatim"
- group "nominatim"
+ :log_file => "#{node[:nominatim][:logdir]}/query.log",
+ :tokenizer => node[:nominatim][:config][:tokenizer]
end
-template "#{ui_directory}/dist/theme/config.theme.js" do
- source "ui-config.js.erb"
- owner "nominatim"
- group "nominatim"
- mode "664"
-end
-
-if node[:nominatim][:flatnode_file]
- directory File.dirname(node[:nominatim][:flatnode_file]) do
- recursive true
- end
-end
-
-template "/etc/logrotate.d/nominatim" do
- source "logrotate.nominatim.erb"
- owner "root"
- group "root"
- mode "644"
-end
-
-external_data = [
- "wikimedia-importance.sql.gz",
- "gb_postcode_data.sql.gz",
- "us_postcode_data.sql.gz"
-]
-
-external_data.each do |fname|
- remote_file "#{build_directory}/#{fname}" do
- action :create_if_missing
+%w[wikimedia-importance.sql.gz gb_postcodes.csv.gz us_postcodes.csv.gz].each do |fname|
+ remote_file "#{project_directory}/#{fname}" do
+ action :create
source "https://www.nominatim.org/data/#{fname}"
owner "nominatim"
group "nominatim"
end
end
-if node[:nominatim][:state] == "off"
- cron_d "nominatim-backup" do
- action :delete
- end
-
- cron_d "nominatim-vacuum-db" do
- action :delete
- end
-
- cron_d "nominatim-clean-db" do
- action :delete
- end
-
- cron_d "nominatim-update-maintenance-trigger" do
- action :delete
- end
-else
- cron_d "nominatim-backup" do
- action node[:nominatim][:enable_backup] ? :create : :delete
- minute "0"
- hour "3"
- day "1"
- user "nominatim"
- command "/usr/local/bin/backup-nominatim"
- mailto email_errors
- end
-
- cron_d "nominatim-vacuum-db" do
- minute "20"
- hour "0"
- user "postgres"
- command "/usr/local/bin/vacuum-db-nominatim"
- mailto email_errors
- end
-
- cron_d "nominatim-clean-db" do
- action node[:nominatim][:state] == "master" ? :create : :delete
- minute "5"
- hour "*/4"
- user "postgres"
- command "/usr/local/bin/clean-db-nominatim"
- mailto email_errors
- end
-
- cron_d "nominatim-update-maintenance-trigger" do
- minute "18"
- hour "1"
- user "nominatim"
- command "touch #{basedir}/status/update_maintenance"
- mailto email_errors
- end
-end
-
-template "#{source_directory}/utils/nominatim-update" do
- source "updater.erb"
- user "nominatim"
- group "nominatim"
- mode "755"
- variables :bindir => build_directory,
- :srcdir => source_directory,
- :logfile => "#{node[:nominatim][:logdir]}/update.log",
- :branch => node[:nominatim][:revision],
- :update_stop_file => "#{basedir}/status/updates_disabled",
- :update_maintenance_trigger => "#{basedir}/status/update_maintenance"
-end
-
-template "/etc/init.d/nominatim-update" do
- source "updater.init.erb"
- user "nominatim"
- group "nominatim"
- mode "755"
- variables :source_directory => source_directory
-end
-
-%w[backup-nominatim vacuum-db-nominatim].each do |fname|
- template "/usr/local/bin/#{fname}" do
- source "#{fname}.erb"
- owner "root"
- group "root"
- mode "755"
- variables :db => node[:nominatim][:dbname]
- end
-end
-
-## webserver frontend
-
-directory "#{basedir}/etc" do
- owner "nominatim"
- group "adm"
- mode "775"
-end
+# Webserver + frontend
%w[user_agent referrer email generic].each do |name|
- file "#{basedir}/etc/nginx_blocked_#{name}.conf" do
+ file "#{cfg_directory}/nginx_blocked_#{name}.conf" do
action :create_if_missing
owner "nominatim"
group "adm"
notifies :reload, "service[nginx]"
end
-package "apache2" do
- action :remove
-end
-
include_recipe "nginx"
nginx_site "default" do
nginx_site "nominatim" do
template "nginx.erb"
- directory build_directory
+ directory project_directory
variables :pools => node[:nominatim][:fpm_pools],
:frontends => frontends,
:confdir => "#{basedir}/etc",
mode "644"
end
+# Updates
+
+%w[nominatim-update
+ nominatim-update-source
+ nominatim-update-refresh-db
+ nominatim-update-data
+ nominatim-daily-maintenance].each do |fname|
+ template "#{bin_directory}/#{fname}" do
+ source "#{fname}.erb"
+ owner "nominatim"
+ group "nominatim"
+ mode "554"
+ variables :bindir => bin_directory,
+ :srcdir => source_directory,
+ :builddir => build_directory,
+ :projectdir => project_directory,
+ :qabindir => qa_bin_directory,
+ :qadatadir => qa_data_directory
+ end
+end
+
+systemd_service "nominatim-update" do
+ description "Update the Nominatim database"
+ exec_start "#{bin_directory}/nominatim-update"
+ restart "on-success"
+ standard_output "append:#{node[:nominatim][:logdir]}/update.log"
+ standard_error "inherit"
+ working_directory project_directory
+end
+
+systemd_service "nominatim-update-maintenance-trigger" do
+ description "Trigger daily maintenance tasks for Nominatim DB"
+ exec_start "ln -sf #{bin_directory}/nominatim-daily-maintenance #{bin_directory}/maintenance/"
+ user "nominatim"
+end
+
+systemd_timer "nominatim-update-maintenance-trigger" do
+ action node[:nominatim][:state] != "off" ? :create : :delete
+ description "Schedule daily maintenance tasks for Nominatim DB"
+ on_calendar "*-*-* 02:03:00 UTC"
+end
+
+service "nominatim-update-maintenance-trigger" do
+ action node[:nominatim][:state] != "off" ? :enable : :disable
+end
+
+# Nominatim UI
+
+git ui_directory do
+ action :sync
+ repository node[:nominatim][:ui_repository]
+ revision node[:nominatim][:ui_revision]
+ user "nominatim"
+ group "nominatim"
+end
+
+template "#{ui_directory}/dist/theme/config.theme.js" do
+ source "ui-config.js.erb"
+ owner "nominatim"
+ group "nominatim"
+ mode "664"
+end
+
+# Nominatim QA
+
+if node[:nominatim][:enable_qa_tiles]
+ package "python3-geojson"
+
+ git qa_bin_directory do
+ repository node[:nominatim][:qa_repository]
+ revision node[:nominatim][:qa_revision]
+ enable_submodules true
+ user "nominatim"
+ group "nominatim"
+ notifies :run, "execute[compile_qa]"
+ end
+
+ execute "compile_qa" do
+ action :nothing
+ user "nominatim"
+ cwd "#{qa_bin_directory}/clustering-vt"
+ command "make"
+ end
+
+ directory qa_data_directory do
+ owner "nominatim"
+ group "nominatim"
+ mode "755"
+ recursive true
+ end
+
+ template "#{qa_bin_directory}/analyser/config/config.yaml" do
+ source "qa_config.erb"
+ owner "nominatim"
+ group "nominatim"
+ mode "755"
+ variables :outputdir => "#{qa_data_directory}/new"
+ end
+
+ ssl_certificate "qa-tile.nominatim.openstreetmap.org" do
+ domains ["qa-tile.nominatim.openstreetmap.org"]
+ notifies :reload, "service[nginx]"
+ end
+
+ nginx_site "qa-tiles.nominatim" do
+ template "nginx-qa-tiles.erb"
+ directory build_directory
+ variables :qa_data_directory => qa_data_directory
+ end
+
+end
+
+# Replication
+
+cron_d "nominatim-clean-db" do
+ action node[:nominatim][:state] == "master" ? :create : :delete
+ minute "5"
+ hour "*/4"
+ user "postgres"
+ command "#{bin_directory}/clean-db-nominatim"
+ mailto email_errors
+end
+
+if node[:nominatim][:state] == "master"
+ postgresql_user "replication" do
+ cluster node[:nominatim][:dbcluster]
+ password data_bag_item("nominatim", "passwords")["replication"]
+ replication true
+ end
+
+ directory node[:rsyncd][:modules][:archive][:path] do
+ owner "postgres"
+ group "postgres"
+ mode "700"
+ end
+
+ template "#{bin_directory}/clean-db-nominatim" do
+ source "clean-db-nominatim.erb"
+ owner "nominatim"
+ group "nominatim"
+ mode "755"
+ variables :archive_dir => node[:rsyncd][:modules][:archive][:path],
+ :update_stop_file => "#{basedir}/status/updates_disabled",
+ :streaming_clients => search(:node, "nominatim_state:slave").map { |slave| slave[:fqdn] }.join(" ")
+ end
+end
+
+# Maintenance
+
+cron_d "nominatim-backup" do
+ action (node[:nominatim][:enable_backup] && node[:nominatim][:state] != "off") ? :create : :delete
+ minute "0"
+ hour "3"
+ day "1"
+ user "nominatim"
+ command "#{bin_directory}/backup-nominatim"
+ mailto email_errors
+end
+
+cron_d "nominatim-vacuum-db" do
+ action node[:nominatim][:state] != "off" ? :create : :delete
+ minute "20"
+ hour "0"
+ user "postgres"
+ command "#{bin_directory}/vacuum-db-nominatim"
+ mailto email_errors
+end
+
+%w[backup-nominatim vacuum-db-nominatim].each do |fname|
+ template "#{bin_directory}/#{fname}" do
+ source "#{fname}.erb"
+ owner "nominatim"
+ group "nominatim"
+ mode "755"
+ variables :db => node[:nominatim][:dbname]
+ end
+end
+
+# Logging
+
+template "/etc/logrotate.d/nominatim" do
+ source "logrotate.nominatim.erb"
+ owner "root"
+ group "root"
+ mode "644"
+end
+
+# Monitoring
+
munin_plugin_conf "nominatim" do
template "munin.erb"
variables :db => node[:nominatim][:dbname],
target "#{source_directory}/munin/nominatim_requests_querylog"
end
-directory "#{basedir}/status" do
- owner "nominatim"
- group "postgres"
- mode "775"
+prometheus_exporter "nominatim" do
+ port 8082
+ user "www-data"
+ options [
+ "--nominatim.query-log=#{node[:nominatim][:logdir]}/query.log",
+ "--nominatim.database-name=#{node[:nominatim][:dbname]}"
+ ]
end
include_recipe "fail2ban"
+++ /dev/null
-#!/bin/bash
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-cd <%= @srcdir %>
-
-git submodule update
-
-cd <%= @builddir %>
-
-cmake <%= @srcdir %> &&
-make
-
-psql -d <%= @dbname %> -c "SELECT version();" >/dev/null 2>&1
-if [[ "$?" == "0" ]]; then
- ./nominatim refresh --functions --address-levels --website
-fi
+++ /dev/null
-LOGFILE='<%= node[:nominatim][:logdir] %>/restricted_ips.log'
-# space-separated list of IPs that are never banned
-WHITELIST = ''
-# space-separated list of IPs manually blocked
-BLACKLIST = ''
-# user-agents that should be blocked from bulk mode
-# (matched with startswith)
-UA_BLOCKLIST = ()
-
-# time before a automatically blocked IP is allowed back
-BLOCKCOOLOFF_PERIOD='1 hour'
-# quiet time before an IP is released from the bulk pool
-BULKCOOLOFF_PERIOD='15 min'
-
-BULKLONG_LIMIT=8000
-BULKSHORT_LIMIT=2000
-BLOCK_UPPER=19000
-BLOCK_LOWER=4000
-BLOCK_LOADFAC=380
-BULK_LOADFAC=160
-BULK_LOWER=1500
-MAX_BULK_IPS=85
-
--- /dev/null
+server {
+ listen 80;
+ listen [::]:80;
+
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+
+ ssl_certificate /etc/ssl/certs/qa-tile.nominatim.openstreetmap.org.pem;
+ ssl_certificate_key /etc/ssl/private/qa-tile.nominatim.openstreetmap.org.key;
+
+ server_name qa-tile.nominatim.openstreetmap.org;
+
+ root <%= @qa_data_directory %>/current;
+
+ access_log <%= node[:nominatim][:logdir] %>/qa-tile.nominatim.openstreetmap.org-access.log combined;
+ error_log <%= node[:nominatim][:logdir] %>/qa-tile.nominatim.openstreetmap.org-error.log;
+
+ rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent;
+
+ location / {
+ add_header Access-Control-Allow-Origin "*" always;
+ }
+}
46.235.224.148 1;
209.132.180.180 1;
209.132.180.168 1;
- 8.43.85.23 1; # gnome
+ 8.43.85.3 1; # gnome
+ 8.43.85.4 1; # gnome
+ 8.43.85.5 1; # gnome
}
map $missing_email$missing_referer$http_user_agent $blocked_user_agent {
server {
# IPv4
- listen 443 ssl deferred backlog=16384 reuseport http2 default_server;
+ listen 443 ssl http2 default_server;
# IPv6
- listen [::]:443 ssl deferred backlog=16384 reuseport http2 default_server;
+ listen [::]:443 ssl http2 default_server;
server_name localhost;
ssl_certificate /etc/ssl/certs/<%= node[:fqdn] %>.pem;
index search.html;
}
+ location /qa-data/ {
+ add_header Access-Control-Allow-Origin "*" always;
+ }
+
location @php {
if ($blocked_user_agent ~ ^2$)
{ return 403; }
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+nominatim refresh --postcodes --word-tokens --threads 4 -v
+
+<% if node[:nominatim][:enable_qa_tiles] -%>
+pushd <%= @qabindir %>
+if python3 cli.py --execute-all; then
+ rm -rf "<%= @qadatadir %>/old"
+ if [ -d "<%= @qadatadir %>/current" ]; then
+ mv "<%= @qadatadir %>/current" "<%= @qadatadir %>/old"
+ fi
+ mv "<%= @qadatadir %>/new" "<%= @qadatadir %>/current"
+fi
+popd
+<% end -%>
--- /dev/null
+#!/bin/bash
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+date "+%c === Downloading and updating latest data from OSM"
+
+cd <%= @projectdir %>
+
+# First execute any maintenance task that may be there.
+
+for task in `find <%= @bindir %>/maintenance -type f,l`; do
+ date "+%c === Running maintenance task ${task}"
+ . ${task}
+ rm ${task}
+done
+
+# Then catch up with the database.
+
+num_cpus=`cat /proc/cpuinfo | grep -c processor`
+num_cpus=$((num_cpus - 2))
+current_load=`cat /proc/loadavg | cut -f 2 -d ' ' | sed 's:\..*::'`
+
+if [[ $current_load -lt $num_cpus ]]
+then
+ INST=4
+else
+ INST=2
+fi
+
+nominatim replication --catch-up --threads $INST
--- /dev/null
+#!/bin/bash
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+date "+%c === Refresh database after software updates"
+
+cd <%= @projectdir %>
+
+nominatim admin --migrate
+nominatim refresh --functions --address-levels --website
--- /dev/null
+#!/bin/bash -e
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Note: the script must return 0 only when new updates have been applied.
+
+date "+%c === Checking for new versions of Nominatim"
+
+cd <%= @srcdir %>
+
+git fetch origin
+
+if git diff --exit-code origin/<%= node[:nominatim][:revision] %> >/dev/null; then
+ # signal that there are no new updates
+ exit 99
+fi
+
+git merge origin/<%= node[:nominatim][:revision] %>
+git submodule update
+
+cd <%= @builddir %>
+cmake .
+make
--- /dev/null
+#!/bin/bash
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+date "+%c === Starting Nominatim update cycle"
+
+starttime=`date +%s`
+
+<% if node[:nominatim][:enable_git_updates] -%>
+if /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-source; then
+ pushd <%= @builddir %>
+ make install
+
+ if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-refresh-db; then
+ date "+%c === Database refresh failed. Stopping updates."
+ exit 1
+ fi
+fi
+<% end -%>
+
+if ! /sbin/runuser -u nominatim -- <%= @bindir %>/nominatim-update-data; then
+ date "+%c === Data update failed. Stopping updates."
+ exit 1
+fi
+
+date "+%c === Nominatim update cycle finished"
+
+# sleep a bit if updates take less than a minute
+endtime=`date +%s`
+elapsed=$((endtime - starttime))
+if [[ $elapsed -lt 60 ]]; then
+ sleepy=$((60 - $elapsed))
+ date "+%c === Sleeping for ${sleepy}s..."
+ sleep $sleepy
+fi
# DO NOT EDIT - This file is being maintained by Chef
NOMINATIM_DATABASE_DSN="pgsql:dbname=<%= @dbname %>"
-NOMINATIM_MAPICON_URL="https://<%= @base_url %>/ui/mapicons/"
+NOMINATIM_MAPICON_URL="https://<%= @base_url %>/ui/mapicons"
<% if @flatnode_file -%>
NOMINATIM_FLATNODE_FILE="<%= @flatnode_file %>"
NOMINATIM_USE_US_TIGER_DATA=yes
-NOMINATIM_PYOSMIUM_BINARY=/usr/bin/pyosmium-get-changes
+NOMINATIM_TOKENIZER="<%= @tokenizer %>"
NOMINATIM_TABLESPACE_SEARCH_DATA=dsearch
NOMINATIM_TABLESPACE_SEARCH_INDEX=isearch
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+#Data source name for the database connection.
+Dsn: 'dbname=<%= node[:nominatim][:dbname] %>'
+
+#Path to the folder where rules data are stored (geojson, vector tiles, etc).
+RulesFolderPath: '<%= @outputdir %>'
+
+#Prefix path of the web URL to access the rules data (ex: https://nominatim.org/QA-data).
+WebPrefixPath: 'https://qa-tile.nominatim.openstreetmap.org'
+++ /dev/null
-#!/bin/bash -e
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-# Change to Nominatim directory
-cd <%= @bindir %>
-
-num_cpus=`cat /proc/cpuinfo | grep -c processor`
-num_cpus=$((num_cpus - 2))
-
-while [ ! -f "<%= @update_stop_file %>" ]
-do
- # Send output to the log (logrotatable)
- exec >> <%= @logfile %> 2>&1
-
- current_load=`cat /proc/loadavg | cut -f 2 -d ' ' | sed 's:\..*::'`
-
- if [[ $current_load -lt $num_cpus ]]
- then
- INST=4
- else
- INST=2
- fi
-
- ./nominatim replication --once --threads $INST
-
-<% if node[:nominatim][:enable_git_updates] -%>
- pushd <%= @srcdir %>
- if git fetch origin; then
- # will trigger recompilation if necessary
- git merge origin/<%= @branch %>
- else
- echo "WARNING: git fetch failed."
- fi
- popd
-<% end -%>
-
- if [ -f "<%= @update_maintenance_trigger %>" ]; then
- rm <%= @update_maintenance_trigger %>
- ./nominatim refresh --postcodes
- fi
-done
+++ /dev/null
-#!/bin/bash
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-start() {
- start-stop-daemon --start --chuid nominatim --background --make-pidfile --pidfile /var/run/nominatim-update.pid --exec <%= @source_directory %>/utils/nominatim-update
-}
-
-stop() {
- start-stop-daemon --stop --retry 3600 --pidfile /var/run/nominatim-update.pid
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- stop || exit $?
- start
- ;;
-esac
-
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :plugin, :kind_of => String, :name_property => true
default[:openssh][:port] = 22
+default[:openssh][:password_authentication] = false
# DO NOT EDIT - This file is being maintained by Chef
+# Automatically generated records
+
<% @hosts.each do |host| -%>
<% host[:keys].keys.sort.each do |type| -%>
<%= host[:names].join(",") -%>,<%= host[:addresses].join(",") -%> <%= type %> <%= host[:keys][type] %>
<% end -%>
<% end -%>
+
+# Manually maintained records
+
ridley.oob.openstreetmap.org,ridley.oob,10.0.1.3 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCohCtONR/6e/RvHnLlSbvl0GqY+EJeTn+Sxu2PyWsw+W1OAfa2jmb2DQg7S54CwbkyI/owJdVrM8Gj3s5CVOi1kIddu7+pbkqrIZKo4Mf+jviFypyZoGYHnPSBwEfgAWKtfBepnbW2RIZ9+JEXLjUyOFwU6jT8QnQMKJc5FiDP3Q==
ridley.oob.openstreetmap.org,ridley.oob,10.0.1.3 ssh-dss AAAAB3NzaC1kc3MAAACBAKzNiUprAK/uF6ippll2gTyE7QIYg8kcE1a59/4iyyh56ChG3W4bq8jgA6ZLvJRks+rbKnjs98duqFKFoGC7sXmvNvLGD7jtSbAUkiPzNUsQ1uwPatNJk/mY5zzHjaxmgOUfA0EtDxKgvxli0atn8Xj8PGy49BbtlBPdnS+tItQ/AAAAFQCO2II1Su14H1gaeU0ogUCkG20ePQAAAIEAo0+0I7Ha53KM9xJWt1qQAVTV3FTGrOwrmedpz6JYcyELhNhC/ZUDOXu5GKqkp5SRcXZ9NRV4FiDMZgKvMGyvRcF1ZOkytNGtx12FiXAzVsM55O+hszLouqZocJVXY6Km3SKmVkymGi+unoowCHWMWJEIAjz80KyR7dsXHQKqIXEAAACAdlDbeOLTQLcgwTGRMbJR63fz6zvQQMZVJ3DDYzQxiW/0qB2CeaB0CuS9DDSJBLVlp2C9MIVnDxxaQi1KmUOvNs2fqb0NEZ8AQG7clCASgf9nXN0EBju+dZ+lGcB6c5ZIcDB/z0gFEp/16sHe8bay70Zp+S4ot6jXD5UM/pLSmF4=
+snap-02.oob.openstreetmap.org,snap-02.oob,10.0.1.4 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKyiu+/H4R/Dx1dzhWIH2Z4+SHyhgo6xONxKjlC6te2blHPjbiWgZzS+WWQXj8siiv6w98p/DonTV/+tqW9RP7fJLca0UBjexQwZBGxjBWPsMCG5bdjWLtiQCN5vVD5Hy3A/6TUeHFYfbSbEuUO+VZVHR6fVMJ0sHHy9eIIwDNsyzGoi2SDB/QsuNgSK8y0TGBQzqHPv0AAGhvmvRONGO/htLZ3lsSuvZQ0D9NPx2fNbcFzkPsOUH05I+1+Wq3tnB7doJ/+hzj6/+wyPZar0zqhNs9YJrKrSOxiltVNnObwFHWvEZabHF3jKDNzmr4IHYUgEMwoMeHvXwI1ly0xz8T
+snap-02.oob.openstreetmap.org,snap-02.oob,10.0.1.4 ssh-dss AAAAB3NzaC1kc3MAAACBAJPM2TEec9aDLSkHqKHQ6mLj9Z2SFsCWIA63kxUSw8wOZMFY7nkoYw9N/ieNLCpw/cfVO7W9Lo0TNXbnSew9js6Zvs6HvKQq+gzTVbBwep5s1jzjxeXUmVBx7Ifef3Fy2vpDUhNigS7tPjw6lXP4EZTnTmzXM7tUHO7EdUX9SiajAAAAFQCyZBIKfsp0XFvi8udODBp8XDHgOQAAAIEAgVA5BUZVTGiD61bSEnbnDCVtJRUVInCeyWspw6gWD1xVtWcxkgznayGINl7E7BtSMuIYXKaagCkr0bEyTaeZNspJhRPEYxqKKFlipvBFZB0KbblrRRfURA5HZmlIZlTlf2hyNpIEEIzPLXkwTgU43wRfsaBl7Pkzwo/3zMfF5+sAAACBAIfSYe40ueqHSxP9X/j0K0LpF9qprmA3P1N4+vE8vVOJsAnTQuXMcVNKdyN1bATCtGZKMGWOPnpiBaXK8K8ckiRrE/nNfyvSKBcvyvPLQ9yyN3BYpXak+GAj3sJCekl6tQwD4Z9N/0229+Ot2/ymJ0lrnyHsI8+p2Gj2als4uAXZ
urmel.oob.openstreetmap.org,urmel.oob,10.0.1.6 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC/Z50neDHObFvqY7SjrvtebendKtlfZ5KdpUHJXzootFg5zli09HaMep8YuEqBK9n1H06qnLQY6Hr3tKUEMBjjn1VS/hiB3OQlAqci0YEqcgwyiBTz2Etkb7lDXgJVDcFA5Pjj5sKnXw7gi4Nmkgg6cfQb81fed1ySGArcFY6PFQ==
urmel.oob.openstreetmap.org,urmel.oob,10.0.1.6 ssh-rsa AAAAB3NzaC1kc3MAAACBAJr/RfX1uZxsD/wuhnTwManZnbVET7yjqGx9H9oVXgDfGNDpk22U0/7VKh0BVHi7iC6Z92YWgCG2Os/SuZgOLqXxdJAjZv9iYqBFQBszzBjGpbtpmOZPzi4q/B4KtXmsiWVPk/eQoW7JodeaalGEflJbYY4rdtfNhWl7uR79NH9lAAAAFQCGJ68LbEk6z0t0fV6UuM2C3KDODwAAAIEAilB3PdoejxgWtd5zVWfK1pYooWyplBp0/qkQ/WV1sT/4+LsuDk1ttszD4DkyvSFwgXKULdcWl56YI2+rFS9busxyNVhM8u5ou7rMvL/laNqkruK8FGdObo1CrpqNS1CuTEcZnIXJcz9grYdmwx9Vt51V0TP7ExKggijX0FmYN4YAAACAJZy0ekCJk2l2kJwTN6D7J4NLIip4Xyv7YZhOuguhEXjmowQrAqsXRyBED0cMdC4DuUOO0AmbLJ7cw/IJ9rf5d87ZVRx8EBaGLd+WAtDGoSsLnYgY9iRWpKkYqfhLAwSfXA9d5iO1rh+FWngLsCBJ3aDurJvQHCw/xVai76tnWTU=
#zark.oob.openstreetmap.org,zark.oob,10.0.1.8 ssh-rsa
katla.oob.openstreetmap.org,katla.oob,10.0.33.40 ssh-dss AAAAB3NzaC1kc3MAAACBAP4oHi33lAVyP8zjoRZe6kxcZGJi1JOgF1vpZqEsxA97yCaLGVjc2cdxi16namqdJ/DgQaRpGRM+chP6AgGN9FD8Z6Wfskm+2sghPpcGRUkr7u6mM7WlJ0xQehD4LDcxFEpZKxtalf6TlxXn9cO0VaL9NNVrpU34c2Pqxl7wg/QnAAAAFQCB10EQxYDOnsxN2xrSHEbmgA3K0wAAAIAWN0b4KREM6Uc6FVkRtOjkiAR8FWmCg8nNQaqlKIPlM4hsrIcPC5yZfc7BzamQSy4PpHNGZG64CkYr8tn8LGWouHVKKbeFOWEXIBsRBSf1NNaYI7cS7WPnGVOmkt6yHvWwPlDcVO8FpPUL9pA7kf6iCuQNdD/MyOBHdbVoU9LcNAAAAIEAsXBb+3EZhsRAYL9Jm22PsrsW2o/hO7aomMeEXvVGG8Wuy77lqmcIvlyW3zhHBs7ubI9TZz1XDsgLK9giCkmqCyKmUsTXGsu9e4veOq+sgvXdbhoBMVi90IFsPLPUdPN5mfovBDHkwi60VtDwOLAX368pFfBfSA50CZWfhwUu26E=
thorn-04.oob.openstreetmap.org,thorn-04.oob,10.0.33.41 ssh-dss AAAAB3NzaC1kc3MAAACBAKZf6qtRHGHjPfOP3drwO1m28l4fpN5X5c8ArkeKhV3aTzY404uwCsSvfYQUw/s24E+989MWZxLUO0Ib+nV+hWlK0nxI85bQPIvOjaWNtbggOfNdz4VyNcLxxzsiJqNhQpGQ3LW2zQ7fsP9pM5ALAs7MDOaSdNja58aUgEMY1ta5AAAAFQC1r9L5Mkax780fOnwkDB6eIaNjCwAAAH97vSxdyRel4IucL4Ckn7Y/zVwFeLpwHiVP41MN7dO2aApuWvsygLU/FUAouv/3PRug/bAAS56w2/JLKVvyo1aRPNHAvgPFEDodqLc+dnC1bXFu1VR69ntQYTEe6iReLlwzeEPLwTW5ucGHddXVbP2jG3R+JEmGGt87P3JxicCjAAAAgH5H4Ra0f4+LfMyJbVpoJIN9wPrC0bbNEJUVIOmtPpxRE4HvoqDOBE8XfHIunhNeTxK5Yzfinz+fCq2XCv/8Sgrr1qJBUQwi9kHfRBNmRJyoylxY0b33Dpsk5kxcAl06+sSugl/OcbXAyW4H3d+dQAUMlRPEVzQCgd98gGrTFF6p
thorn-05.oob.openstreetmap.org,thorn-05.oob,10.0.33.42 ssh-dss AAAAB3NzaC1kc3MAAACBAKZf6qtRHGHjPfOP3drwO1m28l4fpN5X5c8ArkeKhV3aTzY404uwCsSvfYQUw/s24E+989MWZxLUO0Ib+nV+hWlK0nxI85bQPIvOjaWNtbggOfNdz4VyNcLxxzsiJqNhQpGQ3LW2zQ7fsP9pM5ALAs7MDOaSdNja58aUgEMY1ta5AAAAFQC1r9L5Mkax780fOnwkDB6eIaNjCwAAAH97vSxdyRel4IucL4Ckn7Y/zVwFeLpwHiVP41MN7dO2aApuWvsygLU/FUAouv/3PRug/bAAS56w2/JLKVvyo1aRPNHAvgPFEDodqLc+dnC1bXFu1VR69ntQYTEe6iReLlwzeEPLwTW5ucGHddXVbP2jG3R+JEmGGt87P3JxicCjAAAAgQCYjNImXo+2xnRT7T/JiHh+eNl8I5i/sjB4KBaHizKuJnwH4heLbPtmbI9ze9MV0IHJp/289kwT3bSgj0nY9zi9Ucdry0WtPgGQO4JbDZXzCBhwa6MhZVLAIOKU34fK6AIuZqzQJwXeJZuCIiwaoliUwY+QwNcX3rQho80eaK6XFg==
-orm.oob.openstreetmap.org,orm.oob,10.0.49.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAn68BVVd15SyHq1vdXYZukNkoxBPlNBgA8gcaXjlQg917A8gXcHaJQ04xSwt/jkbbvELNuvYDuw0EZAqQQHG1vYsXffg8bYrEq/WUs2+oc1O6iiR3xrzgDWAdefEVk+Fk8TXRGI3dy6IBpFoQ6ywvNCbFvVcB41FLRtBGOWdJFZM=
-ouroboros.oob.openstreetmap.org,ouroboros.oob,10.0.49.4 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC0b16+oF2QHYj+iIS2YT5VnH8KfdYckm1ujYSo5WitGONMqhN872W6krqYbW7GjFvrJ2d7GbNaY/3VeVURLumgWBnit77bExpga++/QYsE90DSoiQMeUT0Q4QuPWXcTIzAcGesda4VtQkTRBTt1UlmdEGBP3eDAqL2GoW4DBPCiQ==
-ramoth.oob.openstreetmap.org,ramoth.oob,10.0.49.5 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgnWJq8z9xvNFujhE0P040rCO1yEsH8pnQmGOGehIRcfclQBd2wOO22+8kpy04BMT9FaFdxjgNTUWtfCwT+oBsxbHIreahld34vFVCw/VSCiPEuUhBdZ+fN9hdLGygrnKxA1b2cIs532nm4LLDoP2VpM4RZuh6da+LV3eHnfDlZHO870=
-ramoth.oob.openstreetmap.org,ramoth.oob,10.0.49.5 ssh-dss AAAAB3NzaC1kc3MAAACBAMjYCKyJfA9/EQWTxwqqGBq88dAaWWG0j+ggoGEYuIWqcdA1NeF70BIiRGvAV5/oBy+p/snd0LAxDG6KnWglOo/0cjzcfys/RQl9kTa6gkcFPp9lUqRnuDF+y/egZVTU3KF376k930nNdODMe5PxECnZdC51158Zga9Hwj0+5nalAAAAFQDnh0Gx+gt+6Qc1r74FeNCiIPmzIQAAAIEAs81g5c2sF42ATY/gd5ustNXm82xfIAuRGeMCgxyXBvFM5UXuLnfOx8JVB8wu9eoSmxhDiuVX7ija5FaKAAucPBXWh/YImH+T3SOWLsxfDh8XglH4NvEtj1r+90VWbX/f1Qy7IsmmBolUCr32qD5cdeQ3JPxvUvO/TdSHaIgGK30AAACAZiVJOiM9mfMf05rAg9fjo+NKxL/jsbZ8ptTnNOFBNjq0XydXQF3Rnt01b/cUSv94VmuJgv9hq9L39nk/dSnBVQbKwIYyB0/NR2Fg0sYHpo4qj+7MFndv+ct9pVd+l9pmlEoR8soLeO1hSVeSmj9YvDzc74lx8FYMVE6+yed8ltw=
-spike-01.oob.openstreetmap.org,spike-01.oob,10.0.49.6 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDHhi90mKvMe+FL1pdzBPWUfC+a0ckv31Qou7Yby1Kn9xhrR5oHvyoT4bc/xPrYvaxRZUHWn+J66ZdylhyfCZf6/5g8xghJoYVAZJn9yCV0R7xw2fzHCgue3iS/Yrep2V3DRaXt/zy+PCe7wZX7InLLtp1rV/Vx2xG3lV91OGa4Zw==
-spike-01.oob.openstreetmap.org,spike-01.oob,10.0.49.6 ssh-dss AAAAB3NzaC1kc3MAAACBAOE5d8RsNmFZxWkcwXHisg5NowzVyvYjW/cXmDRkeN9r2gvjDRj+WU8CIo4rhVhbJIepEA/BUkzEyDBrBOydFa/pFH9KN+tRnSabRHaVweXr337KX9ltSGoPijSwUlDhVITMMSZ5v50tJ9bokyZEYbgpbzPo+slqgMFbR3fr1MvbAAAAFQDWzbv+xMTMOYcQQ92MCaQKtsXCJwAAAIBW02qjzbss0X9TACVhGHGbAy5DcfybmY8JZhfUgqR0xI5rCufUW5+dY7EQu3FlE8bC/R1rPrks7wngmut6xPMtkpcpMYFoxFPgP8/xfwkTNYMs2J5Vbrb6k6e1XMKt9AID+QzhEjTVxmwLKAT8uZGDZjY8ujYnQMbM3wPbCbv/MgAAAIB4xUK2Of6YBWBOpW/0GPfFH/of8Txv2ErpVmTSTOFaO7KD6x4jcKjn9nFMvVUhW/c52UYYcscE6uArd3XNbJBw/H58i26V8RooTkQVWhKNbp9ktXPh8yADNzVq/rRW6kvNYHZbbTev7WZ0NPvz2aIrTLKPcEcUwLq4wpNBe//1LA==
-spike-02.oob.openstreetmap.org,spike-02.oob,10.0.49.7 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJfkctRhGPVyPY18EVcegsABPTC7PsCA6Pt2UOkkzANJKkwrOUJyn5GqgJYHkOb3hWqPlS89zdlV9kXlvTdUZ8QKw4xys/5H5+CWwbag0h1EpDR9S0xO9gIgX5DgyB5Y7oNS8o9AolF+hgyUdmBYO3ff+h7eu1PnqBn8TfquqVcw==
-spike-02.oob.openstreetmap.org,spike-02.oob,10.0.49.7 ssh-dss AAAAB3NzaC1kc3MAAACBAMxbg3AjYJcMX0jlgyXslqLbi3MV1zAVunNGqFOipJCW3thZ/D780MbQiXuXglqJQxWsELy+8RVVjt6/rcnZHORsH2H8M0/3WdlEUW0FxMUISXUAVtto0Fk1v4QznUtyxoKIg7sXktmreaNEcLBA7Le1bOBf/Oz14uQbmI4nycelAAAAFQDEMSn6sAPKhEYhYJiFYsDoV0aWfwAAAIAG9y+c73QbYqHBOdNISG22W0BYAnUj1L90lW44xNnmrVOc+CdTKG3VnAQcIc5BeB75sfE29JOmUGfR3/clCgCL54V8D+gEH3omtSG3eG7B+OoWhcUIoIfgO/3w2ZactdU8lA2qwSfZ0p7xLPsrDN4wuORPYFpoOU/vV9hG+dh7VQAAAIEAuk45eD65i9Gx6hHQuCoN5EGQHhL5qvO2gbShYLNqEhkDN+TmdTLK4Wbevy6tOdCrCRKP5zhoycbqm448hINFtwBPXGfRfhDsAGm075pMwljlh/LU3lSXbSU1RkmiXqjYqcjl0ntxkv2qA+zN7G1/oJK85pwScyiMo9kOuwyh3+M=
-spike-03.oob.openstreetmap.org,spike-03.oob,10.0.49.8 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCvTY6CDpJgBcU5T0l7Hmn6UkLZw1d0EQEPlcQM1UvLfdSKayVR79Yl31eVWFbA+R+QqQ8LKcmzx6ztWPuemW3Ym/gZ7NNYH10y1Rw9LywWhVnFOjKIBUVJmjdiuxftyCPveHu672k1KJ+bApXlA3/oMBmtCckr2Wod2qJDx7JIeQ==
-spike-03.oob.openstreetmap.org,spike-03.oob,10.0.49.8 ssh-dss AAAAB3NzaC1kc3MAAACBAKHL6HuJER/kKOFoGbPvQ0ghCw5lJ4ACsZHi4ptTwpBh1rx+/mmktTU6/U+cP8ocGo2XIuoCaBMfNK/eqrh37a8/fZah5+wxwJBWnZqncOhJT9EjRfvRtbJr8GRtCukNxX554zsQBSqCn9CIP6E62EqbYUf0qfROX5o3SZVu2WzFAAAAFQCWHnuBktRY7R5n2ZuCL1Cdx5hevQAAAIARZiVCIAKIJerBY4AnGADzRf/m21PkhksRIKcqge8vDI5z8MMgYkmtcrlqgGPEavnajBPlAF8DdDFRbx/4k8K5ZZdr+4ipp2++V7fbkg6n2MMwR7qTN3FpoNtLwXSHLlsueAArRW3RNlYdtx9wZppUq+cGlqr0J8jXS4UOLH3MdwAAAIA3Y4EPZv6PufNBppuegYI/gziypGwlNc//XODoIagXyDclGxGnqh36J+AUWxuILQeHRTZzdLCVazFZt+EGJeKI7/C3yJOkSp3vNnre4VYmGGRp1hcBKWDVCltjv+phRMXGiuGSQdqCy+AfkGSctNQafRnQuaL5hLBytHxbXIADhA==
dulcy.oob.openstreetmap.org,dulcy.oob,10.0.49.9 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgmlwXGPIPDqoMz4s5edr+G4iuBnCYcFXjY7Et9jG/ezI6aIKd9lEOXvnHJX5hrC21aqd06dhyMLwZN+eSjJhXNaLtYmm5P442H2ZnGca1KNSpF7yRVhn0eRpX39xWK3biVfMw64mzvV3636C1adCkgBwuaqCvz1EHm/KRrySfuETFLU=
dulcy.oob.openstreetmap.org,dulcy.oob,10.0.49.9 ssh-dss AAAAB3NzaC1kc3MAAACBANcuNreghg/8rJAmfsdD3Rp58vN84Ee1oEFMgGSxF6+yEVTbXrjQoH632jiBXSayQLXGEzrVTsGaWgujK9xT7OinNa52ydnJ/WZp5qK5FdW95h5m7pnUE3Jmm2cPmYpEJW62OeMStmTGkK0EvN2wwRLuts9R1NK63tWjFWik7QmrAAAAFQDNtW3WKlCugOFZnjIh3fBuDakdlwAAAIAzy/pxXiix8yKhlb0LQJ1izilnn2IXRvAHv4aM6LAiq6QIDj2XyT9oTS/77BguCw39WhVG599eOSRckWXFgUT2p3pWBBuuDbLEhQqIc0KgufYh/ygUdjf7zs0O2jusFkLMPgF/0IgRs/ftb36ERn3KJ4C1P0v1ABk9t55Qs985WAAAAIBZFS2HS1ewjv+/jAdUH68zT0mNBctnrqM8ixqT1Xd2Tl7SKjl6Sz9yer+6+Gq7O50U0FBS0pQPo3f9msazQU6BFYCzuSFRIJQmH7uKGPHHA7mbuow6sEOhtXBzq1VfI4addXyWlYLKXxv94/gt9xlxLZHqU4ZZb3GPGbU7kKJA9g==
ironbelly.oob.openstreetmap.org,ironbelly.oob,10.0.49.10 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgwDkRqR1VRgHOON8M7YCNnIG8k0zukAN/r4L5fPKTvWmdhe17UnxywPc+TySjXqNsXQ/jPLGvpO5uoSG3dgT2N7NUdAtdL4Enb87dX7yTbJTJzMMxTb9HSI1SL2/5iSefyAVVo1+R8DMmFqTWa2eFHoD9IoxFSNSTarTZQgmH1oZYoZX
tabaluga.oob.openstreetmap.org,tabaluga.oob,10.0.49.14 ssh-dss AAAAB3NzaC1kc3MAAACBAIQNHSK0uo1CehCFag09Hd+bJ+CDD0LPWoE/6B8Ye3woVQw8XhJPIygWyHlsFo4rbgkTnvz4ooKTUHnisEIoAA6hlqFTVP1LQQarkmba5Gf05x42hYKjM6mYvcoDMAdnkPueqKIa2CQVNCg3sopI2isxaUUWPEqrVeTMgI40ofd7AAAAFQCSNIl/McB7R/7q4fFxZ2dVGtvJGwAAAIBNRHSJrnm4IDYufJetkWyn4KEIkycUMDs1WE1H1LbtmsIaBAGaz1QJKclPCin+hCv/Rne4oPoZWGl3SqB7hjBkvKUOKRaMp4eG1YCpEvAhgNIFjPkgdekctQ1H6/+7CkQmMVelh78cUMOUYEoky7ISiaKUT3z8O9EEjPIndreNBQAAAIAQeqPxG9B+RJtcOqnW5d9M8VVUNeW10A2R2AMtTEH+/hjaoXUPpL3bQ0Fl3aWQKYJMRpOM64GgLswEhxeWf0PzSAi5CwBmyhIEUJpJ0jHOYSUXC6sLpBMV1ad4gF/63CBAgL1fUnQ/FWDtZwDEnBksDbYSS6EJB5m1o1vOx3SHWw==
odin.oob.openstreetmap.org,odin.oob,10.0.49.15 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeK2EVK4rbsdoTq84Cl5kLhbJk7gbaNav61yFuSKfSsizzbH/tzxmiFA7mtB39WU/BlFsTHAg1mHY7cCPE01E811CDPIQhZGEyloh5ftbTACCcGAjKBhYpwTPEteBqlIk3lpN1TNTsnJSYaQay3rbOQ+IXTb8nzKYjTgANQ6QXxSq4BfuRmvMRlNw7ZuIerhs8OL2G/pxldL6AYDPDFXBs9mvvqqS0fw8rzxkjFNUc/z9odFoChtlZVbp33/LTIBQU1dY/XTxaekErjT7H93KG9NP8mmIFZtU8oRo8553ogTYVxFr6hD5D6KkbveaFU9oBDRYlJPWtdHksF8RAEpjN
odin.oob.openstreetmap.org,odin.oob,10.0.49.15 ssh-dss AAAAB3NzaC1kc3MAAACBAMxXgZGeLxWyQCErmy0aGppk2/xHj3GTATPCQgf/Mtm5PYK7c3x8Z/fEop/BBnY2/YDE709g28Tv+61I4SD9D33OO6ABPEapHEwqp3CIYuA8+JFJhuo6Sz9h9bca6fx/KVjdDq9wbmx5IOqEFQlBoCSGJvYw5pTptVFN+nLeiTLjAAAAFQDt76BO4R+GaDn6/SeJvP3xAuqkmwAAAIEAgbhpMfB2Gk+babYDnWTWMkFO1FObUdi8/3NmiS1XUPCzdGkL1h2psoQIMXFtrNfEzSPx320rjC17T+JD1KGzXTBsPSd49MhznMc13JK2YT6KJm3io1CLKuzje4SxrpddM1Uvs/sOLmeAbdNqlUsAM8KUedEYTo/SXeVecos6dboAAACAasbTSjiTPW3NwH1yrEV8xWFCAmsmAPvqwGjaLjrrDdNQCbJ0KHMY+lbUAmT6oZ5qcrwwc2A6B+/v9XBISiT5XWELdP56bhuDcWC78aJDdtfDK1xuMtsHX5tpQcKB7IrPI+2UYVhz7zosvcCbn8FukgDx8sEcp28rHaFB5WPCjig=
+lockheed.oob.openstreetmap.org,lockheed.oob,10.0.49.16 ssh-dss AAAAB3NzaC1kc3MAAACBAKZf6qtRHGHjPfOP3drwO1m28l4fpN5X5c8ArkeKhV3aTzY404uwCsSvfYQUw/s24E+989MWZxLUO0Ib+nV+hWlK0nxI85bQPIvOjaWNtbggOfNdz4VyNcLxxzsiJqNhQpGQ3LW2zQ7fsP9pM5ALAs7MDOaSdNja58aUgEMY1ta5AAAAFQC1r9L5Mkax780fOnwkDB6eIaNjCwAAAH97vSxdyRel4IucL4Ckn7Y/zVwFeLpwHiVP41MN7dO2aApuWvsygLU/FUAouv/3PRug/bAAS56w2/JLKVvyo1aRPNHAvgPFEDodqLc+dnC1bXFu1VR69ntQYTEe6iReLlwzeEPLwTW5ucGHddXVbP2jG3R+JEmGGt87P3JxicCjAAAAgQCFBaTPsbNtWlUSsGnRzObp3NVC6MOro10p4qSXB0kwAB+hQx/IrIH8BjduR+b6Uv2cm/UMnGRzS/1lGYe15cSs0V/IOUyXdVeX+jB0TXzS4hTqclGKJ0Ay2WEsgW27IdPxIjQg/W77s9AZ2UlyEtT7gK2oergD60yUvRfLLJioYA==
+norbert.oob.openstreetmap.org,norbert.oob,10.0.49.17 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAHaxesONNY+jIQmZKVKjsg5PPTYytFpBG9qx5Qjgk7PoPt4VcxZu0X3snv6toy2s4zjmnIo7+T014+ihKF5RzzYB3sRwHgx2QIXp9zjCkeB8HCSyMsnKWUoJcyxDrVy0gS0GgbmzIAL3n47budeyxYW20Bk9iy+b4z2KUGJnMrmhJ76eZkawtsr1DxRIrCWDrXNz66+msk7v/3DDUZFAACkPEF83YVECiNsBeKn5nm82W16OEFKOMsQXM65DjPTzH4iKajlA2j8DTf5qOtgiGGtLVQ8b5erwibgbXFfd1wWsqxhEP25z5omnheSujCkhYoZJ4+larVgqU+CUvCHE7
+snap-01.oob.openstreetmap.org,snap-01.oob,10.0.49.49 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcKedgjsKRd3zPnZkJNL7iZYHay+KBd73bw4PjyHmblyUOcdtMx5yEntBHGcWAs5lwc4mNZgKbSJfuuW142oq+r+3I8UzcvYQGJKAvR5quKCn/c+iDkX56SQvh7SOtgf0K2K0dfHdQEh/jw56AewKcPxgCV5vBJ63ce0gETq3/Fj6mJwIYLU1kjyJiyusng9EWlgbodx8ma1zFM0dlxdHxeMkE38pcnrpOxNhV7qbGY9doU2VFUPQnCQOzpUtLr6n0J8l/1ubPnBsN/VAAYGMNbxwGgpUt+Hpwgl7dcn+1FQfFUUL54inUuP7Y2EV1bEY/WyhfLDkMRwgm+X96QctT
+snap-01.oob.openstreetmap.org,snap-01.oob,10.0.49.49 ssh-dss AAAAB3NzaC1kc3MAAACBAL7X2T4wZtS3IUAc4YiwmM96y6dCC95Rxx1ybwYd37muYousIUYA4W5h9uUQivSmcrjfEQB4kvL6Ie3fEElMnY0Zo3hVcbC5fknJ4Xmfk03Ubg6cVPAkI2xfDsmh0zlpo70WbWSB9d/NuSkRb1rE3LwIk3dn5N5l8+HZjF3jpe6NAAAAFQDV2cgvPobL9hg6v4cx0ftM8sFs4QAAAIEAuYP9hGd/O8C7fMYKqD9w8VnCSgiKRV+KZyyAQBl89mm7VjFlDwu+9yxhQ7VRMSaLVVY3oeHWo5H5Fd5ajRBOpQZRIfjQ56c2kEfuQ31Ind7gqUDRGypNSpWti7Tw5ELTzfV2JPyWQVXQAmoEKzqYsOYktwWmjVCjI9wiiSoPrXkAAACACUoUI2o3eO9wSTiha/arqt4qkTHiESi7L9IuSomAr7JpvMMcCanKVSqhOV22wS08z7IVz2bVAIjzzMCf08b8Z+l8ypKtMkrDqkLr2MwkPR6cX85v+TMAdZ1kEDjWSLqsvcQOYLSlkKWDp3XbSO8G8GAQL4Vkk1uenMs7YSPVCWg=
karm.oob.openstreetmap.org,karm.oob,10.0.49.50 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgnWJq8z9xvNFujhE0P040rCO1yEsH8pnQmGOGehIRcfclQBd2wOO22+8kpy04BMT9FaFdxjgNTUWtfCwT+oBsxbHIreahld34vFVCw/VSCiPEuUhBdZ+fN9hdLGygrnKxA1b2cIs532nm4LLDoP2VpM4RZuh6da+LV3eHnfDlZHO870=
karm.oob.openstreetmap.org,karm.oob,10.0.49.50 ssh-dss AAAAB3NzaC1kc3MAAACBAMjYCKyJfA9/EQWTxwqqGBq88dAaWWG0j+ggoGEYuIWqcdA1NeF70BIiRGvAV5/oBy+p/snd0LAxDG6KnWglOo/0cjzcfys/RQl9kTa6gkcFPp9lUqRnuDF+y/egZVTU3KF376k930nNdODMe5PxECnZdC51158Zga9Hwj0+5nalAAAAFQDnh0Gx+gt+6Qc1r74FeNCiIPmzIQAAAIEAs81g5c2sF42ATY/gd5ustNXm82xfIAuRGeMCgxyXBvFM5UXuLnfOx8JVB8wu9eoSmxhDiuVX7ija5FaKAAucPBXWh/YImH+T3SOWLsxfDh8XglH4NvEtj1r+90VWbX/f1Qy7IsmmBolUCr32qD5cdeQ3JPxvUvO/TdSHaIgGK30AAACAZiVJOiM9mfMf05rAg9fjo+NKxL/jsbZ8ptTnNOFBNjq0XydXQF3Rnt01b/cUSv94VmuJgv9hq9L39nk/dSnBVQbKwIYyB0/NR2Fg0sYHpo4qj+7MFndv+ct9pVd+l9pmlEoR8soLeO1hSVeSmj9YvDzc74lx8FYMVE6+yed8ltw=
-thorn-01.oob.openstreetmap.org,thorn-01.oob,10.0.49.51 ssh-dss AAAAB3NzaC1kc3MAAACBAKZf6qtRHGHjPfOP3drwO1m28l4fpN5X5c8ArkeKhV3aTzY404uwCsSvfYQUw/s24E+989MWZxLUO0Ib+nV+hWlK0nxI85bQPIvOjaWNtbggOfNdz4VyNcLxxzsiJqNhQpGQ3LW2zQ7fsP9pM5ALAs7MDOaSdNja58aUgEMY1ta5AAAAFQC1r9L5Mkax780fOnwkDB6eIaNjCwAAAH97vSxdyRel4IucL4Ckn7Y/zVwFeLpwHiVP41MN7dO2aApuWvsygLU/FUAouv/3PRug/bAAS56w2/JLKVvyo1aRPNHAvgPFEDodqLc+dnC1bXFu1VR69ntQYTEe6iReLlwzeEPLwTW5ucGHddXVbP2jG3R+JEmGGt87P3JxicCjAAAAgQCFBaTPsbNtWlUSsGnRzObp3NVC6MOro10p4qSXB0kwAB+hQx/IrIH8BjduR+b6Uv2cm/UMnGRzS/1lGYe15cSs0V/IOUyXdVeX+jB0TXzS4hTqclGKJ0Ay2WEsgW27IdPxIjQg/W77s9AZ2UlyEtT7gK2oergD60yUvRfLLJioYA==
thorn-02.oob.openstreetmap.org,thorn-02.oob,10.0.49.52 ssh-dss AAAAB3NzaC1kc3MAAACBAKZf6qtRHGHjPfOP3drwO1m28l4fpN5X5c8ArkeKhV3aTzY404uwCsSvfYQUw/s24E+989MWZxLUO0Ib+nV+hWlK0nxI85bQPIvOjaWNtbggOfNdz4VyNcLxxzsiJqNhQpGQ3LW2zQ7fsP9pM5ALAs7MDOaSdNja58aUgEMY1ta5AAAAFQC1r9L5Mkax780fOnwkDB6eIaNjCwAAAH97vSxdyRel4IucL4Ckn7Y/zVwFeLpwHiVP41MN7dO2aApuWvsygLU/FUAouv/3PRug/bAAS56w2/JLKVvyo1aRPNHAvgPFEDodqLc+dnC1bXFu1VR69ntQYTEe6iReLlwzeEPLwTW5ucGHddXVbP2jG3R+JEmGGt87P3JxicCjAAAAgEitEET7IzW9j0lgxcgXT9JgzDR/cbQdlYSwV6rcWvHW9cz1ArWmJ6BY2AJ6CG3wTznVbHPupiFKf0jvkX0omKu8K90f5FJc2/BkUP4aG72YmAoPVe4bflGykvKJE9Rd4BDyPWGqI955Okp3VGCEKXBS/fwnoOZlei+9ex334hK2
thorn-03.oob.openstreetmap.org,thorn-03.oob,10.0.49.53 ssh-dss AAAAB3NzaC1kc3MAAACBAKZf6qtRHGHjPfOP3drwO1m28l4fpN5X5c8ArkeKhV3aTzY404uwCsSvfYQUw/s24E+989MWZxLUO0Ib+nV+hWlK0nxI85bQPIvOjaWNtbggOfNdz4VyNcLxxzsiJqNhQpGQ3LW2zQ7fsP9pM5ALAs7MDOaSdNja58aUgEMY1ta5AAAAFQC1r9L5Mkax780fOnwkDB6eIaNjCwAAAH97vSxdyRel4IucL4Ckn7Y/zVwFeLpwHiVP41MN7dO2aApuWvsygLU/FUAouv/3PRug/bAAS56w2/JLKVvyo1aRPNHAvgPFEDodqLc+dnC1bXFu1VR69ntQYTEe6iReLlwzeEPLwTW5ucGHddXVbP2jG3R+JEmGGt87P3JxicCjAAAAgBrDGGrP1jST/axY9UTs1q0ljkET93/vIitbc/C87pe08ccQUL/PUn0GTrVhXps2Q2nfg2IuI32vYYy0lNKXD53NOpu5G0ZxEB6BYxwejwD5YLZhJQD1mtZ5JvyAPeeWfZa15ZRoI0qzg9RxzB5bp4cRKtHxFcGRAj1jjHkN+80x
+pdu1.dub.openstreetmap.org,pdu1.dub,10.0.64.100 ssh-rsa AAAAB3NzaC1yc2EAAAACAQEAAAEBAN5kJioLsL+Oant6nkdwDyFoAmzJGFEUKaL4gTScrQvRX26oJyI9kBDCM3PHgkVqfA6mj96z4PU6WZuK7fz5QUAE4C3vzgnJ2rew/jGTaf45gFj9GgdRD6ilwFrmCaJtLmm+BmuYjWFXZSkVm0vhbo5lRxtrykjicowYuRFj6mm2MXcDdzua3FjnwEwKK+ArBtHPBnuheyPsaZ55wnXJRnN19gbMYPYfJ0XsN1tRkF09o8Jljpziyr7Z0VIfw7O8vC6t5wz1hp8wSB3QMSuNG0Ze0zwoVyxG6h8Uuna5N9SIOQrQDyjPaIb0wpZItAzfjttFvFt6OPpp68NA+CKDV88=
+pdu2.dub.openstreetmap.org,pdu1.dub,10.0.64.101 ssh-rsa AAAAB3NzaC1yc2EAAAACAQEAAAEBAMmzndbQ6jQLNiVJJH9dpz6kOB+xhMM3Yyp/lvSDZ9GwrX04I8KALOTHhW9/Pzq5X4EhcI4aFy6zEspFI5JOnntjWdM/gXBSqG7QW4r2BSaGmmqAsjzHi3uJ8R76oMd2ckI3fsLIX/x2AVo72M0lq1nuTjeC296vGZByUPUXtq/dKN+pW7wFvCljuFp23Y+uNY7jBTqsoTE6R7FrTJnLHMK5na8wVXY+bDWXJeX4knGIg/qDxkK9kCWv+Ghq6wC4D9oJlF5URC+MpZ8nfD7wB1YVVHhwlmnbAOp9OsZNVZNX3V++5WDtWmFGPCMdxwnpfC8MuPwy2HnLZcAWp0mA8aM=
+oob1.dub.openstreetmap.org,oob1.dub,10.0.64.102 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCZrRoYLxml8E86L8ZsKWtLPvVhzt0ng5upbGR/ZE93p1StVGE/rGECjrttuO0xiu3BsIiKtjil36gg0qHnYvZsbVakJ3nLvaA7wSiIQ4rfFP57YlYAaIR/Hgjju9PMFcsQj+mQPiowj6f7W/NdxTVuDBIJjN2D+V0e3KMHrJE4frEcAxUsJBYTfBHdR7qriRqhZDKLdZMnDcurf02PpdOKC0lqlaBKEIDHnj3451R8xOolC3HsFKKfy5CgTqj5+hvb1huzZFGWjasP5cs6/HnbgcOo6qhtrLtboo7AFqpW1oDGTx7A/004bWJYRRhSU+BtmHzchPdyov6XtyaLz7GIWycJkLzap24gb8nPOzDINNiY7IVYZejEja03h/jncptONg1NVn7rIrd9CwO4rJKAndDDjtgZKv4HoXr3RR9+t0Zx+6HAAnNuOnIL906H/bYBFSP5LdgfnLPQoPdFLs/hUjRY1vAKCh4bvLC+GXwdhga93tbtv6cbwUG37gob3/8=
+ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEn1uwIVWRyNma7X/OKwiqUjaf54eooToWM/0x6kjmIJcl5A4wmzCKG6iVvZezwfRPQo4jbz460QPLzJxb+pBYU=
+oob1.dub.openstreetmap.org,oob1.dub,10.0.64.102 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILvhhWXsbYCeIaQkMVEdlljr8GpzEL4taVWxvRzJa4ap
+fafnir.oob.openstreetmap.org,fafnir.oob,10.0.65.2 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5myokF4M8yOu2EtUoos0CVp42V3BBx14BErSqdtWwPkgQIOxgvaUOkoFLUwtXW5pm1+4WIcvweT0OVNHpEQSftWlTJqn2Wt5pM8wkpvc3hoq8oqzP0qboW5KCQ+WODClEV3btmQMdAZk+BB6EURS5asE8kqEJsfFx9HnVTG1NZLndrTvdfq64pQa2k+r1AvA1B2bv/ehQEte4oaS3Y8eKCBr8HowKcOUzO8sw692yBaT3BdjI7joX8GpQhm0YlrWtBTPDKLiyxLmTp8AO4mQa7Ezmm/LgTRXpsZs/lDK8/Bwv9h+isKO8HQnmNfGLxpM//9FRohFrcol6RnCFExO5
+fafnir.oob.openstreetmap.org,fafnir.oob,10.0.65.2 ssh-dss AAAAB3NzaC1kc3MAAACBAJoBOa5MEN6rqklvC2eeoxXqX/24GBqODeYTbH5+pB2i5Z84ldiZcAr2Web4nb6lDquk9ZShsrEEHFT6v9JUdMfKEd9cXWA5nkmpZap2g24nWYYP7i5JUhOcoLvlMGhO5RpudZWoAIF8Jxgmd8asnXUtESRS5PdlSqW2g1NzxSVHAAAAFQC/3HKZb1gdj+IcV+GWGAS0lgdOFwAAAIAbaPKdC3Xr9skzDqkmPRggyLA2iQSwFQwYaqcR1NHntTgNSyMByrPljRXejqKfJGKS2ZurdgDzAAJ1X7GeWDS+dY9ogaTPq0GzGuRLLgrURJAeiXbCj2xiX5prfhw1e+JOT8fYVun+9rNqYuYZpByNWmHhpJ1zrSas4G3AE8eTSAAAAIADOhcdOHcHOJT+Q/V0vXBptP2Fj8MDL+wrYBkAWfyC2aIGnYOPWTsCkQjf5i7eQOPPCUGab3nXzQxIA3DCqMlhSTf7iS/lofY1KNs233pw8qRmPvjBH6U+tlBs9WmuPPN+NDvdtD/St7erdy7zFieF4e33cA3Wdnq+DXoqO2ojsQ==
+spike-01.oob.openstreetmap.org,spike-01.oob,10.0.65.3 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIrpo9i/nmFZ/7/HSADKEytQhaip5mOERFf+JgenyYF7xQorX2NnuFI9QRoq+n7Xfp11p3kNYjeyZoWUVv/T1y27WgvOyH674fuIhFbdTzuww3upRVEJcbG06mAQZXcxXqlB3ceidtWzbB0/S5oNNF3aL6Zij+lAkgxwguIb7OVM5s80ASEtVCTdugftKx6rshzpF6bKsyqbEQhQOaNFzhEArGHzJldNwM9FHoDHMnpKyIX4Rd2dwp/GaAn8BIlpFJ9la9fukGsBi7fgW992Dfi6CG/aH5Gdnu10msiFd6uL3GpabUIckJTz1Ou6LDNzcsRq2U4trCSzlrAsc3z3Vt
+spike-01.oob.openstreetmap.org,spike-01.oob,10.0.65.3 ssh-dss AAAAB3NzaC1kc3MAAACBAOJRKZI47qDtkvF0OSf0hJ1ctv+MjrzaZkhzi81LOXvCYgXOxmVNFi0TIRCRaTF6Rbuig/L5NZAHGeDRy6Jrt0lkolb2FfUfNzVJ/MKk2MU04wGGviLTTNdyoUDlrxnrpGspycoUpdce+cft5ofroH7a3r8QfZdqc6xnUCUiqA8JAAAAFQC9Q2R7qs16JhLjmllgF8xcZ3yNsQAAAIBONsokg+DvBMKCbCSAD1dVXbRlayK7yG584RgblfWNg8fdI7Yf70wi2x9lQHKYzlRsBTVxgJ+uCv46EoGMNaXwjhxusX9KLk5mTcs2lZwf6DODrPbsJyty0HwFAkgTvbwtwHkEkejT2JgbD1s771H3UaXCXpddndUtUOrFOb58fAAAAIEAneTYZ3QBCja2LWLkFg2ZQjZXAxMrwyInyVpWGDrAL9DOdoTQsUuU9tSRuRO9O0LwlRrKnGK/bIjGYh3jRd07IbGeN8zGBfpSCpZH+zeLh3zq+AndoGedh391AcbA3/hiqUV1jMJo22zPoH8TeJJArPXtA7mYB+ITuipT97ZFnQ4=
+spike-02.oob.openstreetmap.org,spike-02.oob,10.0.65.4 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXlO0w/s1h99D261F0UTEHFrigmhntNOIk5BKwUsEhPBK1yIoV70hU86J3/leLFa2WB8b17SrhfMpooDuM7ImtNkdzoY/pGaQ4Mukxwy0mLgAHhgJbcLEPVUBKg2nw8ZdkMgi8JvYyHj4wSgPTZ4TftdihFJUyaHUOAgfvRS0v9CraAGaRbI1nIDfcRu+zEolmtCJ/JGW6FJW4upBHcZ5EX8E3xYQtVzqG84YRERni9o+beNF/LOtZbfeYdKGhNguRBdILVio8+uIKeSjDGQ++/dMOfQygb6hQT87FHJdLxjr4T8qSVPOaUHxNivj0dUdgKenVDGGPCo729vGYZwy9
+spike-02.oob.openstreetmap.org,spike-02.oob,10.0.65.4 ssh-dss AAAAB3NzaC1kc3MAAACBAM9sgtDyaoDN+zZ1O0GL2OVBNp+pJOQ2nUs2Y4zMSN3LL07a3i/pdy6Cz5kIxqul9EMriOvpKUvBZvWTG6V9ScGr6ZXdGbzZMYuGRRMVk4t49UTazffZOgtFoNBDO15UpBc1Q8rFEstOHDQRRAVYhcCxmmhpvlRHK4AnUpkjPr6TAAAAFQDJr4+TkASy2XqmugQYGs8k8xy91QAAAIAhsMY6a/aUOdU1mgrg3O7X8W+Jn440oCSD5qitlbgfbO+blR/R3jfK99EQIpQrnz7ZGWHUv4c33DceJAok7z8E9I25CLdC6MH3QMFSn5urPyYtPn8pduAGeMgks/ITtyDECmn7Bycf9lHvNnoNQMjnfuoS9dLHPuunlc/nBNGM/gAAAIBJbSk20oP1gFSQOKBZuT8iu1A/K0K3f8yAQRLbL7jJwv4VVpfJjcipuMl4U3u204YwNULXQcl7x1YDTz9bR75PMQNGNvIogJY1Y6h5jdobF3Qq7pXqu1Vzlkgru4+Ztxh6i0mkr6JjxEg3D2fbYTkoR7789ye0gQr21e/R2jCvcQ==
+spike-03.oob.openstreetmap.org,spike-03.oob,10.0.65.5 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKNLVCJAoMnqNDTeQiBvbr/K8IGNnxObFsyIIdKQwJBPrgZIaJNNTmQLA7S+qiVrfhreBaJA2Rbz+iEiXvKz5195Wxsu1voxx+vvhoYeaC3e7M3KECDtB+wPfxoWLMXrvhtu5599M3P7HBFiz1IpwsWL6sL/N6id3NAqZiBlEYcPkhzhoqA5We/wf5AM50patjhYVT7VdV2vYts/MssqiQQvHaGAB6jkCGwenOKKsbA3hXzB5dHEh0KaF+0O+4E/UUDEQcBBXuBxAqDCLdrgvBmW9e7uw3CrOVIOR1ZQLsbIPh2R0KEiUipE4T92v/67o3xaS9u82mgHBK42gIGqLv
+spike-03.oob.openstreetmap.org,spike-03.oob,10.0.65.5 ssh-dss AAAAB3NzaC1kc3MAAACBAIfTJyVOnjN6oQicm1UGUvFAOx0zcihYV9/29r/Xgs5Op/kRZ3XGii1nx1BOY7Ck/G0mMUulU87WDY8lY0C+DegeBpXlEbeH1/DXBzo/FPCsuIB8kSO/NywlS2FPuUjd22xa62iOaNXlRVQY8OC2ROI8eWcg2gqLhc9GyT5P5HMPAAAAFQDv4eyy2ABYQKfANOoXabrVSNOEPQAAAIBCLUXHvi4ZuQYVQ5nr2W0759zUJbanOK0Ot1F51Kzj1GxoIBSjDNfAyGNnWzV/llFAUi+zLpdA1pET7dDkXp+TIhByraioGiOjGxNCf4cn9TIs9jGZb8jB7nwkL8qCIRZjRqM+lHrEsGtbiJ/eJS4eP1sN9AFmWFk6nHdRrI1QcgAAAIBo6u1IdJvUyJlUYvxT412so4lR24v8olRZv5NTzG3pfRRDCHWtkpXnkNM/V3Hhbei9AaIIjM+sYGEgPHtzXa+friAQt5B4nz+p3Acm7VpatcuFZaxJpnExbb5IC+waXCIi6/f9//anCggzedqrqfHXZoTN6zZkZ833xeyCxczCJQ==
+idris.oob.openstreetmap.org,idris.oob,10.0.65.6 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCiPCJ3dA6oh92HgSktihP27uOb3NP92u5+3dMSdt6v+d+wgsuKzStUZeoDivLgV2Utkw1Ax4CuzCaYSFJ3JGYwpFY9/ifds5O5SuAOPjgNDzy0ODYKCbur6L3pt69x2P6SnbzA5FfJeCpusJBzT9Hi4ZFuL+XHVti9j+oaK4Ipw39k9xcZwzpuHqwSWs7GFEYJpIvgv1C4MUBMgYcsne/SEEYEE29dzERDR0Lc/tcZK/WHh7hgM9TbJV4BkDF+BVwxnKrbPqUZOJMW9IrdPHhHS7esDglJFKPpZEOy8biLeYXrvRYb9E0pSu7iEbpIro3WG7+lKpfeHAtxLOTarKLr
+idris.oob.openstreetmap.org,idris.oob,10.0.65.6 ssh-dss AAAAB3NzaC1kc3MAAACBAJ1Wt/2OHRM2eQe+b/tXExi4vVKG+SV+d7nqX4ko7mJkNjRxfnRgx4lzLoFXPoAPPcN5uYpNvXlp3hH4LP31f8N5ZshFI7HN5LhsWpPhP6RnRKPzi7V2cuxPYqvai3fnOG9Big6juUI5J3aYZ9zzjRq9YWmpmC5EwC34NMM/HAdtAAAAFQDRDdL9v/jvgyyVEEWpfVsubT03jQAAAIAkoO+0Ri+eJtf18XnftcMj0nHNrApFQ9Xnau6lIJRqvqvrvb1DVZr1qTSlaQSTK7NBoc8HE+aVaFRwKkeFkVJKDR1doO/bKrN3LOFmFpOIPuZK0hE4wYtaZYWou4BYen0ZrKmxZ6dUjfaqJ/7vxRQFbholpVch+GTKi1QkKZ2ylQAAAIBEAKbiJUpyuznphsJS5AzA4xXq2e1yx40pkW/qnwsswWVOxzDa9/yTPyQqCNyJHX0WLwb37G7ciqsei/6HJtcuil/A0RVK4RT+7NkZN+Nh8Y3oL1s5w66gv+6C/iAtscOa0gvkwGdAOvNN9Eb11G5wv+OCcX6ffLQhUrweOVWWeA==
+konqi.oob.openstreetmap.org,konqi.oob,10.0.65.7 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCTpZOi5g9Od2iDo4FEylFN1v7KYiX3//L7eAi8cafAYNipnRVl+dwDrgXJ3qK1QLSRia9eLWyWTFxh8yOCnHq2uH+5vUlaxY1GY1V+ABNPQGIZDYCAGOQiWrTg9L54sjtQAe0oLBI+e4NDPUSuUgNOgxDkSDKOyxSMRmF8ti7V/OFHoXc3VbAgcngLx/P2neOnl7lnacgDfgyEPARHs/c+mloKKcA3o83Dkcej/pmw0uea8ZkpicGNow+fBy0RUDE2HW/pH5kDfKBTS+QsXEC78d/U3FRDoxbrcJ+DlPv9nk1WSsp343vJ9Ipv49HCsf7hn3H4jGPVIKvbeRLDpMQz
+konqi.oob.openstreetmap.org,konqi.oob,10.0.65.7 ssh-dss AAAAB3NzaC1kc3MAAACBANT//Et5hlB7dyzVWsrC1eO9jkD1LMxdDl/cfaeWMuYWvNjwOD0nB5Hh3rxPicjfcl823NWdLeGKLK8wg5V5wwMtGlgEjwcUvCzxEUFKflpZxP5vaXS7Ar2UG0NTeCnJCzkuhgJbmZ0oiRX6o9/xpBUXY6zpAmWh09ZizICGHA7hAAAAFQD8yb8/C5dtwSngGePMtDxmN9SexwAAAIAluzlHs0D0M11t1h/k82XBWIoUzMyEBkCmC3WRpShYIrjJ7sSsH9+GkNmTki5DXPWn/j10yLPCeIKuTnlvQKGXpF6O2ZI8GH3Vqvm7IovVpT/WO9khYOZkOg4QODQw2vUM3vU0C+uemjP4b6JvkA7Z5k8d6FPwXqmdAJYwK1pVwwAAAIAaEMHKca1NJaKaQGAFma3zkRDy419p95rJnAptkh5Q7j2DXqiag7TmdFSQVTKMZVpm9yPJUYay5c1Jq3KNCFIKncDIn2EG7hhbAeAyYNht+U1mWMls6vaJeoPJ9vgliMkHvyvdmzXJBQJQH4cWJwJMNTE1m1GeKzkO3ZPW8mZahw==
+naga.oob.openstreetmap.org,naga.oob,10.0.65.8 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCinNNW6qam2H2ktHcOz0yruZ+tdvgbHE5Sv4to5blnP5XcbNhjMC2v0dgvgYCjqwWByZV6PU8MbWVcfrrnVJLjHNt2PYpp7oAFotf0+pf+dXEhQaZtoBrH+LcmNlXOmtSamjaHKFEyDjkU00YcxBZbf8+wP4U8+mgfj2thtGSAP6bDBWowpCCn9/NAOd2rw/4wUmSwaplAKbu0LVVD1yLVozdCcKFh6DNI5dLKcxGB4Xh17ifzB3kW7ztDi2a0ENKGQWzgBM1wcwjSxzdp1s+japwBywfvJIJHOuXDTHPAnoGey/q91m6pCHv9UaB3xbQeUGbETg24qV1PI7MwyhRZ
+naga.oob.openstreetmap.org,naga.oob,10.0.65.8 ssh-dss AAAAB3NzaC1kc3MAAACBAKG3O+AUJFyuJvKrVIIwJj5+rAKRfyEPWGCQnm6rT+rswTXFOUEgFSvleRE0daAg1kYJ++Xui8AOvtvM60TYclXsE3iuqyTcRk8fiw4lPXj5ElxfJcpSPDMaLfDFBQuH/CQGN5iPHSPQqF87sTOHyOdKqXPSPT8jF5Yv3A1S1m3LAAAAFQDri6erT0F7Gujf03j/sUvJETC1iwAAAIBi5Tgjncuu7W2Yc4ex9quYdhITBxNlQ1LhpS58S2IG0H5vhWzUNnhgsymfqrrRQM2NkKppLTUOaAwccf+2kZ6qlhxEO6+plAynA4jYi2tXdgvcipgw/avrBY/MCo3EOfydSH7tm3nrk2ZAL9M9zNE/nfVXohV5MOMWmtczuxK9xgAAAIEAidZnFwKTYJW2pYXvNl9U6D9r1LC8yL2lf9upgDqF7gJ0Hz7kv6+57Fd5mV6iWjuEaqGMpu+GhljumB+VwuIm1kq/hl/6y4jHiW+/44y+yyZQI7vFpD3jfCu8ka+v/xnANeP7pg4IXTN2slcOZxtzSDGHndwJvbaKp3Eg82RMEWw=
+culebre.oob.openstreetmap.org,culebre.oob,10.0.65.9 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCCagcuY4af7L3AqMl29xe5em3SUNYQcq+IPnXjbdVBIR3JXMizGPNLov/9PB8sNXOKb4ZapQTc1M2Kzdv7oqyXzfALEgaDOVOd74q9UPh8a9gpevgD8w+TVgnIHP7S26BWpvjaaHp47NiP8npsENAwRcBYkfjZcvCbHccX95efe7ypAiR18An4Zf/hNPL7pl2HJ1c6CSONboC7JovX5YhdRfAXJvSgRgrV809LTKXnTYNSwFk6BiosiY6bw0HT/CHk3DvojvyHb53Ti8ynCAAkylAoScdNFxnG+TMYH4U223EUXLdsCv0E0QkIAxo/Sj7lvwONtZebMKb0aYpXsCaT
+culebre.oob.openstreetmap.org,culebre.oob,10.0.65.9 ssh-dss AAAAB3NzaC1kc3MAAACBAPY0iXbalxX0W9Phx0mECU7N1YmnD5EAj9wRjKpYik3ss3iOXWfzM76NVxcL+f2+zlzBmn6CNOtFctsffJKKuhOWZNQJLmd8kKBoYPmBjEP+3sfNUlbgVNbiy5GgP3O5B6J2sCLq0X6gedCD5iW4SxVW/MyXi0CKhTB8tMUUJb8vAAAAFQDNp5QhlTbB8P4k03POlOUJsofSdQAAAIEAuFRvjD80wVTAwjBFFbnsqF5errn0UTJM7PUraZTQbbHX1tXD2XiM0NC33ayc6ZDjytjmD+rz2ilayMLLEYoLr0QLJZa0+MD2BkT55QcDQrrcdKkiYS4w09Jeu0t5h7ksWcUk3OdCkXrhIn0ZW2dXU6pb3QtgslfqXbKT+D0MeJIAAACAYF8kiVLbJ0V+ciohTtSkFYdjXSMuWv5vTskg4it1qnhuILezzXXcPc/UjPZk5PIQ1S/U8joC/Doq5se/RurNjCh7r1ghig048iUA9ErFCB5TvY8TJ8WAGDB+CYiEgRzX2quEJZcs+noleXXT35eEiLYxpVsn9fXSXq/bYKaVzNY=
+horntail.oob.openstreetmap.org,horntail.oob,10.0.65.10 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDuMo/aMNMWT1Wjr2ac7/sJFtzzJqijdGA3yZR96xPgY3zZX4qQwT1dmr2xU8i7K8EcLuS4oVU6JVNzfLGZycAJUNgA6/yg7FgpmibfY1pinI+7jnEJNH+hp8RuVY30ZNh2iKelNuN3RXKNxKd3tc2eEOZnyv6PcDnwIjL1vML/jezAsQzZtkx6zjPo/pb9jscQTA/rqd9Fv0E2IGrX6Klkz7Z8EXPW2pBK2hURA+9q+dr4RI2Y3hTmg5ynSD3mwgFiRRIt2An0DgBMciC3EnHn9fbApCSTa+O44R8Fr8ZbsYCqM7HV4jDRVFy4kPbqlx6j6r3zQ1SXgHfWeT8lpsdp
+gorwen.oob.openstreetmap.org,gorwen.oob,10.0.65.11 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC96c9B77RfO8fVnGUk/6OP7TkM6giFfa1cn3RK5++8hI2p6o/CA9llYpLYwt5V/rSpYiLKrpKdEpLrU9wp9n43Le6nmxgn60RDCmM/Uvd3VrlO+ZI4jgORtM75tptDbOu8KiPupZt7o6PbUo89WEkWOCZga7RHtIAcrgzDbOGLRNKsKzPqi71BSX3DVpOdOHWXE1iAzzmWzUk/7mgjseN9JR+9CvWJKswrDoUWu3IvSj9Yc0ENbv5rGQqQvGPv+B/Iw81AwcC5AhplhfCG4qtLPjb/SlDpjgsfczvXq/0HO0xiy8FAO3sP4uQCnDOuaBfgYxodmXHkUovlADshH4KR
+gorwen.oob.openstreetmap.org,gorwen.oob,10.0.65.11 ssh-dss AAAAB3NzaC1kc3MAAACBAJSSoNayqaXtsTa016JlK1DVt0gHFeKiPtworoCeYH9++LAYnnZCpfBvXe2O9waSQs8GlJnOkitDZ6RpyY/QDlpY/nPm8QV9DF+79/aRTfdJZE9b9wYEH6qgMQvJfApzg132yCLP9HKEz5YR0iOHe/f5nc2r9TMrvibo2T3rBGDtAAAAFQCsLSwbOYcjXrPq0i+qddvBfvS8IQAAAIB2o6QJD3Yyvr1a1OeJts7bzDhtGx/dYhDS/qRlI1QWJYgnNoq/sb9/C0ZAjWGWMnNQgjQIRtmYgf/6cVLRruwMNQp8Igt0Ut6GLMP8a4aTBcXUJdmjpCTwqzaj7gTQOmrInhMQ+l4Vvnslt2pcvC9SsBJ+tbNFCD48RzAxK6FtPgAAAIBjL+sm02VdW9MmyjqkI2LXP+Zvn4PNYODMNvp1vDQjNxfMAhl+OJuXou01e4TN3WdFmXTxMbWaN0A0h/0a/sAZvthES4W878f9uLMqI+DU0Bag8sPkpsfNRUefUFl+VYi0SAs35aq70EnuHq8dL+l8FpDKXuxo7NmGdr612NEfQw==
+jakelong.oob.openstreetmap.org,jakelong.oob,10.0.65.12 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+HV+Z3bTWwicg7+3coDi0IhMuL6+JSVeqMFkz2GI6jRPsBPCJWFhpfCfzFsHOsyu+BImw2bkEqCnIj1wxwFe0nDwyWEs3CgP06K0BBFcrRInRsn7GNHAzXKBsBRkS5azyA5dWnpv92jnMJUrXmbdN1d2uzb1PVxxSre9ChFcQXSQ5jRikE8dvVHOf6rdKKLuErkLanfydVIZbH6noDWgx3bQAObKzxLg4hf6ki4cTnNbhFB5exM8ZvD9aWgf/jAZ52BDBiVYaf3/qApdeTfeFcwQ7xtbKNcGWmcfWG6ryCTph6QRTuv8yST+V7eNUfWwwd+2ZqDvLzBQmL1YChojz
+jakelong.oob.openstreetmap.org,jakelong.oob,10.0.65.12 ssh-dss AAAAB3NzaC1kc3MAAACBAIAcx7XxrMT+vRrl318O2qbLXe/W3w4IfWPPxJytffThgASQsu2qbm9hv1rNsr5Qgh/+/ZDNJfELHPz8cc1o/UL7PIcDDe56n1cC3KFlbb7VL4vpfHH5BJnld5/4ei0VHTdA6sZfL0vbsEavWH3JTEKdtg1WKsjj8zjTgUbwvnBZAAAAFQDdMdXp3+CQ08hutfYZJFNd5ap0rwAAAIBhlI1PYGiK3HE1iidmdF56m6D0MIDL7kcNrDI4gkpBkYCH0uPHPim8WoSEytUIVCex3OAcx77xccVCR7wTuuubUiGf2o7Oh4Wtv+2WFPwI2l/KZHUZqZkbQCViBGpQTKnsb+0MZcN+dZ92vJ5oA5VATENbS8DqsYf7n39bentDeAAAAIAf6BIQtkn3xf7t1q5RC+7N6g5CFE+/hpmjn2NSUtkq2wB7/EEUJxPz+87k+F8c6Y7Rc2Ev+UhSoWY3gqpnCBexets+LSTuwgAb9JNJGmC3ksn/4AUwY5BoFK14GdQzjRdzDoQnrRR0ojFGdzs59G/4TcsyZ9qDntcgDGHb/5ru6w==
+snap-03.oob.openstreetmap.org,snap-03.oob,10.0.65.50 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUrmWEptEG/L/k2f6haLRtvJnJCFTQWxAY1Nt3yXXAsyum0Egx4ks/Y0fNmTTppxzd8+2coFCeXDXoD3woZCMI/m/Sh20jg9J8/PhESA5kHkNgCqgy9UNNMcvNXEd9djIohM4Q45J2hZ7OFr3/p8BXbP5NgSj2wRXFtctONr+0wzsj4ThhxW5J35ZmvZWXXVbP7zqgesVHfmMTejknNghBp5qniwlzkD/kl8+jKWnSvFyPrKFJvwArEy2NjnrqquTpQcxsX6bwfP4piuQ3PRzHqW6NqQmA6iuqVHGko/uwJ4h9zAJgmS1BEZ33OFGpVRcIqNiNz0uEWhZezrq/MK9h
# DO NOT EDIT - This file is being maintained by Chef
Port <%= node[:openssh][:port] %>
+
+<% if node[:openssh][:password_authentication] -%>
+PasswordAuthentication yes
+<% else -%>
+PasswordAuthentication no
+<% end -%>
include_recipe "chef"
-package "unzip"
package "default-jre"
cache_dir = Chef::Config[:file_cache_path]
backup false
end
-execute "#{cache_dir}/#{osmosis_package}" do
+archive_file "#{cache_dir}/#{osmosis_package}" do
action :nothing
- command "unzip -q #{cache_dir}/#{osmosis_package}"
- cwd osmosis_directory
- user "root"
+ destination osmosis_directory
+ overwrite true
+ owner "root"
group "root"
- subscribes :run, "remote_file[#{cache_dir}/#{osmosis_package}]"
+ subscribes :extract, "remote_file[#{cache_dir}/#{osmosis_package}]"
end
link "/usr/local/bin/osmosis" do
default[:otrs][:version] = "6.0.30"
default[:otrs][:user] = "otrs"
default[:otrs][:group] = nil
-default[:otrs][:database_cluster] = "10/main"
+default[:otrs][:database_cluster] = "13/main"
default[:otrs][:database_name] = "otrs"
default[:otrs][:database_user] = "otrs"
default[:otrs][:database_password] = "otrs"
default[:otrs][:site] = "otrs"
-default[:postgresql][:versions] |= ["10"]
+default[:postgresql][:versions] |= ["13"]
default[:accounts][:users][:otrs][:status] = :role
default[:accounts][:groups][:"www-data"][:members] = [:otrs]
depends "accounts"
depends "apache"
depends "chef"
+depends "exim"
depends "postgresql"
depends "tools"
include_recipe "accounts"
include_recipe "apache"
+include_recipe "exim"
include_recipe "postgresql"
include_recipe "tools"
package "libapache2-reload-perl"
package %w[
+ tar
+ bzip2
libcrypt-eksblowfish-perl
libdatetime-perl
libgd-gd2-perl
libgd-text-perl
libjson-xs-perl
libmail-imapclient-perl
+ libmoo-perl
libnet-ldap-perl
libpdf-api2-perl
libsoap-lite-perl
end
remote_file "#{Chef::Config[:file_cache_path]}/otrs-#{version}.tar.bz2" do
- source "https://ftp.otrs.org/pub/otrs/otrs-#{version}.tar.bz2"
+ source "https://download.znuny.org/releases/otrs-#{version}.tar.bz2"
not_if { ::File.exist?("/opt/otrs-#{version}") }
end
only_if { File.stat("/opt/otrs/README.md").uid != Etc.getpwnam("otrs").uid }
end
-execute "/opt/otrs/bin/Cron.sh" do
- action :nothing
- command "/opt/otrs/bin/Cron.sh restart"
+systemd_service "otrs" do
+ description "OTRS Daemon"
+ type "forking"
user "otrs"
group "otrs"
+ exec_start "/opt/otrs/bin/otrs.Daemon.pl start"
+ private_tmp true
+ protect_system "full"
+ protect_home true
+ read_write_paths "/var/log/exim4"
end
-Dir.glob("/opt/otrs/var/cron/*.dist") do |distname|
- name = distname.sub(".dist", "")
-
- file name do
- owner "otrs"
- group "www-data"
- mode "664"
- content IO.read(distname)
- notifies :run, "execute[/opt/otrs/bin/Cron.sh]"
- end
+service "otrs" do
+ action [:enable, :start]
+ subscribes :restart, "systemd_service[otrs]"
end
ssl_certificate site do
--- /dev/null
+# Overpass Cookbook
+
+This cookbook installs and configures an Overpass API. It can be configured
+to install a stripped down version that can only be used to serve requests
+from the "Query Feature" of the main OSM website.
--- /dev/null
+default[:overpass][:fqdn] = "overpass.openstreetmap.org"
+default[:overpass][:version] = "0.7.57"
+default[:overpass][:full_version] = "0.7.57.2"
+# One of: no, meta, attic
+default[:overpass][:meta_mode] = "attic"
+# One of: no, gz, lz4
+default[:overpass][:compression_mode] = "lz4"
+default[:overpass][:rate_limit] = 2
+default[:overpass][:dispatcher_space] = 10 * 1024 * 1024 * 1024
+default[:overpass][:clone_url] = "http://dev.overpass-api.de/api_drolbr"
+default[:overpass][:replication_url] = "https://planet.openstreetmap.org/replication/minute/"
+# If true only provide an API for the query feature on the website
+default[:overpass][:restricted_api] = true
+
+default[:overpass][:logdir] = "/var/log/overpass"
+
+default[:accounts][:users][:overpass][:status] = :role
-name "squid"
+name "overpass"
maintainer "OpenStreetMap Administrators"
maintainer_email "admins@openstreetmap.org"
license "Apache-2.0"
-description "Installs and configures squid"
+description "Installs and configures an Overpass server"
version "1.0.0"
supports "ubuntu"
-depends "apt"
+depends "accounts"
+depends "apache"
depends "munin"
-depends "prometheus"
+depends "ruby"
depends "systemd"
--- /dev/null
+#
+# Cookbook:: overpass
+# Recipe:: default
+#
+# Copyright:: 2021, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "accounts"
+include_recipe "apache"
+include_recipe "munin"
+include_recipe "ruby"
+
+username = "overpass"
+basedir = data_bag_item("accounts", username)["home"]
+web_passwords = data_bag_item("web", "passwords")
+
+%w[bin site diffs db src munin].each do |dirname|
+ directory "#{basedir}/#{dirname}" do
+ owner username
+ group username
+ mode "755"
+ recursive true
+ end
+end
+
+## Install overpass from source
+
+srcdir = "#{basedir}/src/osm-3s_v#{node[:overpass][:full_version]}"
+
+package %w[
+ build-essential
+ libexpat1-dev
+ zlib1g-dev
+ liblz4-dev
+ pyosmium
+ osmium-tool
+]
+
+remote_file "#{srcdir}.tar.gz" do
+ action :create
+ source "https://dev.overpass-api.de/releases/osm-3s_v#{node[:overpass][:version]}.tar.gz"
+ owner username
+ group username
+ mode "644"
+end
+
+execute "source_tarball" do
+ cwd "#{basedir}/src"
+ command "tar -xf #{srcdir}.tar.gz"
+ user username
+ notifies :run, "execute[install_overpass]"
+ not_if { ::File.exist?(srcdir) }
+end
+
+execute "install_overpass" do
+ action :nothing
+ user username
+ cwd srcdir
+ command "./configure --enable-lz4 --prefix=#{basedir} && make install"
+end
+
+## Setup Apache
+
+gem_package "rotp" do
+ gem_binary node[:ruby][:gem]
+end
+
+directory "#{basedir}/apache" do
+ owner "root"
+ group "root"
+ mode "755"
+end
+
+template "#{basedir}/apache/totp-filter" do
+ source "totp-filter.erb"
+ owner "root"
+ group "root"
+ mode "755"
+ variables :totp_key => web_passwords["totp_key"]
+end
+
+ssl_certificate node[:fqdn] do
+ domains [node[:fqdn],
+ node[:overpass][:fqdn]]
+ notifies :reload, "service[apache2]"
+end
+
+apache_module "cgi"
+apache_module "headers"
+apache_module "rewrite"
+
+apache_site "default" do
+ action :disable
+end
+
+apache_site "#{node[:overpass][:fqdn]}" do
+ template "apache.erb"
+ directory "#{basedir}/site"
+ variables :script_directory => "#{basedir}/cgi-bin"
+end
+
+## Overpass deamons
+
+meta_map_short = {
+ "no" => "",
+ "meta" => "--meta",
+ "attic" => "--attic"
+}
+
+logdir = node[:overpass][:logdir]
+
+directory logdir do
+ owner username
+ group username
+ mode "755"
+ recursive true
+end
+
+%w[overpass-update-db overpass-update-areas].each do |fname|
+ template "#{basedir}/bin/#{fname}" do
+ source "#{fname}.erb"
+ owner "overpass"
+ group "overpass"
+ mode "700"
+ variables :basedir => basedir, :srcdir => srcdir
+ end
+end
+
+template "#{basedir}/bin/overpass-import-db" do
+ source "overpass-import-db.erb"
+ owner "root"
+ group "root"
+ mode "755"
+ variables :basedir => basedir, :username => username, :srcdir => srcdir
+end
+
+systemd_service "overpass-dispatcher" do
+ description "Overpass Main Dispatcher"
+ working_directory basedir
+ exec_start "#{basedir}/bin/dispatcher --osm-base #{meta_map_short[node[:overpass][:meta_mode]]} --db-dir=#{basedir}/db --rate-limit=#{node[:overpass][:rate_limit]} --space=#{node[:overpass][:dispatcher_space]}"
+ exec_stop "#{basedir}/bin/dispatcher --osm-base --terminate"
+ standard_output "append:#{logdir}/osm_base.log"
+ user username
+end
+
+service "overpass-dispatcher" do
+ action [:enable]
+end
+
+systemd_service "overpass-area-dispatcher" do
+ description "Overpass Area Dispatcher"
+ after ["overpass-dispatcher"]
+ working_directory basedir
+ exec_start "#{basedir}/bin/dispatcher --areas #{meta_map_short[node[:overpass][:meta_mode]]} --db-dir=#{basedir}/db"
+ exec_stop "#{basedir}/bin/dispatcher --areas --terminate"
+ standard_output "append:#{logdir}/areas.log"
+ user username
+end
+
+service "overpass-area-dispatcher" do
+ action [:enable]
+end
+
+systemd_service "overpass-update" do
+ description "Overpass Update Application"
+ after ["overpass-dispatcher"]
+ working_directory basedir
+ exec_start "#{basedir}/bin/overpass-update-db"
+ standard_output "append:#{logdir}/update.log"
+ user username
+end
+
+if node[:overpass][:meta_mode] == "attic"
+ systemd_service "overpass-area-processor" do
+ description "Overpass Area Processor"
+ after ["overpass-area-dispatcher"]
+ working_directory basedir
+ exec_start "#{basedir}/bin/overpass-update-areas"
+ standard_output "append:#{logdir}/area-processor.log"
+ nice 19
+ user username
+ end
+else
+ systemd_service "overpass-area-processor" do
+ description "Overpass Area Processor"
+ after ["overpass-area-dispatcher"]
+ working_directory basedir
+ exec_start "#{basedir}/bin/osm3s_query --progress --rules"
+ standard_input "file:#{srcdir}/rules/areas.osm3s"
+ standard_output "append:#{logdir}/area-processor.log"
+ nice 19
+ user username
+ end
+end
+
+systemd_timer "overpass-area-processor" do
+ description "Update areas in Overpass"
+ on_calendar "*-*-* *:*:00"
+end
+
+service "overpass-area-processor" do
+ action [:enable]
+end
+
+template "/etc/logrotate.d/overpass" do
+ source "logrotate.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables :logdir => logdir
+end
+
+# Munin scripts
+
+%w[db_lag request_count].each do |name|
+ template "#{basedir}/munin/overpass_#{name}" do
+ source "munin_#{name}.erb"
+ owner username
+ group username
+ mode "755"
+ variables :basedir => basedir
+ end
+
+ munin_plugin "overpass_#{name}" do
+ target "#{basedir}/munin/overpass_#{name}"
+ conf "munin.erb"
+ conf_variables :user => username
+ end
+end
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+<VirtualHost *:80>
+ ServerName <%= node[:fqdn] %>
+ ServerAlias <%= node[:overpass][:fqdn] %>
+ ServerAdmin webmaster@openstreetmap.org
+
+ CustomLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-access.log combined
+ ErrorLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-error.log
+
+ DocumentRoot <%= @directory %>
+
+ RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+ RedirectPermanent / https://<%= @name %>/
+</VirtualHost>
+
+
+<VirtualHost *:443>
+ ServerName <%= node[:fqdn] %>
+ ServerAlias <%= node[:overpass][:fqdn] %>
+ ServerAdmin webmaster@openstreetmap.org
+
+ CustomLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-access.log combined
+ ErrorLog /var/log/apache2/<%= node[:overpass][:fqdn] %>-error.log
+
+ SSLEngine on
+ SSLCertificateFile /etc/ssl/certs/<%= node[:fqdn] %>.pem
+ SSLCertificateKeyFile /etc/ssl/private/<%= node[:fqdn] %>.key
+
+ DocumentRoot <%= @directory %>
+
+ RewriteMap totp prg:/srv/query.openstreetmap.org/apache/totp-filter
+ RewriteCond ${totp:%{HTTP_COOKIE}} =0
+ RewriteRule ^.*$ - [F,L]
+
+<% if node[:overpass][:restricted_api] -%>
+ ScriptAlias /query-features <%= @script_directory %>/interpreter
+ SetEnvIf Origin "http.*(osm.org|openstreetmap.org).*" AccessControlAllowOrigin=$0
+ # Remove Origin so Overpass does not interfere.
+ RequestHeader unset Origin
+ Header always add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
+<% else -%>
+ ScriptAlias /api/ <%= @script_directory %>/
+<% end -%>
+</VirtualHost>
+
+<Directory "<%= @directory %>">
+ Require all granted
+</Directory>
+
+<Directory "<%= @script_directory %>">
+ SetOutputFilter DEFLATE
+
+ AllowOverride None
+ Options +ExecCGI -MultiViews +FollowSymLinks
+ Require all granted
+</Directory>
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+<%= @logdir %>/*.log {
+ missingok
+ compress
+}
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+[<%= @name %>]
+user <%= @user %>
--- /dev/null
+#!/usr/bin/env bash
+
+# DO NOT EDIT - This file is being maintained by Chef
+#
+# Based on: https://github.com/drolbr/Overpass-API/blob/way_based_areas/munin/osm_replication_lag-api
+
+if [ "$1" = "config" ]; then
+
+ echo 'graph_title DB Lag'
+ echo 'graph_args --base 1000'
+ echo 'graph_vlabel minutes behind main database'
+ echo 'graph_category overpass'
+
+ echo 'lag.label replication lag'
+ echo 'lag.draw LINE'
+ echo 'lag.cdef lag,60,/'
+ echo 'lag.critical 1000'
+
+ exit 0
+fi
+
+lag=$(($(date +%s)-$(date +%s --utc -d "$(cat <%= @basedir %>/db/osm_base_version | cut -f2 -d\" | sed s/"\\\\"/""/g | sed s/[ZT]/" "/g)" )))
+echo "lag.value $lag"
--- /dev/null
+#!/usr/bin/env bash
+#
+# DO NOT EDIT - This file is being maintained by Chef
+#
+# Based on: https://github.com/drolbr/Overpass-API/blob/way_based_areas/munin/osm_db_request_count
+
+if [[ "$1" = "config" ]]; then
+{
+ echo 'graph_title API request count'
+ echo 'graph_vlabel per minute'
+ echo 'graph_category overpass'
+ echo "overpass_request_started.label Base started"
+ echo "overpass_request_started.type COUNTER"
+ echo "overpass_request_started.cdef overpass_request_started,60,*"
+ echo "overpass_request_started.max 10000"
+ echo "overpass_request_completed.label Base completed"
+ echo "overpass_request_completed.type COUNTER"
+ echo "overpass_request_completed.cdef overpass_request_completed,60,*"
+ echo "overpass_request_completed.max 10000"
+ echo "overpass_area_request_started.label Area started"
+ echo "overpass_area_request_started.type COUNTER"
+ echo "overpass_area_request_started.cdef overpass_area_request_started,60,*"
+ echo "overpass_area_request_started.max 10000"
+ echo "overpass_area_request_completed.label Area completed"
+ echo "overpass_area_request_completed.type COUNTER"
+ echo "overpass_area_request_completed.cdef overpass_area_request_completed,60,*"
+ echo "overpass_area_request_completed.max 10000"
+ exit 0
+}; fi
+
+BASE_STATUS=`<%= @basedir %>/bin/dispatcher --osm-base --status | tr '\n' '|'`
+AREA_STATUS=`<%= @basedir %>/bin/dispatcher --areas --status | tr '\n' '|'`
+
+STARTED=`echo $BASE_STATUS | sed 's,.*Counter of started requests:,,;s:|.*::'`
+echo "overpass_request_started.value $STARTED"
+
+COMPLETED=`echo $BASE_STATUS | sed 's,.*Counter of finished requests:,,;s:|.*::'`
+echo "overpass_request_completed.value $COMPLETED"
+
+STARTED=`echo $AREA_STATUS | sed 's,.*Counter of started requests:,,;s:|.*::'`
+echo "overpass_area_request_started.value $STARTED"
+
+COMPLETED=`echo $AREA_STATUS | sed 's,.*Counter of finished requests:,,;s:|.*::'`
+echo "overpass_area_request_completed.value $COMPLETED"
--- /dev/null
+#!/bin/bash -e
+
+FNAME=$1
+
+if [[ "x$FNAME" == "x" ]]; then
+ echo "Usage: overpass-import-db.sh <OSM file>"
+ exit 1
+fi
+
+case "$FNAME" in
+ *.gz) UNPACKER='gunzip -c' ;;
+ *.bz2) UNPACKER='bunzip2 -c' ;;
+ *) UNPACKER='osmium cat -o - -f xml' ;;
+esac
+
+<% if node[:overpass][:meta_mode] == "meta" -%>
+META=--meta
+<% elsif node[:overpass][:meta_mode] == "attic" -%>
+META=--keep-attic
+<% else -%>
+META=
+<% end -%>
+
+sudo systemctl stop overpass-area-processor.timer
+sudo systemctl stop overpass-update
+sudo systemctl stop overpass-area-dispatcher
+sudo systemctl stop overpass-dispatcher
+
+sleep 2
+
+# Remove old database
+sudo -u <%= @username %> rm -rf <%= @basedir %>/db/*
+
+$UNPACKER $FNAME | sudo -u <%= @username %> <%= @basedir %>/bin/update_database --db-dir='<%= @basedir %>/db' --compression-method=<%= node[:overpass][:compression_mode] %> --map-compression-method=<%= node[:overpass][:compression_mode] %> $META
+
+sudo -u <%= @username %> ln -s <%= @srcdir %>/rules <%= @basedir %>/db/rules
+
+echo "Import finished. Catching up with new changes."
+
+sudo systemctl start overpass-dispatcher
+sudo systemctl start overpass-area-dispatcher
+
+PYOSMIUM="sudo -u <%= @username %> pyosmium-get-changes --server <%= node[:overpass][:replication_url] %> -f <%= @basedir %>/db/replicate-id"
+<% if node[:overpass][:meta_mode] == "attic" -%>
+PYOSMIUM="$PYOSMIUM --no-deduplicate"
+<% end -%>
+
+# Get the replication id
+$PYOSMIUM -v -O $FNAME --ignore-osmosis-headers
+
+sudo -u <%= @username %> rm -f <%= @basedir %>/diffs/*
+
+while $PYOSMIUM -v -s 1000 -o <%= @basedir %>/diffs/latest.osc; do
+ if [ ! -f <%= @basedir %>/db/replicate-id ]; then
+ echo "Replication ID not written."
+ exit 1
+ fi
+ DATA_VERSION=`osmium fileinfo -e -g data.timestamp.last <%= @basedir %>/diffs/latest.osc`
+ echo "Downloaded up to timestamp $DATA_VERSION"
+ while ! sudo -u <%= @username %> <%= @basedir %>/bin/update_from_dir --osc-dir=<%= @basedir %>/diffs --version=$DATA_VERSION $META --flush-size=0; do
+ echo "Error while updating. Retry in 1 min."
+ sleep 60
+ done
+ sudo -u <%= @username %> rm <%= @basedir %>/diffs/latest.osc
+ echo "Finished up to $DATA_VERSION."
+done
+
+echo "DB up-to-date. Processing areas."
+
+sudo -u <%= @username %> <%= @basedir %>/bin/osm3s_query --progress --rules <<%= @srcdir %>/rules/areas.osm3s
+
+echo "All updates done."
+
+sudo systemctl start overpass-area-processor.timer
--- /dev/null
+#!/bin/bash
+
+echo "`date '+%F %T'`: update started"
+
+if [[ -a <%= @basedir %>/db/area_version ]]; then
+ sed "s/{{area_version}}/$(cat <%= @basedir %>/db/area_version)/g" <%= @srcdir %>/rules/areas_delta.osm3s | <%= @basedir %>/bin/osm3s_query --progress --rules
+else
+ cat <%= @srcdir %>/rules/areas.osm3s | <%= @basedir %>/bin/osm3s_query --progress --rules
+fi
+
+echo "`date '+%F %T'`: update finished"
--- /dev/null
+#!/bin/bash
+
+PYOSMIUM="pyosmium-get-changes --server <%= node[:overpass][:replication_url] %> -f <%= @basedir %>/db/replicate-id"
+<% if node[:overpass][:meta_mode] == "attic" -%>
+PYOSMIUM="$PYOSMIUM --no-deduplicate"
+<% end -%>
+
+<% if node[:overpass][:meta_mode] == "meta" -%>
+META=--meta
+<% elsif node[:overpass][:meta_mode] == "attic" -%>
+META=--keep-attic
+<% else -%>
+META=
+<% end -%>
+
+while true; do
+ status=3 # make it sleep on issues
+
+ if [ -f <%= @basedir %>/db/replicate-id ]; then
+ # first apply any pending updates
+ if [ -f <%= @basedir %>/diffs/latest.osc ]; then
+ DATA_VERSION=`osmium fileinfo -e -g data.timestamp.last <%= @basedir %>/diffs/latest.osc`
+ if [ "x$DATA_VERSION" != "x" ]; then
+ echo "Downloaded up to timestamp $DATA_VERSION"
+ while ! <%= @basedir %>/bin/update_from_dir --osc-dir=<%= @basedir %>/diffs --version=$DATA_VERSION $META --flush-size=0; do
+ echo "Error while updating. Retry in 1 min."
+ sleep 60
+ done
+ fi
+ rm <%= @basedir %>/diffs/latest.osc
+ fi
+
+ $PYOSMIUM -v -s 1000 -o <%= @basedir %>/diffs/latest.osc
+ status=$?
+ fi
+
+ if [ $status -eq 0 ]; then
+ echo "Downloaded next batch."
+ elif [ $status -eq 3 ]; then
+ rm <%= @basedir %>/diffs/latest.osc
+ echo "No new data, sleeping for a minute."
+ sleep 60
+ else
+ echo "Fatal error, stopping updates."
+ exit $status
+ fi
+done
--- /dev/null
+#!/usr/bin/ruby
+
+requrie "cgi"
+require "rotp"
+
+totp = ROTP::TOTP.new("<%= @totp_key %>", :interval => 3600)
+
+STDIN.each_line do |header|
+ cookies = CGI::Cookie.parse(header)
+
+ if totp.verify(cookies["_osm_totp_token"], :drift_behind => 3600, :drift_ahead => 3600)
+ puts "1"
+ else
+ puts "0"
+ end
+end
+
+exit 0
-default[:passenger][:ruby_version] = if node[:lsb][:release].to_f < 20.04
- "2.5"
- else
- "2.7"
- end
-
default[:passenger][:max_pool_size] = 6
default[:passenger][:pool_idle_time] = 300
default[:passenger][:instance_registry_dir] = "/run/passenger"
depends "apt"
depends "munin"
depends "prometheus"
+depends "ruby"
depends "systemd"
include_recipe "apt"
include_recipe "munin"
include_recipe "prometheus"
-
-package "ruby#{node[:passenger][:ruby_version]}"
-package "ruby#{node[:passenger][:ruby_version]}-dev"
-
-if node[:passenger][:ruby_version].to_f < 1.9
- package "rubygems#{node[:passenger][:ruby_version]}"
- package "irb#{node[:passenger][:ruby_version]}"
-end
+include_recipe "ruby"
template "/usr/local/bin/passenger-ruby" do
source "ruby.erb"
# limitations under the License.
#
+unified_mode true
+
default_action :restart
property :application, String, :name_property => true
#!/bin/sh
-<% if node[:passenger][:ruby_version].to_f < 2.1 -%>
-export RUBY_HEAP_MIN_SLOTS=500000
-export RUBY_HEAP_FREE_MIN=100000
-<% else -%>
export RUBY_GC_HEAP_INIT_SLOTS=500000
export RUBY_GC_HEAP_FREE_SLOTS=100000
-<% end -%>
export RUBY_GC_MALLOC_LIMIT=50000000
-exec /usr/bin/ruby<%= node[:passenger][:ruby_version] %> "$@"
+exec /usr/bin/ruby<%= node[:ruby][:version] %> "$@"
-default[:php][:version] = if node[:lsb][:release].to_f < 20.04
- "7.2"
- else
+default[:php][:version] = if node[:lsb][:release].to_f < 22.04
"7.4"
+ else
+ "8.1"
end
-
default[:php][:fpm][:options] = {}
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :pool, :kind_of => String, :name_property => true
property :user, :kind_of => String, :default => "www-data"
property :group, :kind_of => String, :default => "www-data"
property :pm, :kind_of => String, :default => "dynamic"
-property :pm_max_children, :kind_of => Integer, :default => 5
-property :pm_start_servers, :kind_of => Integer, :default => 2
-property :pm_min_spare_servers, :kind_of => Integer, :default => 1
-property :pm_max_spare_servers, :kind_of => Integer, :default => 3
-property :pm_max_requests, :kind_of => Integer, :default => 500
-property :request_terminate_timeout, :kind_of => Integer, :default => 0
+property :pm_max_children, :kind_of => Integer, :default => 10
+property :pm_start_servers, :kind_of => Integer, :default => 4
+property :pm_min_spare_servers, :kind_of => Integer, :default => 2
+property :pm_max_spare_servers, :kind_of => Integer, :default => 6
+property :pm_max_requests, :kind_of => Integer, :default => 1000
+property :request_terminate_timeout, :kind_of => Integer, :default => 1800
property :environment, :kind_of => Hash, :default => {}
property :php_values, :kind_of => Hash, :default => {}
property :php_admin_values, :kind_of => Hash, :default => {}
+++ /dev/null
-# Piwik Cookbook
-
-This cookbook installs and configures the Piwiki server-side software used for
-analytics on openstreetmap.org
+++ /dev/null
-default[:piwik][:version] = "4.2.1"
-default[:piwik][:plugins] = %w[
- Actions Annotations API BulkTracking Contents CoreAdminHome CoreConsole
- CoreHome CorePluginsAdmin CoreUpdater CoreVisualizations CustomJsTracker
- CustomVariables Dashboard DevicePlugins DevicesDetection Diagnostics
- Ecommerce Events Feedback GeoIp2 Goals Heartbeat ImageGraph Insights
- Installation Intl LanguagesManager Live Login Marketplace MobileMessaging
- Monolog Morpheus MultiSites Overlay PagePerformance PrivacyManager
- ProfessionalServices Provider Proxy Referrers Resolution RssWidget
- ScheduledReports SegmentEditor SEO SitesManager Transitions UserCountry
- UserCountryMap UserId UserLanguage UsersManager VisitFrequency
- VisitorInterest VisitsSummary VisitTime WebsiteMeasurable Widgetize
-]
+++ /dev/null
-#
-# Cookbook:: piwik
-# Recipe:: default
-#
-# Copyright:: 2011, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include_recipe "apache"
-include_recipe "geoipupdate"
-include_recipe "mysql"
-include_recipe "php::fpm"
-
-passwords = data_bag_item("piwik", "passwords")
-
-package %w[
- php-cli
- php-curl
- php-mbstring
- php-mysql
- php-gd
- php-xml
- php-apcu
- unzip
-]
-
-apache_module "expires"
-apache_module "rewrite"
-
-version = node[:piwik][:version]
-
-directory "/opt/piwik-#{version}" do
- owner "root"
- group "root"
- mode "0755"
-end
-
-remote_file "#{Chef::Config[:file_cache_path]}/piwik-#{version}.zip" do
- source "https://builds.matomo.org/piwik-#{version}.zip"
- not_if { ::File.exist?("/opt/piwik-#{version}/piwik") }
-end
-
-execute "unzip-piwik-#{version}" do
- command "unzip -q #{Chef::Config[:file_cache_path]}/piwik-#{version}.zip"
- cwd "/opt/piwik-#{version}"
- user "root"
- group "root"
- not_if { ::File.exist?("/opt/piwik-#{version}/piwik") }
-end
-
-execute "/opt/piwik-#{version}/piwik/piwik.js" do
- command "gzip -k -9 /opt/piwik-#{version}/piwik/piwik.js"
- cwd "/opt/piwik-#{version}"
- user "root"
- group "root"
- not_if { ::File.exist?("/opt/piwik-#{version}/piwik/piwik.js.gz") }
-end
-
-directory "/opt/piwik-#{version}/piwik/config" do
- owner "www-data"
- group "www-data"
- mode "0755"
-end
-
-template "/opt/piwik-#{version}/piwik/config/config.ini.php" do
- source "config.erb"
- owner "root"
- group "root"
- mode "0644"
- variables :passwords => passwords,
- :directory => "/opt/piwik-#{version}/piwik",
- :plugins => node[:piwik][:plugins]
-end
-
-directory "/opt/piwik-#{version}/piwik/tmp" do
- owner "www-data"
- group "www-data"
- mode "0755"
-end
-
-link "/opt/piwik-#{version}/piwik/misc/GeoLite2-ASN.mmdb" do
- to "/usr/share/GeoIP/GeoLite2-ASN.mmdb"
-end
-
-link "/opt/piwik-#{version}/piwik/misc/GeoLite2-City.mmdb" do
- to "/usr/share/GeoIP/GeoLite2-City.mmdb"
-end
-
-link "/opt/piwik-#{version}/piwik/misc/GeoLite2-Country.mmdb" do
- to "/usr/share/GeoIP/GeoLite2-Country.mmdb"
-end
-
-link "/srv/piwik.openstreetmap.org" do
- to "/opt/piwik-#{version}/piwik"
- notifies :restart, "service[php#{node[:php][:version]}-fpm]"
-end
-
-mysql_user "piwik@localhost" do
- password passwords["database"]
-end
-
-mysql_database "piwik" do
- permissions "piwik@localhost" => :all
-end
-
-ssl_certificate "piwik.openstreetmap.org" do
- domains ["piwik.openstreetmap.org", "piwik.osm.org"]
- notifies :reload, "service[apache2]"
-end
-
-php_fpm "piwik.openstreetmap.org" do
- prometheus_port 9253
-end
-
-apache_site "piwik.openstreetmap.org" do
- template "apache.erb"
-end
-
-cron_d "piwik" do
- minute "5"
- user "www-data"
- command "/usr/bin/php /srv/piwik.openstreetmap.org/console core:archive --quiet --url=https://piwik.openstreetmap.org/"
-end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-<VirtualHost *:443>
- ServerName piwik.openstreetmap.org
- ServerAlias piwik.osm.org
- ServerAdmin webmaster@openstreetmap.org
-
- SSLEngine on
- SSLCertificateFile /etc/ssl/certs/piwik.openstreetmap.org.pem
- SSLCertificateKeyFile /etc/ssl/private/piwik.openstreetmap.org.key
-
- CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
- ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
-
- Options -Indexes
-
- DocumentRoot /srv/piwik.openstreetmap.org
-</VirtualHost>
-
-<VirtualHost *:80>
- ServerName piwik.openstreetmap.org
- ServerAlias piwik.osm.org
- ServerAdmin webmaster@openstreetmap.org
-
- CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
- ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
-
- RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
- RedirectPermanent / https://piwik.openstreetmap.org/
-</VirtualHost>
-
-<Directory /srv/piwik.openstreetmap.org>
- Require all granted
-
- ExpiresActive On
- RewriteEngine on
-
- RewriteCond "%{HTTP:Accept-encoding}" "gzip"
- RewriteCond "%{REQUEST_FILENAME}\.gz" -s
- RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
-
- RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
-
- <FilesMatch "\.js\.gz$">
- Header append Content-Encoding gzip
- Header append Vary Accept-Encoding
- </FilesMatch>
-
- <FilesMatch "(\.js|\.js\.gz)$">
- ExpiresDefault "access plus 1 week"
- Header set Cache-Control "max-age=604800"
- </FilesMatch>
-
- <FilesMatch ".+\.ph(ar|p|tml)$">
- SetHandler "proxy:unix:/run/php/piwik.openstreetmap.org.sock|fcgi://127.0.0.1"
- </FilesMatch>
-</Directory>
-#!/usr/bin/env python
+#!/usr/bin/python3
-print """
+print("""
<html>
<head>
<title>OpenStreetMap historical CC BY-SA 2.0 licensed data</title>
<p>The <tt>full-planet-120401-final.osm.bz2</tt> file is the last dump of data before <a href="https://blog.osmfoundation.org/2012/07/26/automated-redactions-complete/">redactions were run to remove data which could not be released under ODbL</a>. The <tt>full-planet-120601-1150.osm.bz2</tt> is the last dump of data available under CC BY-SA, but after the redactions were run. This means it may have less data in some areas, although many redactions were quickly re-mapped.</p>
<p>Licensed under the <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA 2.0</a></p>
<p> </p>
-"""
+""")
-#!/usr/bin/env python
+#!/usr/bin/python3
from time import time
from os import stat, environ
return '%d months' % (time / 2592000.)
-def file_info(file, name):
+def file_info(file, rss_file, name):
torrent_file = file + '.torrent'
size = nice_size(file)
hash = search(r'\w{32}', open(file+'.md5', 'r').read()).group(0)
date = nice_time(time() - stat(file).st_mtime)
- return '<b><a href="%(file)s">%(name)s</a> (<a href="%(torrent_file)s">torrent</a>)</b><br><b>%(size)s</b>, created %(date)s ago.<br><small>md5: %(hash)s</small>.' % locals()
+ return '<b><a href="%(file)s">%(name)s</a> (<a href="%(torrent_file)s">torrent</a>) (<a href="%(rss_file)s">RSS</a>)</b><br><b>%(size)s</b>, created %(date)s ago.<br><small>md5: %(hash)s</small>.' % locals()
-planet_link = file_info('planet/planet-latest.osm.bz2', 'Latest Weekly Planet XML File')
-changesets_link = file_info('planet/changesets-latest.osm.bz2', 'Latest Weekly Changesets')
-planet_pbf_link = file_info('pbf/planet-latest.osm.pbf', 'Latest Weekly Planet PBF File')
+planet_link = file_info('planet/planet-latest.osm.bz2', 'planet/planet-bz2-rss.xml', 'Latest Weekly Planet XML File')
+changesets_link = file_info('planet/changesets-latest.osm.bz2', 'planet/changesets-bz2-rss.xml', 'Latest Weekly Changesets')
+planet_pbf_link = file_info('pbf/planet-latest.osm.pbf', 'pbf/planet-pbf-rss.xml', 'Latest Weekly Planet PBF File')
-print """
+print("""
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<p>
If you find data within OpenStreetMap that you believe is an infringement of someone else's copyright, then please make contact with the <a href="https://wiki.openstreetmap.org/wiki/Data_working_group">OpenStreetMap Data Working Group</a>.
</p>
-""" % locals()
+""" % locals())
-#!/usr/bin/env python
+#!/usr/bin/python3
from time import time
from os import stat, environ
planet_link = file_info('history-latest.osm.bz2', 'Latest Full History Planet XML File')
planet_pbf_link = file_info('../../pbf/full-history/history-latest.osm.pbf', 'Latest Full History Planet PBF File')
-print """
+print("""
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<p>
If you find data within OpenStreetMap that you believe is an infringement of someone else's copyright, then please make contact with the <a href="https://wiki.openstreetmap.org/wiki/Data_working_group">OpenStreetMap Data Working Group</a>.
</p>
-""" % locals()
+""" % locals())
--- /dev/null
+#!/bin/sh
+
+set -e
+
+find /var/lib/replication/minute -name *.done -mtime +14 -print0 | xargs -0r rm
+++ /dev/null
-#!/bin/sh
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-export TZ=UTC
-
-exec >> /var/log/replication/streaming-replicator 2>&1
-
-exec /usr/local/bin/osmosis -q \
- --replicate-apidb iterations=0 minInterval=10000 maxInterval=60000 authFile=/etc/replication/auth.conf validateSchemaVersion=false \
- --send-replication-sequence port=8081 \
- --write-replication workingDirectory=/var/lib/replication/streaming
+++ /dev/null
-#!/bin/sh
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-export TZ=UTC
-
-exec >> /var/log/replication/streaming-server 2>&1
-
-exec /usr/local/bin/osmosis -q \
- --send-replication-data dataDirectory=/var/lib/replication/streaming port=8080 notificationPort=8081
-#!/usr/bin/env python
+#!/usr/bin/python3
-print """
+print("""
<html>
<head>
<title>OpenStreetMap replication diffs</title>
<h1>planet.openstreetmap.org - replication diffs</h1>
<p>OpenStreetMap is <i>open data</i>, licensed under the <a href="https://opendatacommons.org/licenses/odbl/">Open Data Commons Open Database License</a> (ODbL)</p>
<p> </p>
-"""
+""")
depends "git"
depends "incron"
depends "munin"
+depends "ruby"
depends "osmosis"
depends "systemd"
owner "planet"
group "planet"
mode "644"
- not_if { ENV["TEST_KITCHEN"] }
+ not_if { kitchen? }
end
cron_d "planet-update" do
- minute "17"
+ minute "37"
hour "1"
user "root"
command "/usr/local/bin/planet-update"
mode "775"
end
+directory "/store/planet/statistics" do
+ owner "www-data"
+ group "planet"
+ mode "775"
+end
+
template "/usr/local/bin/apache-latest-planet-filename" do
source "apache-latest-planet-filename.erb"
owner "root"
php-cli
php-curl
mktorrent
+ xmlstarlet
+ libxml2-utils
]
directory "/opt/planet-dump-ng" do
git "/opt/planet-dump-ng" do
action :sync
repository "https://github.com/zerebubuth/planet-dump-ng.git"
- revision "v1.2.0"
+ revision "v1.2.4"
depth 1
user "root"
group "root"
exec_start "/usr/local/bin/planetdump %i"
memory_max "64G"
private_tmp true
- private_devices true
- private_network true
protect_system "full"
protect_home true
- no_new_privileges true
+ read_write_paths "/var/log/exim4"
end
cron_d "planet-dump-mirror" do
include_recipe "accounts"
include_recipe "apt"
include_recipe "osmosis"
+include_recipe "ruby"
+include_recipe "tools"
db_passwords = data_bag_item("db", "passwords")
package %w[
postgresql-client
- ruby
- ruby-dev
ruby-libxml
make
gcc
osmdbt
]
-gem_package "pg"
+gem_package "pg" do
+ gem_binary node[:ruby][:gem]
+end
## Build preload library to flush files
files_mode "755"
end
-template "/usr/local/bin/replicate-minute" do
- source "replicate-minute.erb"
- owner "root"
- group "root"
- mode "755"
-end
-
template "/usr/local/bin/users-agreed" do
source "users-agreed.erb"
owner "root"
variables :password => db_passwords["planetdiff"]
end
+systemd_service "users-agreed" do
+ description "Update list of users accepting CTs"
+ user "planet"
+ exec_start "/usr/local/bin/users-agreed"
+ private_tmp true
+ private_devices true
+ protect_system "full"
+ protect_home true
+ restrict_address_families %w[AF_INET AF_INET6]
+ no_new_privileges true
+end
+
+systemd_timer "users-agreed" do
+ description "Update list of users accepting CTs"
+ on_calendar "7:00"
+end
+
+systemd_service "users-deleted" do
+ description "Update list of deleted users"
+ user "planet"
+ exec_start "/usr/local/bin/users-deleted"
+ private_tmp true
+ private_devices true
+ protect_system "full"
+ protect_home true
+ restrict_address_families %w[AF_INET AF_INET6]
+ no_new_privileges true
+end
+
+systemd_timer "users-deleted" do
+ description "Update list of deleted users"
+ on_calendar "17:00"
+end
+
## Changeset replication
directory "/store/planet/replication/changesets" do
variables :password => db_passwords["planetdiff"]
end
+systemd_service "replication-changesets" do
+ description "Changesets replication"
+ user "planet"
+ exec_start "/usr/local/bin/replicate-changesets /etc/replication/changesets.conf"
+ private_tmp true
+ private_devices true
+ protect_system "full"
+ protect_home true
+ restrict_address_families %w[AF_INET AF_INET6]
+ no_new_privileges true
+end
+
+systemd_timer "replication-changesets" do
+ description "Changesets replication"
+ on_boot_sec 60
+ on_unit_active_sec 60
+ accuracy_sec 5
+end
+
## Minutely replication
directory "/store/planet/replication/minute" do
description "Hourly replication"
user "planet"
exec_start "/usr/local/bin/osmosis -q --merge-replication-files workingDirectory=/var/lib/replication/hour"
+ environment "LD_PRELOAD" => "/opt/flush/flush.so"
private_tmp true
private_devices true
protect_system "full"
description "Daily replication"
user "planet"
exec_start "/usr/local/bin/osmosis -q --merge-replication-files workingDirectory=/var/lib/replication/day"
+ environment "LD_PRELOAD" => "/opt/flush/flush.so"
private_tmp true
private_devices true
protect_system "full"
on_calendar "*-*-* *:02/15:00"
end
+## Replication cleanup
+
+systemd_service "replication-cleanup" do
+ description "Cleanup replication"
+ user "planet"
+ exec_start "/usr/local/bin/replicate-cleanup"
+ private_tmp true
+ private_devices true
+ private_network true
+ protect_system "full"
+ protect_home true
+ no_new_privileges true
+end
+
+systemd_timer "replication-cleanup" do
+ description "Cleanup replication"
+ on_boot_sec 60
+ on_unit_active_sec 86400
+ accuracy_sec 1800
+end
+
## Enable/disable feeds
if node[:planet][:replication] == "enabled"
- cron_d "users-agreed" do
- minute "0"
- hour "7"
- user "planet"
- command "/usr/local/bin/users-agreed"
- mailto "zerebubuth@gmail.com"
+ service "users-agreed.timer" do
+ action [:enable, :start]
end
- cron_d "users-deleted" do
- minute "0"
- hour "17"
- user "planet"
- command "/usr/local/bin/users-deleted"
- mailto "zerebubuth@gmail.com"
+ service "users-deleted.timer" do
+ action [:enable, :start]
end
- cron_d "replication-changesets" do
- user "planet"
- command "/usr/local/bin/replicate-changesets /etc/replication/changesets.conf"
- mailto "zerebubuth@gmail.com"
+ service "replication-changesets.timer" do
+ action [:enable, :start]
end
service "replication-minutely.timer" do
service "replication-daily.timer" do
action [:enable, :start]
end
+
+ service "replication-cleanup.timer" do
+ action [:enable, :start]
+ end
else
- cron_d "users-agreed" do
- action :delete
+ service "users-agreed.timer" do
+ action [:stop, :disable]
end
- cron_d "users-deleted" do
- action :delete
+ service "users-deleted.timer" do
+ action [:stop, :disable]
end
- cron_d "replication-changesets" do
- action :delete
+ service "replication-changesets.timer" do
+ action [:stop, :disable]
end
service "replication-minutely.timer" do
service "replication-daily.timer" do
action [:stop, :disable]
end
+
+ service "replication-cleanup.timer" do
+ action [:stop, :disable]
+ end
end
Require all granted
</Directory>
- ProxyPass /replication/streaming http://127.0.0.1:8080
-
- <Location /replication/steaming>
- Require all granted
- </Location>
-
Redirect /pbf-experimental/ /pbf/
<IfModule mod_headers.c>
echo $$ > /tmp/planet-notes-dump.lock
-cur_date=`date +%y%m%d`
-cur_year=`date +%Y`
-cur_planet_notes=planet-notes-${cur_date}.osn
+cur_date=$(date +%y%m%d)
+cur_year=$(date +%Y)
+cur_planet_notes="planet-notes-${cur_date}.osn"
planet_dir=/store/planet/
export PATH='/usr/local/bin:/usr/bin:/bin:/usr/bin/X11'
-if [ \! -d ${planet_dir}/notes/ ]
+if [ \! -d "${planet_dir}/notes/" ]
then
- echo ${planet_dir}notes/ does not exist
+ echo "${planet_dir}notes/ does not exist"
exit 1
fi
-if [ \! -d ${planet_dir}/notes/${cur_year}/ ]; then mkdir ${planet_dir}/notes/${cur_year}/; fi
-cd ${planet_dir}/notes/${cur_year}/
+if [ \! -d "${planet_dir}/notes/${cur_year}/" ]; then mkdir "${planet_dir}/notes/${cur_year}/"; fi
+cd "${planet_dir}/notes/${cur_year}/"
-/usr/bin/python3 /opt/planet-notes-dump/dump.py --quiet --database openstreetmap --host <%= node[:web][:readonly_database_host] %> --user planetdump --password '<%= @password %>' .${cur_planet_notes}
-pbzip2 -p6 -9 .${cur_planet_notes}
+/usr/bin/python3 /opt/planet-notes-dump/dump.py --quiet --database openstreetmap --host <%= node[:web][:readonly_database_host] %> --user planetdump --password '<%= @password %>' ".${cur_planet_notes}"
+pbzip2 -p6 -9 ".${cur_planet_notes}"
-planet_notes_size=$(du -sb .${cur_planet_notes}.bz2 | awk '{ print $1 }')
+planet_notes_size=$(du -sb ".${cur_planet_notes}.bz2" | awk '{ print $1 }')
if ((planet_notes_size<12000000)); then
- echo Planet .${cur_planet_notes}.bz2 too small
+ echo "Planet .${cur_planet_notes}.bz2 too small"
exit 1
fi
-mv .${cur_planet_notes}.bz2 ${cur_planet_notes}.bz2
-md5sum ${cur_planet_notes}.bz2 > ${cur_planet_notes}.bz2.md5
+mv ".${cur_planet_notes}.bz2" "${cur_planet_notes}.bz2"
+md5sum "${cur_planet_notes}.bz2" > "${cur_planet_notes}.bz2.md5"
#link planet latest to the new file
-cd ${planet_dir}/notes/
+cd "${planet_dir}/notes/"
-ln -fs ${cur_year}/${cur_planet_notes}.bz2 planet-notes-latest.osn.bz2
+ln -fs "${cur_year}/${cur_planet_notes}.bz2" planet-notes-latest.osn.bz2
# mangle md5 files for 'latest' ones
rm -f planet-notes-latest.osn.bz2.md5
-sed -e "s/${cur_planet_notes}.bz2/planet-notes-latest.osn.bz2/" ${cur_year}/${cur_planet_notes}.bz2.md5 > planet-notes-latest.osn.bz2.md5
+sed -e "s/${cur_planet_notes}.bz2/planet-notes-latest.osn.bz2/" "${cur_year}/${cur_planet_notes}.bz2.md5" > planet-notes-latest.osn.bz2.md5
rm /tmp/planet-notes-dump.lock
-
PLANETPREV="${PLANETDIR}/planet-previous.${SUFFIX}"
PLANETCURR="${PLANETDIR}/planet.${SUFFIX}"
PLANETNEW="${PLANETDIR}/planet-new.${SUFFIX}"
-PLANETTMP="${PLANETDIR}/planet-tmp.${SUFFIX}"
-pyosmium-up-to-date -v -o "$PLANETNEW" "$PLANETCURR"
+pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR"
retval=$?
while [ $retval -eq 1 ]; do
- mv "$PLANETNEW" "$PLANETTMP"
- pyosmium-up-to-date -v -o "$PLANETNEW" "$PLANETTMP"
+ mv "$PLANETCURR" "$PLANETPREV"
+ mv "$PLANETNEW" "$PLANETCURR"
+ pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR"
retval=$?
- rm "$PLANETTMP"
done
if [ $retval -ne 0 ]; then
# DO NOT EDIT - This file is being maintained by Chef
-exec > /var/log/planet-update.log 2>&1
+exec >> /var/log/planet-update.log 2>&1
echo "Updating planet file..."
# support doing this in the incrontab
if [[ -s "$logfile" ]]
then
- mailx -s "Planet dump output: ${file}" zerebubuth@gmail.com < "${logfile}"
+ mailx -s "Planet dump output: ${file}" admins@openstreetmap.org zerebubuth@gmail.com < "${logfile}"
fi
# Remove the log file
function mk_torrent {
type="$1"
format="$2"
- web_dir="$3"
+ dir="$3"
+ s_year="$4"
+ web_dir="${dir}${s_year}"
name="${type}-${date}.osm.${format}"
web_path="${web_dir}/${name}"
+ rss_web_dir="https://planet.openstreetmap.org/${dir}"
+ rss_file="${type}-${format}-rss.xml"
+ torrent_file="${name}.torrent"
+ torrent_url="${rss_web_dir}${s_year}/${torrent_file}"
- mktorrent -l 22 ${name} \
+ # create .torrent file
+ mktorrent -l 22 "${name}" \
-a udp://tracker.opentrackr.org:1337 \
-a udp://tracker.datacenterlight.ch:6969/announce,http://tracker.datacenterlight.ch:6969/announce \
-a udp://tracker.torrent.eu.org:451 \
-a udp://tracker-udp.gbitt.info:80/announce,http://tracker.gbitt.info/announce,https://tracker.gbitt.info/announce \
-a http://retracker.local/announce \
- -w https://planet.openstreetmap.org/${web_path} \
- -w https://ftp5.gwdg.de/pub/misc/openstreetmap/planet.openstreetmap.org/${web_path} \
- -w https://ftpmirror.your.org/pub/openstreetmap/${web_path} \
- -w https://mirror.init7.net/openstreetmap/${web_path} \
- -w https://free.nchc.org.tw/osm.planet/${web_path} \
- -w https://ftp.fau.de/osm-planet/${web_path} \
- -w https://ftp.spline.de/pub/openstreetmap/${web_path} \
- -w https://osm.openarchive.site/${name} \
- -w https://downloads.opencagedata.com/planet/${name} \
- -w https://planet.osm-hr.org/${web_path} \
+ -w "https://planet.openstreetmap.org/${web_path}" \
+ -w "https://ftp5.gwdg.de/pub/misc/openstreetmap/planet.openstreetmap.org/${web_path}" \
+ -w "https://ftpmirror.your.org/pub/openstreetmap/${web_path}" \
+ -w "https://mirror.init7.net/openstreetmap/${web_path}" \
+ -w "https://free.nchc.org.tw/osm.planet/${web_path}" \
+ -w "https://ftp.fau.de/osm-planet/${web_path}" \
+ -w "https://ftp.spline.de/pub/openstreetmap/${web_path}" \
+ -w "https://osm.openarchive.site/${name}" \
+ -w "https://downloads.opencagedata.com/planet/${name}" \
+ -w "https://planet.osm-hr.org/${web_path}" \
+ -w "https://planet.maps.mail.ru/${web_path}" \
-c "OpenStreetMap ${type} data export, licensed under https://opendatacommons.org/licenses/odbl/ by OpenStreetMap contributors" \
- -o ${name}.torrent
+ -o "${torrent_file}" > /dev/null
+
+ # create .xml global RSS headers if missing
+ torrent_time_rfc="$(date -R -r ${torrent_file})"
+ test -f "${rss_file}" || echo "<x/>" | xmlstarlet select --xml-decl --indent \
+ -N "atom=http://www.w3.org/2005/Atom" \
+ -N "dcterms=http://purl.org/dc/terms/" \
+ -N "content=http://purl.org/rss/1.0/modules/content/" \
+ --encode "UTF-8" \
+ --template \
+ --match / \
+ --elem "rss" \
+ --attr "version" --output "2.0" --break \
+ --attr "atom:DUMMY" --break \
+ --elem "channel" \
+ --elem "title" --output "OpenStreetMap ${type} ${format} torrent RSS" --break \
+ --elem "link" --output "${rss_web_dir}" --break \
+ --elem "atom:link" \
+ --attr "href" --output "${rss_web_dir}/${rss_file}" --break \
+ --attr "rel" --output "self" --break \
+ --attr "type" --output "application/rss+xml" --break \
+ --break \
+ --elem "description" --output "${type}.osm.${format}.torrent RSS feed" --break \
+ --elem "copyright" --output "Source: OpenStreetMap contributors, under ODbL 1.0 licence" --break \
+ --elem "generator" --output "OpenStreetMap xmlstarlet powered shell script v1.0" --break \
+ --elem "language" --output "en" --break \
+ --elem "lastBuildDate" --output "${torrent_time_rfc}" \
+ > "${rss_file}"
+
+ # add newly created .torrent file as new entry to .xml RSS feed, removing excess entries
+ torrent_size="$(stat --format="%s" ${torrent_file})"
+ xmlstarlet edit --inplace \
+ -a "//lastBuildDate" -t elem -n item -v "" \
+ -s "//item[1]" -t elem -n "title" -v "${torrent_file}" \
+ -s "//item[1]" -t elem -n "guid" -v "${torrent_url}" \
+ -s "//item[1]" -t elem -n "link" -v "${torrent_url}" \
+ -s "//item[1]" -t elem -n "pubDate" -v "${torrent_time_rfc}" \
+ -s "//item[1]" -t elem -n "category" -v "OpenStreetMap data" \
+ -s "//item[1]" -t elem -n "enclosure" \
+ -s "//item[1]"/enclosure -t attr -n "type" -v "application/x-bittorrent" \
+ -s "//item[1]"/enclosure -t attr -n "length" -v "${torrent_size}" \
+ -s "//item[1]"/enclosure -t attr -n "url" -v "${torrent_url}" \
+ -s "//item[1]" -t elem -n "description" -v "OpenStreetMap torrent ${torrent_file}" \
+ -u /rss/channel/lastBuildDate -v "${torrent_time_rfc}" \
+ -d /rss/@atom:DUMMY \
+ -d "//item[position()>5]" \
+ "${rss_file}"
}
# Function to install a dump in place
year="$4"
name="${type}-${date}.osm.${format}"
latest="${type}-latest.osm.${format}"
+ rss_file="${type}-${format}-rss.xml"
md5sum "${name}" > "${name}.md5"
mkdir -p "${dir}/${year}"
mv "${name}" "${name}.md5" "${dir}/${year}"
ln -sf "${year:-.}/${name}" "${dir}/${latest}"
test -f "${name}.torrent" && mv "${name}.torrent" "${dir}/${year}" && ln -sf "${year:-.}/${name}.torrent" "${dir}/${latest}.torrent"
+ test -f "${rss_file}" && xmllint --noout "${rss_file}" && cp -f "${rss_file}" "${dir}"
rm -f "${dir}/${latest}.md5"
sed -e "s/${name}/${latest}/" "${dir}/${year}/${name}.md5" > "${dir}/${latest}.md5"
}
# Create *.torrent files
-mk_torrent "changesets" "bz2" "planet/${year}"
-mk_torrent "discussions" "bz2" "planet/${year}"
-mk_torrent "planet" "bz2" "planet/${year}"
-mk_torrent "history" "bz2" "planet/full-history/${year}"
+mk_torrent "changesets" "bz2" "planet" "/${year}"
+mk_torrent "discussions" "bz2" "planet" "/${year}"
+mk_torrent "planet" "bz2" "planet" "/${year}"
+mk_torrent "history" "bz2" "planet/full-history" "/${year}"
mk_torrent "planet" "pbf" "pbf"
mk_torrent "history" "pbf" "pbf/full-history"
install_dump "history" "bz2" "<%= node[:planet][:dump][:xml_history_directory] %>" "${year}"
install_dump "planet" "pbf" "<%= node[:planet][:dump][:pbf_directory] %>"
install_dump "history" "pbf" "<%= node[:planet][:dump][:pbf_history_directory] %>"
-
-# Remove pbf dumps older than 90 days
-find "<%= node[:planet][:dump][:pbf_directory] %>" "<%= node[:planet][:dump][:pbf_history_directory] %>" \
- -maxdepth 1 -mindepth 1 -type f -mtime +90 \
- \( \
- -iname 'planet-*.pbf' \
- -o -iname 'history-*.pbf' \
- -o -iname 'planet-*.pbf.md5' \
- -o -iname 'history-*.pbf.md5' \
- \) \
- -delete
export PGPASSFILE=/etc/replication/users-agreed.conf
-echo "# user IDs < 286582 who have agreed to the contributor terms. " > $T/users_agreed
-echo "# any active user IDs >= 286582 would have agreed as part of the sign-up process." >> $T/users_agreed
-psql -h <%= node[:web][:readonly_database_host] %> -U planetdiff -t -c "select id from users where id < 286582 and terms_agreed is not null order by id asc" openstreetmap >> $T/users_agreed
+echo "# user IDs < 286582 who have agreed to the contributor terms. " > "$T/users_agreed"
+echo "# any active user IDs >= 286582 would have agreed as part of the sign-up process." >> "$T/users_agreed"
+psql -h <%= node[:web][:readonly_database_host] %> -U planetdiff -t -c "select id from users where id < 286582 and terms_agreed is not null order by id asc" openstreetmap >> "$T/users_agreed"
-psql -h <%= node[:web][:readonly_database_host] %> -U planetdiff -t -c "select id from users where terms_seen and terms_agreed is null order by id asc" openstreetmap > $T/users_disagreed
+psql -h <%= node[:web][:readonly_database_host] %> -U planetdiff -t -c "select id from users where terms_seen and terms_agreed is null order by id asc" openstreetmap > "$T/users_disagreed"
if cmp -s "${T}/users_agreed" "/store/planet/users_agreed/users_agreed.txt"; then
: # do nothing
else
- cp $T/users_agreed /store/planet/users_agreed/users_agreed.txt
+ cp "$T/users_agreed" /store/planet/users_agreed/users_agreed.txt
fi
if cmp -s "${T}/users_disagreed" "/store/planet/users_agreed/users_disagreed.txt"; then
: # do nothing
else
- cp $T/users_disagreed /store/planet/users_agreed/users_disagreed.txt
+ cp "$T/users_disagreed" /store/planet/users_agreed/users_disagreed.txt
fi
-rm -rf $T
+rm -rf "$T"
@cluster = cluster
end
+ def version
+ @cluster.split("/").first.to_f
+ end
+
def execute(options)
# Create argument array
args = []
mode "644"
variables :version => version, :defaults => defaults, :settings => settings
notifies :reload, "service[postgresql]"
+ only_if { ::Dir.exist?("/etc/postgresql/#{version}/main") }
end
template "/etc/postgresql/#{version}/main/pg_hba.conf" do
variables :early_rules => settings[:early_authentication_rules] || defaults[:early_authentication_rules],
:late_rules => settings[:late_authentication_rules] || defaults[:late_authentication_rules]
notifies :reload, "service[postgresql]"
+ only_if { ::Dir.exist?("/etc/postgresql/#{version}/main") }
end
template "/etc/postgresql/#{version}/main/pg_ident.conf" do
mode "640"
variables :maps => settings[:user_name_maps] || defaults[:user_name_maps]
notifies :reload, "service[postgresql]"
+ only_if { ::Dir.exist?("/etc/postgresql/#{version}/main") }
end
link "/var/lib/postgresql/#{version}/main/server.crt" do
to "/etc/ssl/certs/ssl-cert-snakeoil.pem"
+ only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") }
end
link "/var/lib/postgresql/#{version}/main/server.key" do
to "/etc/ssl/private/ssl-cert-snakeoil.key"
+ only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") }
end
standby_mode = settings[:standby_mode] || defaults[:standby_mode]
:restore_command => restore_command,
:passwords => passwords
notifies :reload, "service[postgresql]"
+ only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") }
end
else
template "/var/lib/postgresql/#{version}/main/recovery.conf" do
action :delete
notifies :reload, "service[postgresql]"
+ only_if { ::Dir.exist?("/var/lib/postgresql/#{version}/main") }
end
end
end
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :database, :kind_of => String, :name_property => true
action :drop do
if cluster.databases.include?(new_resource.database)
converge_by "drop database #{new_resource.database}" do
- cluster.execute(:command => "DROP DATABASE \"#{new_resource.database}\"")
+ if cluster.version >= 13
+ cluster.execute(:command => "DROP DATABASE \"#{new_resource.database}\" WITH (FORCE)")
+ else
+ cluster.execute(:command => "DROP DATABASE \"#{new_resource.database}\"")
+ end
end
end
end
# limitations under the License.
#
+unified_mode true
+
default_action :run
property :command, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :extension, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :munin, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :table, :kind_of => String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :tablespace, :kind_of => String, :name_property => true
require "shellwords"
+unified_mode true
+
default_action :create
property :user, :kind_of => String, :name_property => true
default[:prometheus][:addresses] = {}
default[:prometheus][:exporters] = {}
default[:prometheus][:snmp] = {}
+default[:prometheus][:metrics] = {}
+default[:prometheus][:files] = []
+default[:prometheus][:promscale] = false
if node[:recipes].include?("prometheus::server")
- default[:apt][:sources] |= ["grafana"]
+ default[:apt][:sources] |= %w[grafana timescaledb]
end
directory "/opt/prometheus" do
action :delete
- owner "root"
- group "root"
- mode "755"
recursive true
- not_if { ::Dir.exist?("/opt/prometheus/.git") }
end
-git "/opt/prometheus" do
+git "/opt/prometheus-exporters" do
action :sync
repository "https://github.com/openstreetmap/prometheus-exporters.git"
revision "main"
--collector.interrupts
--collector.ntp
--collector.processes
+ --collector.rapl.enable-zone-label
--collector.systemd
--collector.tcpstat
]
unless node[:prometheus][:snmp].empty?
prometheus_exporter "snmp" do
port 9116
- options "--config.file=/opt/prometheus/exporters/snmp/snmp.yml"
+ options "--config.file=/opt/prometheus-exporters/exporters/snmp/snmp.yml"
register_target false
end
end
+
+if node[:prometheus][:files].empty?
+ prometheus_exporter "filestat" do
+ action :delete
+ end
+
+ file "/etc/prometheus/filestat.yml" do
+ action :delete
+ end
+else
+ template "/etc/prometheus/filestat.yml" do
+ source "filestat.yml.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ end
+
+ prometheus_exporter "filestat" do
+ port 9943
+ options "--config.file=/etc/prometheus/filestat.yml"
+ subscribes :restart, "template[/etc/prometheus/filestat.yml]"
+ end
+end
passwords = data_bag_item("prometheus", "passwords")
tokens = data_bag_item("prometheus", "tokens")
+admins = data_bag_item("apache", "admins")
prometheus_exporter "fastly" do
port 8080
- listen_switch "endpoint"
- listen_type "url"
+ listen_switch "listen"
environment "FASTLY_API_TOKEN" => tokens["fastly"]
end
-package %w[
+prometheus_exporter "fastly_healthcheck" do
+ port 9696
+ scrape_interval "1m"
+ environment "FASTLY_API_TOKEN" => tokens["fastly"]
+end
+
+prometheus_exporter "statuscake" do
+ port 9595
+ environment "STATUSCAKE_APIKEY" => tokens["statuscake"]
+end
+
+cache_dir = Chef::Config[:file_cache_path]
+
+prometheus_version = "2.31.1"
+alertmanager_version = "0.23.0"
+karma_version = "0.105"
+
+directory "/opt/prometheus-server" do
+ owner "root"
+ group "root"
+ mode "755"
+end
+
+remote_file "#{cache_dir}/prometheus.linux-amd64.tar.gz" do
+ source "https://github.com/prometheus/prometheus/releases/download/v#{prometheus_version}/prometheus-#{prometheus_version}.linux-amd64.tar.gz"
+ owner "root"
+ group "root"
+ mode "644"
+ backup false
+end
+
+archive_file "#{cache_dir}/prometheus.linux-amd64.tar.gz" do
+ action :nothing
+ destination "/opt/prometheus-server/prometheus"
+ overwrite true
+ strip_components 1
+ owner "root"
+ group "root"
+ subscribes :extract, "remote_file[#{cache_dir}/prometheus.linux-amd64.tar.gz]"
+end
+
+remote_file "#{cache_dir}/alertmanager.linux-amd64.tar.gz" do
+ source "https://github.com/prometheus/alertmanager/releases/download/v#{alertmanager_version}/alertmanager-#{alertmanager_version}.linux-amd64.tar.gz"
+ owner "root"
+ group "root"
+ mode "644"
+ backup false
+end
+
+archive_file "#{cache_dir}/alertmanager.linux-amd64.tar.gz" do
+ action :nothing
+ destination "/opt/prometheus-server/alertmanager"
+ overwrite true
+ strip_components 1
+ owner "root"
+ group "root"
+ subscribes :extract, "remote_file[#{cache_dir}/alertmanager.linux-amd64.tar.gz]"
+end
+
+remote_file "#{cache_dir}/karma-linux-amd64.tar.gz" do
+ source "https://github.com/prymitive/karma/releases/download/v#{karma_version}/karma-linux-amd64.tar.gz"
+ owner "root"
+ group "root"
+ mode "644"
+ backup false
+end
+
+archive_file "#{cache_dir}/karma-linux-amd64.tar.gz" do
+ action :nothing
+ destination "/opt/prometheus-server/karma"
+ overwrite true
+ owner "root"
+ group "root"
+ subscribes :extract, "remote_file[#{cache_dir}/karma-linux-amd64.tar.gz]"
+end
+
+promscale_version = "0.11.0"
+
+database_version = node[:timescaledb][:database_version]
+database_cluster = "#{database_version}/main"
+
+package %W[
prometheus
prometheus-alertmanager
+ promscale-extension-postgresql-#{database_version}
]
-promscale_version = "0.2.0"
-
-database_cluster = "#{node[:timescaledb][:database_version]}/main"
-
postgresql_user "prometheus" do
cluster database_cluster
superuser true
mode "755"
end
-package %w[
- make
- gcc
- clang-9
- llvm-9
- cargo
-]
-
-git "/opt/promscale/extension" do
- action :sync
- repository "https://github.com/timescale/promscale_extension.git"
- revision "0.1.1"
- user "root"
- group "root"
-end
-
-execute "/opt/promscale/extension/Makefile" do
- action :nothing
- command "make install"
- cwd "/opt/promscale/extension"
- user "root"
- group "root"
- subscribes :run, "git[/opt/promscale/extension]", :immediately
- notifies :restart, "service[postgresql]", :immediately
-end
-
directory "/opt/promscale/bin" do
owner "root"
group "root"
description "Promscale Connector"
type "simple"
user "prometheus"
- exec_start "/opt/promscale/bin/promscale --db-host /run/postgresql --db-port 5432 --db-user prometheus --db-name promscale --db-connections-max 400"
- # exec_start lazy { "/opt/promscale/bin/promscale --db-host /run/postgresql --db-port #{node[:postgresql][:clusters][database_cluster][:port]} --db-user prometheus --db-name promscale --db-max-connections 400" }
+ exec_start "/opt/promscale/bin/promscale --db.uri postgresql:///promscale?host=/run/postgresql&port=5432 --db.connections-max 400"
limit_nofile 16384
private_tmp true
protect_system "strict"
no_new_privileges true
end
-service "promscale" do
- action [:enable, :start]
- subscribes :restart, "remote_file[/opt/promscale/bin/promscale]"
- subscribes :restart, "systemd_service[promscale]"
-end
-
-systemd_service "promscale-maintenance" do
- description "Promscale Maintenace"
- type "simple"
- user "prometheus"
- exec_start "/usr/bin/psql --command='CALL prom_api.execute_maintenance()' promscale"
- private_tmp true
- protect_system "strict"
- protect_home true
- no_new_privileges true
-end
-
-systemd_timer "promscale-maintenance" do
- description "Promscale Maintenace"
- on_active_sec 1800
- on_unit_inactive_sec 1800
-end
-
-service "promscale-maintenance.timer" do
- action [:enable, :start]
+if node[:prometheus][:promscale]
+ service "promscale" do
+ action [:enable, :start]
+ subscribes :restart, "remote_file[/opt/promscale/bin/promscale]"
+ subscribes :restart, "systemd_service[promscale]"
+ end
+else
+ service "promscale" do
+ action [:disable, :stop]
+ end
end
search(:node, "roles:gateway") do |gateway|
if exporter.is_a?(Hash)
name = exporter[:name]
address = exporter[:address]
+ sni = exporter[:sni]
+ scrape_interval = exporter[:scrape_interval]
metric_relabel = exporter[:metric_relabel] || []
else
name = key
address = exporter
+ sni = nil
+ scrape_interval = nil
metric_relabel = []
end
jobs[name] ||= []
jobs[name] << {
:address => address,
+ :sni => sni,
:instance => client.name.split(".").first,
+ :scrape_interval => scrape_interval,
:metric_relabel => metric_relabel
}
end
snmp_targets << {
:instance => instance,
:target => details[:address],
- :module => details[:module],
+ :modules => details[:modules],
:address => client[:prometheus][:addresses]["snmp"],
:labels => Array(details[:labels])
}
register_target false
end
-template "/etc/default/prometheus" do
- source "default.prometheus.erb"
- owner "root"
- group "root"
- mode "644"
+systemd_service "prometheus-executable" do
+ service "prometheus"
+ dropin "executable"
+ exec_start "/opt/prometheus-server/prometheus/prometheus --config.file=/etc/prometheus/prometheus.yml --web.external-url=https://prometheus.openstreetmap.org/prometheus --storage.tsdb.path=/var/lib/prometheus/metrics2 --storage.tsdb.retention.time=30d"
+ timeout_stop_sec 300
+ notifies :restart, "service[prometheus]"
end
template "/etc/prometheus/prometheus.yml" do
service "prometheus" do
action [:enable, :start]
- subscribes :restart, "template[/etc/default/prometheus]"
subscribes :reload, "template[/etc/prometheus/prometheus.yml]"
subscribes :reload, "template[/etc/prometheus/alert_rules.yml]"
+ subscribes :restart, "archive_file[#{cache_dir}/prometheus.linux-amd64.tar.gz]"
end
-template "/etc/default/prometheus-alertmanager" do
- source "default.alertmanager.erb"
- owner "root"
- group "root"
- mode "644"
+systemd_service "prometheus-alertmanager-executable" do
+ service "prometheus-alertmanager"
+ dropin "executable"
+ exec_start "/opt/prometheus-server/alertmanager/alertmanager --config.file=/etc/prometheus/alertmanager.yml --storage.path=/var/lib/prometheus/alertmanager --web.external-url=https://prometheus.openstreetmap.org/alertmanager"
+ notifies :restart, "service[prometheus-alertmanager]"
end
template "/etc/prometheus/alertmanager.yml" do
service "prometheus-alertmanager" do
action [:enable, :start]
- subscribes :restart, "template[/etc/default/prometheus-alertmanager]"
subscribes :reload, "template[/etc/prometheus/alertmanager.yml]"
+ subscribes :restart, "archive_file[#{cache_dir}/alertmanager.linux-amd64.tar.gz]"
end
template "/etc/prometheus/amtool.yml" do
mode "644"
end
+template "/etc/prometheus/karma.yml" do
+ source "karma.yml.erb"
+ owner "root"
+ group "root"
+ mode "644"
+end
+
+systemd_service "prometheus-karma" do
+ description "Alert dashboard for Prometheus Alertmanager"
+ user "prometheus"
+ exec_start "/opt/prometheus-server/karma/karma-linux-amd64 --config.file=/etc/prometheus/karma.yml"
+ private_tmp true
+ private_devices true
+ protect_system "full"
+ protect_home true
+ no_new_privileges true
+ restart "on-failure"
+end
+
+service "prometheus-karma" do
+ action [:enable, :start]
+ subscribes :reload, "template[/etc/prometheus/karma.yml]"
+ subscribes :restart, "archive_file[#{cache_dir}/karma-linux-amd64.tar.gz]"
+end
+
package "grafana-enterprise"
template "/etc/grafana/grafana.ini" do
apache_site "prometheus.openstreetmap.org" do
template "apache.erb"
+ variables :admin_hosts => admins["hosts"]
end
template "/etc/cron.daily/prometheus-backup" do
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :collector, :kind_of => String, :name_property => true
private_tmp true
protect_system "strict"
protect_home true
- read_write_paths "/var/lib/prometheus/node-exporter"
+ read_write_paths ["/var/lib/prometheus/node-exporter", "/var/lock", "/var/log"]
no_new_privileges true
end
end
def executable_path
- "/opt/prometheus/collectors/#{new_resource.collector}/#{new_resource.collector}_collector"
+ "/opt/prometheus-exporters/collectors/#{new_resource.collector}/#{new_resource.collector}_collector"
end
def executable_options
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :exporter, :kind_of => String, :name_property => true
property :options, :kind_of => [String, Array]
property :environment, :kind_of => Hash, :default => {}
property :service, :kind_of => String
+property :scrape_interval, :kind_of => String
property :metric_relabel, :kind_of => Array
property :register_target, :kind_of => [TrueClass, FalseClass], :default => true
action :create do
systemd_service service_name do
+ after "network-online.target"
+ wants "network-online.target"
description "Prometheus #{new_resource.exporter} exporter"
type "simple"
user new_resource.user
node.default[:prometheus][:exporters][new_resource.port] = {
:name => new_resource.exporter,
:address => listen_address,
+ :scrape_interval => new_resource.scrape_interval,
:metric_relabel => new_resource.metric_relabel
}
end
action :restart do
service service_name do
action :restart
+ only_if { service_exists? }
end
end
end
end
+ def service_exists?
+ ::File.exist?("/etc/systemd/system/#{service_name}.service")
+ end
+
def executable_path
- "/opt/prometheus/exporters/#{new_resource.exporter}/#{new_resource.exporter}_exporter"
+ "/opt/prometheus-exporters/exporters/#{new_resource.exporter}/#{new_resource.exporter}_exporter"
end
def executable_options
end
def after_created
- subscribes :restart, "git[/opt/prometheus]"
+ subscribes :restart, "git[/opt/prometheus-exporters]"
end
# DO NOT EDIT - This file is being maintained by Chef
groups:
- - name: alertmanager
+ - name: amsterdam
rules:
- - alert: prometheus target missing
- expr: up == 0
+ - alert: pdu current draw
+ expr: rPDU2PhaseStatusCurrent{site="amsterdam",rPDU2PhaseStatusIndex="1"} / 10 > 10
for: 5m
labels:
- alertgroup: "prometheus"
+ alertgroup: "amsterdam"
+ annotations:
+ current: "{{ $value | humanize }}A"
+ - alert: site current draw
+ expr: sum(rPDU2PhaseStatusCurrent{site="amsterdam",rPDU2PhaseStatusIndex="1"} / 10) > 13
+ for: 5m
+ labels:
+ alertgroup: "amsterdam"
+ annotations:
+ current: "{{ $value | humanize }}A"
+ - alert: site temperature
+ expr: min(rPDU2SensorTempHumidityStatusTempC{site="amsterdam"}) / 10 < 18 or min(rPDU2SensorTempHumidityStatusTempC{site="amsterdam"}) / 10 > 25
+ for: 5m
+ labels:
+ alertgroup: "amsterdam"
+ annotations:
+ temperature: "{{ $value | humanize }}C"
+ - alert: site humidity
+ expr: max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="amsterdam"}) / 100 < 0.25 or max(rPDU2SensorTempHumidityStatusRelativeHumidity{site="amsterdam"}) / 100 > 0.65
+ for: 5m
+ labels:
+ alertgroup: "amsterdam"
+ annotations:
+ humidity: "{{ $value | humanizePercentage }}"
- name: apache
rules:
- alert: apache down
alertgroup: "{{ $labels.instance }}"
annotations:
busy_workers: "{{ $value | humanizePercentage }}"
+ - alert: apache low request rate
+ expr: rate(apache_accesses_total[5m]) / rate(apache_accesses_total[1h] offset 1w) < 0.25 and rate(apache_accesses_total[1h] offset 1w) > 2
+ for: 15m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ request_rate: "{{ $value | humanizePercentage }}"
+ - name: chef
+ rules:
+ - alert: chef client not running
+ expr: time() - node_systemd_timer_last_trigger_seconds{name="chef-client.timer"} > 3600
+ for: 12h
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ down_time: "{{ $value | humanizeDuration }}"
+ - name: cisco
+ rules:
+ - alert: cisco fan alarm
+ expr: rlPhdUnitEnvParamFan1Status{rlPhdUnitEnvParamFan1Status!="normal"} > 0 or rlPhdUnitEnvParamFan2Status{rlPhdUnitEnvParamFan2Status!="normal"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.site }}"
+ annotations:
+ fan_rpm: "{{ with printf \"rlPhdUnitEnvParamFan1Speed{site='%s',instance='%s',rlPhdUnitEnvParamStackUnit='%s'}\" $labels.site $labels.instance $labels.rlPhdUnitEnvParamStackUnit | query }}{{ . | first | value | humanize }}rpm{{end}}"
+ - alert: cisco temperature alarm
+ expr: rlPhdUnitEnvParamTempSensorStatus{rlPhdUnitEnvParamTempSensorStatus!="ok"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.site }}"
+ annotations:
+ temp_celsius: "{{ with printf \"rlPhdUnitEnvParamTempSensorValue{site='%s',instance='%s',rlPhdUnitEnvParamStackUnit='%s'}\" $labels.site $labels.instance $labels.rlPhdUnitEnvParamStackUnit | query }}{{ . | first | value | humanize }}C{{end}}"
+ - alert: cisco main power alarm
+ expr: rlPhdUnitEnvParamMainPSStatus{rlPhdUnitEnvParamMainPSStatus!="normal"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.site }}"
+ - alert: cisco redundant power alarm
+ expr: rlPhdUnitEnvParamRedundantPSStatus{rlPhdUnitEnvParamRedundantPSStatus!="normal"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.site }}"
+ - name: cpu
+ rules:
+ - alert: cpu pressure
+ expr: rate(node_pressure_cpu_waiting_seconds_total[5m]) > 0.6
+ for: 15m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ pressure: "{{ $value | humanizePercentage }}"
- name: database
rules:
- alert: postgres replication delay
alertgroup: database
annotations:
delay: "{{ $value | humanizeDuration }}"
+ - name: fastly
+ rules:
+ - alert: fastly error rate
+ expr: sum(rate(fastly_rt_status_group_total{status_group="5xx"}[5m])) by (service_name, datacenter) / sum(rate(fastly_rt_status_group_total[5m])) by (service_name, datacenter) > 0.005
+ for: 15m
+ labels:
+ alertgroup: fastly
+ annotations:
+ error_rate: "{{ $value | humanizePercentage }}"
+ - alert: fastly healthcheck failing
+ expr: count(fastly_healthcheck_status == 0) > 0
+ for: 15m
+ labels:
+ alertgroup: fastly
+ - alert: fastly healthcheck failing
+ expr: count(fastly_healthcheck_status == 0) > 4
+ for: 5m
+ labels:
+ alertgroup: fastly
+ - name: filesystem
+ rules:
+ - alert: readonly filesystem
+ expr: node_filesystem_readonly == 1
+ for: 0m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ - alert: filesystem low on space
+ expr: node_filesystem_avail_bytes / node_filesystem_size_bytes < 0.05
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ percentage_free: "{{ $value | humanizePercentage }}"
+ free_bytes: "{{ with printf \"node_filesystem_avail_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
+ total_total: "{{ with printf \"node_filesystem_size_bytes{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value | humanize1024 }}bytes{{end}}"
+ - alert: filesystem low on inodes
+ expr: node_filesystem_files_free / node_filesystem_files < 0.1
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ percentage_free: "{{ $value | humanizePercentage }}"
+ free_inodes: "{{ with printf \"node_filesystem_files_free{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
+ total_inodes: "{{ with printf \"node_filesystem_files{instance='%s',mountpoint='%s'}\" $labels.instance $labels.mountpoint | query }}{{ . | first | value }}{{end}}"
- name: hwmon
rules:
- alert: hwmon fan alarm
in_volts: "{{ with printf \"node_hwmon_in_volts{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}V{{end}}"
in_min_volts: "{{ with printf \"node_hwmon_in_min_volts{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}V{{end}}"
in_max_volts: "{{ with printf \"node_hwmon_in_max_volts{instance='%s',chip='%s',sensor='%s'}\" $labels.instance $labels.chip $labels.sensor | query }}{{ . | first | value | humanize }}V{{end}}"
+ - name: io
+ rules:
+ - alert: io pressure
+ expr: rate(node_pressure_io_waiting_seconds_total[5m]) > 0.6
+ for: 60m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ pressure: "{{ $value | humanizePercentage }}"
- name: ipmi
rules:
- alert: ipmi fan alarm
for: 5m
labels:
alertgroup: "{{ $labels.instance }}"
+ - name: juniper
+ rules:
+ - alert: juniper fan alarm
+ expr: jnxOperatingState{jnxOperatingContentsIndex="4",jnxOperatingState!="running"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.site }}"
+ - alert: juniper power alarm
+ expr: jnxOperatingState{jnxOperatingContentsIndex="2",jnxOperatingState!="running"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.site }}"
+ - name: mail
+ rules:
+ - alert: exim queue length
+ expr: exim_queue > exim_queue_limit
+ for: 60m
+ labels:
+ alertgroup: mail
+ annotations:
+ queue_length: "{{ $value }}"
+ - alert: mailman queue length
+ expr: mailman_queue_length > 200
+ for: 60m
+ labels:
+ alertgroup: mail
+ annotations:
+ queue_length: "{{ $value }}"
- name: mdadm
rules:
- alert: mdadm array inactive
active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
+ - alert: mdadm array degraded
+ expr: sum (node_md_disks{state="active"}) without (state) < node_md_disks_required
+ for: 0m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ required: "{{ with printf \"node_md_disks_required{instance='%s',device='%s'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
+ active: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='active'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
+ failed: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='failed'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
+ spare: "{{ with printf \"node_md_disks{instance='%s',device='%s',state='spare'}\" $labels.instance $labels.device | query }}{{ . | first | value | humanize }} disks{{end}}"
- alert: mdadm disk failed
expr: node_md_disks{state="failed"} > 0
for: 0m
rules:
- alert: low memory
expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.1
- for: 5m
+ for: 15m
labels:
alertgroup: "{{ $labels.instance }}"
annotations:
memory_free: "{{ $value | humanizePercentage }}"
- alert: memory pressure
- expr: rate(node_vmstat_pgmajfault[1m]) > 1000
- for: 5m
+ expr: rate(node_pressure_memory_waiting_seconds_total[5m]) > 0.6
+ for: 60m
labels:
alertgroup: "{{ $labels.instance }}"
annotations:
- major_page_faults: "{{ $value }} faults/s"
+ pressure: "{{ $value | humanizePercentage }}"
- alert: oom kill detected
expr: increase(node_vmstat_oom_kill[1m]) > 0
for: 0m
annotations:
bandwidth_used: "{{ $value | humanizePercentage }}"
- alert: interface transmit errors
- expr: rate(node_network_transmit_errs_total[1m]) / rate(node_network_transmit_packets_total[1m]) > 0.01
+ expr: rate(node_network_transmit_errs_total{device!~"wg.*"}[1m]) / rate(node_network_transmit_packets_total{device!~"wg.*"}[1m]) > 0.01
for: 5m
labels:
alertgroup: "{{ $labels.instance }}"
annotations:
error_rate: "{{ $value | humanizePercentage }}"
+ - alert: interface transmit errors
+ expr: rate(node_network_transmit_errs_total{device=~"wg.*"}[1m]) / rate(node_network_transmit_packets_total{device=~"wg.*"}[1m]) > 0.05
+ for: 1h
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ error_rate: "{{ $value | humanizePercentage }}"
- alert: interface receive errors
expr: rate(node_network_receive_errs_total[1m]) / rate(node_network_receive_packets_total[1m]) > 0.01
for: 5m
alertgroup: "{{ $labels.instance }}"
annotations:
entries_used: "{{ $value | humanizePercentage }}"
+ - name: planet
+ rules:
+ - alert: planet dump overdue
+ expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/(pbf|planet)/.*"} > 7 * 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
+ for: 24h
+ labels:
+ alertgroup: planet
+ annotations:
+ overdue_by: "{{ $value | humanizeDuration }}"
+ - alert: notes dump overdue
+ expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/notes/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
+ for: 6h
+ labels:
+ alertgroup: planet
+ annotations:
+ overdue_by: "{{ $value | humanizeDuration }}"
+ - alert: daily replication feed delayed
+ expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/day/.*"} > 86400 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
+ for: 3h
+ labels:
+ alertgroup: planet
+ annotations:
+ delayed_by: "{{ $value | humanizeDuration }}"
+ - alert: hourly replication feed delayed
+ expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/hour/.*"} > 3600 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
+ for: 30m
+ labels:
+ alertgroup: planet
+ annotations:
+ delayed_by: "{{ $value | humanizeDuration }}"
+ - alert: minutely replication feed delayed
+ expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/minute/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
+ for: 5m
+ labels:
+ alertgroup: planet
+ annotations:
+ delayed_by: "{{ $value | humanizeDuration }}"
+ - alert: changeset replication feed delayed
+ expr: time() - file_stat_modif_time_seconds{path=~"/store/planet/replication/changesets/.*"} > 60 and ignoring (job, name, path) chef_role{name="planetdump"} == 1
+ for: 5m
+ labels:
+ alertgroup: planet
+ annotations:
+ delayed_by: "{{ $value | humanizeDuration }}"
- name: postgresql
rules:
- alert: postgresql down
alertgroup: "{{ $labels.instance }}"
annotations:
queries: "{{ $value }}"
+ - name: prometheus
+ rules:
+ - alert: prometheus configuration error
+ expr: prometheus_config_last_reload_successful == 0
+ for: 10m
+ labels:
+ alertgroup: "prometheus"
+ - alert: prometheus target missing
+ expr: up == 0
+ for: 10m
+ labels:
+ alertgroup: "prometheus"
+ - name: raid
+ rules:
+ - alert: raid array degraded
+ expr: ohai_array_info{status="degraded"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ - alert: raid disk failed
+ expr: ohai_disk_info{status="failed"} > 0
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ - name: smart
+ rules:
+ - alert: smart failure
+ expr: smart_health_status == 0
+ for: 60m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ - alert: smart ssd wearout approaching
+ expr: smart_percentage_used >= 80
+ for: 60m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ annotations:
+ percentage_used: "{{ $value | humanizePercentage }}"
- name: ssl
rules:
- alert: ssl certificate probe failed
for: 0m
labels:
alertgroup: ssl
+ - name: statuscake
+ rules:
+ - alert: statuscake uptime check failing
+ expr: statuscake_uptime{status="down",paused="false"} > 0
+ for: 10m
+ labels:
+ alertgroup: statuscake
+ - name: systemd
+ rules:
+ - alert: systemd failed service
+ expr: node_systemd_unit_state{state="failed",name!="chef-client.service"} == 1
+ for: 5m
+ labels:
+ alertgroup: "{{ $labels.instance }}"
+ - alert: systemd failed service
+ expr: node_systemd_unit_state{state="failed",name="chef-client.service"} == 1
+ for: 6h
+ labels:
+ alertgroup: "{{ $labels.instance }}"
- name: tile
rules:
- alert: renderd replication delay
expr: renderd_replication_delay > 120
- for: 5m
+ for: 15m
labels:
alertgroup: tile
annotations:
alertgroup: "{{ $labels.instance }}"
annotations:
skew: "{{ with printf \"node_timex_offset_seconds{instance='%s'}\" $labels.instance | query }} {{ . | humanizeDuration }}{{ end }}"
+ - name: web
+ rules:
+ - alert: web error rate
+ expr: sum(rate(api_call_count_total{status=~"50[0-8]|5[1-9][0-9]"}[5m])) by (instance) / sum(rate(api_call_count_total[5m])) by (instance) > 0.002
+ for: 5m
+ labels:
+ alertgroup: web
+ annotations:
+ error_rate: "{{ $value | humanizePercentage }}"
+ - alert: job processing rate
+ expr: rate(pg_stat_user_tables_n_tup_del{datname="openstreetmap",relname="delayed_jobs"}[5m]) / rate(pg_stat_user_tables_n_tup_ins{datname="openstreetmap",relname="delayed_jobs"}[5m]) < 0.9 and ignoring(job, name, datname, relname, schemaname, server) chef_role{name="db-master"} == 1
+ for: 15m
+ labels:
+ alertgroup: web
+ annotations:
+ job_processing_rate: "{{ $value | humanizePercentage }}"
ProxyPass /prometheus http://localhost:9090/prometheus
Redirect 403 /alertmanager/api
ProxyPass /alertmanager http://localhost:9093/alertmanager
+ ProxyPass /karma http://localhost:8081/karma
ProxyPass / http://localhost:3000/
ProxyPreserveHost on
+
+ <Location /alertmanager>
+<% @admin_hosts.each do |host| -%>
+ Require ip <%= host %>
+<% end -%>
+ </Location>
+
+ <Location /karma>
+<% @admin_hosts.each do |host| -%>
+ Require ip <%= host %>
+<% end -%>
+ </Location>
</VirtualHost>
<% node[:roles].sort.each do |role| -%>
chef_role{name="<%= role %>"} 1
<% end -%>
-<% if node[:roles].include?("tilecache") -%>
-# HELP chef_tile_parent Information about tile cache parents
-# TYPE chef_tile_parent gauge
-chef_tile_parent{name="<%= node[:tilecache][:tile_parent].split(".").first %>"} 1
+<% node[:prometheus][:metrics].sort.each do |name, details| -%>
+# HELP <%= name %> <%= details[:help] %>
+# TYPE <%= name %> gauge
+<%= name %>{<%= Hash(details[:labels]).map { |k,v| "#{k}=\"#{v}\"" }.join(",") %>} <%= details[:metric] || 1 %>
<% end -%>
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-ARGS="--web.external-url=https://prometheus.openstreetmap.org/alertmanager"
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-ARGS="--web.external-url=https://prometheus.openstreetmap.org/prometheus"
--- /dev/null
+exporter:
+ files:
+ - patterns:
+<% node[:prometheus][:files].each do |file| -%>
+ - <%= file %>
+<% end -%>
--- /dev/null
+karma:
+ name: OpenStreetMap
+alertmanager:
+ interval: 1m
+ servers:
+ - name: openstreetmap
+ uri: http://127.0.0.1:9093/alertmanager/
+ external_uri: https://prometheus.openstreetmap.org/alertmanager/
+ proxy: true
+listen:
+ port: 8081
+ prefix: /karma/
+filters:
+ default:
+ - "@state=active"
+labels:
+ color:
+ static:
+ - instance
+ strip:
+ - "@cluster"
replacement: 127.0.0.1:9219
<% @jobs.sort.each do |name, targets| -%>
- job_name: <%= name %>
+<% if targets.first[:scrape_interval] -%>
+ scrape_interval: <%= targets.first[:scrape_interval] %>
+<% end -%>
+<% if targets.first[:sni] -%>
+ tls_config:
+ server_name: <%= targets.first[:sni] %>
+ relabel_configs:
+ - target_label: __scheme__
+ replacement: https
+<% end -%>
static_configs:
<% targets.each do |target| -%>
- targets:
<% end -%>
- job_name: snmp
scrape_interval: 5m
- scrape_timeout: 1m
+ scrape_timeout: 2m
metrics_path: /snmp
static_configs:
- - targets:
<% @snmp_targets.sort_by { |t| t[:instance] }.each do |target| -%>
- targets:
- - "<%= target[:target] %>/<%= target[:module] %>/<%= target[:address] %>"
+<% target[:modules].each do |module_name| -%>
+ - "<%= target[:target] %>/<%= module_name %>/<%= target[:address] %>"
+<% end -%>
labels:
instance: <%= target[:instance] %>
<% target[:labels].sort.each do |name, value| -%>
# limitations under the License.
#
+unified_mode true
+
default_action :install
property :package_name, :kind_of => String, :name_property => true
end
end
+action :upgrade do
+ if new_resource.version.nil?
+ execute "pip-upgrade-#{new_resource.package_name}" do
+ command "#{pip_command} install --upgrade #{new_resource.package_name}"
+ only_if "#{pip_command} list --outdated | fgrep -q #{new_resource.package_name}"
+ end
+ else
+ execute "pip-upgrade-#{new_resource.package_name}" do
+ command "#{pip_command} install --upgrade #{new_resource.package_name}==#{new_resource.version}"
+ not_if "#{pip_command} show #{new_resource.package_name} | fgrep -q #{new_resource.version}"
+ end
+ end
+end
+
action :remove do
execute "pip-uninstall-#{new_resource.package_name}" do
command "#{pip_command} uninstall #{new_resource.package_name}"
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :virtualenv_directory, :kind_of => String, :name_property => true
include_recipe "networking"
+writable_paths = []
hosts_allow = {}
hosts_deny = {}
node[:rsyncd][:modules].each do |name, details|
+ writable_paths << details[:path] if details[:write_only]
+
hosts_allow[name] = details[:hosts_allow] || []
if details[:nodes_allow]
service "rsync"
dropin "override"
exec_start "/usr/bin/rsync --daemon --no-detach --bwlimit=16384"
+ read_write_paths writable_paths.sort
notifies :restart, "service[rsync]"
end
--- /dev/null
+# Ruby Cookbook
+
+Installs and configures ruby.
--- /dev/null
+default[:ruby][:version] = if node[:lsb][:release].to_f < 22.04
+ "2.7"
+ else
+ "3.0"
+ end
+default[:ruby][:gem] = "/usr/bin/gem#{node[:ruby][:version]}"
+default[:ruby][:bundle] = "/usr/bin/bundle#{node[:ruby][:version]}"
-name "nfs"
+name "ruby"
maintainer "OpenStreetMap Administrators"
maintainer_email "admins@openstreetmap.org"
license "Apache-2.0"
-description "Installs and configures nfs"
+description "Installs and configures ruby"
version "1.0.0"
supports "ubuntu"
--- /dev/null
+#
+# Cookbook:: ruby
+# Recipe:: default
+#
+# Copyright:: 2022, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ruby_version = node[:ruby][:version]
+
+package %W[
+ ruby
+ ruby#{ruby_version}
+ ruby
+ ruby#{ruby_version}-dev
+]
+
+gem_package "bundler#{ruby_version}-1" do
+ package_name "bundler"
+ version "~> 1.17.3"
+ gem_binary node[:ruby][:gem]
+ options "--format-executable"
+end
+
+gem_package "bundler#{ruby_version}-2" do
+ package_name "bundler"
+ version "~> 2.3.16"
+ gem_binary node[:ruby][:gem]
+ options "--format-executable"
+end
--- /dev/null
+#
+# Cookbook:: ruby
+# Resource:: bundle_exec
+#
+# Copyright:: 2022, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+resource_name :bundle_exec
+provides :bundle_exec
+
+unified_mode true
+
+default_action :run
+
+property :directory, :kind_of => String, :name_property => true
+property :command, :kind_of => String
+property :user, :kind_of => String
+property :group, :kind_of => String
+property :environment, :kind_of => Hash
+
+action :run do
+ execute "#{new_resource.directory}/Gemfile" do
+ command "#{bundle_command} exec #{new_resource.command}"
+ cwd new_resource.directory
+ user new_resource.user
+ group new_resource.group
+ environment new_resource.environment
+ end
+end
+
+action_class do
+ def bundle_command
+ node[:ruby][:bundle]
+ end
+end
--- /dev/null
+#
+# Cookbook:: ruby
+# Resource:: bundle_install
+#
+# Copyright:: 2022, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+resource_name :bundle_install
+provides :bundle_install
+
+unified_mode true
+
+default_action :run
+
+property :directory, :kind_of => String, :name_property => true
+property :options, :kind_of => String
+property :user, :kind_of => String
+property :group, :kind_of => String
+property :environment, :kind_of => Hash
+
+action :run do
+ execute "#{new_resource.directory}/Gemfile" do
+ command "#{bundle_command} install #{new_resource.options}"
+ cwd new_resource.directory
+ user new_resource.user
+ group new_resource.group
+ environment new_resource.environment
+ end
+end
+
+action_class do
+ def bundle_command
+ node[:ruby][:bundle]
+ end
+end
+
+def after_created
+ subscribes :run, "gem_package[bundler#{node[:ruby][:version]}-1]"
+ subscribes :run, "gem_package[bundler#{node[:ruby][:version]}-2]"
+end
This cookbook configures the hardware details website found at
[hardware.openstreetmap.org](https://hardware.openstreetmap.org). The code for
-the website itself is available at [github.com/gravitystorm/osmf-server-info](https://github.com/gravitystorm/osmf-server-info).
+the website itself is available at [github.com/osmfoundation/osmf-server-info](https://github.com/osmfoundation/osmf-server-info).
supports "ubuntu"
depends "apache"
depends "git"
+depends "ruby"
include_recipe "apache"
include_recipe "git"
+include_recipe "ruby"
package %w[
gcc
g++
make
- ruby
- ruby-dev
libssl-dev
zlib1g-dev
pkg-config
]
-gem_package "bundler" do
- version "1.17.3"
-end
-
git "/srv/hardware.openstreetmap.org" do
action :sync
- repository "https://github.com/gravitystorm/osmf-server-info.git"
+ repository "https://github.com/osmfoundation/osmf-server-info.git"
depth 1
user "root"
group "root"
- notifies :run, "execute[/srv/hardware.openstreetmap.org/Gemfile]"
+ notifies :run, "bundle_install[/srv/hardware.openstreetmap.org]"
end
nodes = { :rows => search(:node, "*:*") }
mode "644"
owner "root"
group "root"
- notifies :run, "execute[/srv/hardware.openstreetmap.org]"
+ notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
end
file "/srv/hardware.openstreetmap.org/_data/roles.json" do
mode "644"
owner "root"
group "root"
- notifies :run, "execute[/srv/hardware.openstreetmap.org]"
+ notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
end
directory "/srv/hardware.openstreetmap.org/_site" do
group "nogroup"
end
-execute "/srv/hardware.openstreetmap.org/Gemfile" do
+bundle_install "/srv/hardware.openstreetmap.org" do
action :nothing
- command "bundle install --deployment"
- cwd "/srv/hardware.openstreetmap.org"
+ options "--deployment"
user "root"
group "root"
- notifies :run, "execute[/srv/hardware.openstreetmap.org]"
+ notifies :run, "bundle_exec[/srv/hardware.openstreetmap.org]"
end
-execute "/srv/hardware.openstreetmap.org" do
+bundle_exec "/srv/hardware.openstreetmap.org" do
action :nothing
- command "bundle exec jekyll build --trace --baseurl=https://hardware.openstreetmap.org"
- cwd "/srv/hardware.openstreetmap.org"
+ command "jekyll build --trace --baseurl=https://hardware.openstreetmap.org"
user "nobody"
group "nogroup"
end
package "snmpd"
-service "snmpd" do
- action [:enable, :start]
- supports :status => true, :restart => true
-end
-
template "/etc/snmp/snmpd.conf" do
source "snmpd.conf.erb"
owner "root"
notifies :restart, "service[snmpd]"
end
+service "snmpd" do
+ action [:enable, :start]
+ supports :status => true, :restart => true
+end
+
if node[:snmpd][:clients]
node[:snmpd][:clients].each do |address|
firewall_rule "accept-snmp" do
+++ /dev/null
-# Squid cookbook
-
-This cookbook installs the Squid caching proxy service and configures it for use
-as a tile cache.
+++ /dev/null
-default[:squid][:version] = 4
-default[:squid][:cache_mem] = "256 MB"
-default[:squid][:cache_dir] = "ufs /var/spool/squid 256 16 256"
-default[:squid][:access_log] = "/var/log/squid/access.log openstreetmap"
-default[:squid][:private_devices] = true
-
-default[:apt][:sources] = node[:apt][:sources] | ["squid#{node[:squid][:version]}"]
+++ /dev/null
-#
-# Cookbook:: squid
-# Recipe:: default
-#
-# Copyright:: 2011, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-include_recipe "apt"
-include_recipe "munin"
-include_recipe "prometheus"
-
-if node[:squid][:version] >= 3
- apt_package "squid" do
- action :unlock
- end
-
- apt_package "squid-common" do
- action :unlock
- end
-
- apt_package "squid" do
- action :purge
- only_if "dpkg-query -W squid | fgrep -q 2."
- end
-
- apt_package "squid-common" do
- action :purge
- only_if "dpkg-query -W squid-common | fgrep -q 2."
- end
-
- file "/store/squid/coss-01" do
- action :delete
- backup false
- end
-
- package "squidclient" do
- action :upgrade
- end
-end
-
-package "squid"
-package "squidclient"
-
-template "/etc/squid/squid.conf" do
- source "squid.conf.erb"
- owner "root"
- group "root"
- mode "644"
-end
-
-directory "/etc/squid/squid.conf.d" do
- owner "root"
- group "root"
- mode "755"
-end
-
-Array(node[:squid][:cache_dir]).each do |cache_dir|
- if cache_dir =~ /^coss (\S+) /
- cache_dir = File.dirname(Regexp.last_match(1))
- elsif cache_dir =~ /^\S+ (\S+) /
- cache_dir = Regexp.last_match(1)
- end
-
- directory cache_dir do
- owner "proxy"
- group "proxy"
- mode "750"
- recursive true
- notifies :restart, "service[squid]"
- end
-end
-
-systemd_tmpfile "/var/run/squid" do
- type "d"
- owner "proxy"
- group "proxy"
- mode "0755"
-end
-
-address_families = %w[AF_UNIX AF_INET AF_INET6]
-
-file "/etc/systemd/system/squid.service" do
- action :delete
-end
-
-file "/etc/logrotate.d/squid.dpkg-dist" do
- action :delete
-end
-
-squid_service_exec = if node[:lsb][:release].to_f < 20.04
- "/usr/sbin/squid -YC"
- else
- "/usr/sbin/squid --foreground -YC"
- end
-
-systemd_service "squid" do
- dropin "chef"
- limit_nofile 98304
- private_tmp true
- private_devices node[:squid][:private_devices]
- protect_system "full"
- protect_home true
- restrict_address_families address_families
- restart "always"
- exec_start "#{squid_service_exec}"
-end
-
-service "squid" do
- action :enable
- subscribes :restart, "systemd_service[squid]"
- subscribes :restart, "template[/etc/squid/squid.conf]"
- subscribes :reload, "template[/etc/resolv.conf]"
-end
-
-notify_group "squid-start" do
- action :run
- notifies :start, "service[squid]"
-end
-
-service "squid-restart" do
- service_name "squid"
- action :restart
- only_if do
- IO.popen(["squidclient", "--host=127.0.0.1", "--port=3128", "mgr:counters"]) do |io|
- io.each.grep(/^[a-z][a-z_.]+ = -[0-9]+$/).count.positive?
- end
- end
-end
-
-munin_plugin "squid_cache"
-munin_plugin "squid_times"
-munin_plugin "squid_icp"
-munin_plugin "squid_objectsize"
-munin_plugin "squid_requests"
-munin_plugin "squid_traffic"
-
-munin_plugin "squid_delay_pools" do
- action :delete
-end
-
-munin_plugin "squid_delay_pools_noreferer" do
- action :delete
-end
-
-prometheus_exporter "squid" do
- port 9301
- listen_switch "listen"
-end
+++ /dev/null
-#
-# Cookbook:: squid
-# Resource:: squid_fragment
-#
-# Copyright:: 2015, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-default_action :create
-
-property :fragment, :kind_of => String, :name_property => true
-property :template, :kind_of => String, :required => [:create]
-property :variables, :kind_of => Hash, :default => {}
-
-action :create do
- declare_resource :template, fragment_path do
- source new_resource.template
- owner "root"
- group "root"
- mode "644"
- variables new_resource.variables
- end
-end
-
-action :delete do
- file fragment_path do
- action :delete
- end
-end
-
-action_class do
- def fragment_path
- "/etc/squid/squid.conf.d/#{new_resource.fragment}.conf"
- end
-end
-
-def after_created
- notifies :create, "template[/etc/squid/squid.conf]"
-end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-# configure host name
-visible_hostname <%= node.name %>
-
-cache_mem <%= node[:squid][:cache_mem] %>
-<% if node[:squid][:version] > 2 -%>
-
-workers <%= [ node[:cpu][:total] - 2, 1 ].max.ceil %>
-cpu_affinity_map process_numbers=<%= (1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %> cores=<%=(1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %>
-
-# Set short clean shutdown interval
-shutdown_lifetime 2 seconds
-
-error_log_languages off
-<% end -%>
-
-max_filedescriptors 98304
-
-<% if node[:squid][:version] > 3 -%>
-# Use RFC6891 recommended max size
-dns_packet_max 4096 bytes
-# Use low initial retry interval (backoff start)
-dns_retransmit_interval 2 seconds
-# Set low timeout
-dns_timeout 15 seconds
-<% end -%>
-dns_v4_first on
-
-# used by squidclient / munin
-http_port 3128
-# HTCP
-htcp_port 4827
-# ICP
-icp_port 3130
-log_icp_queries off
-
-<% if node[:squid][:version] < 3 -%>
-http_port 80 accel defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6 http11
-<% else -%>
-http_port 8080 accel no-vhost defaultsite=tile.openstreetmap.org tcpkeepalive=60,10,6
-<% end -%>
-
-cache_effective_user proxy
-cache_effective_group proxy
-
-<% Array(node[:squid][:cache_dir]).each do |cache_dir| -%>
-cache_dir <%= cache_dir %>
-<% end -%>
-
-<% if node[:squid][:version] < 3 -%>
-cache_swap_log /var/spool/squid/%s
-<% end -%>
-
-cache_mgr webmaster@openstreetmap.org
-
-quick_abort_min 0 KB
-quick_abort_max 0 KB
-
-read_ahead_gap 64 KB
-
-maximum_object_size 256 KB
-maximum_object_size_in_memory 64 KB
-
-cache_replacement_policy heap LFUDA
-memory_replacement_policy heap GDSF
-
-server_persistent_connections on
-<% if node[:squid][:version] < 3 -%>
-persistent_request_timeout 1 minutes
-<% else -%>
-client_idle_pconn_timeout 1 minutes
-<% end -%>
-<% if node[:squid][:version] > 3 -%>
-pconn_lifetime 5 minutes
-<% end -%>
-
-negative_ttl 15 seconds
-<% if node[:squid][:version] < 3 -%>
-pipeline_prefetch on
-<% end -%>
-
-read_timeout 90 seconds
-request_timeout 90 seconds
-connect_timeout 20 seconds
-client_lifetime 1 hours
-
-<% if node[:squid][:version] < 3 -%>
-refresh_stale_hit 300 seconds
-<% end -%>
-
-# Recommended minimum configuration:
-# ----------------------------------
-<% if node[:squid][:version] < 3 -%>
-acl all src all
-acl manager proto cache_object
-acl localhost src 127.0.0.1/32
-acl to_localhost dst 127.0.0.0/8
-<% end -%>
-acl SSL_ports port 443
-acl Safe_ports port 80 # http
-acl Safe_ports port 21 # ftp
-acl Safe_ports port 443 # https
-acl Safe_ports port 70 # gopher
-acl Safe_ports port 210 # wais
-acl Safe_ports port 1025-65535 # unregistered ports
-acl Safe_ports port 280 # http-mgmt
-acl Safe_ports port 488 # gss-http
-acl Safe_ports port 591 # filemaker
-acl Safe_ports port 777 # multiling http
-acl CONNECT method CONNECT
-http_access allow manager localhost
-
-http_access allow manager
-
-http_access deny manager
-http_access deny !Safe_ports
-http_access deny CONNECT !SSL_ports
-# ----------------------------------
-
-acl purge_hosts src 127.0.0.0/8
-acl PURGE method purge
-http_access allow purge purge_hosts
-http_access deny purge
-
-forwarded_for on
-follow_x_forwarded_for allow localhost
-
-<% if node[:squid][:version] < 3 -%>
-logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03Hs %<st %rm %rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
-access_log <%= node[:squid][:access_log] %>
-<% else -%>
-logformat openstreetmap %ts.%03tu %tr %>a %Ss/%03>Hs %<st %rm %>rp %Sh/%<A %mt "%{Referer}>h" "%{User-Agent}>h"
-access_log daemon:<%= node[:squid][:access_log] %>
-<% end -%>
-cache_log /var/log/squid/cache.log
-cache_store_log none
-
-buffered_logs on
-
-client_db off
-strip_query_terms off
-<% if node[:squid][:version] > 2 -%>
-# Work around bug in squid 3 that causes log_fqdn to be
-# turned on by some of the (unused by us) default formats:
-# http://lists.squid-cache.org/pipermail/squid-users/2016-February/thread.html#8999
-url_rewrite_extras "%>a %un %>rm myip=%la myport=%lp"
-store_id_extras "%>a %un %>rm myip=%la myport=%lp"
-<% end -%>
-
-digest_generation off
-
-refresh_pattern . 0 50% 20160
-refresh_pattern -i tile.openstreetmap.org 60 80% 20160 reload-into-ims
-
-# ZERO required for logrotate to work properly
-logfile_rotate 0
-
-<% Dir.glob("/etc/squid/squid.conf.d/*.conf") do |file| -%>
-<%= File.read(file) %>
-<% end -%>
-
-# MUST BE LAST ACL
-# --------------
-http_access deny all
-htcp_access deny all
-icp_access deny all
-# --------------
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :certificate, String, :name_property => true
version "1.0.0"
supports "ubuntu"
+depends "ruby"
depends "wordpress"
# limitations under the License.
#
+include_recipe "ruby"
include_recipe "wordpress"
passwords = data_bag_item("stateofthemap", "passwords")
revision "theme-2007"
end
-wordpress_plugin "2007.stateofthemap.org-geopress" do
- plugin "geopress"
- site "2007.stateofthemap.org"
-end
+# wordpress_plugin "2007.stateofthemap.org-geopress" do
+# plugin "geopress"
+# site "2007.stateofthemap.org"
+# end
directory "/srv/2008.stateofthemap.org" do
owner "wordpress"
revision "theme-2008"
end
-wordpress_plugin "2008.stateofthemap.org-geopress" do
- plugin "geopress"
- site "2008.stateofthemap.org"
-end
+# wordpress_plugin "2008.stateofthemap.org-geopress" do
+# plugin "geopress"
+# site "2008.stateofthemap.org"
+# end
directory "/srv/2009.stateofthemap.org" do
owner "wordpress"
revision "theme-2009"
end
-wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
- plugin "wp-sticky"
- site "2009.stateofthemap.org"
-end
+# wordpress_plugin "2009.stateofthemap.org-wp-sticky" do
+# plugin "wp-sticky"
+# site "2009.stateofthemap.org"
+# end
directory "/srv/2010.stateofthemap.org" do
owner "wordpress"
plugin "sitepress-multilingual-cms"
site "2010.stateofthemap.org"
repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
- not_if { ENV["TEST_KITCHEN"] }
+ revision "master"
+ not_if { kitchen? }
end
-wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
- plugin "wp-sticky"
- site "2010.stateofthemap.org"
-end
+# wordpress_plugin "2010.stateofthemap.org-wp-sticky" do
+# plugin "wp-sticky"
+# site "2010.stateofthemap.org"
+# end
directory "/srv/2011.stateofthemap.org" do
owner "wordpress"
plugin "sitepress-multilingual-cms"
site "2011.stateofthemap.org"
repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
- not_if { ENV["TEST_KITCHEN"] }
+ revision "master"
+ not_if { kitchen? }
end
-wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
- plugin "wp-sticky"
- site "2011.stateofthemap.org"
-end
+# wordpress_plugin "2011.stateofthemap.org-wp-sticky" do
+# plugin "wp-sticky"
+# site "2011.stateofthemap.org"
+# end
directory "/srv/2012.stateofthemap.org" do
owner "wordpress"
plugin "sitepress-multilingual-cms"
site "2012.stateofthemap.org"
repository "https://git.openstreetmap.org/private/sitepress-multilingual-cms.git"
- not_if { ENV["TEST_KITCHEN"] }
+ revision "master"
+ not_if { kitchen? }
end
-wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
- plugin "wp-sticky"
- site "2012.stateofthemap.org"
-end
+# wordpress_plugin "2012.stateofthemap.org-wp-sticky" do
+# plugin "wp-sticky"
+# site "2012.stateofthemap.org"
+# end
%w[2013].each do |year|
git "/srv/#{year}.stateofthemap.org" do
gcc
g++
make
- ruby
- ruby-dev
libssl-dev
zlib1g-dev
pkg-config
apache_module "expires"
apache_module "rewrite"
-gem_package "bundler" do
- version "1.17.3"
-end
-
-gem_package "bundler" do
- version "2.1.4"
-end
-
-%w[2016 2017 2018 2019 2020 2021].each do |year|
+%w[2016 2017 2018 2019 2020 2021 2022].each do |year|
git "/srv/#{year}.stateofthemap.org" do
action :sync
repository "https://github.com/openstreetmap/stateofthemap-#{year}.git"
depth 1
user "root"
group "root"
- notifies :run, "execute[/srv/#{year}.stateofthemap.org/Gemfile]"
+ notifies :run, "bundle_install[/srv/#{year}.stateofthemap.org]"
end
directory "/srv/#{year}.stateofthemap.org/_site" do
group "nogroup"
end
- execute "/srv/#{year}.stateofthemap.org/Gemfile" do
+ bundle_install "/srv/#{year}.stateofthemap.org" do
action :nothing
- command "bundle install --deployment"
- cwd "/srv/#{year}.stateofthemap.org"
+ options "--deployment --jobs #{node[:cpu][:total]}"
user "root"
group "root"
- notifies :run, "execute[/srv/#{year}.stateofthemap.org]"
+ notifies :run, "bundle_exec[/srv/#{year}.stateofthemap.org]"
only_if { ::File.exist?("/srv/#{year}.stateofthemap.org/Gemfile") }
end
- execute "/srv/#{year}.stateofthemap.org" do
+ bundle_exec "/srv/#{year}.stateofthemap.org" do
action :nothing
- command "bundle exec jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
- cwd "/srv/#{year}.stateofthemap.org"
+ command "jekyll build --trace --baseurl=https://#{year}.stateofthemap.org"
user "nobody"
group "nogroup"
+ environment "LANG" => "C.UTF-8"
end
ssl_certificate "#{year}.stateofthemap.org" do
+++ /dev/null
-#!/bin/sh
-
-/usr/bin/sudo -u trac /usr/bin/trac-admin /var/lib/trac changeset added "$1" "$2"
+++ /dev/null
-#!/bin/sh
-
-/usr/bin/sudo -u trac /usr/bin/trac-admin /var/lib/trac changeset modified "$1" "$2"
include_recipe "apache"
-package "subversion"
-
-repository_directory = "/var/lib/subversion/repos/openstreetmap"
-
-remote_directory "#{repository_directory}/hooks" do
- source "hooks"
- owner "www-data"
- group "www-data"
- mode "755"
- files_owner "www-data"
- files_group "www-data"
- files_mode "755"
- purge false
-end
-
-apache_module "dav" do
- package "apache2"
-end
-
-apache_module "dav_fs" do
- package "apache2"
-end
-
-apache_module "dav_svn" do
- package "libapache2-mod-svn"
-end
-
-apache_module "authz_svn" do
- package "libapache2-mod-svn"
-end
+apache_module "rewrite"
ssl_certificate "svn.openstreetmap.org" do
domains ["svn.openstreetmap.org", "svn.osm.org"]
apache_site "svn.openstreetmap.org" do
template "apache.erb"
- directory repository_directory
- variables :realm => "Subversion Repository", :password_file => "/etc/apache2/svn.passwd", :aliases => ["svn.osm.org"]
-end
-
-template "/etc/cron.daily/svn-backup" do
- source "backup.cron.erb"
- owner "root"
- group "root"
- mode "755"
+ variables :aliases => ["svn.osm.org"]
end
ServerName <%= @name %>
ServerAdmin webmaster@openstreetmap.org
- Protocols http/1.1
-
SSLEngine on
SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
CustomLog /var/log/apache2/<%= @name %>-access.log combined
- CustomLog /var/log/apache2/<%= @name %>-svn-access.log "%h %t %u %{SVN-ACTION}e" env=SVN-ACTION
ErrorLog /var/log/apache2/<%= @name %>-error.log
- <Location />
- DAV svn
- SVNPath <%= @directory %>
- SVNIndexXSLT /svnindex.xsl
-
- LimitXMLRequestBody 0
- LimitRequestBody 0
-
- <Limit GET PROPFIND OPTIONS REPORT>
- Require all granted
- </Limit>
+ RedirectPermanent /applications/editors/josm/plugins/cadastre-fr/images/cadastre_small.png https://raw.githubusercontent.com/openstreetmap/svn-archive/main/applications/editors/josm/plugins/cadastre-fr/images/cadastre_small.png
- <LimitExcept GET PROPFIND OPTIONS REPORT>
- Require all denied
- </LimitExcept>
- </Location>
+ RewriteEngine on
+ RewriteRule ^/misc/maps/uk/towns/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/maps/uk/towns [QSD,L,R=permanent]
+ RewriteRule ^/misc/maps/uk/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/maps/uk [QSD,L,R=permanent]
+ RewriteRule ^/misc/maps/featured/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/maps/featured [QSD,L,R=permanent]
+ RewriteRule ^/misc/maps/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/maps [QSD,L,R=permanent]
+ RewriteRule ^/misc/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/german_roll_up/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/german_roll_up [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/releases/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/releases [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/german_flyer_2008-01/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/german_flyer_2008-01 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/german_flyer_2009_03/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/german_flyer_2009_03 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/german_flyer_2010_04/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/german_flyer_2010_04 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/german_flyer_2011_08/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/german_flyer_2011_08 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/german_flyer_2013_01/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/german_flyer_2013_01 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/italy_miniguida/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/italy_miniguida [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/portuguese_flyer_2013_01/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/portuguese_flyer_2013_01 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/recruitment_poster/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/recruitment_poster [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/dutch_flyer_2013_02/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/dutch_flyer_2013_02 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/french_local_admininistrations/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/french_local_admininistrations [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/italy_flyers/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/italy_flyers [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/english_flyer_ajr_2008-04/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/english_flyer_ajr_2008-04 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/czech_poster_2008_10/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/czech_poster_2008_10 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/slideshow/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/slideshow [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/english_flyer_2010_10/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/english_flyer_2010_10 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/french_flyer_2011_10/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material/french_flyer_2011_10 [QSD,L,R=permanent]
+ RewriteRule ^/misc/pr_material/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/pr_material [QSD,L,R=permanent]
+ RewriteRule ^/misc/64bit_testdata/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/64bit_testdata [QSD,L,R=permanent]
+ RewriteRule ^/misc/images/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/images [QSD,L,R=permanent]
+ RewriteRule ^/misc/videos/code_swarm/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/videos/code_swarm [QSD,L,R=permanent]
+ RewriteRule ^/misc/videos/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/videos [QSD,L,R=permanent]
+ RewriteRule ^/misc/documents/osmbook/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/documents/osmbook [QSD,L,R=permanent]
+ RewriteRule ^/misc/documents/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/documents [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2006/NickWhitelegg_Wed6th_602a/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2006/NickWhitelegg_Wed6th_602a [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2006/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2006 [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2007/Nick_Black_FOSS/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2007/Nick_Black_FOSS [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2007/Frederik_Ramm/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2007/Frederik_Ramm [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2007/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2007 [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2008/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2008 [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/2009/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures/2009 [QSD,L,R=permanent]
+ RewriteRule ^/misc/lectures/?.* https://github.com/openstreetmap/svn-archive/tree/main/misc/lectures [QSD,L,R=permanent]
+ RewriteRule ^/imports/ongoing/?.* https://github.com/openstreetmap/svn-archive/tree/main/imports/ongoing [QSD,L,R=permanent]
+ RewriteRule ^/imports/one-time/airport_import/?.* https://github.com/openstreetmap/svn-archive/tree/main/imports/one-time/airport_import [QSD,L,R=permanent]
+ RewriteRule ^/imports/one-time/?.* https://github.com/openstreetmap/svn-archive/tree/main/imports/one-time [QSD,L,R=permanent]
+ RewriteRule ^/imports/?.* https://github.com/openstreetmap/svn-archive/tree/main/imports [QSD,L,R=permanent]
+ RewriteRule ^/extensions/wordpress/osmf-blog-theme/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/wordpress/osmf-blog-theme [QSD,L,R=permanent]
+ RewriteRule ^/extensions/wordpress/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/wordpress [QSD,L,R=permanent]
+ RewriteRule ^/extensions/mediawiki/osmf/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/mediawiki/osmf [QSD,L,R=permanent]
+ RewriteRule ^/extensions/mediawiki/usergroupsbot/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/mediawiki/usergroupsbot [QSD,L,R=permanent]
+ RewriteRule ^/extensions/mediawiki/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/mediawiki [QSD,L,R=permanent]
+ RewriteRule ^/extensions/joomla/mod_osmMap/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/joomla/mod_osmMap [QSD,L,R=permanent]
+ RewriteRule ^/extensions/joomla/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions/joomla [QSD,L,R=permanent]
+ RewriteRule ^/extensions/?.* https://github.com/openstreetmap/svn-archive/tree/main/extensions [QSD,L,R=permanent]
+ RewriteRule ^/sites/ooc\.openstreetmap\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/ooc.openstreetmap.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/www\.openstreetbrowser\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/www.openstreetbrowser.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/stateofthemap/feedback/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/stateofthemap/feedback [QSD,L,R=permanent]
+ RewriteRule ^/sites/stateofthemap/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/stateofthemap [QSD,L,R=permanent]
+ RewriteRule ^/sites/www\.openstreetmap\.no/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/www.openstreetmap.no [QSD,L,R=permanent]
+ RewriteRule ^/sites/tile\.openstreetmap\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/tile.openstreetmap.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/namefinder/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/namefinder [QSD,L,R=permanent]
+ RewriteRule ^/sites/free-map\.org\.uk/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/free-map.org.uk [QSD,L,R=permanent]
+ RewriteRule ^/sites/www\.freethepostcode\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/www.freethepostcode.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/www\.openstreetmap\.org\.za/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/www.openstreetmap.org.za [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/StaticMap/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/StaticMap [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/places/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/places [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/trapi/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/trapi [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/route-altitude-profile/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/route-altitude-profile [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/tilesAtHome_tahngo/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/tilesAtHome_tahngo [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/tiles/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/tiles [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/ranaShareServer/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/ranaShareServer [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/tiledata/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/tiledata [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/osmabrowser/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/osmabrowser [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/tilesSvrB/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/tilesSvrB [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/freemap-npe/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other/freemap-npe [QSD,L,R=permanent]
+ RewriteRule ^/sites/other/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/other [QSD,L,R=permanent]
+ RewriteRule ^/sites/support/www\.openstreetmap\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/support/www.openstreetmap.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/support/osm-autologger/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/support/osm-autologger [QSD,L,R=permanent]
+ RewriteRule ^/sites/support/tile/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/support/tile [QSD,L,R=permanent]
+ RewriteRule ^/sites/support/log-anonymiser/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/support/log-anonymiser [QSD,L,R=permanent]
+ RewriteRule ^/sites/support/dev/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/support/dev [QSD,L,R=permanent]
+ RewriteRule ^/sites/support/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/support [QSD,L,R=permanent]
+ RewriteRule ^/sites/irc\.openstreetmap\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/irc.openstreetmap.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/www\.openstreetmap\.de/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/www.openstreetmap.de [QSD,L,R=permanent]
+ RewriteRule ^/sites/wms\.openstreetmap\.de/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/wms.openstreetmap.de [QSD,L,R=permanent]
+ RewriteRule ^/sites/donate\.openstreetmap\.org/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/donate.openstreetmap.org [QSD,L,R=permanent]
+ RewriteRule ^/sites/rails_port/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/rails_port [QSD,L,R=permanent]
+ RewriteRule ^/sites/osm\.org_down_notice/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/osm.org_down_notice [QSD,L,R=permanent]
+ RewriteRule ^/sites/dns/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites/dns [QSD,L,R=permanent]
+ RewriteRule ^/sites/?.* https://github.com/openstreetmap/svn-archive/tree/main/sites [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/merkaartor/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/merkaartor [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/josm-ng/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/josm-ng [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/osmpedit/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/osmpedit [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/josm/plugins/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/josm/plugins [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/josm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/josm [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/osm-editor/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/osm-editor [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/applet/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/applet [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/osmtracker/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/osmtracker [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/pyosmeditor/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/pyosmeditor [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/potlatch/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/potlatch [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/potlatch2/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/potlatch2 [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/django/osmeditor/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/django/osmeditor [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/django/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors/django [QSD,L,R=permanent]
+ RewriteRule ^/applications/editors/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/editors [QSD,L,R=permanent]
+ RewriteRule ^/applications/etc/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/etc [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/revert/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/revert [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/packaging/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/packaging [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/misc/api06_migrate/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/misc/api06_migrate [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/misc/search_tracklogs/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/misc/search_tracklogs [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/misc/relation-browser/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/misc/relation-browser [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/misc/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/misc [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/perl_lib/Geo/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/perl_lib/Geo [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/perl_lib/Utils/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/perl_lib/Utils [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/perl_lib/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/perl_lib [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/true_offset/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/true_offset [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/maplint/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/maplint [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planetdiff/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planetdiff [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/video/georeference_video/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/video/georeference_video [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/video/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/video [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/amf/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/amf [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/python_lib/OsmApi/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/python_lib/OsmApi [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/python_lib/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/python_lib [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/relationbuilder/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/relationbuilder [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/OsmMapCallValidator/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/OsmMapCallValidator [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/LiveEditMapViewer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/LiveEditMapViewer [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/debian/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/debian [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/tileDownloader/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/tileDownloader [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/georss/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/georss [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/garmin-mapsource-installer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/garmin-mapsource-installer [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/sanitize/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/sanitize [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/addbounds/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/addbounds [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/gpx-import/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/gpx-import [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/gpxplanet_tools/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/gpxplanet_tools [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/columbus-to-gpx/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/columbus-to-gpx [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/gpx-batch-upload/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/gpx-batch-upload [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/ns1togpx/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/ns1togpx [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/tracey/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/tracey [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/gpx2svg/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/gpx2svg [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/jgpxupload/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks/jgpxupload [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gps-tracks/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gps-tracks [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-activity/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-activity [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gosmin/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gosmin [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/nominatim/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/nominatim [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/distance_maps/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/distance_maps [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmgenerate/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmgenerate [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmapitest/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmapitest [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet\.osm/python/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet.osm/python [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet\.osm/perl/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet.osm/perl [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet\.osm/java/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet.osm/java [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet\.osm/php/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet.osm/php [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet\.osm/C/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet.osm/C [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet\.osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet.osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/service-monitoring/OSMHealthCheck/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/service-monitoring/OSMHealthCheck [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/service-monitoring/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/service-monitoring [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gary68/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gary68 [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/serverStatus/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/serverStatus [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/srtm2shp/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/srtm2shp [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/Srtm2Osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/Srtm2Osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/xsltrans/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/xsltrans [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-error/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-error [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-matrix/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-matrix [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/tmc-validator/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/tmc-validator [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/where_are_they/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/where_are_they [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/ooc/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/ooc [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/srtm2postgis/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/srtm2postgis [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmosis/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmosis [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/tagstat/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/tagstat [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-data/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-data [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/planet-mirror/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/planet-mirror [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmosis-history/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmosis-history [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/color255/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/color255 [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/sync-wiki/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/sync-wiki [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/little-osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/little-osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/coastcheck/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/coastcheck [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/downloading/taho/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/downloading/taho [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/downloading/maps4glopus/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/downloading/maps4glopus [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/downloading/openstreetbugs/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/downloading/openstreetbugs [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/downloading/tiles_by_bbox/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/downloading/tiles_by_bbox [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/downloading/JTileDownloader/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/downloading/JTileDownloader [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/downloading/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/downloading [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/tirex/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/tirex [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/mytah/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/mytah [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/mod_tile/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/mod_tile [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-extract/polygons/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-extract/polygons [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-extract/extract-polygon-c/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-extract/extract-polygon-c [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-extract/osmcut/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-extract/osmcut [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osm-extract/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osm-extract [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/mod_mapnik_wms/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/mod_mapnik_wms [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/change_tags/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/change_tags [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/map-feature-list/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/map-feature-list [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmolt/source/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmolt/source [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmolt/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmolt [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/cadastre-france/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/cadastre-france [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/conv05/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/conv05 [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/osmparser/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/osmparser [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/osm-renumber/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/osm-renumber [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/wayclean/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/wayclean [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/oscgrep/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/oscgrep [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/osm-unbraid/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/osm-unbraid [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/osm-download/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/osm-download [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/merge-ways/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/merge-ways [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/odblsimulator/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/odblsimulator [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/osmgrep/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/osmgrep [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/simplify/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/simplify [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/osm-length/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter/osm-length [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/filter/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/filter [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2kml/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2kml [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/segmentise/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/segmentise [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2poidb/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2poidb [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/bzhack/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/bzhack [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2csv/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2csv [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/tile_expiry/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/tile_expiry [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osmgarminmap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osmgarminmap [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2pgsql/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2pgsql [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/poiexport/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/poiexport [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2singleline_per_tag/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2singleline_per_tag [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/tiledata/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/tiledata [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/guidise/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/guidise [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/tiletabber/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/tiletabber [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2shp/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2shp [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2stuff/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2stuff [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/cgimap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/cgimap [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/MTB/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/MTB [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/OSM_Composer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/OSM_Composer [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/garmincyclemap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/garmincyclemap [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/tiledata2/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/tiledata2 [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osm2ai/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osm2ai [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/osmgoogleearth/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/osmgoogleearth [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/OSM2GTFS/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/OSM2GTFS [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/CityKML/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export/CityKML [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/export/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/export [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/wiki-extensions/SimpleMap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/wiki-extensions/SimpleMap [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/wiki-extensions/OSM_AuthPlugin/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/wiki-extensions/OSM_AuthPlugin [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/wiki-extensions/SlippyMap-local/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/wiki-extensions/SlippyMap-local [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/wiki-extensions/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/wiki-extensions [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gentoo/sci-geosciences/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gentoo/sci-geosciences [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gentoo/profiles/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gentoo/profiles [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gentoo/eclass/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gentoo/eclass [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gentoo/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gentoo [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/gml2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/gml2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/tiger2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/tiger2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/OsmGlommer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/OsmGlommer [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/gadm2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/gadm2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/geobase2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/geobase2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/and2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/and2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/bulk_import/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/bulk_import [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/bulkupload/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/bulkupload [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/ogr2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/ogr2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/mp2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/mp2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/linz2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/linz2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/naptan2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/naptan2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/osmsync/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/osmsync [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/srtm2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/srtm2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/bulk_upload_06/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/bulk_upload_06 [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/csv2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/csv2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/shp2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/shp2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/wdb2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/wdb2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/osmtrackfilter/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/osmtrackfilter [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/srtm2wayinfo/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/srtm2wayinfo [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/lakewalker/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/lakewalker [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/nhd2osm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import/nhd2osm [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/import/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/import [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/changeset2shp/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/changeset2shp [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/spreadnik/examples/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/spreadnik/examples [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/spreadnik/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/spreadnik [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/whichdiff/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/whichdiff [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/gpsbabel/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/gpsbabel [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/wms2kml/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/wms2kml [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/tagwatch/template/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/tagwatch/template [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/tagwatch/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/tagwatch [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/amr2wav/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/amr2wav [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/sv-stat/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/sv-stat [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/map-feature-ref/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils/map-feature-ref [QSD,L,R=permanent]
+ RewriteRule ^/applications/utils/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/utils [QSD,L,R=permanent]
+ RewriteRule ^/applications/viewer/pymap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/viewer/pymap [QSD,L,R=permanent]
+ RewriteRule ^/applications/viewer/diffreader/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/viewer/diffreader [QSD,L,R=permanent]
+ RewriteRule ^/applications/viewer/jmapviewer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/viewer/jmapviewer [QSD,L,R=permanent]
+ RewriteRule ^/applications/viewer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/viewer [QSD,L,R=permanent]
+ RewriteRule ^/applications/mobile/OSMRaider/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/mobile/OSMRaider [QSD,L,R=permanent]
+ RewriteRule ^/applications/mobile/rana2/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/mobile/rana2 [QSD,L,R=permanent]
+ RewriteRule ^/applications/mobile/rana/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/mobile/rana [QSD,L,R=permanent]
+ RewriteRule ^/applications/mobile/healthwhere/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/mobile/healthwhere [QSD,L,R=permanent]
+ RewriteRule ^/applications/mobile/FreemapMobile/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/mobile/FreemapMobile [QSD,L,R=permanent]
+ RewriteRule ^/applications/mobile/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/mobile [QSD,L,R=permanent]
+ RewriteRule ^/applications/lib/ccoord/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/lib/ccoord [QSD,L,R=permanent]
+ RewriteRule ^/applications/lib/Geo-OSM-MapFeatures/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/lib/Geo-OSM-MapFeatures [QSD,L,R=permanent]
+ RewriteRule ^/applications/lib/libosm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/lib/libosm [QSD,L,R=permanent]
+ RewriteRule ^/applications/lib/libimg/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/lib/libimg [QSD,L,R=permanent]
+ RewriteRule ^/applications/lib/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/lib [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/nor-screenspec/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/nor-screenspec [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/gpx_slippy_map/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/gpx_slippy_map [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/misc/lighthouses/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/misc/lighthouses [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/misc/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/misc [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/tilesAtHome/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/tilesAtHome [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/osmbook/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/osmbook [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/wms/osmarender6/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/wms/osmarender6 [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/wms/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/wms [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/osmarender/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/osmarender [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/toposm/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/toposm [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/clopin/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/clopin [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/pdf-atlas/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/pdf-atlas [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/makeMapOnMove/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/makeMapOnMove [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/restguide/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/restguide [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/party/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/party [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/osmps/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/osmps [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/osm-atlas/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/osm-atlas [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/fmapgen/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/fmapgen [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/rendercontrol/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/rendercontrol [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/gosmore/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/gosmore [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/mapnik-german/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/mapnik-german [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/kah/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/kah [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/imgAtlas/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/imgAtlas [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/tilesAtHome-dev/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/tilesAtHome-dev [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/pyrender/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/pyrender [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/history/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/history [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/tahwin/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/tahwin [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/genericHeatmapRender/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/genericHeatmapRender [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/png2tileinfo/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/png2tileinfo [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/mtb/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/mtb [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/tah-heatmap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/tah-heatmap [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/tilesPipeAtHome/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/tilesPipeAtHome [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/mapnik/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/mapnik [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/nor-hikingmap/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/nor-hikingmap [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/forWikipedia/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/forWikipedia [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/OSMLabelOptimizer/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/OSMLabelOptimizer [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/parking/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/parking [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/tahNG/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/tahNG [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/subway/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/subway [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/mapyrus/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering/mapyrus [QSD,L,R=permanent]
+ RewriteRule ^/applications/rendering/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/rendering [QSD,L,R=permanent]
+ RewriteRule ^/applications/routing/pyroute-dev/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/routing/pyroute-dev [QSD,L,R=permanent]
+ RewriteRule ^/applications/routing/pyroute_webGUI/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/routing/pyroute_webGUI [QSD,L,R=permanent]
+ RewriteRule ^/applications/routing/pyroutelib2/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/routing/pyroutelib2 [QSD,L,R=permanent]
+ RewriteRule ^/applications/routing/pyroute/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/routing/pyroute [QSD,L,R=permanent]
+ RewriteRule ^/applications/routing/yours/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/routing/yours [QSD,L,R=permanent]
+ RewriteRule ^/applications/routing/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/routing [QSD,L,R=permanent]
+ RewriteRule ^/applications/share/map-icons/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/share/map-icons [QSD,L,R=permanent]
+ RewriteRule ^/applications/share/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications/share [QSD,L,R=permanent]
+ RewriteRule ^/applications/?.* https://github.com/openstreetmap/svn-archive/tree/main/applications [QSD,L,R=permanent]
+ RewriteRule ^/?.* https://github.com/openstreetmap/svn-archive [QSD,L,R=permanent]
</VirtualHost>
<% unless @aliases.empty? -%>
+++ /dev/null
-#!/bin/sh
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-T=$(mktemp -d -t -p /var/tmp svn.XXXXXXXXXX)
-D=$(date +%Y-%m-%d)
-B=svn-$D.tar.gz
-
-nice svnadmin hotcopy /var/lib/subversion/repos/openstreetmap $T/svn-$D > /dev/null
-
-export RSYNC_RSH="ssh -ax"
-
-nice tar --create --directory=$T svn-$D | nice gzip --rsyncable -9 > $T/$B
-nice rsync --preallocate --fuzzy $T/$B backup::backup
-
-rm -rf $T
-channel #osm-dev-test
+channel #osm-dev
lobotomized False
defaultAllow True
+ capability -voice
capability -halfop
- capability -protected
capability -op
- capability -voice
+ capability -protected
-channel #osm-dev
+channel #osm-dev-test
lobotomized False
defaultAllow True
+ capability -voice
capability -halfop
- capability -protected
capability -op
- capability -voice
+ capability -protected
[osm-cgimap]
short name = osm-cgimap
-url = https://git.openstreetmap.org/public/cgimap.git
+url = https://github.com/zerebubuth/openstreetmap-cgimap.git
branch = master
-commit link = https://github.com/openstreetmap/cgimap/commit/%c
+commit link = https://github.com/zerebubuth/openstreetmap-cgimap/commit/%c
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
-[osm-osm2pgsql-0.92.x]
-short name = osm-osm2pgsql-0.92.x
-url = https://github.com/openstreetmap/osm2pgsql.git
-branch = 0.92.x
-commit link = https://github.com/openstreetmap/osm2pgsql/commit/%c
-channels = #osm-dev
-commit message = [%s|%b|%a] %m %l
-
-[osm-osm2pgsql-0.90.x]
-short name = osm-osm2pgsql-0.90.x
-url = https://github.com/openstreetmap/osm2pgsql.git
-branch = 0.90.x
-commit link = https://github.com/openstreetmap/osm2pgsql/commit/%c
-channels = #osm-dev
-commit message = [%s|%b|%a] %m %l
-
-[osm-osm2pgsql-0.88.x]
-short name = osm-osm2pgsql-0.88.x
-url = https://github.com/openstreetmap/osm2pgsql.git
-branch = 0.88.x
-commit link = https://github.com/openstreetmap/osm2pgsql/commit/%c
-channels = #osm-dev
-commit message = [%s|%b|%a] %m %l
-
[osm-mod_tile]
short name = osm-mod_tile
url = https://github.com/openstreetmap/mod_tile.git
[osm-id]
short name = osm-id
url = https://github.com/openstreetmap/iD.git
-branch = master
+branch = develop
commit link = https://github.com/openstreetmap/iD/commit/%c
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
+[osm-tilelog]
+short name = osm-tilelog
+url = https://github.com/openstreetmap/tilelog.git
+branch = main
+commit link = https://github.com/openstreetmap/tilelog/commit/%c
+channels = #osm-dev
+commit message = [%s|%b|%a] %m %l
+
[osm-josm]
short name = osm-josm
-url = https://github.com/openstreetmap/josm.git
+url = https://github.com/JOSM/josm.git
branch = master
-commit link = https://github.com/openstreetmap/josm/commit/%c
+commit link = https://github.com/JOSM/josm/commit/%c
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
[osmlab-osm-community-index]
short name = osmlab-osm-community-index
url = https://github.com/osmlab/osm-community-index.git
-branch = master
+branch = main
commit link = https://github.com/osmlab/osm-community-index/commit/%c
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
short name = vespucci
url = https://github.com/MarcusWolschon/osmeditor4android.git
branch = master
-commit link = https://github.com//MarcusWolschon/osmeditor4android/commit/%c
+commit link = https://github.com/MarcusWolschon/osmeditor4android/commit/%c
channels = #osm-dev
commit message = [%s|%b|%a] %m %l
supports "ubuntu"
depends "apache"
depends "git"
+depends "ruby"
include_recipe "apache"
include_recipe "git"
+include_recipe "ruby"
package %w[
gcc
g++
make
- ruby
- ruby-dev
libssl-dev
zlib1g-dev
pkg-config
apache_module "expires"
apache_module "rewrite"
-gem_package "bundler" do
- version "1.17.3"
-end
-
git "/srv/switch2osm.org" do
action :sync
repository "https://github.com/switch2osm/switch2osm.github.io.git"
depth 1
user "root"
group "root"
- notifies :run, "execute[/srv/switch2osm.org/Gemfile]"
+ notifies :run, "bundle_install[/srv/switch2osm.org]"
end
directory "/srv/switch2osm.org/_site" do
group "nogroup"
end
-execute "/srv/switch2osm.org/Gemfile" do
+bundle_install "/srv/switch2osm.org" do
action :nothing
- command "bundle install --deployment"
- cwd "/srv/switch2osm.org"
+ options "--deployment"
user "root"
group "root"
- notifies :run, "execute[/srv/switch2osm.org]"
+ notifies :run, "bundle_exec[/srv/switch2osm.org]"
end
-execute "/srv/switch2osm.org" do
+bundle_exec "/srv/switch2osm.org" do
action :nothing
- command "bundle exec jekyll build --trace --config _config.yml,_config_osm.yml"
- cwd "/srv/switch2osm.org"
+ command "jekyll build --trace --config _config.yml,_config_osm.yml"
user "nobody"
group "nogroup"
end
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :path, String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :service, String, :name_property => true
property :exec_reload, String
property :runtime_directory, String
property :runtime_directory_mode, Integer
+property :runtime_max_sec, Integer
property :standard_input, String,
:is => %w[null tty tty-force tty-fail socket]
property :standard_output, String,
property :restrict_address_families, [String, Array]
property :no_new_privileges, [true, false]
property :tasks_max, Integer
+property :timeout_start_sec, Integer
+property :timeout_stop_sec, Integer
+property :timeout_abort_sec, Integer
property :timeout_sec, Integer
property :pid_file, String
property :nice, Integer
--- /dev/null
+#
+# Cookbook:: systemd
+# Resource:: systemd_socket
+#
+# Copyright:: 2021, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+unified_mode true
+
+default_action :create
+
+property :socket, String, :name_property => true
+property :description, String, :required => [:create]
+property :after, [String, Array]
+property :wants, [String, Array]
+property :listen_stream, [String, Array]
+property :listen_datagram, [String, Array]
+property :listen_sequential_packet, [String, Array]
+property :listen_fifo, [String, Array]
+property :listen_special, [String, Array]
+property :listen_netlink, [String, Array]
+property :listen_message_queue, [String, Array]
+property :listen_usb_function, [String, Array]
+property :socket_protocol, String
+property :bind_ipv6_only, String
+property :backlog, Integer
+property :bind_to_device, String
+property :socket_user, String
+property :socket_group, String
+property :socket_mode, Integer
+property :directory_mode, Integer
+property :accept, [true, false]
+property :writable, [true, false]
+property :max_connections, Integer
+property :max_connections_per_source, Integer
+property :keep_alive, [true, false]
+property :keep_alive_time_sec, Integer
+property :keep_alive_interval_sec, Integer
+property :keep_alive_probes, Integer
+property :no_delay, [true, false]
+property :priority, Integer
+property :defer_accept_sec, Integer
+property :receive_buffer, Integer
+property :send_buffer, Integer
+property :ip_tos, Integer
+property :ip_ttl, Integer
+property :mark, Integer
+property :reuse_port, [true, false]
+property :pipe_size, Integer
+property :message_queue_max_messages, Integer
+property :message_queue_message_size, Integer
+property :free_bind, [true, false]
+property :transparent, [true, false]
+property :broadcast, [true, false]
+property :pass_credentials, [true, false]
+property :pass_security, [true, false]
+property :tcp_congestion, String
+property :exec_start_pre, [String, Array]
+property :exec_start, [String, Array]
+property :exec_start_post, [String, Array]
+property :exec_stop, [String, Array]
+property :timeout_sec, [Integer, String]
+property :service, String
+property :remove_on_stop, [true, false]
+property :symlinks, [String, Array]
+property :file_descriptor_name, String
+property :trigger_limit_interval_sec, [Integer, String]
+property :trigger_limit_burst, Integer
+
+action :create do
+ socket_variables = new_resource.to_hash
+
+ template "/etc/systemd/system/#{new_resource.socket}.socket" do
+ cookbook "systemd"
+ source "socket.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables socket_variables
+ end
+
+ execute "systemctl-reload-#{new_resource.socket}.socket" do
+ action :nothing
+ command "systemctl daemon-reload"
+ user "root"
+ group "root"
+ subscribes :run, "template[/etc/systemd/system/#{new_resource.socket}.socket]"
+ end
+end
+
+action :delete do
+ file "/etc/systemd/system/#{new_resource.socket}.socket" do
+ action :delete
+ end
+
+ execute "systemctl-reload-#{new_resource.socket}.socket" do
+ action :nothing
+ command "systemctl daemon-reload"
+ user "root"
+ group "root"
+ subscribes :run, "file[/etc/systemd/system/#{new_resource.socket}.socket]"
+ end
+end
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :timer, String, :name_property => true
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :type, String, :required => [:create]
<% if @runtime_directory_mode -%>
RuntimeDirectoryMode=<%= sprintf("0%o", @runtime_directory_mode) %>
<% end -%>
+<% if @runtime_max_sec -%>
+RuntimeMaxSec=<%= @runtime_max_sec %>
+<% end -%>
<% if @standard_input -%>
StandardInput=<%= @standard_input %>
<% end -%>
<% if @restart -%>
Restart=<%= @restart %>
<% end -%>
+<% if @timeout_start_sec -%>
+TimeoutStartSec=<%= @timeout_start_sec %>
+<% end -%>
+<% if @timeout_stop_sec -%>
+TimeoutStopSec=<%= @timeout_stop_sec %>
+<% end -%>
+<% if @timeout_abort_sec -%>
+TimeoutAbortSec=<%= @timeout_abort_sec %>
+<% end -%>
<% if @timeout_sec -%>
TimeoutSec=<%= @timeout_sec %>
<% end -%>
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+[Unit]
+Description=<%= @description %>
+<% if @after -%>
+After=<%= Array(@after).join(" ") %>
+<% end -%>
+<% if @wants -%>
+Wants=<%= Array(@wants).join(" ") %>
+<% end -%>
+
+[Socket]
+<% Array(@listen_stream).each do |listen| -%>
+ListenStream=<%= listen %>
+<% end -%>
+<% Array(@listen_datagram).each do |listen| -%>
+ListenDatagram=<%= listen %>
+<% end -%>
+<% Array(@listen_sequential_packet).each do |listen| -%>
+ListenSequentialPacket=<%= listen %>
+<% end -%>
+<% Array(@listen_fifo).each do |listen| -%>
+ListenFIFO=<%= listen %>
+<% end -%>
+<% Array(@listen_special).each do |listen| -%>
+ListenSpecial=<%= listen %>
+<% end -%>
+<% Array(@listen_netlink).each do |listen| -%>
+ListenNetlink=<%= listen %>
+<% end -%>
+<% Array(@listen_message_queue).each do |listen| -%>
+ListenMessageQueue=<%= listen %>
+<% end -%>
+<% Array(@listen_usb_function).each do |listen| -%>
+ListenUSBFunction=<%= listen %>
+<% end -%>
+<% if @socket_protocol -%>
+SocketProtocol=<%= @socket_protocol %>
+<% end -%>
+<% if @bind_ipv6_only -%>
+BindIpv6Only=<%= @bind_ipv6_only %>
+<% end -%>
+<% if @backlog -%>
+Backlog=<%= @backlog %>
+<% end -%>
+<% if @bind_to_device -%>
+BindToDevice=<%= @bind_to_device %>
+<% end -%>
+<% if @socket_user -%>
+SocketUser=<%= @socket_user %>
+<% end -%>
+<% if @socket_group -%>
+SocketGroup=<%= @socket_group %>
+<% end -%>
+<% if @socket_mode -%>
+SocketMode=<%= sprintf("0%o", @socket_mode) %>
+<% end -%>
+<% if @directory_mode -%>
+DirectoryMode=<%= sprintf("0%o", @directory_mode) %>
+<% end -%>
+<% if @accept -%>
+Accept=<%= @accept %>
+<% end -%>
+<% if @writable -%>
+Writable=<%= @writable %>
+<% end -%>
+<% if @max_connections -%>
+MaxConnections=<%= @max_connections %>
+<% end -%>
+<% if @max_connections_per_source -%>
+MaxConnectionsPerSource=<%= @max_connections_per_source %>
+<% end -%>
+<% if @keep_alive -%>
+KeepAlive=<%= @keep_alive %>
+<% end -%>
+<% if @keep_alive_time_sec -%>
+KeepAliveTimeSec=<%= @keep_alive_time_sec %>
+<% end -%>
+<% if @keep_alive_interval_sec -%>
+KeepAliveIntervalSec=<%= @keep_alive_interval_sec %>
+<% end -%>
+<% if @keep_alive_probes -%>
+KeepAliveProbes=<%= @keep_alive_probes %>
+<% end -%>
+<% if @no_delay -%>
+NoDelay=<%= @no_delay %>
+<% end -%>
+<% if @priority -%>
+Priority=<%= @priority %>
+<% end -%>
+<% if @defer_accept_sec -%>
+DeferAcceptSec=<%= @defer_accept_sec %>
+<% end -%>
+<% if @receive_buffer -%>
+ReceiveBuffer=<%= @receive_buffer %>
+<% end -%>
+<% if @send_buffer -%>
+SendBuffer=<%= @send_buffer %>
+<% end -%>
+<% if @ip_tos -%>
+IpTos=<%= @ip_tos %>
+<% end -%>
+<% if @ip_ttl -%>
+IpTtl=<%= @ip_ttl %>
+<% end -%>
+<% if @mark -%>
+Mark=<%= @mark %>
+<% end -%>
+<% if @reuse_port -%>
+ReusePort=<%= @reuse_port %>
+<% end -%>
+<% if @pipe_size -%>
+PipeSize=<%= @pipe_size %>
+<% end -%>
+<% if @message_queue_max_messages -%>
+MessageQueueMaxMessages=<%= @message_queue_max_messages %>
+<% end -%>
+<% if @message_queue_message_size -%>
+MessageQueueMessageSize=<%= @message_queue_message_size %>
+<% end -%>
+<% if @free_bind -%>
+FreeBind=<%= @free_bind %>
+<% end -%>
+<% if @transparent -%>
+Transparent=<%= @transparent %>
+<% end -%>
+<% if @broadcast -%>
+Broadcast=<%= @broadcast %>
+<% end -%>
+<% if @pass_credentials -%>
+PassCredentials=<%= @pass_credentials %>
+<% end -%>
+<% if @pass_security -%>
+PassSecurity=<%= @pass_security %>
+<% end -%>
+<% if @tcp_congestion -%>
+TcpCongestion=<%= @tcp_congestion %>
+<% end -%>
+<% Array(@exec_start_pre).each do |exec| -%>
+ExecStartPre=<%= exec %>
+<% end -%>
+<% Array(@exec_start).each do |exec| -%>
+ExecStart=<%= exec %>
+<% end -%>
+<% Array(@exec_stop_post).each do |exec| -%>
+ExecStopPost=<%= exec %>
+<% end -%>
+<% Array(@exec_stop).each do |exec| -%>
+ExecStop=<%= exec %>
+<% end -%>
+<% if @timeout_sec -%>
+TimeoutSec=<%= @timeout_sec %>
+<% end -%>
+<% if @service -%>
+Service=<%= @service %>
+<% end -%>
+<% if @remove_on_stop -%>
+RemoveOnStop=<%= @remove_on_stop %>
+<% end -%>
+<% Array(@symlinks).each do |symlink| -%>
+Symlinks=<%= symlink %>
+<% end -%>
+<% if @file_descriptor_name -%>
+FileDescriptorName=<%= @file_descriptor_name %>
+<% end -%>
+<% if @trigger_limit_interval_sec -%>
+TriggerLimitIntervalSec=<%= @trigger_limit_interval_sec %>
+<% end -%>
+<% if @trigger_limit_burst -%>
+TriggerLimitBurst=<%= @trigger_limit_burst %>
+<% end -%>
+
+[Install]
+WantedBy=multi-user.target
supports "ubuntu"
depends "accounts"
depends "apache"
-depends "passenger"
depends "git"
+depends "passenger"
+depends "ruby"
include_recipe "accounts"
include_recipe "apache"
-include_recipe "passenger"
include_recipe "git"
+include_recipe "passenger"
+include_recipe "ruby"
package %w[
libsqlite3-dev
pbzip2
]
-ruby_version = node[:passenger][:ruby_version]
-
-package "ruby#{ruby_version}"
-
-gem_package "bundler#{ruby_version}" do
- package_name "bundler"
- version "~> 1.16.2"
- gem_binary "gem#{ruby_version}"
- options "--format-executable"
-end
-
apache_module "cache"
apache_module "cache_disk"
apache_module "headers"
notifies :restart, "service[apache2]"
end
- execute "#{directory}/taginfo/Gemfile" do
+ bundle_install "#{directory}/taginfo" do
action :nothing
- command "bundle#{ruby_version} install"
- cwd "#{directory}/taginfo"
user "root"
group "root"
- subscribes :run, "gem_package[bundler#{ruby_version}]"
subscribes :run, "git[#{directory}/taginfo]"
notifies :restart, "passenger_application[#{directory}/taginfo/web/public]"
end
default[:tile][:database][:style_file] = nil
default[:tile][:database][:tag_transform_script] = nil
-default[:tile][:replication][:url] = "https://planet.osm.org/replication/minute/"
+default[:tile][:mapnik] = "3.1"
+
+default[:tile][:replication][:url] = "https://planet.openstreetmap.org/replication/minute/"
default[:tile][:data] = {}
default[:tile][:styles] = {}
+default[:tile][:ratelimit][:requests_per_second] = 15
+default[:tile][:ratelimit][:maximum_backlog] = 1800
+
default[:postgresql][:versions] |= [node[:tile][:database][:cluster].split("/").first]
default[:accounts][:users][:tile][:status] = :role
depends "postgresql"
depends "prometheus"
depends "python"
+depends "ruby"
depends "systemd"
depends "tools"
include_recipe "postgresql"
include_recipe "prometheus"
include_recipe "python"
+include_recipe "ruby"
include_recipe "tools"
blocks = data_bag_item("tile", "blocks")
conf "tile.conf.erb"
end
+apache_conf "renderd" do
+ action :disable
+end
+
ssl_certificate node[:fqdn] do
domains [node[:fqdn], "tile.openstreetmap.org", "render.openstreetmap.org"]
notifies :reload, "service[apache2]"
ignore_failure true
end
-tilecaches = search(:node, "roles:tilecache").sort_by { |n| n[:hostname] }
fastlyips = JSON.parse(IO.read("#{Chef::Config[:file_cache_path]}/fastly-ip-list.json"))
apache_site "default" do
- action [:disable]
+ action :disable
+end
+
+apache_site "tileserver_site" do
+ action :disable
end
apache_site "tile.openstreetmap.org" do
template "apache.erb"
- variables :caches => tilecaches, :fastly => fastlyips["addresses"]
+ variables :fastly => fastlyips["addresses"]
end
template "/etc/logrotate.d/apache2" do
mode "755"
end
+directory "/srv/tile.openstreetmap.org/conf" do
+ owner "tile"
+ group "tile"
+ mode "755"
+end
+
+file "/srv/tile.openstreetmap.org/conf/ip.map" do
+ owner "tile"
+ group "adm"
+ mode "644"
+end
+
package "renderd"
systemd_service "renderd" do
- description "Mapnik rendering daemon"
+ dropin "chef"
after "postgresql.service"
wants "postgresql.service"
- user "www-data"
- exec_start "/usr/bin/renderd -f"
- runtime_directory "renderd"
- standard_error "null"
limit_nofile 4096
private_tmp true
private_devices true
restart "on-failure"
end
+systemd_service "renderd" do
+ action :delete
+end
+
service "renderd" do
action [:enable, :start]
subscribes :restart, "systemd_service[renderd]"
package %w[
python3-cairo
python3-mapnik
+ python3-pyproj
python3-setuptools
]
python_version "3"
end
-package %w[
+unifont = if node[:lsb][:release].to_f < 22.04
+ "ttf-unifont"
+ else
+ "fonts-unifont"
+ end
+
+package %W[
fonts-noto-cjk
fonts-noto-hinted
fonts-noto-unhinted
fonts-hanazono
- ttf-unifont
+ #{unifont}
]
["NotoSansArabicUI-Regular.ttf", "NotoSansArabicUI-Bold.ttf"].each do |font|
details[:tile_directories].each do |directory|
directory directory[:name] do
- owner "www-data"
- group "www-data"
+ owner "_renderd"
+ group "_renderd"
mode "755"
end
directory[:min_zoom].upto(directory[:max_zoom]) do |zoom|
directory "#{directory[:name]}/#{zoom}" do
- owner "www-data"
- group "www-data"
+ owner "_renderd"
+ group "_renderd"
mode "755"
end
cluster node[:tile][:database][:cluster]
end
+postgresql_user "_renderd" do
+ cluster node[:tile][:database][:cluster]
+end
+
postgresql_database "gis" do
cluster node[:tile][:database][:cluster]
owner "tile"
cluster node[:tile][:database][:cluster]
database "gis"
owner "tile"
- permissions "tile" => :all, "www-data" => :select
+ permissions "tile" => :all, "www-data" => :select, "_renderd" => :select
end
end
if node[:tile][:database][:external_data_script]
execute node[:tile][:database][:external_data_script] do
- command node[:tile][:database][:external_data_script]
+ command "#{node[:tile][:database][:external_data_script]} -R _renderd"
cwd "/srv/tile.openstreetmap.org"
user "tile"
group "tile"
+ ignore_failure true
end
Array(node[:tile][:database][:external_data_tables]).each do |table|
cluster node[:tile][:database][:cluster]
database "gis"
owner "tile"
- permissions "tile" => :all, "www-data" => :select
+ permissions "tile" => :all, "www-data" => :select, "_renderd" => :select
end
end
end
file node[:tile][:database][:node_file] do
owner "tile"
- group "www-data"
+ group "_renderd"
mode "660"
end
package %w[
osm2pgsql
- ruby
osmium-tool
pyosmium
python3-pyproj
]
+gem_package "apachelogregex" do
+ gem_binary node[:ruby][:gem]
+end
+
+gem_package "file-tail" do
+ gem_binary node[:ruby][:gem]
+end
+
+gem_package "lru_redux" do
+ gem_binary node[:ruby][:gem]
+end
+
remote_directory "/usr/local/bin" do
source "bin"
owner "root"
files_mode "755"
end
+template "/usr/local/bin/tile-ratelimit" do
+ source "tile-ratelimit.erb"
+ owner "root"
+ group "root"
+ mode "755"
+end
+
+systemd_service "tile-ratelimit" do
+ description "Monitor tile requests and enforce rate limits"
+ after "apache2.service"
+ user "tile"
+ group "adm"
+ exec_start "/usr/local/bin/tile-ratelimit"
+ private_tmp true
+ private_devices true
+ private_network true
+ protect_system "full"
+ protect_home true
+ read_write_paths "/srv/tile.openstreetmap.org/conf"
+ no_new_privileges true
+ restart "on-failure"
+end
+
+service "tile-ratelimit" do
+ action [:enable, :start]
+ subscribes :restart, "file[/usr/local/bin/tile-ratelimit]"
+ subscribes :restart, "systemd_service[tile-ratelimit]"
+end
+
template "/usr/local/bin/expire-tiles" do
source "expire-tiles.erb"
owner "root"
directory "/var/lib/replicate/expire-queue" do
owner "tile"
- group "www-data"
+ group "_renderd"
mode "775"
end
systemd_service "expire-tiles" do
description "Tile dirtying service"
type "simple"
- user "www-data"
+ user "_renderd"
exec_start "/usr/local/bin/expire-tiles"
standard_output "null"
private_tmp true
systemd_timer "render-lowzoom" do
description "Render low zoom tiles"
- on_calendar "Sun *-*~07/1 01:00:00"
+ on_calendar "Fri *-*-* 23:00:00 UTC"
end
service "render-lowzoom.timer" do
cron_d "cleanup-tiles#{label}" do
minute "0"
- user "www-data"
+ user "_renderd"
command "ionice -c 3 /usr/local/bin/cleanup-tiles #{directory}"
mailto "admins@openstreetmap.org"
end
munin_plugin "replication_delay"
+package "ruby-webrick"
+
prometheus_exporter "modtile" do
port 9494
end
ScriptAlias /cgi-bin/ /srv/tile.openstreetmap.org/cgi-bin/
# Get the real remote IP for requests via a trusted proxy
- RemoteIPHeader X-Forwarded-For
-<% @caches.each do |cache| -%>
-<% cache.ipaddresses(:role => :external).sort.each do |address| -%>
- RemoteIPTrustedProxy <%= address %>
-<% end -%>
-<% end -%>
+ RemoteIPHeader Fastly-Client-IP
<% @fastly.sort.each do |address| -%>
RemoteIPTrustedProxy <%= address %>
<% end -%>
# Enable the rewrite engine
RewriteEngine on
+ # Enforce rate limits
+ RewriteMap ipmap txt:/srv/tile.openstreetmap.org/conf/ip.map
+ RewriteCond ${ipmap:%{REMOTE_ADDR}} ^.+$
+ RewriteRule ^.*$ /${ipmap:%{REMOTE_ADDR}} [PT]
+
# Rewrite tile requests to the default style
RewriteRule ^/(\d+)/(\d+)/(\d+)\.png$ /default/$1/$2/$3.png [PT,T=image/png,L]
RewriteRule ^/(\d+)/(\d+)/(\d+)\.png/status/?$ /default/$1/$2/$3.png/status [PT,T=text/plain,L]
# Redirect ACME certificate challenges
RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+
+ # Internal endpoint for blocked users
+ <Location /blocked>
+ Header always set Cache-Control private
+ Redirect 429
+ </Location>
</VirtualHost>
<VirtualHost *:80>
ServerAlias render.openstreetmap.org
ServerAdmin webmaster@openstreetmap.org
- # Get the real remote IP for requests via a trusted proxy
- RemoteIPHeader X-Forwarded-For
-<% @caches.each do |cache| -%>
-<% cache.ipaddresses(:role => :external).sort.each do |address| -%>
- RemoteIPTrustedProxy <%= address %>
-<% end -%>
-<% end -%>
-
# Setup logging
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined_with_remoteip
CustomLog /var/log/apache2/access.log combined_with_remoteip
import mapnik
import os
import pyotp
+import pyproj
import resource
import shutil
import signal
output_error("No format specified")
else:
# Create projection object
- prj = mapnik.Projection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over");
+ transformer = pyproj.Transformer.from_crs("EPSG:4326", "EPSG:3857", always_xy=True)
# Get the bounds of the area to render
bbox = [float(x) for x in form.getvalue("bbox").split(",")]
output_error("Invalid bounding box")
else:
# Project the bounds to the map projection
- bbox = mapnik.forward_(mapnik.Box2d(*bbox), prj)
+ bbox = mapnik.Box2d(*transformer.transform(bbox[0], bbox[1]),
+ *transformer.transform(bbox[2], bbox[3]))
# Get the style to use
style = form.getvalue("style", "default")
stats_file=/var/run/renderd/renderd.stats
[mapnik]
-plugins_dir=/usr/lib/mapnik/3.0/input
+plugins_dir=/usr/lib/mapnik/<%= node[:tile][:mapnik] %>/input
font_dir=/usr/share/fonts
font_dir_recurse=true
<% node[:tile][:styles].each do |name,details| -%>
# Change to the replication state directory
cd /var/lib/replicate
-<% if @postgresql_version >= 12 -%>
-
-# Disable JIT and parallel workers in postgres
-export PGOPTIONS="-c jit=off -c max_parallel_workers_per_gather=0"
-<% end -%>
# Install exit handler
trap onexit EXIT
--- /dev/null
+#!/usr/bin/ruby
+
+require "apache_log_regex"
+require "date"
+require "file-tail"
+require "gdbm"
+require "lru_redux"
+
+REQUESTS_PER_SECOND = <%= node[:tile][:ratelimit][:requests_per_second] %>
+BLOCK_AT = <%= node[:tile][:ratelimit][:maximum_backlog] %>
+UNBLOCK_AT = BLOCK_AT / 2
+
+parser = ApacheLogRegex.new('%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"')
+clients = LruRedux::Cache.new(1000000)
+
+def decay_count(client, time)
+ decay = (time.to_i - client[:last_update]) * REQUESTS_PER_SECOND
+
+ client[:request_count] = [client[:request_count] - decay, 0].max
+ client[:last_update] = time.to_i
+end
+
+def write_blocked_ips(clients)
+ time = Time.now
+
+ File.open("/srv/tile.openstreetmap.org/conf/ip.map.new", "w") do |file|
+ clients.each do |address, client|
+ decay_count(client, time)
+
+ if client[:request_count] >= UNBLOCK_AT
+ file.puts "#{address} blocked"
+ elsif client.has_key?(:blocked_at)
+ puts "Unblocked #{address}"
+
+ client.delete(:blocked_at)
+ end
+ end
+ end
+
+ File.rename("/srv/tile.openstreetmap.org/conf/ip.map.new",
+ "/srv/tile.openstreetmap.org/conf/ip.map")
+
+ time + 900
+end
+
+next_check = write_blocked_ips(clients)
+
+File::Tail::Logfile.tail("/var/log/apache2/access.log") do |line|
+ begin
+ hash = parser.parse!(line)
+
+ address = hash["%a"]
+ request = hash["%r"]
+
+ next if address == "127.0.0.1" || address == "::1"
+
+ time = Time.now
+
+ client = clients.getset(address) do
+ { :request_count => 0, :last_update => 0 }
+ end
+
+ decay_count(client, time)
+
+ if request =~ %r{^(GET|POST) /cgi-bin/export.*}
+ client[:request_count] = client[:request_count] + 150
+ else
+ client[:request_count] = client[:request_count] + 1
+ end
+
+ if client[:request_count] > BLOCK_AT && !client.has_key?(:blocked_at)
+ puts "Blocked #{address}"
+
+ client[:blocked_at] = time
+
+ next_check = time
+ elsif client[:request_count] < UNBLOCK_AT && client.has_key?(:blocked_at)
+ puts "Unblocked #{address}"
+
+ client.delete(:blocked_at)
+
+ next_check = time
+ end
+
+ if time >= next_check
+ next_check = write_blocked_ips(clients)
+ end
+ rescue ApacheLogRegex::ParseError
+ # nil
+ end
+end
+++ /dev/null
-# tilecache cookbook
-
-This cookbook installs and configures the tile caches for the
-tile.openstreetmap.org tileservers.
+++ /dev/null
-default[:tilecache][:tile_parent] = "render.openstreetmap.org"
-
-# Per IP bucket refill rate
-default[:tilecache][:ip_bucket_refill] = 4096
-# Per IP bucket size
-default[:tilecache][:ip_bucket_size] = 67108864
-# Per Class C refill rate
-default[:tilecache][:net_bucket_refill] = 8192
-# Per Class C bucket size
-default[:tilecache][:net_bucket_size] = 134217728
-
-# Enable nginx cache
-default[:nginx][:cache][:proxy][:enable] = true
+++ /dev/null
-%{time_total},%{http_code},%{url_effective},%{time_namelookup},%{time_connect},%{time_appconnect},%{time_pretransfer},%{time_redirect},%{time_starttransfer}\n
+++ /dev/null
-name "tilecache"
-maintainer "OpenStreetMap Administrators"
-maintainer_email "admins@openstreetmap.org"
-license "Apache-2.0"
-description "Installs and configures a tile cache"
-
-version "1.0.0"
-supports "ubuntu"
-depends "fail2ban"
-depends "munin"
-depends "nginx"
-depends "ohai"
-depends "squid"
-depends "ssl"
+++ /dev/null
-#
-# Cookbook:: tilecache
-# Recipe:: default
-#
-# Copyright:: 2011, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "ipaddr"
-
-include_recipe "fail2ban"
-include_recipe "munin"
-include_recipe "nginx"
-include_recipe "squid"
-include_recipe "ssl"
-
-package "apache2" do
- action :remove
-end
-
-package %w[
- curl
- xz-utils
- openssl
-]
-
-# oathtool for QoS token
-package "oathtool"
-
-tilecaches = search(:node, "roles:tilecache").sort_by { |n| n[:hostname] }
-tilerenders = search(:node, "roles:tile").sort_by { |n| n[:hostname] }
-
-web_passwords = data_bag_item("web", "passwords")
-
-tilecaches.each do |cache|
- cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address|
- firewall_rule "accept-squid" do
- action :accept
- family "inet"
- source "net:#{address}"
- dest "fw"
- proto "tcp:syn"
- dest_ports "3128"
- source_ports "1024:"
- end
-
- firewall_rule "accept-squid-icp" do
- action :accept
- family "inet"
- source "net:#{address}"
- dest "fw"
- proto "udp"
- dest_ports "3130"
- source_ports "3130"
- end
-
- firewall_rule "accept-squid-icp-reply" do
- action :accept
- family "inet"
- source "fw"
- dest "net:#{address}"
- proto "udp"
- dest_ports "3130"
- source_ports "3130"
- end
-
- firewall_rule "accept-squid-htcp" do
- action :accept
- family "inet"
- source "net:#{address}"
- dest "fw"
- proto "udp"
- dest_ports "4827"
- source_ports "4827"
- end
-
- firewall_rule "accept-squid-htcp-reply" do
- action :accept
- family "inet"
- source "fw"
- dest "net:#{address}"
- proto "udp"
- dest_ports "4827"
- source_ports "4827"
- end
- end
-end
-
-squid_fragment "tilecache" do
- template "squid.conf.erb"
- variables :caches => tilecaches, :renders => tilerenders
-end
-
-package "rsync"
-
-template "/etc/logrotate.d/squid" do
- source "logrotate.squid.erb"
- owner "root"
- group "root"
- mode "644"
-end
-
-nginx_site "default" do
- action [:delete]
-end
-
-template "/usr/local/bin/nginx_generate_tilecache_qos_map" do
- source "nginx_generate_tilecache_qos_map.erb"
- owner "root"
- group "root"
- mode "750"
- variables :totp_key => web_passwords["totp_key"]
-end
-
-cron_d "tilecache" do
- action :delete
-end
-
-cron_d "tilecache-generate-qos-map" do
- minute "0"
- user "root"
- command "/usr/local/bin/nginx_generate_tilecache_qos_map"
-end
-
-cron_d "tilecache-curl-time" do
- user "www-data"
- command "/srv/tilecache/tilecache-curl-time"
-end
-
-cron_d "tilecache-curl-time-cleanup" do
- minute "15"
- hour "0"
- user "www-data"
- command "/srv/tilecache/tilecache-curl-time-cleanup"
-end
-
-execute "execute_nginx_generate_tilecache_qos_map" do
- command "/usr/local/bin/nginx_generate_tilecache_qos_map"
- creates "/etc/nginx/conf.d/tile_qos_rates.map"
- action :run
-end
-
-ssl_certificate "tile.openstreetmap.org" do
- domains ["tile.openstreetmap.org",
- "a.tile.openstreetmap.org",
- "b.tile.openstreetmap.org",
- "c.tile.openstreetmap.org",
- "tile.osm.org",
- "a.tile.osm.org",
- "b.tile.osm.org",
- "c.tile.osm.org"]
- notifies :restart, "service[nginx]"
-end
-
-nginx_site "tile" do
- template "nginx_tile.conf.erb"
- variables :caches => tilecaches
-end
-
-template "/etc/logrotate.d/nginx" do
- source "logrotate.nginx.erb"
- owner "root"
- group "root"
- mode "644"
-end
-
-fail2ban_jail "squid" do
- maxretry 1000
-end
-
-tilerenders.each do |render|
- munin_plugin "ping_#{render[:fqdn]}" do
- target "ping_"
- conf "munin.ping.erb"
- conf_variables :host => render[:fqdn]
- end
-end
-
-directory "/srv/tilecache" do
- owner "root"
- group "root"
- mode "755"
-end
-
-directory "/srv/tilecache/data" do
- owner "www-data"
- group "www-data"
- mode "755"
-end
-
-cookbook_file "/srv/tilecache/tilecache-curl-time.txt" do
- source "tilecache-curl-time.txt"
- owner "root"
- group "root"
- mode "755"
-end
-
-template "/srv/tilecache/tilecache-curl-time" do
- source "tilecache-curl-time.erb"
- owner "root"
- group "root"
- mode "755"
- variables :caches => tilecaches, :renders => tilerenders
-end
-
-template "/srv/tilecache/tilecache-curl-time-cleanup" do
- source "tilecache-curl-time-cleanup.erb"
- owner "root"
- group "root"
- mode "755"
-end
-
-ohai_plugin "tilecache" do
- template "ohai.rb.erb"
-end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-/var/log/nginx/*.log {
- daily
- missingok
- rotate 7
- compress
- delaycompress
- notifempty
- create 640 nginx adm
- sharedscripts
- postrotate
- [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
- endscript
-}
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-/var/log/squid/*.log {
- daily
- compress
- compresscmd /usr/bin/xz
- compressoptions --threads=<%= [ node[:cpu][:total] / 2, 1 ].max.ceil %>
- uncompresscmd /usr/bin/unxz
- compressext .xz
- rotate 2
- missingok
- nocreate
- sharedscripts
- postrotate
-<% if node[:lsb][:release].to_f < 20.04 -%>
- test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
-<% else -%>
- test ! -e /run/squid/squid.pid || /usr/sbin/squid -k rotate
-<% end -%>
- endscript
- lastaction
- /usr/bin/rsync --preallocate /var/log/squid/access.log.1.xz ironbelly::logs/tile.openstreetmap.org/<%= node[:hostname] %>-`date -d "-1 days" +%Y-%m-%d`.xz || true
- endscript
-}
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-[ping_<%= @host %>]
-env.ping_args -c 1 -w 20
-env.ping_warn 0.5
-env.ping_crit 1.0
-env.packetloss_warn 10
-env.packetloss_crit 30
+++ /dev/null
-#!/bin/bash
-# DO NOT EDIT - This file is being maintained by Chef
-set -e
-
-NUM_TOKENS=4 # current + 4
-VALID_TOKEN=3600 # in seconds
-
-SECONDS_AGO=$((${NUM_TOKENS} * ${VALID_TOKEN}))
-OLD_TIME=$(/bin/date -u "+%Y-%m-%dT %H:%M:%S %z" -d "${SECONDS_AGO} seconds ago")
-QOS_TOKENS=($(/usr/bin/oathtool --totp --now="${OLD_TIME}" --window=${NUM_TOKENS} --time-step-size=${VALID_TOKEN}s -b "<%= @totp_key %>"))
-
-# ${qos_tokens[4]/[-1] } = OSM.org exclusive / current
-# ${qos_tokens[3]/[-2] } = OSM.org exclusive / stale
-# ${qos_tokens[2]/[-3] } = tile.openstreetmap.org default
-# ${qos_tokens[1]/[-4] } = stale ~ 1 hour
-# ${qos_tokens[0]} = expired
-
-# Test if number of tokens returned by oathtool is expected number
-if [ "${#QOS_TOKENS[@]}" -ne "$((${NUM_TOKENS}+1))" ]; then
- >&2 echo "ERROR: Unexpected number of tokens"
- exit 1
-fi
-
-QOS_TOKEN_OSM=${QOS_TOKENS[-1]} # Cookie set by openstreetmap.org
-QOS_TOKEN_OSM_STALE=${QOS_TOKENS[-2]} # Cookie set by openstreetmap.org stale
-QOS_TOKEN_DEFAULT=${QOS_TOKENS[-3]} # Cookie presented by tile.openstreetmap.org to browsers
-QOS_TOKEN_STALE=${QOS_TOKENS[-4]} # Cookie which has become stale and will be replaced
-
-if [ -z "$QOS_TOKEN_OSM" -o -z "$QOS_TOKEN_DEFAULT" -o -z "$QOS_TOKEN_STALE" ]; then
- >&2 echo "ERROR: Unexpected blank token"
- exit 2
-fi
-
-cat <<EOF >/etc/nginx/conf.d/tile_qos_rates.map
-default 8192; # Default Rate (No QoS cookie)
-"${QOS_TOKEN_STALE}" 24576; # Stale
-"${QOS_TOKEN_DEFAULT}" 24576; # Default
-"${QOS_TOKEN_OSM_STALE}" 32768; # Exclusive Stale
-"${QOS_TOKEN_OSM}" 32768; # Exclusive
-EOF
-
-cat <<EOF >/etc/nginx/conf.d/tile_qos_cookies.map
-default '_osm_totp_token=${QOS_TOKEN_DEFAULT}; Max-Age=${VALID_TOKEN}; Domain=openstreetmap.org; Path=/'; # Cookie Domain per RFC6265
-"${QOS_TOKEN_DEFAULT}" ''; # Do not Set-Cookie. # Default
-"${QOS_TOKEN_OSM_STALE}" ''; # Do not Set-Cookie. # Exclusive Stale
-"${QOS_TOKEN_OSM}" ''; # Do not Set-Cookie. # Exclusive
-EOF
-
-# Check config, reload config and fail safe
-# /etc/init.d/nginx configtest 2>/dev/null && /bin/systemctl try-reload-or-restart nginx
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-upstream tile_cache_backend {
- server 127.0.0.1:8080 weight=1000 max_fails=32;
- server 127.0.0.2:8080 weight=1000 max_fails=32;
-
- # Add the tile_siblings caches to relieve pressure if local squid failing
- # Balancer: round-robin
-<% server_weight = 1000 -%>
-<% Array(@node[:tilecache][:tile_siblings]).each do |cache_peer| -%>
-<% @caches.each do |cache| -%>
-<% if cache_peer == cache[:fqdn] -%>
-<% if cache[:hostname] != node[:hostname] -%>
-<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
- server <%= address %>:80 weight=<%= server_weight %> max_fails=32 backup; # Server <%= cache[:hostname] %>
-<% server_weight -= server_weight.div(2) -%>
-<% end -%>
-<% end -%>
-<% end -%>
-<% end -%>
-<% end -%>
-
- keepalive 128;
-}
-
-# Geo Map of tile caches
-geo $tile_cache {
- default "client";
-<% @caches.each do |cache| -%>
-<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
- <%= address %> "cache"; # <%= cache[:hostname] %>
-<% end -%>
-<% end -%>
-}
-
-# Rates table based on current cookie value
-# map $cookie__osm_totp_token $limit_rate_qos {
-# include /etc/nginx/conf.d/tile_qos_rates.map;
-# }
-
-# Set-Cookie table based on current cookie value
-# map $cookie__osm_totp_token $cookie_qos_token_set {
-# include /etc/nginx/conf.d/tile_qos_cookies.map;
-# }
-
-map $http_user_agent $approved_scraper {
- default 0; # Not approved
- '~^JOSM\/' 1; # JOSM
- '~^Mozilla\/5\.0\ QGIS\/' 1; # QGIS
-}
-
-map $http_user_agent $denied_scraper {
- default 0; # Not denied
- '' 1; # No User-Agent Set
- '-' 1;
-
- # Library defaults
- '~^Python\-urllib\/' 1;
- '~^python\-requests\/' 1;
- '~^node\-fetch\/' 1;
- '~^R$' 1;
- '~^Java\/' 1;
- '~^tiles$' 1;
- '~^okhttp\/' 1;
- '~^Microsoft-ATL-Native\/' 1;
- '/n software IPWorks HTTP/S Component - www.nsoftware.com' 1;
- '~^Wget\/' 1;
- 'java' 1;
-
- # Library defaults or fakes
- 'Android' 1;
- 'kc_android' 1;
- 'host' 1;
- '~^maptestapp' 1;
- 'Other' 1;
- 'osmdroid' 1;
- '~^tilelive-http' 1;
- '~^Java-http-client' 1;
-
- # Fakes
- 'Mozilla/4.0' 1;
- 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)' 1;
-
- # Bulk downloaders
- 'C# TilesDownloader' 1;
- 'MapDownloader' 1;
- '~^staticmaps' 1;
-
- # Overusage apps
- '~^runtastic' 1;
- '~^Where\ my\ children' 1;
- 'nossoonibusjp.android.crosswalk' 1;
- 'br.com.concisoti.potybus' 1;
- 'com.soft373.taptaxi' 1;
- 'com.kradac.ktxcore' 1;
- '~^ru.crowdsystems.topcontrol.knd' 1;
- 'pl.itaxi.driver' 1;
- 'net.uztaxi.driver' 1;
- 'OSMDroid/2.1 (its; rutaxi 3.28.0)' 1;
- 'com.helleniccomms.mercedes.driver' 1;
- 'ru.taximaster.www' 1;
- 'com.arobs.trackgps' 1;
- 'com.helleniccomms.asteras.driver' 1;
-
- # Malware
- 'Agent Smith' 1;
- # '~[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}' 1; # Fake UA
-}
-
-map $http_referer $denied_referer {
- default 0; # Not denied
- # Faked sites
- 'http://www.openstreetmap.org/' 1;
- 'http://www.openstreetmap.org' 1;
- 'https://www.openstreetmap.org' 1;
- 'http://openstreetmap.org/' 1;
- 'http://openstreetmap.org' 1;
- 'https://openstreetmap.org' 1;
- 'http://www.osm.org/' 1;
- 'http://www.osm.org' 1;
- 'http://osm.org/' 1;
- 'http://osm.org' 1;
- 'http://google.com' 1;
- 'http://www.google.com' 1;
- 'http://google.com/' 1;
- 'http://www.google.com/' 1;
- 'https://google.com' 1;
- 'https://www.google.com' 1;
- 'https://google.com/' 1;
- 'https://www.google.com/' 1;
- 'http://www.microsoft.com/' 1;
-
- # Overusing websites
- '~^https?://pmap\.kuku\.lu/' 1;
- '~^https?://[^.]*\.pmap\.kuku\.lu/' 1;
- '~^https?://fastpokemap\.com/' 1;
- '~^https?://[^.]*\.fastpokemap\.com/' 1;
- '~^https?://pkget\.com/' 1;
- '~^https?://[^.]*\.pkget\.com/' 1;
- '~^https?://twpkinfo\.com/' 1;
- '~^https?://[^.]*\.twpkinfo\.com/' 1;
- '~^https?://9db\.jp/' 1;
- '~^https?://[^.]*\.9db\.jp/' 1;
- '~^https?://clustrmaps\.com/' 1;
- '~^https?://[^.]*\.clustrmaps\.com/' 1;
- '~^https?://geoportal360\.pl/' 1;
- '~^https?://skelbiu\.lt/' 1;
- '~^https?://[^.]*\.skelbiu\.lt/' 1;
- '~^https?://wialon\.[^.]*/' 1; # wialon has many domains, so block them all
- '~^https?://[^.]*\.wialon\.[^.]*/' 1;
- '~^https?://gps-trace\.com/' 1;
- '~^https?://[^.]*\.gps-trace\.com/' 1;
- '~^https?://cellmapper\.net/' 1;
- '~^https?://[^.]*\.cellmapper\.net/' 1;
-}
-
-map $http_referer $censored_referer {
- default 0; # Not denied
- # Blocked on board instructions
- '~^https?://schiebt-sie-ab\.de/' 1;
- '~^https?://[^.]*\.schiebt-sie-ab\.de/' 1;
-}
-
-
-map $http_referer $osm_referer {
- default ''; # False
- '~^https:\/\/www\.openstreetmap\.org\/' 'osm'; # True
-}
-
-# Limit Cache-Control header to only approved User-Agents
-map $tile_cache$osm_referer$http_user_agent $limit_http_cache_control {
- default ''; # Unset Header
- '~^clientosmMozilla\/5\.0\ \(X11' $http_cache_control; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(Windows' $http_cache_control; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(iPhone' $http_cache_control; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(Macintosh' $http_cache_control; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(Linux' $http_cache_control; # Pass Header
-}
-
-# Limit Pragma header to only approved User-Agents
-map $tile_cache$osm_referer$http_user_agent $limit_http_pragma {
- default ''; # Unset Header
- '~^clientosmMozilla\/5\.0\ \(X11' $http_pragma; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(Windows' $http_pragma; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(iPhone' $http_pragma; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(Macintosh' $http_pragma; # Pass Header
- '~^clientosmMozilla\/5\.0\ \(Linux' $http_pragma; # Pass Header
-}
-
-# Find Browser User-Agents which are not sending a referer.
-# Browsers with no referer could be due to Browser extension or website Referrer-Policy
-map $tile_cache$http_referer$scheme$http_user_agent $deny_missing_referer {
- default 0; # Not denied
- '~^clienthttpsMozilla\/5\.0\ \(X11' 1;
- '~^clienthttpsMozilla\/5\.0\ \(Windows' 1;
- '~^clienthttpsMozilla\/5\.0\ \(iPhone' 1;
- '~^clienthttpsMozilla\/5\.0\ \(Macintosh' 1;
- '~^clienthttpsMozilla\/5\.0\ \(Linux' 1;
-}
-
-server {
- # IPv4
- listen 80 deferred backlog=16384 reuseport default_server;
- listen 443 ssl deferred backlog=16384 reuseport http2 default_server;
- # IPv6
- listen [::]:80 deferred backlog=16384 reuseport default_server;
- listen [::]:443 ssl deferred backlog=16384 reuseport http2 default_server;
- server_name localhost;
-
- proxy_buffers 8 64k;
- proxy_busy_buffers_size 64k;
-
- ssl_certificate /etc/ssl/certs/tile.openstreetmap.org.pem;
- ssl_certificate_key /etc/ssl/private/tile.openstreetmap.org.key;
-
- # Requests sent within early data are subject to replay attacks.
- # See: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_early_data
- ssl_early_data on;
-
- # Immediately 404 layers we do not support
-<% for i in 20..99 do %>
- location /<%= i %>/ {
- return 404;
- }
-<% end %>
-
- # Immediately 404 silly tile requests
- location = /0/-1/-1.png {
- return 404;
- }
- location = /0/-1/0.png {
- return 404;
- }
- location = /0/-1/1.png {
- return 404;
- }
- location = /0/0/-1.png {
- return 404;
- }
- location = /0/0/1.png {
- return 404;
- }
- location = /0/0/2.png {
- return 404;
- }
- location = /0/1/-1.png {
- return 404;
- }
- location = /0/1/0.png {
- return 404;
- }
- location = /0/1/1.png {
- return 404;
- }
- location = /0/1/2.png {
- return 404;
- }
- location = /0/2/0.png {
- return 404;
- }
- location = /0/2/1.png {
- return 404;
- }
- location = /0/2/2.png {
- return 404;
- }
- location = /1/-1/-1.png {
- return 404;
- }
- location = /1/-1/0.png {
- return 404;
- }
- location = /1/-1/1.png {
- return 404;
- }
- location = /1/-1/2.png {
- return 404;
- }
- location = /1/0/-1.png {
- return 404;
- }
- location = /1/1/-1.png {
- return 404;
- }
- location = /1/2/-1.png {
- return 404;
- }
- location = /2/-1/0.png {
- return 404;
- }
- location = /2/-1/1.png {
- return 404;
- }
- location = /2/-1/2.png {
- return 404;
- }
- location = /2/-1/3.png {
- return 404;
- }
- location = /2/0/-1.png {
- return 404;
- }
- location = /2/1/-1.png {
- return 404;
- }
- location = /2/1/4.png {
- return 404;
- }
- location = /2/2/4.png {
- return 404;
- }
- location = /2/3/4.png {
- return 404;
- }
- location = /2/4/0.png {
- return 404;
- }
- location = /2/4/1.png {
- return 404;
- }
- location = /2/4/2.png {
- return 404;
- }
- location = /2/4/3.png {
- return 404;
- }
- location = /2/4/4.png {
- return 404;
- }
-
-<% for i in 0..16 do %>
-<% if i == 0 -%>
- # Default Fallback Location Handler (lowest)
- location / {
-<% elsif -%>
- # Dedicated zoom handler for caching
- location /<%= i %>/ {
-<% end %>
- # Only allow GET / HEAD / OPTIONS (CORS) requests
- limit_except GET HEAD OPTIONS {
- deny all;
- }
-
- proxy_pass http://tile_cache_backend;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_http_version 1.1;
- proxy_set_header Connection '';
-
- proxy_connect_timeout 20s;
-
- proxy_next_upstream_tries 2;
-
- # Replace host header.
- proxy_set_header Host 'tile.openstreetmap.org';
- # Drop all request headers and request body
- proxy_pass_request_headers off;
- proxy_pass_request_body off;
-
- # Do not allow setting cookies from backends due to caching.
- proxy_ignore_headers Set-Cookie;
- proxy_hide_header Set-Cookie;
-
-<% if i != 0 -%>
- # Caching
- proxy_cache "proxy_cache_zone";
- proxy_cache_lock on;
- proxy_cache_valid 200 2d;
- proxy_cache_valid 404 15m;
- # Serve stale cache on errors or if updating
- proxy_cache_use_stale error timeout updating http_404 http_500 http_503 http_504;
- # If in cache as stale, serve stale and update in background
- proxy_cache_background_update on;
- # Workaround nginx async bug which causes stale cache replies to wait for the async backend cache update reply (seen in v1.16.0)
- keepalive_requests 0;
- # Enable revalidation using If-Modified-Since and If-None-Match for stale items
- proxy_cache_revalidate on;
- proxy_cache_min_uses 4;
-
- add_header x-cache-status "$upstream_cache_status - <%= node[:hostname] %>";
-<% else %>
- # Severely rate limit Browser UAs which are not sending a referer.
- # With no referer we do not know who is using tiles
- if ($deny_missing_referer) {
- set $limit_rate 1024;
- add_header x-cache-ratelimit "missing-referer";
- }
-<% end -%>
-
- # Set a QoS cookie if none presented (uses nginx Map)
- # add_header Set-Cookie $cookie_qos_token_set;
-<% if node[:ssl][:strict_transport_security] -%>
- # Ensure Strict-Transport-Security header is removed from proxied server responses
- proxy_hide_header Strict-Transport-Security;
-
- # Enable HSTS
- add_header Strict-Transport-Security "<%= node[:ssl][:strict_transport_security] %>" always;
-<% end -%>
-
- # QoS Traffic Rate see $limit_rate on http://nginx.org/en/docs/http/ngx_http_core_module.html
- # set $limit_rate $limit_rate_qos;
-
- # Allow Higher Traffic Rate from Approved User-Agents which do not support cookies (uses nginx Map)
- # if ($approved_scraper) {
- # set $limit_rate 65536;
- # }
-
- if ($denied_scraper) {
- set $limit_rate 512;
- return 429;
- }
- if ($denied_referer) {
- set $limit_rate 512;
- return 418;
- }
-
- if ($censored_referer) {
- set $limit_rate 512;
- return 451 "Unavailable at OSMF Board request";
- }
-
- # Strip any ?query parameters from urls
- set $args '';
-
- # Allow cache purging headers only from select User-Agents (uses nginx Map)
- proxy_set_header Cache-Control $limit_http_cache_control;
- proxy_set_header Pragma $limit_http_pragma;
- }
-<% end %>
-}
+++ /dev/null
-Ohai.plugin(:TileCache) do
- provides "tilecache"
-
- def tile_siblings
- recent = Time.now - 600
- times = Hash.new
-
- # Find performance reports for last few minutes
- # Add up total time taken to download tile grouped by remote server
- # Remove 1 second per successful time report (de-prioritise new servers)
- # Add 10 seconds per failed time report request
- Dir.glob("/srv/tilecache/data/**/tilecache-*.txt").each do |path|
- if File.mtime(path) > recent
- IO.readlines(path).reverse.take(20).each do |sample|
- if sample =~ %r{^(\d+\.\d+),(\d+),https://([^/]+)/} then
- time = Regexp.last_match(1).to_f
- status = Regexp.last_match(2).to_i
- host = Regexp.last_match(3)
-
- if status == 200 then
- times[host] = times.fetch(host, 0) + (time + 1) * (time + 1) - 1
- else
- times[host] = times.fetch(host, 0) + 10
- end
- end
- end
- end
- end
-
- # Sort time reports
- # Strip to best 4 server names
- times.to_a.sort_by(&:last).take(4).map(&:first)
- end
-
- collect_data(:default) do
- tilecache Mash.new
-
- tilecache[:tile_siblings] = tile_siblings
- end
-end
+++ /dev/null
-acl osmtile_thishost dstdomain <%= node.name %>
-acl osmtile_sites dstdomain <%= node.name %> a.tile.openstreetmap.org b.tile.openstreetmap.org c.tile.openstreetmap.org tile.openstreetmap.org a.tile.osm.org b.tile.osm.org c.tile.osm.org tile.osm.org
-acl osmtiles_png urlpath_regex .png$
-
-acl whitelist_path urlpath_regex ^/cgi-bin/(export|debug)
-acl blacklist_path urlpath_regex ^/cgi-bin/
-acl blacklist_path urlpath_regex ^/MyAdmin/
-acl blacklist_path urlpath_regex ^/myadmin/
-acl blacklist_path urlpath_regex ^/pma/
-acl blacklist_path urlpath_regex ^/phpmyadmin/
-acl blacklist_path urlpath_regex ^/phpMyAdmin/
-acl blacklist_path urlpath_regex ^/idssvc/
-acl blacklist_path urlpath_regex ^/iesvc/
-acl blacklist_path urlpath_regex ^/invoker/
-acl blacklist_path urlpath_regex ^/jmx-console/
-acl blacklist_path urlpath_regex ^/manager/
-acl blacklist_path urlpath_regex ^/service/
-acl blacklist_path urlpath_regex ^/web-console/
-acl blacklist_path urlpath_regex ^/wstats/
-acl blacklist_path urlpath_regex ^/zecmd/
-
-http_access allow osmtile_sites whitelist_path
-http_access deny blacklist_path
-
-acl requestMethodGet method GET
-
-http_access allow osmtile_sites requestMethodGet
-
-acl osmtile_nocache_url urlpath_regex \.png/(status|dirty)$
-cache deny osmtile_sites osmtile_nocache_url
-
-<% @caches.each do |cache| -%>
-<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
-acl tile_caches src <%= address %>
-<% end -%>
-<% end -%>
-
-# Primary Parent
-<% if node[:squid][:version] < 4 -%>
-cache_peer <%= node[:tilecache][:tile_parent] %> parent 443 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 ssl ssldomain=render.openstreetmap.org
-<% elsif node[:lsb][:release].to_f < 20.04 -%>
-cache_peer <%= node[:tilecache][:tile_parent] %> parent 443 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 tls tlsdomain=render.openstreetmap.org
-<% else -%>
-cache_peer <%= node[:tilecache][:tile_parent] %> parent 443 0 no-query originserver name=osmtileAccel login=PASS connect-timeout=120 no-digest weight=1000 tls tlsdomain=render.openstreetmap.org tls-options=NORMAL:-VERS-TLS1.3
-<% end -%>
-cache_peer_access osmtileAccel allow osmtile_sites
-
-# Backup Parents
-<% @renders.each do |renders| -%>
-<% if node[:squid][:version] < 4 -%>
-cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 443 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 ssl ssldomain=render.openstreetmap.org
-<% elsif node[:lsb][:release].to_f < 20.04 -%>
-cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 443 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 tls tlsdomain=render.openstreetmap.org
-<% else -%>
-cache_peer <%= renders[:hostname] %>.render.openstreetmap.org parent 443 0 no-query originserver name=osmtileAccelBackup<%= renders[:hostname] %> login=PASS connect-timeout=60 no-digest weight=10 tls tlsdomain=render.openstreetmap.org tls-options=NORMAL:-VERS-TLS1.3
-<% end -%>
-cache_peer_access osmtileAccelBackup<%= renders[:hostname] %> allow osmtile_sites
-<% end -%>
-
-# ----------------------------------
-
-<% if node[:squid][:version] < 4 -%>
-
-#Allow tile_caches HTCP access
-htcp_access allow tile_caches
-
-#Allow tile_caches ICP access
-icp_access allow tile_caches
-<% end %>
-
-#----------------------------------
+++ /dev/null
-#/bin/bash
-set -eu
-/usr/bin/find /srv/tilecache/data/ -type f -iname '*.txt' -mtime +7 -print0 | /usr/bin/xargs -0 -n 12 --no-run-if-empty -P 2 /usr/bin/xz -9e
+++ /dev/null
-#!/bin/bash
-sleep $[ ( $RANDOM % 20 ) + 1 ]
-mkdir -p /srv/tilecache/data/$(date --utc "+%Y/%m")
-# localhost
-curl -w "@/srv/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \
---max-time 60 \
-'http://localhost:8080/19/262106/174485.png' \
--H 'authority: c.tile.openstreetmap.org' \
--H 'sec-fetch-dest: image' \
--H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \
--H 'dnt: 1' \
--H 'accept: image/webp,image/apng,image/*,*/*;q=0.8' \
--H 'sec-fetch-site: same-site' \
--H 'sec-fetch-mode: no-cors' \
--H 'referer: https://www.openstreetmap.org/' \
--H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
---compressed >> /srv/tilecache/data/$(date --utc "+%Y/%m")/localhost-<%= node.name.split(".").first %>-$(date --utc "+%Y-%m-%dT%H").txt
-# render
-<% @renders.each do |render| -%>
-<% if render.name != node.name -%>
-<% render.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
- curl -w "@/srv/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \
- --max-time 60 \
- 'https://<%= render.name %>/19/262106/174485.png' \
- -H 'authority: c.tile.openstreetmap.org' \
- -H 'sec-fetch-dest: image' \
- -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \
- -H 'dnt: 1' \
- -H 'accept: image/webp,image/apng,image/*,*/*;q=0.8' \
- -H 'sec-fetch-site: same-site' \
- -H 'sec-fetch-mode: no-cors' \
- -H 'referer: https://www.openstreetmap.org/' \
- -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
- --compressed >> /srv/tilecache/data/$(date --utc "+%Y/%m")/render-<%= render.name.split(".").first %>-$(date --utc "+%Y-%m-%dT%H").txt
-<% end -%>
-<% end -%>
-<% end -%>
-# caches
-<% @caches.each do |cache| -%>
-<% if cache.name != node.name -%>
-<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
- curl -w "@/srv/tilecache/tilecache-curl-time.txt" -o /dev/null -s -k -4 \
- --max-time 60 \
- 'https://<%= cache.name %>/19/262106/174485.png' \
- -H 'authority: c.tile.openstreetmap.org' \
- -H 'sec-fetch-dest: image' \
- -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' \
- -H 'dnt: 1' \
- -H 'accept: image/webp,image/apng,image/*,*/*;q=0.8' \
- -H 'sec-fetch-site: same-site' \
- -H 'sec-fetch-mode: no-cors' \
- -H 'referer: https://www.openstreetmap.org/' \
- -H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
- --compressed >> /srv/tilecache/data/$(date --utc "+%Y/%m")/tilecache-<%= cache.name.split(".").first %>-$(date --utc "+%Y-%m-%dT%H").txt
-<% end -%>
-<% end -%>
-<% end -%>
-default[:tilelog][:source_directory] = "/opt/tilelog"
-default[:tilelog][:input_directory] = "/store/logs/tile.openstreetmap.org"
default[:tilelog][:output_directory] = "/store/planet/tile_logs"
version "1.0.0"
supports "ubuntu"
-depends "git"
-depends "tools"
+depends "python"
+depends "systemd"
# Cookbook:: tilelog
# Recipe:: default
#
-# Copyright:: 2014, OpenStreetMap Foundation
+# Copyright:: 2014-2022, OpenStreetMap Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# limitations under the License.
#
-include_recipe "git"
-include_recipe "tools"
+include_recipe "python"
-package %w[
- gcc
- g++
- make
- autoconf
- automake
- libboost-filesystem-dev
- libboost-program-options-dev
- libboost-system-dev
-]
+passwords = data_bag_item("tilelog", "passwords")
-tilelog_source_directory = node[:tilelog][:source_directory]
-tilelog_input_directory = node[:tilelog][:input_directory]
+tilelog_directory = "/opt/tilelog"
tilelog_output_directory = node[:tilelog][:output_directory]
-# resources for building the tile analysis binary
-git tilelog_source_directory do
- action :sync
- repository "https://github.com/zerebubuth/openstreetmap-tile-analyze.git"
- revision "live"
- user "root"
- group "root"
- notifies :run, "execute[tilelog-autogen]", :immediately
+python_virtualenv tilelog_directory do
+ interpreter "/usr/bin/python3"
end
-execute "tilelog-autogen" do
- action :nothing
- command "autoreconf -i"
- cwd tilelog_source_directory
- user "root"
- group "root"
- notifies :run, "execute[tilelog-configure]", :immediately
-end
-
-execute "tilelog-configure" do
- action :nothing
- command "./configure --with-boost-libdir=/usr/lib/x86_64-linux-gnu"
- cwd tilelog_source_directory
- user "root"
- group "root"
- notifies :run, "execute[tilelog-build]", :immediately
+python_package "tilelog" do
+ python_virtualenv tilelog_directory
+ python_version "3"
+ version "1.4.0"
end
-execute "tilelog-build" do
- action :nothing
- command "make"
- cwd tilelog_source_directory
- user "root"
- group "root"
+directory tilelog_output_directory do
+ user "www-data"
+ group "www-data"
+ mode "755"
+ recursive true
end
-# resources for running the tile analysis
template "/usr/local/bin/tilelog" do
source "tilelog.erb"
owner "root"
group "root"
mode "755"
- variables :analyze_bin => "#{tilelog_source_directory}/openstreetmap-tile-analyze",
- :input_dir => tilelog_input_directory,
- :output_dir => tilelog_output_directory
+ variables :output_dir => tilelog_output_directory,
+ :aws_key => passwords["aws_key"]
end
-cron_d "tilelog" do
- minute "17"
- hour "22"
+systemd_service "tilelog" do
+ description "Tile log analysis"
user "www-data"
- command "/usr/local/bin/tilelog"
- mailto "zerebubuth@gmail.com"
+ exec_start "/usr/local/bin/tilelog"
+ private_tmp true
+ private_devices true
+ protect_system "strict"
+ protect_home true
+ read_write_paths tilelog_output_directory
end
-# resources related to the output of the analysis and where it
-# can be publicly downloaded.
-directory tilelog_output_directory do
- user "www-data"
- group "www-data"
- mode "755"
- recursive true
+systemd_timer "tilelog" do
+ description "Tile log analysis"
+ on_calendar "*-*-* 01:07:00"
+end
+
+service "tilelog.timer" do
+ action [:enable, :start]
end
#!/bin/sh
+set -e
-ANALYZE=<%= @analyze_bin %>
-LOGDIR=<%= @input_dir %>
-OUTDIR=<%= @output_dir %>
-if [ -z "$DATE" ]; then
- DATE=`date -d "1 day ago" "+%Y-%m-%d"`
+if [ -z "$DATE" ]
+then
+ DATE=$(date -d "1 day ago" "+%Y-%m-%d")
fi
-TMPDIR=`mktemp -d -t tmp.XXXXXXXXX`
-ORIGDIR=`pwd`
-clean_up() {
- cd $ORIGDIR
- rm -rf $TMPDIR
-}
+OUTDIR="<%= @output_dir %>"
+TMPDIR=$(mktemp -d -t tilelog.XXXXXXXXX)
-trap clean_up 0 HUP INT TERM
-cd $TMPDIR
+cd "$TMPDIR"
-mkdir db
-nice -n 19 $ANALYZE $LOGDIR/*-${DATE}.xz > analyze.log
-if [ -f tiles.txt ]; then
- nice -n 19 xz -9e -z tiles.txt
- mv tiles.txt.xz $OUTDIR/tiles-${DATE}.txt.xz
+export AWS_ACCESS_KEY_ID="AKIASQUXHPE7JFCFMOUP"
+export AWS_SECRET_ACCESS_KEY="<%= @aws_key %>"
+export AWS_REGION="eu-west-1"
-else
- cat analyze.log
-fi
+TILEFILE="tiles-${DATE}.txt.xz"
+HOSTFILE="hosts-${DATE}.csv"
+
+nice -n 19 /opt/tilelog/bin/tilelog --date "${DATE}" --generate-success \
+ --tile "${TILEFILE}" --host "${HOSTFILE}"
+
+mv "${TILEFILE}" "${HOSTFILE}" "${OUTDIR}"
+
+rm -rf "$TMPDIR"
-default[:timescaledb][:database_version] = "12"
+default[:timescaledb][:database_version] = "14"
default[:timescaledb][:max_background_workers] = 8
default[:apt][:sources] |= ["timescaledb"]
rsyslog
cron
locales-all
+ systemd-coredump
]
service "rsyslog" do
+++ /dev/null
-default[:accounts][:users][:trac][:status] = :role
--- /dev/null
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+21 21
+22 22
+23 23
+24 24
+25 25
+26 26
+27 27
+28 28
+29 29
+30 30
+31 31
+32 32
+33 33
+34 34
+35 35
+36 36
+37 37
+38 38
+39 39
+40 40
+41 41
+42 42
+43 43
+44 44
+45 45
+46 46
+47 47
+48 48
+49 49
+50 50
+51 51
+52 52
+53 53
+54 54
+55 55
+56 56
+57 57
+58 58
+59 59
+60 60
+61 61
+62 62
+63 63
+64 64
+65 65
+66 66
+67 67
+68 68
+69 69
+70 70
+71 71
+72 72
+73 73
+74 74
+75 75
+76 76
+77 77
+78 78
+79 79
+80 80
+81 81
+82 82
+83 83
+84 84
+85 85
+86 86
+87 87
+88 88
+89 89
+90 90
+91 91
+92 92
+93 93
+94 94
+95 95
+96 96
+97 97
+98 98
+99 99
+100 100
+101 101
+102 102
+103 103
+104 104
+105 105
+106 106
+107 107
+108 108
+109 109
+110 110
+111 111
+112 112
+113 113
+114 114
+115 115
+116 116
+117 117
+118 118
+119 119
+120 120
+121 121
+122 122
+123 123
+124 124
+125 125
+126 126
+127 127
+128 128
+129 129
+130 130
+131 131
+132 132
+133 133
+134 134
+135 135
+136 136
+137 137
+138 138
+139 139
+140 140
+141 141
+142 142
+143 143
+144 144
+145 145
+146 146
+147 147
+148 148
+149 149
+150 150
+151 151
+152 152
+153 153
+154 154
+155 155
+156 156
+157 157
+158 158
+159 159
+160 160
+161 161
+162 162
+163 163
+164 164
+165 165
+166 166
+167 167
+168 168
+169 169
+170 170
+171 171
+172 172
+173 173
+174 174
+175 175
+176 176
+177 177
+178 178
+179 179
+180 180
+181 181
+182 182
+183 183
+184 184
+185 185
+186 186
+187 187
+188 188
+189 189
+190 190
+191 191
+192 192
+193 193
+194 194
+195 195
+196 196
+197 197
+198 198
+199 199
+200 200
+201 201
+202 202
+203 203
+204 204
+205 205
+206 206
+207 207
+208 208
+209 209
+210 210
+211 211
+212 212
+213 213
+214 214
+215 215
+216 216
+217 217
+218 218
+219 219
+220 220
+221 221
+222 222
+223 223
+224 224
+225 225
+226 226
+227 227
+228 228
+229 229
+230 230
+231 231
+232 232
+233 233
+234 234
+235 235
+236 236
+237 237
+238 238
+239 239
+240 240
+241 241
+242 242
+243 243
+244 244
+245 245
+246 246
+247 247
+248 248
+249 249
+250 250
+251 251
+252 252
+253 253
+254 254
+255 255
+256 256
+257 257
+258 258
+259 259
+260 260
+261 261
+262 262
+263 263
+264 264
+265 265
+266 266
+267 267
+268 268
+269 269
+270 270
+271 271
+272 272
+273 273
+274 274
+275 275
+276 276
+277 277
+278 278
+279 279
+280 280
+281 281
+282 282
+283 283
+284 284
+285 285
+286 286
+287 287
+288 288
+289 289
+290 290
+291 291
+292 292
+293 293
+294 294
+295 295
+296 296
+297 297
+298 298
+299 299
+300 300
+301 301
+302 302
+303 303
+304 304
+305 305
+306 306
+307 307
+308 308
+309 309
+310 310
+311 311
+312 312
+313 313
+314 314
+315 315
+316 316
+317 317
+318 318
+319 319
+320 320
+321 321
+322 322
+323 323
+324 324
+325 325
+326 326
+327 327
+328 328
+329 329
+330 330
+331 331
+332 332
+333 333
+334 334
+335 335
+336 336
+337 337
+338 338
+339 339
+340 340
+341 341
+342 342
+343 343
+344 344
+345 345
+346 346
+347 347
+348 348
+349 349
+350 350
+351 351
+352 352
+353 353
+354 354
+355 355
+356 356
+357 357
+358 358
+359 359
+360 360
+361 361
+362 362
+363 363
+364 364
+365 365
+366 366
+367 367
+368 368
+369 369
+370 370
+371 371
+372 372
+373 373
+374 374
+375 375
+376 376
+377 377
+378 378
+379 379
+380 380
+381 381
+382 382
+383 383
+384 384
+385 385
+386 386
+387 387
+388 388
+389 389
+390 390
+391 391
+392 392
+393 393
+394 394
+395 395
+396 396
+397 397
+398 398
+399 399
+400 400
+401 401
+402 402
+403 403
+404 404
+405 405
+406 406
+407 407
+408 408
+409 409
+410 410
+411 411
+412 412
+413 413
+414 414
+415 415
+416 416
+417 417
+418 418
+419 419
+420 420
+421 421
+422 422
+423 423
+424 424
+425 425
+426 426
+427 427
+428 428
+429 429
+430 430
+431 431
+432 432
+433 433
+434 434
+435 435
+436 436
+437 437
+438 438
+439 439
+440 440
+441 441
+442 442
+443 443
+444 444
+445 445
+446 446
+447 447
+448 448
+449 449
+450 450
+451 451
+452 452
+453 453
+454 454
+455 455
+456 456
+457 457
+458 458
+459 459
+460 460
+461 461
+462 462
+463 463
+464 464
+465 465
+466 466
+467 467
+468 468
+469 469
+470 470
+471 471
+472 472
+473 473
+474 474
+475 475
+476 476
+477 477
+478 478
+479 479
+480 480
+481 481
+482 482
+483 483
+484 484
+485 485
+486 486
+487 487
+488 488
+489 489
+490 490
+491 491
+492 492
+493 493
+494 494
+495 495
+496 496
+497 497
+498 498
+499 499
+500 500
+501 501
+502 502
+503 503
+504 504
+505 505
+506 506
+507 507
+508 508
+509 509
+510 510
+511 511
+512 512
+513 513
+514 514
+515 515
+516 516
+517 517
+518 518
+519 519
+520 520
+521 521
+522 522
+523 523
+524 524
+525 525
+526 526
+527 527
+528 528
+529 529
+530 530
+531 531
+532 532
+533 533
+534 534
+535 535
+536 536
+537 537
+538 538
+539 539
+540 540
+541 541
+542 542
+543 543
+544 544
+545 545
+546 546
+547 547
+548 548
+549 549
+550 550
+551 551
+552 552
+553 553
+554 554
+555 555
+556 556
+557 557
+558 558
+559 559
+560 560
+561 561
+562 562
+563 563
+564 564
+565 565
+566 566
+567 567
+568 568
+569 569
+570 570
+571 571
+572 572
+573 573
+574 574
+575 575
+576 576
+577 577
+578 578
+579 579
+580 580
+581 581
+582 582
+583 583
+584 584
+585 585
+586 586
+587 587
+588 588
+589 589
+590 590
+591 591
+592 592
+593 593
+594 594
+595 595
+596 596
+597 597
+598 598
+599 599
+600 600
+601 601
+602 602
+603 603
+604 604
+605 605
+606 606
+607 607
+608 608
+609 609
+610 610
+611 611
+612 612
+613 613
+614 614
+615 615
+616 616
+617 617
+618 618
+619 619
+620 620
+621 621
+622 622
+623 623
+624 624
+625 625
+626 626
+627 627
+628 628
+629 629
+630 630
+631 631
+632 632
+633 633
+634 634
+635 635
+636 636
+637 637
+638 638
+639 639
+640 640
+641 641
+642 642
+643 643
+644 644
+645 645
+646 646
+647 647
+648 648
+649 649
+650 650
+651 651
+652 652
+653 653
+654 654
+655 655
+656 656
+657 657
+658 658
+659 659
+660 660
+661 661
+662 662
+663 663
+664 664
+665 665
+666 666
+667 667
+668 668
+669 669
+670 670
+671 671
+672 672
+673 673
+674 674
+675 675
+676 676
+677 677
+678 678
+679 679
+680 680
+681 681
+682 682
+683 683
+684 684
+685 685
+686 686
+687 687
+688 688
+689 689
+690 690
+691 691
+692 692
+693 693
+694 694
+695 695
+696 696
+697 697
+698 698
+699 699
+700 700
+701 701
+702 702
+703 703
+704 704
+705 705
+706 706
+707 707
+708 708
+709 709
+710 710
+711 711
+712 712
+713 713
+714 714
+715 715
+716 716
+717 717
+718 718
+719 719
+720 720
+721 721
+722 722
+723 723
+724 724
+725 725
+726 726
+727 727
+728 728
+729 729
+730 730
+731 731
+732 732
+733 733
+734 734
+735 735
+736 736
+737 737
+738 738
+739 739
+740 740
+741 741
+742 742
+743 743
+744 744
+745 745
+746 746
+747 747
+748 748
+749 749
+750 750
+751 751
+752 752
+753 753
+754 754
+755 755
+756 756
+757 757
+758 758
+759 759
+760 760
+761 761
+762 762
+763 763
+764 764
+765 765
+766 766
+767 767
+768 768
+769 769
+770 770
+771 771
+772 772
+773 773
+774 774
+775 775
+776 776
+777 777
+778 778
+779 779
+780 780
+781 781
+782 782
+783 783
+784 784
+785 785
+786 786
+787 787
+788 788
+789 789
+790 790
+791 791
+792 792
+793 793
+794 794
+795 795
+796 796
+797 797
+798 798
+799 799
+800 800
+801 801
+802 802
+803 803
+804 804
+805 805
+806 806
+807 807
+808 808
+809 809
+810 810
+811 811
+812 812
+813 813
+814 814
+815 815
+816 816
+817 817
+818 818
+819 819
+820 820
+821 821
+822 822
+823 823
+824 824
+825 825
+826 826
+827 827
+828 828
+829 829
+830 830
+831 831
+832 832
+833 833
+834 834
+835 835
+836 836
+837 837
+838 838
+839 839
+840 840
+841 841
+842 842
+843 843
+844 844
+845 845
+846 846
+847 847
+848 848
+849 849
+850 850
+851 851
+852 852
+853 853
+854 854
+855 855
+856 856
+857 857
+858 858
+859 859
+860 860
+861 861
+862 862
+863 863
+864 864
+865 865
+866 866
+867 867
+868 868
+869 869
+870 870
+871 871
+872 872
+873 873
+874 874
+875 875
+876 876
+877 877
+878 878
+879 879
+880 880
+881 881
+882 882
+883 883
+884 884
+885 885
+886 886
+887 887
+888 888
+889 889
+890 890
+891 891
+892 892
+893 893
+894 894
+895 895
+896 896
+897 897
+898 898
+899 899
+900 900
+901 901
+902 902
+903 903
+904 904
+905 905
+906 906
+907 907
+908 908
+909 909
+910 910
+911 911
+912 912
+913 913
+914 914
+915 915
+916 916
+917 917
+918 918
+919 919
+920 920
+921 921
+922 922
+923 923
+924 924
+925 925
+926 926
+927 927
+928 928
+929 929
+930 930
+931 931
+932 932
+933 933
+934 934
+935 935
+936 936
+937 937
+938 938
+939 939
+940 940
+941 941
+942 942
+943 943
+944 944
+945 945
+946 946
+947 947
+948 948
+949 949
+950 950
+951 951
+952 952
+953 953
+954 954
+955 955
+956 956
+957 957
+958 958
+959 959
+960 960
+961 961
+962 962
+963 963
+964 964
+965 965
+966 966
+967 967
+968 968
+969 969
+970 970
+971 971
+972 972
+973 973
+974 974
+975 975
+976 976
+977 977
+978 978
+979 979
+980 980
+981 981
+982 982
+983 983
+984 984
+985 985
+986 986
+987 987
+988 988
+989 989
+990 990
+991 991
+992 992
+993 993
+994 994
+995 995
+996 996
+997 997
+998 998
+999 999
+1000 1000
+1001 1001
+1002 1002
+1003 1003
+1004 1004
+1005 1005
+1006 1006
+1007 1007
+1008 1008
+1009 1009
+1010 1010
+1011 1011
+1012 1012
+1013 1013
+1014 1014
+1015 1015
+1016 1016
+1017 1017
+1018 1018
+1019 1019
+1020 1020
+1021 1021
+1022 1022
+1023 1023
+1024 1024
+1025 1025
+1026 1026
+1027 1027
+1028 1028
+1029 1029
+1030 1030
+1031 1031
+1032 1032
+1033 1033
+1034 1034
+1035 1035
+1036 1036
+1037 1037
+1038 1038
+1039 1039
+1040 1040
+1041 1041
+1042 1042
+1043 1043
+1044 1044
+1045 1045
+1046 1046
+1047 1047
+1048 1048
+1049 1049
+1050 1050
+1051 1051
+1052 1052
+1053 1053
+1054 1054
+1055 1055
+1056 1056
+1057 1057
+1058 1058
+1059 1059
+1060 1060
+1061 1061
+1062 1062
+1063 1063
+1064 1064
+1065 1065
+1066 1066
+1067 1067
+1068 1068
+1069 1069
+1070 1070
+1071 1071
+1072 1072
+1073 1073
+1074 1074
+1075 1075
+1076 1076
+1077 1077
+1078 1078
+1079 1079
+1080 1080
+1081 1081
+1082 1082
+1083 1083
+1084 1084
+1085 1085
+1086 1086
+1087 1087
+1088 1088
+1089 1089
+1090 1090
+1091 1091
+1092 1092
+1093 1093
+1094 1094
+1095 1095
+1096 1096
+1097 1097
+1098 1098
+1099 1099
+1100 1100
+1101 1101
+1102 1102
+1103 1103
+1104 1104
+1105 1105
+1106 1106
+1107 1107
+1108 1108
+1109 1109
+1110 1110
+1111 1111
+1112 1112
+1113 1113
+1114 1114
+1115 1115
+1116 1116
+1117 1117
+1118 1118
+1119 1119
+1120 1120
+1121 1121
+1122 1122
+1123 1123
+1124 1124
+1125 1125
+1126 1126
+1127 1127
+1128 1128
+1129 1129
+1130 1130
+1131 1131
+1132 1132
+1133 1133
+1134 1134
+1135 1135
+1136 1136
+1137 1137
+1138 1138
+1139 1139
+1140 1140
+1141 1141
+1142 1142
+1143 1143
+1144 1144
+1145 1145
+1146 1146
+1147 1147
+1148 1148
+1149 1149
+1150 1150
+1151 1151
+1152 1152
+1153 1153
+1154 1154
+1155 1155
+1156 1156
+1157 1157
+1158 1158
+1159 1159
+1160 1160
+1161 1161
+1162 1162
+1163 1163
+1164 1164
+1165 1165
+1166 1166
+1167 1167
+1168 1168
+1169 1169
+1170 1170
+1171 1171
+1172 1172
+1173 1173
+1174 1174
+1175 1175
+1176 1176
+1177 1177
+1178 1178
+1179 1179
+1180 1180
+1181 1181
+1182 1182
+1183 1183
+1184 1184
+1185 1185
+1186 1186
+1187 1187
+1188 1188
+1189 1189
+1190 1190
+1191 1191
+1192 1192
+1193 1193
+1194 1194
+1195 1195
+1196 1196
+1197 1197
+1198 1198
+1199 1199
+1200 1200
+1201 1201
+1202 1202
+1203 1203
+1204 1204
+1205 1205
+1206 1206
+1207 1207
+1208 1208
+1209 1209
+1210 1210
+1211 1211
+1212 1212
+1213 1213
+1214 1214
+1215 1215
+1216 1216
+1217 1217
+1218 1218
+1219 1219
+1220 1220
+1221 1221
+1222 1222
+1223 1223
+1224 1224
+1225 1225
+1226 1226
+1227 1227
+1228 1228
+1229 1229
+1230 1230
+1231 1231
+1232 1232
+1233 1233
+1234 1234
+1235 1235
+1236 1236
+1237 1237
+1238 1238
+1239 1239
+1240 1240
+1241 1241
+1242 1242
+1243 1243
+1244 1244
+1245 1245
+1246 1246
+1247 1247
+1248 1248
+1249 1249
+1250 1250
+1251 1251
+1252 1252
+1253 1253
+1254 1254
+1255 1255
+1256 1256
+1257 1257
+1258 1258
+1259 1259
+1260 1260
+1261 1261
+1262 1262
+1263 1263
+1264 1264
+1265 1265
+1266 1266
+1267 1267
+1268 1268
+1269 1269
+1270 1270
+1271 1271
+1272 1272
+1273 1273
+1274 1274
+1275 1275
+1276 1276
+1277 1277
+1278 1278
+1279 1279
+1280 1280
+1281 1281
+1282 1282
+1283 1283
+1284 1284
+1285 1285
+1286 1286
+1287 1287
+1288 1288
+1289 1289
+1290 1290
+1291 1291
+1292 1292
+1293 1293
+1294 1294
+1295 1295
+1296 1296
+1297 1297
+1298 1298
+1299 1299
+1300 1300
+1301 1301
+1302 1302
+1303 1303
+1304 1304
+1305 1305
+1306 1306
+1307 1307
+1308 1308
+1309 1309
+1310 1310
+1311 1311
+1312 1312
+1313 1313
+1314 1314
+1315 1315
+1316 1316
+1317 1317
+1318 1318
+1319 1319
+1320 1320
+1321 1321
+1322 1322
+1323 1323
+1324 1324
+1325 1325
+1326 1326
+1327 1327
+1328 1328
+1329 1329
+1330 1330
+1331 1331
+1332 1332
+1333 1333
+1334 1334
+1335 1335
+1336 1336
+1337 1337
+1338 1338
+1339 1339
+1340 1340
+1341 1341
+1342 1342
+1343 1343
+1344 1344
+1345 1345
+1346 1346
+1347 1347
+1348 1348
+1349 1349
+1350 1350
+1351 1351
+1352 1352
+1353 1353
+1354 1354
+1355 1355
+1356 1356
+1357 1357
+1358 1358
+1359 1359
+1360 1360
+1361 1361
+1362 1362
+1363 1363
+1364 1364
+1365 1365
+1366 1366
+1367 1367
+1368 1368
+1369 1369
+1370 1370
+1371 1371
+1372 1372
+1373 1373
+1374 1374
+1375 1375
+1376 1376
+1377 1377
+1378 1378
+1379 1379
+1380 1380
+1381 1381
+1382 1382
+1383 1383
+1384 1384
+1385 1385
+1386 1386
+1387 1387
+1388 1388
+1389 1389
+1390 1390
+1391 1391
+1392 1392
+1393 1393
+1394 1394
+1395 1395
+1396 1396
+1397 1397
+1398 1398
+1399 1399
+1400 1400
+1401 1401
+1402 1402
+1403 1403
+1404 1404
+1405 1405
+1406 1406
+1407 1407
+1408 1408
+1409 1409
+1410 1410
+1411 1411
+1412 1412
+1413 1413
+1414 1414
+1415 1415
+1416 1416
+1417 1417
+1418 1418
+1419 1419
+1420 1420
+1421 1421
+1422 1422
+1423 1423
+1424 1424
+1425 1425
+1426 1426
+1427 1427
+1428 1428
+1429 1429
+1430 1430
+1431 1431
+1432 1432
+1433 1433
+1434 1434
+1435 1435
+1436 1436
+1437 1437
+1438 1438
+1439 1439
+1440 1440
+1441 1441
+1442 1442
+1443 1443
+1444 1444
+1445 1445
+1446 1446
+1447 1447
+1448 1448
+1449 1449
+1450 1450
+1451 1451
+1452 1452
+1453 1453
+1454 1454
+1455 1455
+1456 1456
+1457 1457
+1458 1458
+1459 1459
+1460 1460
+1461 1461
+1462 1462
+1463 1463
+1464 1464
+1465 1465
+1466 1466
+1467 1467
+1468 1468
+1469 1469
+1470 1470
+1471 1471
+1472 1472
+1473 1473
+1474 1474
+1475 1475
+1476 1476
+1477 1477
+1478 1478
+1479 1479
+1480 1480
+1481 1481
+1482 1482
+1483 1483
+1484 1484
+1485 1485
+1486 1486
+1487 1487
+1488 1488
+1489 1489
+1490 1490
+1491 1491
+1492 1492
+1493 1493
+1494 1494
+1495 1495
+1496 1496
+1497 1497
+1498 1498
+1499 1499
+1500 1500
+1501 1501
+1502 1502
+1503 1503
+1504 1504
+1505 1505
+1506 1506
+1507 1507
+1508 1508
+1509 1509
+1510 1510
+1511 1511
+1512 1512
+1513 1513
+1514 1514
+1515 1515
+1516 1516
+1517 1517
+1518 1518
+1519 1519
+1520 1520
+1521 1521
+1522 1522
+1523 1523
+1524 1524
+1525 1525
+1526 1526
+1527 1527
+1528 1528
+1529 1529
+1530 1530
+1531 1531
+1532 1532
+1533 1533
+1534 1534
+1535 1535
+1536 1536
+1537 1537
+1538 1538
+1539 1539
+1540 1540
+1541 1541
+1542 1542
+1543 1543
+1544 1544
+1545 1545
+1546 1546
+1547 1547
+1548 1548
+1549 1549
+1550 1550
+1551 1551
+1552 1552
+1553 1553
+1554 1554
+1555 1555
+1556 1556
+1557 1557
+1558 1558
+1559 1559
+1560 1560
+1561 1561
+1562 1562
+1563 1563
+1564 1564
+1565 1565
+1566 1566
+1567 1567
+1568 1568
+1569 1569
+1570 1570
+1571 1571
+1572 1572
+1573 1573
+1574 1574
+1575 1575
+1576 1576
+1577 1577
+1578 1578
+1579 1579
+1580 1580
+1581 1581
+1582 1582
+1583 1583
+1584 1584
+1585 1585
+1586 1586
+1587 1587
+1588 1588
+1589 1589
+1590 1590
+1591 1591
+1592 1592
+1593 1593
+1594 1594
+1595 1595
+1596 1596
+1597 1597
+1598 1598
+1599 1599
+1600 1600
+1601 1601
+1602 1602
+1603 1603
+1604 1604
+1605 1605
+1606 1606
+1607 1607
+1608 1608
+1609 1609
+1610 1610
+1611 1611
+1612 1612
+1613 1613
+1614 1614
+1615 1615
+1616 1616
+1617 1617
+1618 1618
+1619 1619
+1620 1620
+1621 1621
+1622 1622
+1623 1623
+1624 1624
+1625 1625
+1626 1626
+1627 1627
+1628 1628
+1629 1629
+1630 1630
+1631 1631
+1632 1632
+1633 1633
+1634 1634
+1635 1635
+1636 1636
+1637 1637
+1638 1638
+1639 1639
+1640 1640
+1641 1641
+1642 1642
+1643 1643
+1644 1644
+1645 1645
+1646 1646
+1647 1647
+1648 1648
+1649 1649
+1650 1650
+1651 1651
+1652 1652
+1653 1653
+1654 1654
+1655 1655
+1656 1656
+1657 1657
+1658 1658
+1659 1659
+1660 1660
+1661 1661
+1662 1662
+1663 1663
+1664 1664
+1665 1665
+1666 1666
+1667 1667
+1668 1668
+1669 1669
+1670 1670
+1671 1671
+1672 1672
+1673 1673
+1674 1674
+1675 1675
+1676 1676
+1677 1677
+1678 1678
+1679 1679
+1680 1680
+1681 1681
+1682 1682
+1683 1683
+1684 1684
+1685 1685
+1686 1686
+1687 1687
+1688 1688
+1689 1689
+1690 1690
+1691 1691
+1692 1692
+1693 1693
+1694 1694
+1695 1695
+1696 1696
+1697 1697
+1698 1698
+1699 1699
+1700 1700
+1701 1701
+1702 1702
+1703 1703
+1704 1704
+1705 1705
+1706 1706
+1707 1707
+1708 1708
+1709 1709
+1710 1710
+1711 1711
+1712 1712
+1713 1713
+1714 1714
+1715 1715
+1716 1716
+1717 1717
+1718 1718
+1719 1719
+1720 1720
+1721 1721
+1722 1722
+1723 1723
+1724 1724
+1725 1725
+1726 1726
+1727 1727
+1728 1728
+1729 1729
+1730 1730
+1731 1731
+1732 1732
+1733 1733
+1734 1734
+1735 1735
+1736 1736
+1737 1737
+1738 1738
+1739 1739
+1740 1740
+1741 1741
+1742 1742
+1743 1743
+1744 1744
+1745 1745
+1746 1746
+1747 1747
+1748 1748
+1749 1749
+1750 1750
+1751 1751
+1752 1752
+1753 1753
+1754 1754
+1755 1755
+1756 1756
+1757 1757
+1758 1758
+1759 1759
+1760 1760
+1761 1761
+1762 1762
+1763 1763
+1764 1764
+1765 1765
+1766 1766
+1767 1767
+1768 1768
+1769 1769
+1770 1770
+1771 1771
+1772 1772
+1773 1773
+1774 1774
+1775 1775
+1776 1776
+1777 1777
+1778 1778
+1779 1779
+1780 1780
+1781 1781
+1782 1782
+1783 1783
+1784 1784
+1785 1785
+1786 1786
+1787 1787
+1788 1788
+1789 1789
+1790 1790
+1791 1791
+1792 1792
+1793 1793
+1794 1794
+1795 1795
+1796 1796
+1797 1797
+1798 1798
+1799 1799
+1800 1800
+1801 1801
+1802 1802
+1803 1803
+1804 1804
+1805 1805
+1806 1806
+1807 1807
+1808 1808
+1809 1809
+1810 1810
+1811 1811
+1812 1812
+1813 1813
+1814 1814
+1815 1815
+1816 1816
+1817 1817
+1818 1818
+1819 1819
+1820 1820
+1821 1821
+1822 1822
+1823 1823
+1824 1824
+1825 1825
+1826 1826
+1827 1827
+1828 1828
+1829 1829
+1830 1830
+1831 1831
+1832 1832
+1833 1833
+1834 1834
+1835 1835
+1836 1836
+1837 1837
+1838 1838
+1839 1839
+1840 1840
+1841 1841
+1842 1842
+1843 1843
+1844 1844
+1845 1845
+1846 1846
+1847 1847
+1848 1848
+1849 1849
+1850 1850
+1851 1851
+1852 1852
+1853 1853
+1854 1854
+1855 1855
+1856 1856
+1857 1857
+1858 1858
+1859 1859
+1860 1860
+1861 1861
+1862 1862
+1863 1863
+1864 1864
+1865 1865
+1866 1866
+1867 1867
+1868 1868
+1869 1869
+1870 1870
+1871 1871
+1872 1872
+1873 1873
+1874 1874
+1875 1875
+1876 1876
+1877 1877
+1878 1878
+1879 1879
+1880 1880
+1881 1881
+1882 1882
+1883 1883
+1884 1884
+1885 1885
+1886 1886
+1887 1887
+1888 1888
+1889 1889
+1890 1890
+1891 1891
+1892 1892
+1893 1893
+1894 1894
+1895 1895
+1896 1896
+1897 1897
+1898 1898
+1899 1899
+1900 1900
+1901 1901
+1902 1902
+1903 1903
+1904 1904
+1905 1905
+1906 1906
+1907 1907
+1908 1908
+1909 1909
+1910 1910
+1911 1911
+1912 1912
+1913 1913
+1914 1914
+1915 1915
+1916 1916
+1917 1917
+1918 1918
+1919 1919
+1920 1920
+1921 1921
+1922 1922
+1923 1923
+1924 1924
+1925 1925
+1926 1926
+1927 1927
+1928 1928
+1929 1929
+1930 1930
+1931 1931
+1932 1932
+1933 1933
+1934 1934
+1935 1935
+1936 1936
+1937 1937
+1938 1938
+1939 1939
+1940 1940
+1941 1941
+1942 1942
+1943 1943
+1944 1944
+1945 1945
+1946 1946
+1947 1947
+1948 1948
+1949 1949
+1950 1950
+1951 1951
+1952 1952
+1953 1953
+1954 1954
+1955 1955
+1956 1956
+1957 1957
+1958 1958
+1959 1959
+1960 1960
+1961 1961
+1962 1962
+1963 1963
+1964 1964
+1965 1965
+1966 1966
+1967 1967
+1968 1968
+1969 1969
+1970 1970
+1971 1971
+1972 1972
+1973 1973
+1974 1974
+1975 1975
+1976 1976
+1977 1977
+1978 1978
+1979 1979
+1980 1980
+1981 1981
+1982 1982
+1983 1983
+1984 1984
+1985 1985
+1986 1986
+1987 1987
+1988 1988
+1989 1989
+1990 1990
+1991 1991
+1992 1992
+1993 1993
+1994 1994
+1995 1995
+1996 1996
+1997 1997
+1998 1998
+1999 1999
+2000 2000
+2001 2001
+2002 2002
+2003 2003
+2004 2004
+2005 2005
+2006 2006
+2007 2007
+2008 2008
+2009 2009
+2010 2010
+2011 2011
+2012 2012
+2013 2013
+2014 2014
+2015 2015
+2016 2016
+2017 2017
+2018 2018
+2019 2019
+2020 2020
+2021 2021
+2022 2022
+2023 2023
+2024 2024
+2025 2025
+2026 2026
+2027 2027
+2028 2028
+2029 2029
+2030 2030
+2031 2031
+2032 2032
+2033 2033
+2034 2034
+2035 2035
+2036 2036
+2037 2037
+2038 2038
+2039 2039
+2040 2040
+2041 2041
+2042 2042
+2043 2043
+2044 2044
+2045 2045
+2046 2046
+2047 2047
+2048 2048
+2049 2049
+2050 2050
+2051 2051
+2052 2052
+2053 2053
+2054 2054
+2055 2055
+2056 2056
+2057 2057
+2058 2058
+2059 2059
+2060 2060
+2061 2061
+2062 2062
+2063 2063
+2064 2064
+2065 2065
+2066 2066
+2067 2067
+2068 2068
+2069 2069
+2070 2070
+2071 2071
+2072 2072
+2073 2073
+2074 2074
+2075 2075
+2076 2076
+2077 2077
+2078 2078
+2079 2079
+2080 2080
+2081 2081
+2082 2082
+2083 2083
+2084 2084
+2085 2085
+2086 2086
+2087 2087
+2088 2088
+2089 2089
+2090 2090
+2091 2091
+2092 2092
+2093 2093
+2094 2094
+2095 2095
+2096 2096
+2097 2097
+2098 2098
+2099 2099
+2100 2100
+2101 2101
+2102 2102
+2103 2103
+2104 2104
+2105 2105
+2106 2106
+2107 2107
+2108 2108
+2109 2109
+2110 2110
+2111 2111
+2112 2112
+2113 2113
+2114 2114
+2115 2115
+2116 2116
+2117 2117
+2118 2118
+2119 2119
+2120 2120
+2121 2121
+2122 2122
+2123 2123
+2124 2124
+2125 2125
+2126 2126
+2127 2127
+2128 2128
+2129 2129
+2130 2130
+2131 2131
+2132 2132
+2133 2133
+2134 2134
+2135 2135
+2136 2136
+2137 2137
+2138 2138
+2139 2139
+2140 2140
+2141 2141
+2142 2142
+2143 2143
+2144 2144
+2145 2145
+2146 2146
+2147 2147
+2148 2148
+2149 2149
+2150 2150
+2151 2151
+2152 2152
+2153 2153
+2154 2154
+2155 2155
+2156 2156
+2157 2157
+2158 2158
+2159 2159
+2160 2160
+2161 2161
+2162 2162
+2163 2163
+2164 2164
+2165 2165
+2166 2166
+2167 2167
+2168 2168
+2169 2169
+2170 2170
+2171 2171
+2172 2172
+2173 2173
+2174 2174
+2175 2175
+2176 2176
+2177 2177
+2178 2178
+2179 2179
+2180 2180
+2181 2181
+2182 2182
+2183 2183
+2184 2184
+2185 2185
+2186 2186
+2187 2187
+2188 2188
+2189 2189
+2190 2190
+2191 2191
+2192 2192
+2193 2193
+2194 2194
+2195 2195
+2196 2196
+2197 2197
+2198 2198
+2199 2199
+2200 2200
+2201 2201
+2202 2202
+2203 2203
+2204 2204
+2205 2205
+2206 2206
+2207 2207
+2208 2208
+2209 2209
+2210 2210
+2211 2211
+2212 2212
+2213 2213
+2214 2214
+2215 2215
+2216 2216
+2217 2217
+2218 2218
+2219 2219
+2220 2220
+2221 2221
+2222 2222
+2223 2223
+2224 2224
+2225 2225
+2226 2226
+2227 2227
+2228 2228
+2229 2229
+2230 2230
+2231 2231
+2232 2232
+2233 2233
+2234 2234
+2235 2235
+2236 2236
+2237 2237
+2238 2238
+2239 2239
+2240 2240
+2241 2241
+2242 2242
+2243 2243
+2244 2244
+2245 2245
+2246 2246
+2247 2247
+2248 2248
+2249 2249
+2250 2250
+2251 2251
+2252 2252
+2253 2253
+2254 2254
+2255 2255
+2256 2256
+2257 2257
+2258 2258
+2259 2259
+2260 2260
+2261 2261
+2262 2262
+2263 2263
+2264 2264
+2265 2265
+2266 2266
+2267 2267
+2268 2268
+2269 2269
+2270 2270
+2271 2271
+2272 2272
+2273 2273
+2274 2274
+2275 2275
+2276 2276
+2277 2277
+2278 2278
+2279 2279
+2280 2280
+2281 2281
+2282 2282
+2283 2283
+2284 2284
+2285 2285
+2286 2286
+2287 2287
+2288 2288
+2289 2289
+2290 2290
+2291 2291
+2292 2292
+2293 2293
+2294 2294
+2295 2295
+2296 2296
+2297 2297
+2298 2298
+2299 2299
+2300 2300
+2301 2301
+2302 2302
+2303 2303
+2304 2304
+2305 2305
+2306 2306
+2307 2307
+2308 2308
+2309 2309
+2310 2310
+2311 2311
+2312 2312
+2313 2313
+2314 2314
+2315 2315
+2316 2316
+2317 2317
+2318 2318
+2319 2319
+2320 2320
+2321 2321
+2322 2322
+2323 2323
+2324 2324
+2325 2325
+2326 2326
+2327 2327
+2328 2328
+2329 2329
+2330 2330
+2331 2331
+2332 2332
+2333 2333
+2334 2334
+2335 2335
+2336 2336
+2337 2337
+2338 2338
+2339 2339
+2340 2340
+2341 2341
+2342 2342
+2343 2343
+2344 2344
+2345 2345
+2346 2346
+2347 2347
+2348 2348
+2349 2349
+2350 2350
+2351 2351
+2352 2352
+2353 2353
+2354 2354
+2355 2355
+2356 2356
+2357 2357
+2358 2358
+2359 2359
+2360 2360
+2361 2361
+2362 2362
+2363 2363
+2364 2364
+2365 2365
+2366 2366
+2367 2367
+2368 2368
+2369 2369
+2370 2370
+2371 2371
+2372 2372
+2373 2373
+2374 2374
+2375 2375
+2376 2376
+2377 2377
+2378 2378
+2379 2379
+2380 2380
+2381 2381
+2382 2382
+2383 2383
+2384 2384
+2385 2385
+2386 2386
+2387 2387
+2388 2388
+2389 2389
+2390 2390
+2391 2391
+2392 2392
+2393 2393
+2394 2394
+2395 2395
+2396 2396
+2397 2397
+2398 2398
+2399 2399
+2400 2400
+2401 2401
+2402 2402
+2403 2403
+2404 2404
+2405 2405
+2406 2406
+2407 2407
+2408 2408
+2409 2409
+2410 2410
+2411 2411
+2412 2412
+2413 2413
+2414 2414
+2415 2415
+2416 2416
+2417 2417
+2418 2418
+2419 2419
+2420 2420
+2421 2421
+2422 2422
+2423 2423
+2424 2424
+2425 2425
+2426 2426
+2427 2427
+2428 2428
+2429 2429
+2430 2430
+2431 2431
+2432 2432
+2433 2433
+2434 2434
+2435 2435
+2436 2436
+2437 2437
+2438 2438
+2439 2439
+2440 2440
+2441 2441
+2442 2442
+2443 2443
+2444 2444
+2445 2445
+2446 2446
+2447 2447
+2448 2448
+2449 2449
+2450 2450
+2451 2451
+2452 2452
+2453 2453
+2454 2454
+2455 2455
+2456 2456
+2457 2457
+2458 2458
+2459 2459
+2460 2460
+2461 2461
+2462 2462
+2463 2463
+2464 2464
+2465 2465
+2466 2466
+2467 2467
+2468 2468
+2469 2469
+2470 2470
+2471 2471
+2472 2472
+2473 2473
+2474 2474
+2475 2475
+2476 2476
+2477 2477
+2478 2478
+2479 2479
+2480 2480
+2481 2481
+2482 2482
+2483 2483
+2484 2484
+2485 2485
+2486 2486
+2487 2487
+2488 2488
+2489 2489
+2490 2490
+2491 2491
+2492 2492
+2493 2493
+2494 2494
+2495 2495
+2496 2496
+2497 2497
+2498 2498
+2499 2499
+2500 2500
+2501 2501
+2502 2502
+2503 2503
+2504 2504
+2505 2505
+2506 2506
+2507 2507
+2508 2508
+2509 2509
+2510 2510
+2511 2511
+2512 2512
+2513 2513
+2514 2514
+2515 2515
+2516 2516
+2517 2517
+2518 2518
+2519 2519
+2520 2520
+2521 2521
+2522 2522
+2523 2523
+2524 2524
+2525 2525
+2526 2526
+2527 2527
+2528 2528
+2529 2529
+2530 2530
+2531 2531
+2532 2532
+2533 2533
+2534 2534
+2535 2535
+2536 2536
+2537 2537
+2538 2538
+2539 2539
+2540 2540
+2541 2541
+2542 2542
+2543 2543
+2544 2544
+2545 2545
+2546 2546
+2547 2547
+2548 2548
+2549 2549
+2550 2550
+2551 2551
+2552 2552
+2553 2553
+2554 2554
+2555 2555
+2556 2556
+2557 2557
+2558 2558
+2559 2559
+2560 2560
+2561 2561
+2562 2562
+2563 2563
+2564 2564
+2565 2565
+2566 2566
+2567 2567
+2568 2568
+2569 2569
+2570 2570
+2571 2571
+2572 2572
+2573 2573
+2574 2574
+2575 2575
+2576 2576
+2577 2577
+2578 2578
+2579 2579
+2580 2580
+2581 2581
+2582 2582
+2583 2583
+2584 2584
+2585 2585
+2586 2586
+2587 2587
+2588 2588
+2589 2589
+2590 2590
+2591 2591
+2592 2592
+2593 2593
+2594 2594
+2595 2595
+2596 2596
+2597 2597
+2598 2598
+2599 2599
+2600 2600
+2601 2601
+2602 2602
+2603 2603
+2604 2604
+2605 2605
+2606 2606
+2607 2607
+2608 2608
+2609 2609
+2610 2610
+2611 2611
+2612 2612
+2613 2613
+2614 2614
+2615 2615
+2616 2616
+2617 2617
+2618 2618
+2619 2619
+2620 2620
+2621 2621
+2622 2622
+2623 2623
+2624 2624
+2625 2625
+2626 2626
+2627 2627
+2628 2628
+2629 2629
+2630 2630
+2631 2631
+2632 2632
+2633 2633
+2634 2634
+2635 2635
+2636 2636
+2637 2637
+2638 2638
+2639 2639
+2640 2640
+2641 2641
+2642 2642
+2643 2643
+2644 2644
+2645 2645
+2646 2646
+2647 2647
+2648 2648
+2649 2649
+2650 2650
+2651 2651
+2652 2652
+2653 2653
+2654 2654
+2655 2655
+2656 2656
+2657 2657
+2658 2658
+2659 2659
+2660 2660
+2661 2661
+2662 2662
+2663 2663
+2664 2664
+2665 2665
+2666 2666
+2667 2667
+2668 2668
+2669 2669
+2670 2670
+2671 2671
+2672 2672
+2673 2673
+2674 2674
+2675 2675
+2676 2676
+2677 2677
+2678 2678
+2679 2679
+2680 2680
+2681 2681
+2682 2682
+2683 2683
+2684 2684
+2685 2685
+2686 2686
+2687 2687
+2688 2688
+2689 2689
+2690 2690
+2691 2691
+2692 2692
+2693 2693
+2694 2694
+2695 2695
+2696 2696
+2697 2697
+2698 2698
+2699 2699
+2700 2700
+2701 2701
+2702 2702
+2703 2703
+2704 2704
+2705 2705
+2706 2706
+2707 2707
+2708 2708
+2709 2709
+2710 2710
+2711 2711
+2712 2712
+2713 2713
+2714 2714
+2715 2715
+2716 2716
+2717 2717
+2718 2718
+2719 2719
+2720 2720
+2721 2721
+2722 2722
+2723 2723
+2724 2724
+2725 2725
+2726 2726
+2727 2727
+2728 2728
+2729 2729
+2730 2730
+2731 2731
+2732 2732
+2733 2733
+2734 2734
+2735 2735
+2736 2736
+2737 2737
+2738 2738
+2739 2739
+2740 2740
+2741 2741
+2742 2742
+2743 2743
+2744 2744
+2745 2745
+2746 2746
+2747 2747
+2748 2748
+2749 2749
+2750 2750
+2751 2751
+2752 2752
+2753 2753
+2754 2754
+2755 2755
+2756 2756
+2757 2757
+2758 2758
+2759 2759
+2760 2760
+2761 2761
+2762 2762
+2763 2763
+2764 2764
+2765 2765
+2766 2766
+2767 2767
+2768 2768
+2769 2769
+2770 2770
+2771 2771
+2772 2772
+2773 2773
+2774 2774
+2775 2775
+2776 2776
+2777 2777
+2778 2778
+2779 2779
+2780 2780
+2781 2781
+2782 2782
+2783 2783
+2784 2784
+2785 2785
+2786 2786
+2787 2787
+2788 2788
+2789 2789
+2790 2790
+2791 2791
+2792 2792
+2793 2793
+2794 2794
+2795 2795
+2796 2796
+2797 2797
+2798 2798
+2799 2799
+2800 2800
+2801 2801
+2802 2802
+2803 2803
+2804 2804
+2805 2805
+2806 2806
+2807 2807
+2808 2808
+2809 2809
+2810 2810
+2811 2811
+2812 2812
+2813 2813
+2814 2814
+2815 2815
+2816 2816
+2817 2817
+2818 2818
+2819 2819
+2820 2820
+2821 2821
+2822 2822
+2823 2823
+2824 2824
+2825 2825
+2826 2826
+2827 2827
+2828 2828
+2829 2829
+2830 2830
+2831 2831
+2832 2832
+2833 2833
+2834 2834
+2835 2835
+2836 2836
+2837 2837
+2838 2838
+2839 2839
+2840 2840
+2841 2841
+2842 2842
+2843 2843
+2844 2844
+2845 2845
+2846 2846
+2847 2847
+2848 2848
+2849 2849
+2850 2850
+2851 2851
+2852 2852
+2853 2853
+2854 2854
+2855 2855
+2856 2856
+2857 2857
+2858 2858
+2859 2859
+2860 2860
+2861 2861
+2862 2862
+2863 2863
+2864 2864
+2865 2865
+2866 2866
+2867 2867
+2868 2868
+2869 2869
+2870 2870
+2871 2871
+2872 2872
+2873 2873
+2874 2874
+2875 2875
+2876 2876
+2877 2877
+2878 2878
+2879 2879
+2880 2880
+2881 2881
+2882 2882
+2883 2883
+2884 2884
+2885 2885
+2886 2886
+2887 2887
+2888 2888
+2889 2889
+2890 2890
+2891 2891
+2892 2892
+2893 2893
+2894 2894
+2895 2895
+2896 2896
+2897 2897
+2898 2898
+2899 2899
+2900 2900
+2901 2901
+2902 2902
+2903 2903
+2904 2904
+2905 2905
+2906 2906
+2907 2907
+2908 2908
+2909 2909
+2910 2910
+2911 2911
+2912 2912
+2913 2913
+2914 2914
+2915 2915
+2916 2916
+2917 2917
+2918 2918
+2919 2919
+2920 2920
+2921 2921
+2922 2922
+2923 2923
+2924 2924
+2925 2925
+2926 2926
+2927 2927
+2928 2928
+2929 2929
+2930 2930
+2931 2931
+2932 2932
+2933 2933
+2934 2934
+2935 2935
+2936 2936
+2937 2937
+2938 2938
+2939 2939
+2940 2940
+2941 2941
+2942 2942
+2943 2943
+2944 2944
+2945 2945
+2946 2946
+2947 2947
+2948 2948
+2949 2949
+2950 2950
+2951 2951
+2952 2952
+2953 2953
+2954 2954
+2955 2955
+2956 2956
+2957 2957
+2958 2958
+2959 2959
+2960 2960
+2961 2961
+2962 2962
+2963 2963
+2964 2964
+2965 2965
+2966 2966
+2967 2967
+2968 2968
+2969 2969
+2970 2970
+2971 2971
+2972 2972
+2973 2973
+2974 2974
+2975 2975
+2976 2976
+2977 2977
+2978 2978
+2979 2979
+2980 2980
+2981 2981
+2982 2982
+2983 2983
+2984 2984
+2985 2985
+2986 2986
+2987 2987
+2988 2988
+2989 2989
+2990 2990
+2991 2991
+2992 2992
+2993 2993
+2994 2994
+2995 2995
+2996 2996
+2997 2997
+2998 2998
+2999 2999
+3000 3000
+3001 3001
+3002 3002
+3003 3003
+3004 3004
+3005 3005
+3006 3006
+3007 3007
+3008 3008
+3009 3009
+3010 3010
+3011 3011
+3012 3012
+3013 3013
+3014 3014
+3015 3015
+3016 3016
+3017 3017
+3018 3018
+3019 3019
+3020 3020
+3021 3021
+3022 3022
+3023 3023
+3024 3024
+3025 3025
+3026 3026
+3027 3027
+3028 3028
+3029 3029
+3030 3030
+3031 3031
+3032 3032
+3033 3033
+3034 3034
+3035 3035
+3036 3036
+3037 3037
+3038 3038
+3039 3039
+3040 3040
+3041 3041
+3042 3042
+3043 3043
+3044 3044
+3045 3045
+3046 3046
+3047 3047
+3048 3048
+3049 3049
+3050 3050
+3051 3051
+3052 3052
+3053 3053
+3054 3054
+3055 3055
+3056 3056
+3057 3057
+3058 3058
+3059 3059
+3060 3060
+3061 3061
+3062 3062
+3063 3063
+3064 3064
+3065 3065
+3066 3066
+3067 3067
+3068 3068
+3069 3069
+3070 3070
+3071 3071
+3072 3072
+3073 3073
+3074 3074
+3075 3075
+3076 3076
+3077 3077
+3078 3078
+3079 3079
+3080 3080
+3081 3081
+3082 3082
+3083 3083
+3084 3084
+3085 3085
+3086 3086
+3087 3087
+3088 3088
+3089 3089
+3090 3090
+3091 3091
+3092 3092
+3093 3093
+3094 3094
+3095 3095
+3096 3096
+3097 3097
+3098 3098
+3099 3099
+3100 3100
+3101 3101
+3102 3102
+3103 3103
+3104 3104
+3105 3105
+3106 3106
+3107 3107
+3108 3108
+3109 3109
+3110 3110
+3111 3111
+3112 3112
+3113 3113
+3114 3114
+3115 3115
+3116 3116
+3117 3117
+3118 3118
+3119 3119
+3120 3120
+3121 3121
+3122 3122
+3123 3123
+3124 3124
+3125 3125
+3126 3126
+3127 3127
+3128 3128
+3129 3129
+3130 3130
+3131 3131
+3132 3132
+3133 3133
+3134 3134
+3135 3135
+3136 3136
+3137 3137
+3138 3138
+3139 3139
+3140 3140
+3141 3141
+3142 3142
+3143 3143
+3144 3144
+3145 3145
+3146 3146
+3147 3147
+3148 3148
+3149 3149
+3150 3150
+3151 3151
+3152 3152
+3153 3153
+3154 3154
+3155 3155
+3156 3156
+3157 3157
+3158 3158
+3159 3159
+3160 3160
+3161 3161
+3162 3162
+3163 3163
+3164 3164
+3165 3165
+3166 3166
+3167 3167
+3168 3168
+3169 3169
+3170 3170
+3171 3171
+3172 3172
+3173 3173
+3174 3174
+3175 3175
+3176 3176
+3177 3177
+3178 3178
+3179 3179
+3180 3180
+3181 3181
+3182 3182
+3183 3183
+3184 3184
+3185 3185
+3186 3186
+3187 3187
+3188 3188
+3189 3189
+3190 3190
+3191 3191
+3192 3192
+3193 3193
+3194 3194
+3195 3195
+3196 3196
+3197 3197
+3198 3198
+3199 3199
+3200 3200
+3201 3201
+3202 3202
+3203 3203
+3204 3204
+3205 3205
+3206 3206
+3207 3207
+3208 3208
+3209 3209
+3210 3210
+3211 3211
+3212 3212
+3213 3213
+3214 3214
+3215 3215
+3216 3216
+3217 3217
+3218 3218
+3219 3219
+3220 3220
+3221 3221
+3222 3222
+3223 3223
+3224 3224
+3225 3225
+3226 3226
+3227 3227
+3228 3228
+3229 3229
+3230 3230
+3231 3231
+3232 3232
+3233 3233
+3234 3234
+3235 3235
+3236 3236
+3237 3237
+3238 3238
+3239 3239
+3240 3240
+3241 3241
+3242 3242
+3243 3243
+3244 3244
+3245 3245
+3246 3246
+3247 3247
+3248 3248
+3249 3249
+3250 3250
+3251 3251
+3252 3252
+3253 3253
+3254 3254
+3255 3255
+3256 3256
+3257 3257
+3258 3258
+3259 3259
+3260 3260
+3261 3261
+3262 3262
+3263 3263
+3264 3264
+3265 3265
+3266 3266
+3267 3267
+3268 3268
+3269 3269
+3270 3270
+3271 3271
+3272 3272
+3273 3273
+3274 3274
+3275 3275
+3276 3276
+3277 3277
+3278 3278
+3279 3279
+3280 3280
+3281 3281
+3282 3282
+3283 3283
+3284 3284
+3285 3285
+3286 3286
+3287 3287
+3288 3288
+3289 3289
+3290 3290
+3291 3291
+3292 3292
+3293 3293
+3294 3294
+3295 3295
+3296 3296
+3297 3297
+3298 3298
+3299 3299
+3300 3300
+3301 3301
+3302 3302
+3303 3303
+3304 3304
+3305 3305
+3306 3306
+3307 3307
+3308 3308
+3309 3309
+3310 3310
+3311 3311
+3312 3312
+3313 3313
+3314 3314
+3315 3315
+3316 3316
+3317 3317
+3318 3318
+3319 3319
+3320 3320
+3321 3321
+3322 3322
+3323 3323
+3324 3324
+3325 3325
+3326 3326
+3327 3327
+3328 3328
+3329 3329
+3330 3330
+3331 3331
+3332 3332
+3333 3333
+3334 3334
+3335 3335
+3336 3336
+3337 3337
+3338 3338
+3339 3339
+3340 3340
+3341 3341
+3342 3342
+3343 3343
+3344 3344
+3345 3345
+3346 3346
+3347 3347
+3348 3348
+3349 3349
+3350 3350
+3351 3351
+3352 3352
+3353 3353
+3354 3354
+3355 3355
+3356 3356
+3357 3357
+3358 3358
+3359 3359
+3360 3360
+3361 3361
+3362 3362
+3363 3363
+3364 3364
+3365 3365
+3366 3366
+3367 3367
+3368 3368
+3369 3369
+3370 3370
+3371 3371
+3372 3372
+3373 3373
+3374 3374
+3375 3375
+3376 3376
+3377 3377
+3378 3378
+3379 3379
+3380 3380
+3381 3381
+3382 3382
+3383 3383
+3384 3384
+3385 3385
+3386 3386
+3387 3387
+3388 3388
+3389 3389
+3390 3390
+3391 3391
+3392 3392
+3393 3393
+3394 3394
+3395 3395
+3396 3396
+3397 3397
+3398 3398
+3399 3399
+3400 3400
+3401 3401
+3402 3402
+3403 3403
+3404 3404
+3405 3405
+3406 3406
+3407 3407
+3408 3408
+3409 3409
+3410 3410
+3411 3411
+3412 3412
+3413 3413
+3414 3414
+3415 3415
+3416 3416
+3417 3417
+3418 3418
+3419 3419
+3420 3420
+3421 3421
+3422 3422
+3423 3423
+3424 3424
+3425 3425
+3426 3426
+3427 3427
+3428 3428
+3429 3429
+3430 3430
+3431 3431
+3432 3432
+3433 3433
+3434 3434
+3435 3435
+3436 3436
+3437 3437
+3438 3438
+3439 3439
+3440 3440
+3441 3441
+3442 3442
+3443 3443
+3444 3444
+3445 3445
+3446 3446
+3447 3447
+3448 3448
+3449 3449
+3450 3450
+3451 3451
+3452 3452
+3453 3453
+3454 3454
+3455 3455
+3456 3456
+3457 3457
+3458 3458
+3459 3459
+3460 3460
+3461 3461
+3462 3462
+3463 3463
+3464 3464
+3465 3465
+3466 3466
+3467 3467
+3468 3468
+3469 3469
+3470 3470
+3471 3471
+3472 3472
+3473 3473
+3474 3474
+3475 3475
+3476 3476
+3477 3477
+3478 3478
+3479 3479
+3480 3480
+3481 3481
+3482 3482
+3483 3483
+3484 3484
+3485 3485
+3486 3486
+3487 3487
+3488 3488
+3489 3489
+3490 3490
+3491 3491
+3492 3492
+3493 3493
+3494 3494
+3495 3495
+3496 3496
+3497 3497
+3498 3498
+3499 3499
+3500 3500
+3501 3501
+3502 3502
+3503 3503
+3504 3504
+3505 3505
+3506 3506
+3507 3507
+3508 3508
+3509 3509
+3510 3510
+3511 3511
+3512 3512
+3513 3513
+3514 3514
+3515 3515
+3516 3516
+3517 3517
+3518 3518
+3519 3519
+3520 3520
+3521 3521
+3522 3522
+3523 3523
+3524 3524
+3525 3525
+3526 3526
+3527 3527
+3528 3528
+3529 3529
+3530 3530
+3531 3531
+3532 3532
+3533 3533
+3534 3534
+3535 3535
+3536 3536
+3537 3537
+3538 3538
+3539 3539
+3540 3540
+3541 3541
+3542 3542
+3543 3543
+3544 3544
+3545 3545
+3546 3546
+3547 3547
+3548 3548
+3549 3549
+3550 3550
+3551 3551
+3552 3552
+3553 3553
+3554 3554
+3555 3555
+3556 3556
+3557 3557
+3558 3558
+3559 3559
+3560 3560
+3561 3561
+3562 3562
+3563 3563
+3564 3564
+3565 3565
+3566 3566
+3567 3567
+3568 3568
+3569 3569
+3570 3570
+3571 3571
+3572 3572
+3573 3573
+3574 3574
+3575 3575
+3576 3576
+3577 3577
+3578 3578
+3579 3579
+3580 3580
+3581 3581
+3582 3582
+3583 3583
+3584 3584
+3585 3585
+3586 3586
+3587 3587
+3588 3588
+3589 3589
+3590 3590
+3591 3591
+3592 3592
+3593 3593
+3594 3594
+3595 3595
+3596 3596
+3597 3597
+3598 3598
+3599 3599
+3600 3600
+3601 3601
+3602 3602
+3603 3603
+3604 3604
+3605 3605
+3606 3606
+3607 3607
+3608 3608
+3609 3609
+3610 3610
+3611 3611
+3612 3612
+3613 3613
+3614 3614
+3615 3615
+3616 3616
+3617 3617
+3618 3618
+3619 3619
+3620 3620
+3621 3621
+3622 3622
+3623 3623
+3624 3624
+3625 3625
+3626 3626
+3627 3627
+3628 3628
+3629 3629
+3630 3630
+3631 3631
+3632 3632
+3633 3633
+3634 3634
+3635 3635
+3636 3636
+3637 3637
+3638 3638
+3639 3639
+3640 3640
+3641 3641
+3642 3642
+3643 3643
+3644 3644
+3645 3645
+3646 3646
+3647 3647
+3648 3648
+3649 3649
+3650 3650
+3651 3651
+3652 3652
+3653 3653
+3654 3654
+3655 3655
+3656 3656
+3657 3657
+3658 3658
+3659 3659
+3660 3660
+3661 3661
+3662 3662
+3663 3663
+3664 3664
+3665 3665
+3666 3666
+3667 3667
+3668 3668
+3669 3669
+3670 3670
+3671 3671
+3672 3672
+3673 3673
+3674 3674
+3675 3675
+3676 3676
+3677 3677
+3678 3678
+3679 3679
+3680 3680
+3681 3681
+3682 3682
+3683 3683
+3684 3684
+3685 3685
+3686 3686
+3687 3687
+3688 3688
+3689 3689
+3690 3690
+3691 3691
+3692 3692
+3693 3693
+3694 3694
+3695 3695
+3696 3696
+3697 3697
+3698 3698
+3699 3699
+3700 3700
+3701 3701
+3702 3702
+3703 3703
+3704 3704
+3705 3705
+3706 3706
+3707 3707
+3708 3708
+3709 3709
+3710 3710
+3711 3711
+3712 3712
+3713 3713
+3714 3714
+3715 3715
+3716 3716
+3717 3717
+3718 3718
+3719 3719
+3720 3720
+3721 3721
+3722 3722
+3723 3723
+3724 3724
+3725 3725
+3726 3726
+3727 3727
+3728 3728
+3729 3729
+3730 3730
+3731 3731
+3732 3732
+3733 3733
+3734 3734
+3735 3735
+3736 3736
+3737 3737
+3738 3738
+3739 3739
+3740 3740
+3741 3741
+3742 3742
+3743 3743
+3744 3744
+3745 3745
+3746 3746
+3747 3747
+3748 3748
+3749 3749
+3750 3750
+3751 3751
+3752 3752
+3753 3753
+3754 3754
+3755 3755
+3756 3756
+3757 3757
+3758 3758
+3759 3759
+3760 3760
+3761 3761
+3762 3762
+3763 3763
+3764 3764
+3765 3765
+3766 3766
+3767 3767
+3768 3768
+3769 3769
+3770 3770
+3771 3771
+3772 3772
+3773 3773
+3774 3774
+3775 3775
+3776 3776
+3777 3777
+3778 3778
+3779 3779
+3780 3780
+3781 3781
+3782 3782
+3783 3783
+3784 3784
+3785 3785
+3786 3786
+3787 3787
+3788 3788
+3789 3789
+3790 3790
+3791 3791
+3792 3792
+3793 3793
+3794 3794
+3795 3795
+3796 3796
+3797 3797
+3798 3798
+3799 3799
+3800 3800
+3801 3801
+3802 3802
+3803 3803
+3804 3804
+3805 3805
+3806 3806
+3807 3807
+3808 3808
+3809 3809
+3810 3810
+3811 3811
+3812 3812
+3813 3813
+3814 3814
+3815 3815
+3816 3816
+3817 3817
+3818 3818
+3819 3819
+3820 3820
+3821 3821
+3822 3822
+3823 3823
+3824 3824
+3825 3825
+3826 3826
+3827 3827
+3828 3828
+3829 3829
+3830 3830
+3831 3831
+3832 3832
+3833 3833
+3834 3834
+3835 3835
+3836 3836
+3837 3837
+3838 3838
+3839 3839
+3840 3840
+3841 3841
+3842 3842
+3843 3843
+3844 3844
+3845 3845
+3846 3846
+3847 3847
+3848 3848
+3849 3849
+3850 3850
+3851 3851
+3852 3852
+3853 3853
+3854 3854
+3855 3855
+3856 3856
+3857 3857
+3858 3858
+3859 3859
+3860 3860
+3861 3861
+3862 3862
+3863 3863
+3864 3864
+3865 3865
+3866 3866
+3867 3867
+3868 3868
+3869 3869
+3870 3870
+3871 3871
+3872 3872
+3873 3873
+3874 3874
+3875 3875
+3876 3876
+3877 3877
+3878 3878
+3879 3879
+3880 3880
+3881 3881
+3882 3882
+3883 3883
+3884 3884
+3885 3885
+3886 3886
+3887 3887
+3888 3888
+3889 3889
+3890 3890
+3891 3891
+3892 3892
+3893 3893
+3894 3894
+3895 3895
+3896 3896
+3897 3897
+3898 3898
+3899 3899
+3900 3900
+3901 3901
+3902 3902
+3903 3903
+3904 3904
+3905 3905
+3906 3906
+3907 3907
+3908 3908
+3909 3909
+3910 3910
+3911 3911
+3912 3912
+3913 3913
+3914 3914
+3915 3915
+3916 3916
+3917 3917
+3918 3918
+3919 3919
+3920 3920
+3921 3921
+3922 3922
+3923 3923
+3924 3924
+3925 3925
+3926 3926
+3927 3927
+3928 3928
+3929 3929
+3930 3930
+3931 3931
+3932 3932
+3933 3933
+3934 3934
+3935 3935
+3936 3936
+3937 3937
+3938 3938
+3939 3939
+3940 3940
+3941 3941
+3942 3942
+3943 3943
+3944 3944
+3945 3945
+3946 3946
+3947 3947
+3948 3948
+3949 3949
+3950 3950
+3951 3951
+3952 3952
+3953 3953
+3954 3954
+3955 3955
+3956 3956
+3957 3957
+3958 3958
+3959 3959
+3960 3960
+3961 3961
+3962 3962
+3963 3963
+3964 3964
+3965 3965
+3966 3966
+3967 3967
+3968 3968
+3969 3969
+3970 3970
+3971 3971
+3972 3972
+3973 3973
+3974 3974
+3975 3975
+3976 3976
+3977 3977
+3978 3978
+3979 3979
+3980 3980
+3981 3981
+3982 3982
+3983 3983
+3984 3984
+3985 3985
+3986 3986
+3987 3987
+3988 3988
+3989 3989
+3990 3990
+3991 3991
+3992 3992
+3993 3993
+3994 3994
+3995 3995
+3996 3996
+3997 3997
+3998 3998
+3999 3999
+4000 4000
+4001 4001
+4002 4002
+4003 4003
+4004 4004
+4005 4005
+4006 4006
+4007 4007
+4008 4008
+4009 4009
+4010 4010
+4011 4011
+4012 4012
+4013 4013
+4014 4014
+4015 4015
+4016 4016
+4017 4017
+4018 4018
+4019 4019
+4020 4020
+4021 4021
+4022 4022
+4023 4023
+4024 4024
+4025 4025
+4026 4026
+4027 4027
+4028 4028
+4029 4029
+4030 4030
+4031 4031
+4032 4032
+4033 4033
+4034 4034
+4035 4035
+4036 4036
+4037 4037
+4038 4038
+4039 4039
+4040 4040
+4041 4041
+4042 4042
+4043 4043
+4044 4044
+4045 4045
+4046 4046
+4047 4047
+4048 4048
+4049 4049
+4050 4050
+4051 4051
+4052 4052
+4053 4053
+4054 4054
+4055 4055
+4056 4056
+4057 4057
+4058 4058
+4059 4059
+4060 4060
+4061 4061
+4062 4062
+4063 4063
+4064 4064
+4065 4065
+4066 4066
+4067 4067
+4068 4068
+4069 4069
+4070 4070
+4071 4071
+4072 4072
+4073 4073
+4074 4074
+4075 4075
+4076 4076
+4077 4077
+4078 4078
+4079 4079
+4080 4080
+4081 4081
+4082 4082
+4083 4083
+4084 4084
+4085 4085
+4086 4086
+4087 4087
+4088 4088
+4089 4089
+4090 4090
+4091 4091
+4092 4092
+4093 4093
+4094 4094
+4095 4095
+4096 4096
+4097 4097
+4098 4098
+4099 4099
+4100 4100
+4101 4101
+4102 4102
+4103 4103
+4104 4104
+4105 4105
+4106 4106
+4107 4107
+4108 4108
+4109 4109
+4110 4110
+4111 4111
+4112 4112
+4113 4113
+4114 4114
+4115 4115
+4116 4116
+4117 4117
+4118 4118
+4119 4119
+4120 4120
+4121 4121
+4122 4122
+4123 4123
+4124 4124
+4125 4125
+4126 4126
+4127 4127
+4128 4128
+4129 4129
+4130 4130
+4131 4131
+4132 4132
+4133 4133
+4134 4134
+4135 4135
+4136 4136
+4137 4137
+4138 4138
+4139 4139
+4140 4140
+4141 4141
+4142 4142
+4143 4143
+4144 4144
+4145 4145
+4146 4146
+4147 4147
+4148 4148
+4149 4149
+4150 4150
+4151 4151
+4152 4152
+4153 4153
+4154 4154
+4155 4155
+4156 4156
+4157 4157
+4158 4158
+4159 4159
+4160 4160
+4161 4161
+4162 4162
+4163 4163
+4164 4164
+4165 4165
+4166 4166
+4167 4167
+4168 4168
+4169 4169
+4170 4170
+4171 4171
+4172 4172
+4173 4173
+4174 4174
+4175 4175
+4176 4176
+4177 4177
+4178 4178
+4179 4179
+4180 4180
+4181 4181
+4182 4182
+4183 4183
+4184 4184
+4185 4185
+4186 4186
+4187 4187
+4188 4188
+4189 4189
+4190 4190
+4191 4191
+4192 4192
+4193 4193
+4194 4194
+4195 4195
+4196 4196
+4197 4197
+4198 4198
+4199 4199
+4200 4200
+4201 4201
+4202 4202
+4203 4203
+4204 4204
+4205 4205
+4206 4206
+4207 4207
+4208 4208
+4209 4209
+4210 4210
+4211 4211
+4212 4212
+4213 4213
+4214 4214
+4215 4215
+4216 4216
+4217 4217
+4218 4218
+4219 4219
+4220 4220
+4221 4221
+4222 4222
+4223 4223
+4224 4224
+4225 4225
+4226 4226
+4227 4227
+4228 4228
+4229 4229
+4230 4230
+4231 4231
+4232 4232
+4233 4233
+4234 4234
+4235 4235
+4236 4236
+4237 4237
+4238 4238
+4239 4239
+4240 4240
+4241 4241
+4242 4242
+4243 4243
+4244 4244
+4245 4245
+4246 4246
+4247 4247
+4248 4248
+4249 4249
+4250 4250
+4251 4251
+4252 4252
+4253 4253
+4254 4254
+4255 4255
+4256 4256
+4257 4257
+4258 4258
+4259 4259
+4260 4260
+4261 4261
+4262 4262
+4263 4263
+4264 4264
+4265 4265
+4266 4266
+4267 4267
+4268 4268
+4269 4269
+4270 4270
+4271 4271
+4272 4272
+4273 4273
+4274 4274
+4275 4275
+4276 4276
+4277 4277
+4278 4278
+4279 4279
+4280 4280
+4281 4281
+4282 4282
+4283 4283
+4284 4284
+4285 4285
+4286 4286
+4287 4287
+4288 4288
+4289 4289
+4290 4290
+4291 4291
+4292 4292
+4293 4293
+4294 4294
+4295 4295
+4296 4296
+4297 4297
+4298 4298
+4299 4299
+4300 4300
+4301 4301
+4302 4302
+4303 4303
+4304 4304
+4305 4305
+4306 4306
+4307 4307
+4308 4308
+4309 4309
+4310 4310
+4311 4311
+4312 4312
+4313 4313
+4314 4314
+4315 4315
+4316 4316
+4317 4317
+4318 4318
+4319 4319
+4320 4320
+4321 4321
+4322 4322
+4323 4323
+4324 4324
+4325 4325
+4326 4326
+4327 4327
+4328 4328
+4329 4329
+4330 4330
+4331 4331
+4332 4332
+4333 4333
+4334 4334
+4335 4335
+4336 4336
+4337 4337
+4338 4338
+4339 4339
+4340 4340
+4341 4341
+4342 4342
+4343 4343
+4344 4344
+4345 4345
+4346 4346
+4347 4347
+4348 4348
+4349 4349
+4350 4350
+4351 4351
+4352 4352
+4353 4353
+4354 4354
+4355 4355
+4356 4356
+4357 4357
+4358 4358
+4359 4359
+4360 4360
+4361 4361
+4362 4362
+4363 4363
+4364 4364
+4365 4365
+4366 4366
+4367 4367
+4368 4368
+4369 4369
+4370 4370
+4371 4371
+4372 4372
+4373 4373
+4374 4374
+4375 4375
+4376 4376
+4377 4377
+4378 4378
+4379 4379
+4380 4380
+4381 4381
+4382 4382
+4383 4383
+4384 4384
+4385 4385
+4386 4386
+4387 4387
+4388 4388
+4389 4389
+4390 4390
+4391 4391
+4392 4392
+4393 4393
+4394 4394
+4395 4395
+4396 4396
+4397 4397
+4398 4398
+4399 4399
+4400 4400
+4401 4401
+4402 4402
+4403 4403
+4404 4404
+4405 4405
+4406 4406
+4407 4407
+4408 4408
+4409 4409
+4410 4410
+4411 4411
+4412 4412
+4413 4413
+4414 4414
+4415 4415
+4416 4416
+4417 4417
+4418 4418
+4419 4419
+4420 4420
+4421 4421
+4422 4422
+4423 4423
+4424 4424
+4425 4425
+4426 4426
+4427 4427
+4428 4428
+4429 4429
+4430 4430
+4431 4431
+4432 4432
+4433 4433
+4434 4434
+4435 4435
+4436 4436
+4437 4437
+4438 4438
+4439 4439
+4440 4440
+4441 4441
+4442 4442
+4443 4443
+4444 4444
+4445 4445
+4446 4446
+4447 4447
+4448 4448
+4449 4449
+4450 4450
+4451 4451
+4452 4452
+4453 4453
+4454 4454
+4455 4455
+4456 4456
+4457 4457
+4458 4458
+4459 4459
+4460 4460
+4461 4461
+4462 4462
+4463 4463
+4464 4464
+4465 4465
+4466 4466
+4467 4467
+4468 4468
+4469 4469
+4470 4470
+4471 4471
+4472 4472
+4473 4473
+4474 4474
+4475 4475
+4476 4476
+4477 4477
+4478 4478
+4479 4479
+4480 4480
+4481 4481
+4482 4482
+4483 4483
+4484 4484
+4485 4485
+4486 4486
+4487 4487
+4488 4488
+4489 4489
+4490 4490
+4491 4491
+4492 4492
+4493 4493
+4494 4494
+4495 4495
+4496 4496
+4497 4497
+4498 4498
+4499 4499
+4500 4500
+4501 4501
+4502 4502
+4503 4503
+4504 4504
+4505 4505
+4506 4506
+4507 4507
+4508 4508
+4509 4509
+4510 4510
+4511 4511
+4512 4512
+4513 4513
+4514 4514
+4515 4515
+4516 4516
+4517 4517
+4518 4518
+4519 4519
+4520 4520
+4521 4521
+4522 4522
+4523 4523
+4524 4524
+4525 4525
+4526 4526
+4527 4527
+4528 4528
+4529 4529
+4530 4530
+4531 4531
+4532 4532
+4533 4533
+4534 4534
+4535 4535
+4536 4536
+4537 4537
+4538 4538
+4539 4539
+4540 4540
+4541 4541
+4542 4542
+4543 4543
+4544 4544
+4545 4545
+4546 4546
+4547 4547
+4548 4548
+4549 4549
+4550 4550
+4551 4551
+4552 4552
+4553 4553
+4554 4554
+4555 4555
+4556 4556
+4557 4557
+4558 4558
+4559 4559
+4560 4560
+4561 4561
+4562 4562
+4563 4563
+4564 4564
+4565 4565
+4566 4566
+4567 4567
+4568 4568
+4569 4569
+4570 4570
+4571 4571
+4572 4572
+4573 4573
+4574 4574
+4575 4575
+4576 4576
+4577 4577
+4578 4578
+4579 4579
+4580 4580
+4581 4581
+4582 4582
+4583 4583
+4584 4584
+4585 4585
+4586 4586
+4587 4587
+4588 4588
+4589 4589
+4590 4590
+4591 4591
+4592 4592
+4593 4593
+4594 4594
+4595 4595
+4596 4596
+4597 4597
+4598 4598
+4599 4599
+4600 4600
+4601 4601
+4602 4602
+4603 4603
+4604 4604
+4605 4605
+4606 4606
+4607 4607
+4608 4608
+4609 4609
+4610 4610
+4611 4611
+4612 4612
+4613 4613
+4614 4614
+4615 4615
+4616 4616
+4617 4617
+4618 4618
+4619 4619
+4620 4620
+4621 4621
+4622 4622
+4623 4623
+4624 4624
+4625 4625
+4626 4626
+4627 4627
+4628 4628
+4629 4629
+4630 4630
+4631 4631
+4632 4632
+4633 4633
+4634 4634
+4635 4635
+4636 4636
+4637 4637
+4638 4638
+4639 4639
+4640 4640
+4641 4641
+4642 4642
+4643 4643
+4644 4644
+4645 4645
+4646 4646
+4647 4647
+4648 4648
+4649 4649
+4650 4650
+4651 4651
+4652 4652
+4653 4653
+4654 4654
+4655 4655
+4656 4656
+4657 4657
+4658 4658
+4659 4659
+4660 4660
+4661 4661
+4662 4662
+4663 4663
+4664 4664
+4665 4665
+4666 4666
+4667 4667
+4668 4668
+4669 4669
+4670 4670
+4671 4671
+4672 4672
+4673 4673
+4674 4674
+4675 4675
+4676 4676
+4677 4677
+4678 4678
+4679 4679
+4680 4680
+4681 4681
+4682 4682
+4683 4683
+4684 4684
+4685 4685
+4686 4686
+4687 4687
+4688 4688
+4689 4689
+4690 4690
+4691 4691
+4692 4692
+4693 4693
+4694 4694
+4695 4695
+4696 4696
+4697 4697
+4698 4698
+4699 4699
+4700 4700
+4701 4701
+4702 4702
+4703 4703
+4704 4704
+4705 4705
+4706 4706
+4707 4707
+4708 4708
+4709 4709
+4710 4710
+4711 4711
+4712 4712
+4713 4713
+4714 4714
+4715 4715
+4716 4716
+4717 4717
+4718 4718
+4719 4719
+4720 4720
+4721 4721
+4722 4722
+4723 4723
+4724 4724
+4725 4725
+4726 4726
+4727 4727
+4728 4728
+4729 4729
+4730 4730
+4731 4731
+4732 4732
+4733 4733
+4734 4734
+4735 4735
+4736 4736
+4737 4737
+4738 4738
+4739 4739
+4740 4740
+4741 4741
+4742 4742
+4743 4743
+4744 4744
+4745 4745
+4746 4746
+4747 4747
+4748 4748
+4749 4749
+4750 4750
+4751 4751
+4752 4752
+4753 4753
+4754 4754
+4755 4755
+4756 4756
+4757 4757
+4758 4758
+4759 4759
+4760 4760
+4761 4761
+4762 4762
+4763 4763
+4764 4764
+4765 4765
+4766 4766
+4767 4767
+4768 4768
+4769 4769
+4770 4770
+4771 4771
+4772 4772
+4773 4773
+4774 4774
+4775 4775
+4776 4776
+4777 4777
+4778 4778
+4779 4779
+4780 4780
+4781 4781
+4782 4782
+4783 4783
+4784 4784
+4785 4785
+4786 4786
+4787 4787
+4788 4788
+4789 4789
+4790 4790
+4791 4791
+4792 4792
+4793 4793
+4794 4794
+4795 4795
+4796 4796
+4797 4797
+4798 4798
+4799 4799
+4800 4800
+4801 4801
+4802 4802
+4803 4803
+4804 4804
+4805 4805
+4806 4806
+4807 4807
+4808 4808
+4809 4809
+4810 4810
+4811 4811
+4812 4812
+4813 4813
+4814 4814
+4815 4815
+4816 4816
+4817 4817
+4818 4818
+4819 4819
+4820 4820
+4821 4821
+4822 4822
+4823 4823
+4824 4824
+4825 4825
+4826 4826
+4827 4827
+4828 4828
+4829 4829
+4830 4830
+4831 4831
+4832 4832
+4833 4833
+4834 4834
+4835 4835
+4836 4836
+4837 4837
+4838 4838
+4839 4839
+4840 4840
+4841 4841
+4842 4842
+4843 4843
+4844 4844
+4845 4845
+4846 4846
+4847 4847
+4848 4848
+4849 4849
+4850 4850
+4851 4851
+4852 4852
+4853 4853
+4854 4854
+4855 4855
+4856 4856
+4857 4857
+4858 4858
+4859 4859
+4860 4860
+4861 4861
+4862 4862
+4863 4863
+4864 4864
+4865 4865
+4866 4866
+4867 4867
+4868 4868
+4869 4869
+4870 4870
+4871 4871
+4872 4872
+4873 4873
+4874 4874
+4875 4875
+4876 4876
+4877 4877
+4878 4878
+4879 4879
+4880 4880
+4881 4881
+4882 4882
+4883 4883
+4884 4884
+4885 4885
+4886 4886
+4887 4887
+4888 4888
+4889 4889
+4890 4890
+4891 4891
+4892 4892
+4893 4893
+4894 4894
+4895 4895
+4896 4896
+4897 4897
+4898 4898
+4899 4899
+4900 4900
+4901 4901
+4902 4902
+4903 4903
+4904 4904
+4905 4905
+4906 4906
+4907 4907
+4908 4908
+4909 4909
+4910 4910
+4911 4911
+4912 4912
+4913 4913
+4914 4914
+4915 4915
+4916 4916
+4917 4917
+4918 4918
+4919 4919
+4920 4920
+4921 4921
+4922 4922
+4923 4923
+4924 4924
+4925 4925
+4926 4926
+4927 4927
+4928 4928
+4929 4929
+4930 4930
+4931 4931
+4932 4932
+4933 4933
+4934 4934
+4935 4935
+4936 4936
+4937 4937
+4938 4938
+4939 4939
+4940 4940
+4941 4941
+4942 4942
+4943 4943
+4944 4944
+4945 4945
+4946 4946
+4947 4947
+4948 4948
+4949 4949
+4950 4950
+4951 4951
+4952 4952
+4953 4953
+4954 4954
+4955 4955
+4956 4956
+4957 4957
+4958 4958
+4959 4959
+4960 4960
+4961 4961
+4962 4962
+4963 4963
+4964 4964
+4965 4965
+4966 4966
+4967 4967
+4968 4968
+4969 4969
+4970 4970
+4971 4971
+4972 4972
+4973 4973
+4974 4974
+4975 4975
+4976 4976
+4977 4977
+4978 4978
+4979 4979
+4980 4980
+4981 4981
+4982 4982
+4983 4983
+4984 4984
+4985 4985
+4986 4986
+4987 4987
+4988 4988
+4989 4989
+4990 4990
+4991 4991
+4992 4992
+4993 4993
+4994 4994
+4995 4995
+4996 4996
+4997 4997
+4998 4998
+4999 4999
+5000 5000
+5001 5001
+5002 5002
+5003 5003
+5004 5004
+5005 5005
+5006 5006
+5007 5007
+5008 5008
+5009 5009
+5010 5010
+5011 5011
+5012 5012
+5013 5013
+5014 5014
+5015 5015
+5016 5016
+5017 5017
+5018 5018
+5019 5019
+5020 5020
+5021 5021
+5022 5022
+5023 5023
+5024 5024
+5025 5025
+5026 5026
+5027 5027
+5028 5028
+5029 5029
+5030 5030
+5031 5031
+5032 5032
+5033 5033
+5034 5034
+5035 5035
+5036 5036
+5037 5037
+5038 5038
+5039 5039
+5040 5040
+5041 5041
+5042 5042
+5043 5043
+5044 5044
+5045 5045
+5046 5046
+5047 5047
+5048 5048
+5049 5049
+5050 5050
+5051 5051
+5052 5052
+5053 5053
+5054 5054
+5055 5055
+5056 5056
+5057 5057
+5058 5058
+5059 5059
+5060 5060
+5061 5061
+5062 5062
+5063 5063
+5064 5064
+5065 5065
+5066 5066
+5067 5067
+5068 5068
+5069 5069
+5070 5070
+5071 5071
+5072 5072
+5073 5073
+5074 5074
+5075 5075
+5076 5076
+5077 5077
+5078 5078
+5079 5079
+5080 5080
+5081 5081
+5082 5082
+5083 5083
+5084 5084
+5085 5085
+5086 5086
+5087 5087
+5088 5088
+5089 5089
+5090 5090
+5091 5091
+5092 5092
+5093 5093
+5094 5094
+5095 5095
+5096 5096
+5097 5097
+5098 5098
+5099 5099
+5100 5100
+5101 5101
+5102 5102
+5103 5103
+5104 5104
+5105 5105
+5106 5106
+5107 5107
+5108 5108
+5109 5109
+5110 5110
+5111 5111
+5112 5112
+5113 5113
+5114 5114
+5115 5115
+5116 5116
+5117 5117
+5118 5118
+5119 5119
+5120 5120
+5121 5121
+5122 5122
+5123 5123
+5124 5124
+5125 5125
+5126 5126
+5127 5127
+5128 5128
+5129 5129
+5130 5130
+5131 5131
+5132 5132
+5133 5133
+5134 5134
+5135 5135
+5136 5136
+5137 5137
+5138 5138
+5139 5139
+5140 5140
+5141 5141
+5142 5142
+5143 5143
+5144 5144
+5145 5145
+5146 5146
+5147 5147
+5148 5148
+5149 5149
+5150 5150
+5151 5151
+5152 5152
+5153 5153
+5154 5154
+5155 5155
+5156 5156
+5157 5157
+5158 5158
+5159 5159
+5160 5160
+5161 5161
+5162 5162
+5163 5163
+5164 5164
+5165 5165
+5166 5166
+5167 5167
+5168 5168
+5169 5169
+5170 5170
+5171 5171
+5172 5172
+5173 5173
+5174 5174
+5175 5175
+5176 5176
+5177 5177
+5178 5178
+5179 5179
+5180 5180
+5181 5181
+5182 5182
+5183 5183
+5184 5184
+5185 5185
+5186 5186
+5187 5187
+5188 5188
+5189 5189
+5190 5190
+5191 5191
+5192 5192
+5193 5193
+5194 5194
+5195 5195
+5196 5196
+5197 5197
+5198 5198
+5199 5199
+5200 5200
+5201 5201
+5202 5202
+5203 5203
+5204 5204
+5205 5205
+5206 5206
+5207 5207
+5208 5208
+5209 5209
+5210 5210
+5211 5211
+5212 5212
+5213 5213
+5214 5214
+5215 5215
+5216 5216
+5217 5217
+5218 5218
+5219 5219
+5220 5220
+5221 5221
+5222 5222
+5223 5223
+5224 5224
+5225 5225
+5226 5226
+5228 5227
+5229 5228
+5231 5229
+5232 5230
+5233 5231
+5234 5232
+5235 5233
+5236 5234
+5237 5235
+5238 5236
+5239 5237
+5240 5238
+5241 5239
+5242 5240
+5243 5241
+5244 5242
+5245 5243
+5246 5244
+5247 5245
+5248 5246
+5249 5247
+5250 5248
+5251 5249
+5252 5250
+5253 5251
+5254 5252
+5255 5253
+5256 5254
+5257 5255
+5258 5256
+5259 5257
+5260 5258
+5261 5259
+5262 5260
+5263 5261
+5264 5262
+5265 5263
+5266 5264
+5267 5265
+5268 5266
+5269 5267
+5270 5268
+5271 5269
+5272 5270
+5273 5271
+5274 5272
+5275 5273
+5276 5274
+5277 5275
+5278 5276
+5279 5277
+5280 5278
+5281 5279
+5282 5280
+5283 5281
+5284 5282
+5285 5283
+5286 5284
+5287 5285
+5288 5286
+5289 5287
+5290 5288
+5291 5289
+5292 5290
+5293 5291
+5294 5292
+5295 5293
+5296 5294
+5297 5295
+5298 5296
+5299 5297
+5300 5298
+5301 5299
+5302 5300
+5303 5301
+5304 5302
+5305 5303
+5306 5304
+5307 5305
+5308 5306
+5309 5307
+5310 5308
+5311 5309
+5312 5310
+5313 5311
+5314 5312
+5315 5313
+5316 5314
+5317 5315
+5318 5316
+5319 5317
+5320 5318
+5321 5319
+5322 5320
+5323 5321
+5324 5322
+5325 5323
+5326 5324
+5327 5325
+5328 5326
+5329 5327
+5330 5328
+5331 5329
+5332 5330
+5333 5331
+5334 5332
+5335 5333
+5336 5334
+5337 5335
+5338 5336
+5339 5337
+5340 5338
+5341 5339
+5342 5340
+5343 5341
+5344 5342
+5345 5343
+5346 5344
+5347 5345
+5348 5346
+5349 5347
+5350 5348
+5351 5349
+5352 5350
+5353 5351
+5354 5352
+5355 5353
+5356 5354
+5357 5355
+5358 5356
+5359 5357
+5360 5358
+5361 5359
+5362 5360
+5363 5361
+5364 5362
+5365 5363
+5366 5364
+5367 5365
+5368 5366
+5369 5367
+5370 5368
+5371 5369
+5372 5370
+5373 5371
+5374 5372
+5375 5373
+5376 5374
+5377 5375
+5378 5376
+5379 5377
+5380 5378
+5381 5379
+5382 5380
+5383 5381
+5384 5382
+5385 5383
+5386 5384
+5387 5385
+5388 5386
+5389 5387
+5390 5388
+5391 5389
+5392 5390
+5393 5391
+5394 5392
+5395 5393
+5396 5394
+5397 5395
+5398 5396
+5399 5397
+5400 5398
+5401 5399
+5402 5400
+5403 5401
+5404 5402
+5405 5403
+5406 5404
+5407 5405
+5408 5406
+5409 5407
+5410 5408
+5411 5409
+5412 5410
+5413 5411
+5414 5412
+5415 5413
+5416 5414
+5417 5415
+5418 5416
+5419 5417
+5420 5418
+5421 5419
+5422 5420
+5423 5421
+5424 5422
+5425 5423
+5426 5424
+5427 5425
+5428 5426
+5429 5427
+5430 5428
+5431 5429
+5432 5430
+5433 5431
+5434 5432
+5435 5433
+5436 5434
+5437 5435
+5438 5436
+5439 5437
+5440 5438
+5441 5439
+5442 5440
+5443 5441
+5444 5442
+5445 5443
+5446 5444
+5447 5445
+5448 5446
+5449 5447
+5450 5448
+5451 5449
+5452 5450
+5453 5451
+5454 5452
+5455 5453
+5456 5454
+5457 5455
+5458 5456
+5459 5457
+5460 5458
+5461 5459
+5462 5460
+5463 5461
+5464 5462
+5465 5463
+5466 5464
+5467 5465
+5468 5466
+5469 5467
+5470 5468
+5471 5469
+5472 5470
+5473 5471
+5474 5472
+5475 5473
+5476 5474
+5477 5475
+5478 5476
+5479 5477
+5480 5478
+5481 5479
+5482 5480
+5483 5481
+5484 5482
+5485 5483
+5486 5484
+5487 5485
+5488 5486
+5489 5487
+5490 5488
+5491 5489
+5492 5490
+5493 5491
+5494 5492
+5495 5493
+5496 5494
+5497 5495
+5498 5496
+5499 5497
+5500 5498
+5501 5499
+5502 5500
+5503 5501
+5504 5502
+5505 5503
+5506 5504
+5507 5505
+5508 5506
+5509 5507
+5510 5508
+++ /dev/null
-#!/usr/bin/ruby
-
-require "net/http"
-require "uri"
-
-user = gets.chop
-pass = gets.chop
-
-request = Net::HTTP::Get.new("/api/0.6/user/details")
-request.basic_auth user, pass
-
-response = Net::HTTP.start("api.openstreetmap.org", :use_ssl => true) do |http|
- http.request(request)
-end
-
-exit!(0) if response.is_a?(Net::HTTPSuccess)
-exit!(1)
version "1.0.0"
supports "ubuntu"
-depends "accounts"
depends "apache"
# limitations under the License.
#
-include_recipe "accounts"
include_recipe "apache"
-package %w[
- trac
- ruby
-]
+apache_module "rewrite"
-site_name = "trac.openstreetmap.org"
-site_directory = "/srv/#{site_name}"
-
-directory "/var/lib/trac" do
- owner "trac"
- group "trac"
- mode "755"
-end
-
-execute "trac-initenv-#{site_name}" do
- command "trac-admin /var/lib/trac initenv #{site_name} sqlite:db/trac.db"
- user "trac"
- group "trac"
- not_if { ::File.exist?("/var/lib/trac/VERSION") }
-end
-
-template "/var/lib/trac/conf/trac.ini" do
- source "trac.ini.erb"
- owner "trac"
- group "www-data"
- mode "644"
- variables :name => site_name
-end
-
-remote_directory "/var/lib/trac/htdocs" do
- source "htdocs"
- owner "trac"
- group "trac"
- mode "755"
- files_owner "trac"
- files_group "trac"
- files_mode "644"
- purge true
-end
-
-remote_directory "/var/lib/trac/templates" do
- source "templates"
- owner "trac"
- group "trac"
- mode "755"
- files_owner "trac"
- files_group "trac"
- files_mode "644"
- purge true
-end
-
-execute "trac-deploy-#{site_name}" do
- command "trac-admin /var/lib/trac deploy #{site_directory}"
- user "root"
+directory "/srv/trac.openstreetmap.org" do
+ owner "root"
group "root"
- not_if { ::File.exist?(site_directory) }
+ mode "0755"
end
-cookbook_file "/usr/local/bin/trac-authenticate" do
+cookbook_file "/srv/trac.openstreetmap.org/tickets.map" do
owner "root"
group "root"
- mode "755"
-end
-
-apache_module "wsgi"
-
-apache_module "authnz_external" do
- package "libapache2-mod-authnz-external"
+ mode "0644"
end
ssl_certificate "trac.openstreetmap.org" do
notifies :reload, "service[apache2]"
end
-apache_site site_name do
+apache_site "trac.openstreetmap.org" do
template "apache.erb"
- directory site_directory
variables :user => "trac", :group => "trac", :aliases => ["trac.osm.org"]
end
-
-template "/etc/sudoers.d/trac" do
- source "sudoers.erb"
- owner "root"
- group "root"
- mode "440"
-end
-
-template "/etc/cron.daily/trac-backup" do
- source "backup.cron.erb"
- owner "root"
- group "root"
- mode "755"
-end
# DO NOT EDIT - This file is being maintained by Chef
-WSGIDaemonProcess <%= @name %> user=<%= @user %> group=<%= @group %> processes=4 threads=8 restart-interval=3600 inactivity-timeout=180 graceful-timeout=60 maximum-requests=2000
-
<VirtualHost *:80>
ServerName <%= @name %>
<% @aliases.each do |alias_name| -%>
CustomLog /var/log/apache2/<%= @name %>-access.log combined
ErrorLog /var/log/apache2/<%= @name %>-error.log
- DocumentRoot <%= @directory %>/htdocs
- Alias /robots.txt <%= @directory %>/htdocs/site/robots.txt
- WSGIScriptAlias / <%= @directory %>/cgi-bin/trac.wsgi
-
- WSGIProcessGroup <%= @name %>
-
- DefineExternalAuth osm pipe /usr/local/bin/trac-authenticate
-
- # Disable /timeline for now
- RedirectMatch 410 ^/timeline(.*)$
-
- <Location /login>
- AuthType Basic
- AuthName "OpenStreetMap Trac"
- AuthBasicProvider external
- AuthExternal osm
- Require valid-user
- </Location>
+ RewriteEngine on
+ RewriteMap tickets txt:/srv/trac.openstreetmap.org/tickets.map
+ RewriteRule ^/ticket/(\d+)$ https://github.com/openstreetmap/trac-tickets/issues/${tickets:$1}
+ RewriteRule ^/?(.*) https://github.com/openstreetmap/trac-tickets [QSD,L,R=permanent]
</VirtualHost>
-
-<Directory <%= @directory %>/htdocs>
- Require all granted
-</Directory>
-
-<Directory <%= @directory %>/cgi-bin>
- Require all granted
-</Directory>
+++ /dev/null
-#!/bin/sh
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-T=$(mktemp -d -t -p /var/tmp trac.XXXXXXXXXX)
-D=$(date +%Y-%m-%d)
-B=trac-$D.tar.gz
-
-trac-admin /var/lib/trac hotcopy $T/trac-$D > /dev/null
-
-export RSYNC_RSH="ssh -ax"
-
-nice tar --create --directory=$T trac-$D | nice gzip --rsyncable -9 > $T/$B
-nice rsync --preallocate --fuzzy $T/$B backup::backup
-
-rm -rf $T
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-# Allow subversion to notify trac of commits
-www-data ALL=(trac) NOPASSWD: /usr/bin/trac-admin /var/lib/trac changeset *
-
-# Allow git to notify trac of commits
-%git ALL=(trac) NOPASSWD: /usr/bin/trac-admin /var/lib/trac changeset *
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-[attachment]
-max_size = 262144
-max_zip_size = 2097152
-render_unsafe_content = false
-
-[browser]
-color_scale = True
-downloadable_paths = /trunk, /branches/*, /tags/*
-hide_properties = svk:merge
-intermediate_color =
-intermediate_point =
-newest_color = (255, 136, 136)
-oldest_color = (136, 136, 255)
-oneliner_properties = trac:summary
-render_unsafe_content = false
-wiki_properties = trac:description
-
-[changeset]
-max_diff_bytes = 10000000
-max_diff_files = 0
-wiki_format_messages = true
-
-[components]
-tracopt.ticket.deleter = enabled
-tracopt.versioncontrol.git.* = enabled
-tracopt.versioncontrol.svn.* = enabled
-
-[header_logo]
-alt = OpenStreetMap
-height = 80
-link = https://<%= @name %>/
-src = site/osm.png
-width = 228
-
-[inherit]
-htdocs_dir =
-plugins_dir =
-templates_dir =
-
-[intertrac]
-josm.compat = false
-josm.title = JOSM Trac
-josm.url = https://josm.openstreetmap.de
-
-[logging]
-log_file = trac.log
-# log_format = <inherited>
-log_level = INFO
-log_type = file
-
-[milestone]
-stats_provider = DefaultTicketGroupStatsProvider
-
-[mimeviewer]
-max_preview_size = 262144
-mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
-mime_map_patterns = text/plain:README|INSTALL|COPYING.*
-pygments_default_style = trac
-pygments_modes =
-tab_width = 8
-treat_as_binary = application/octet-stream, application/pdf, application/postscript, application/msword,application/rtf,
-
-[notification]
-admit_domains =
-always_notify_owner = true
-always_notify_reporter = true
-always_notify_updater = true
-ambiguous_char_width = single
-batch_subject_template = $prefix Batch modify: $tickets_descr
-email_sender = SmtpEmailSender
-ignore_domains =
-mime_encoding = none
-sendmail_path = sendmail
-smtp_always_bcc =
-smtp_always_cc =
-smtp_default_domain =
-smtp_enabled = true
-smtp_from = trac@noreply.openstreetmap.org
-smtp_from_author = false
-smtp_from_name =
-smtp_password =
-smtp_port = 25
-smtp_replyto = trac@noreply.openstreetmap.org
-smtp_server = localhost
-smtp_subject_prefix = __default__
-smtp_user =
-ticket_subject_template = $prefix #$ticket.id: $summary
-use_public_cc = true
-use_short_addr = false
-use_tls = false
-
-[project]
-admin =
-admin_trac_url = .
-descr = OpenStreetMap is a free editable map of the whole world
-footer = Visit the map at<br /><a href="https://www.openstreetmap.org/">https://www.openstreetmap.org/</a>
-icon = site/osm.ico
-name = OpenStreetMap
-url = https://www.openstreetmap.org/
-
-[query]
-default_anonymous_query = status!=closed&cc~=$USER
-default_query = status!=closed&owner=$USER
-items_per_page = 100
-ticketlink_query = ?status=!closed
-
-[report]
-items_per_page = 100
-items_per_page_rss = 0
-
-[repositories]
-subversion.dir = /var/lib/subversion/repos/openstreetmap
-subversion.description = Legacy subversion repository
-subversion.type = svn
-subversion.url = https://svn.openstreetmap.org/
-subversion.hidden = true
-<% Dir.glob("/var/lib/git/*.git").sort.each do |repository| -%>
-<%= File.basename(repository, ".git") %>.dir = <%= repository %>
-<%= File.basename(repository, ".git") %>.description = <%= IO.read("#{repository}/description").strip %>
-<%= File.basename(repository, ".git") %>.type = git
-<%= File.basename(repository, ".git") %>.url = https://git.openstreetmap.org/public/<%= File.basename(repository) %>
-<% end -%>
-.alias = subversion
-
-[revisionlog]
-default_log_limit = 100
-graph_colors = ['#cc0', '#0c0', '#0cc', '#00c', '#c0c', '#c00']
-
-[roadmap]
-stats_provider = DefaultTicketGroupStatsProvider
-
-[search]
-# default_disabled_filters = <inherited>
-min_query_length = 3
-
-[sqlite]
-# extensions = <inherited>
-
-[svn]
-branches = trunk,branches/*
-tags = tags/*
-
-[ticket]
-default_cc =
-default_component =
-default_description =
-default_keywords =
-default_milestone =
-default_owner = < default >
-default_priority = minor
-default_resolution = fixed
-default_severity =
-default_summary =
-default_type = defect
-default_version =
-max_comment_size = 262144
-max_description_size = 262144
-preserve_newlines = default
-restrict_owner = false
-workflow = ConfigurableTicketWorkflow
-
-[ticket-workflow]
-accept = new,assigned,accepted,reopened -> accepted
-accept.operations = set_owner_to_self
-accept.permissions = TICKET_MODIFY
-leave = * -> *
-leave.default = 1
-leave.operations = leave_status
-reassign = new,assigned,accepted,reopened -> assigned
-reassign.operations = set_owner
-reassign.permissions = TICKET_MODIFY
-reopen = closed -> reopened
-reopen.operations = del_resolution
-reopen.permissions = TICKET_CREATE
-resolve = new,assigned,accepted,reopened -> closed
-resolve.operations = set_resolution
-resolve.permissions = TICKET_MODIFY
-
-[timeline]
-abbreviated_messages = True
-changeset_collapse_events = false
-changeset_long_messages = false
-changeset_show_files = 0
-default_daysback = 30
-max_daysback = 90
-newticket_formatter = oneliner
-ticket_show_details = false
-
-[trac]
-auth_cookie_lifetime = 0
-auth_cookie_path =
-authz_file =
-authz_module_name =
-auto_preview_timeout = 2.0
-auto_reload = False
-backup_dir = db
-base_url = https://<%= @name %>/
-check_auth_ip = false
-database = sqlite:db/trac.db
-debug_sql = False
-default_charset = utf-8
-default_dateinfo_format = relative
-genshi_cache_size = 128
-htdocs_location =
-ignore_auth_case = false
-jquery_location =
-jquery_ui_location =
-jquery_ui_theme_location =
-mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
-metanav = login,logout,prefs,help,about
-mysqldump_path = mysqldump
-never_obfuscate_mailto = false
-permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy
-permission_store = DefaultPermissionStore
-pg_dump_path = pg_dump
-repository_dir =
-repository_sync_per_request = (default)
-repository_type = svn
-resizable_textareas = true
-secure_cookies = False
-show_email_addresses = false
-show_ip_addresses = false
-timeout = 20
-use_base_url_for_redirect = False
-
-[versioncontrol]
-allowed_repository_dir_prefixes =
-
-[wiki]
-ignore_missing_pages = false
-max_size = 262144
-render_unsafe_content = false
-safe_schemes = cvs, file, ftp, git, irc, http, https, news, sftp, smb, ssh, svn, svn+ssh
-split_page_names = false
-
This cookbook installs and configures the web frontend machines that power
[www.openstreetmap.org](https://www.openstreetmap.org). There are several recipes
-* `web::backend` - sets up the backend servers, used for processing longer-running requests
* `web::base` - sets up common storage configuration between all the machines
* `web::cgimap` - builds and configures [cgimap](https://github.com/openstreetmap/cgimap)
* `web::cleanup` - configures a cleanup script to be run daily
default[:web][:pid_directory] = "/run/web"
default[:web][:log_directory] = "/var/log/web"
default[:web][:primary_cluster] = false
+default[:web][:max_request_area] = 0.25
+default[:web][:max_number_of_nodes] = 50000
+default[:web][:max_number_of_way_nodes] = 2000
+default[:web][:max_number_of_relation_members] = 32000
default[:accounts][:users][:rails][:status] = :role
depends "git"
depends "memcached"
depends "munin"
-depends "nfs"
depends "nodejs"
depends "passenger"
+depends "ruby"
depends "systemd"
depends "tools"
+++ /dev/null
-#
-# Cookbook:: web
-# Recipe:: backend
-#
-# Copyright:: 2011, OpenStreetMap Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-node.default[:memcached][:ip_address] = node.internal_ipaddress
-
-include_recipe "memcached"
-include_recipe "apache"
-include_recipe "web::rails"
-include_recipe "web::cgimap"
-
-web_passwords = data_bag_item("web", "passwords")
-
-apache_module "remoteip"
-apache_module "rewrite"
-apache_module "proxy"
-apache_module "proxy_fcgi"
-apache_module "setenvif"
-
-apache_site "default" do
- action [:disable]
-end
-
-apache_site "www.openstreetmap.org" do
- template "apache.backend.erb"
- variables :status => node[:web][:status],
- :secret_key_base => web_passwords["secret_key_base"]
-end
-
-service "rails-jobs@storage" do
- action [:disable, :stop]
-end
-
-service "rails-jobs@traces" do
- action [:disable, :stop]
-end
# limitations under the License.
#
-node.default[:nfs]["/store/rails"] = {
- :host => node[:web][:fileserver],
- :path => "/store/rails"
-}
-
include_recipe "accounts"
-include_recipe "nfs"
directory node[:web][:base_directory] do
group "rails"
db_passwords = data_bag_item("db", "passwords")
package "openstreetmap-cgimap-bin" do
- action :upgrade
+ action :install
end
database_host = node[:web][:readonly_database_host] || node[:web][:database_host]
"CGIMAP_LOGFILE" => "#{node[:web][:log_directory]}/cgimap.log",
"CGIMAP_MEMCACHE" => memcached_servers.join(","),
"CGIMAP_RATELIMIT" => "204800",
- "CGIMAP_MAXDEBT" => "250"
+ "CGIMAP_MAXDEBT" => "250",
+ "CGIMAP_MAP_AREA" => node[:web][:max_request_area],
+ "CGIMAP_MAP_NODES" => node[:web][:max_number_of_nodes],
+ "CGIMAP_MAX_WAY_NODES" => node[:web][:max_number_of_way_nodes],
+ "CGIMAP_MAX_RELATION_MEMBERS" => node[:web][:max_number_of_relation_members]
}
if %w[database_readonly api_readonly].include?(node[:web][:status])
include_recipe "web::base"
-ruby = "ruby#{node[:passenger][:ruby_version]}"
+ruby = "ruby#{node[:ruby][:version]}"
rails_directory = "#{node[:web][:base_directory]}/rails"
template "/etc/cron.daily/web-cleanup" do
subscribes :restart, "systemd_service[rails-jobs]"
end
-if node[:web][:primary_cluster]
- service "rails-jobs@traces" do
- action [:enable, :start]
- supports :restart => true
- subscribes :restart, "rails_port[www.openstreetmap.org]"
- subscribes :restart, "systemd_service[rails-jobs]"
- end
-else
- service "rails-jobs@traces" do
- action [:disable, :stop]
- end
+service "rails-jobs@traces" do
+ action [:enable, :start]
+ supports :restart => true
+ subscribes :restart, "rails_port[www.openstreetmap.org]"
+ subscribes :restart, "systemd_service[rails-jobs]"
end
include_recipe "munin"
include_recipe "nodejs"
include_recipe "passenger"
+include_recipe "ruby"
include_recipe "tools"
include_recipe "web::base"
mode "755"
end
-ruby_version = node[:passenger][:ruby_version]
rails_directory = "#{node[:web][:base_directory]}/rails"
-piwik = data_bag_item("web", "piwik")
+matomo = data_bag_item("web", "matomo")
storage = {
- "aws" => {
+ "avatars" => {
"service" => "S3",
"access_key_id" => "AKIASQUXHPE7AMJQRFOS",
"secret_access_key" => web_passwords["aws_key"],
"acl" => "public-read",
"cache_control" => "public, max-age=31536000, immutable"
}
+ },
+ "gps_traces" => {
+ "service" => "S3",
+ "access_key_id" => "AKIASQUXHPE7AMJQRFOS",
+ "secret_access_key" => web_passwords["aws_key"],
+ "region" => "eu-west-1",
+ "bucket" => "openstreetmap-gps-traces",
+ "use_dualstack_endpoint" => true,
+ "upload" => {
+ "acl" => "public-read",
+ "cache_control" => "public, max-age=31536000, immutable"
+ }
+ },
+ "gps_images" => {
+ "service" => "S3",
+ "access_key_id" => "AKIASQUXHPE7AMJQRFOS",
+ "secret_access_key" => web_passwords["aws_key"],
+ "region" => "eu-west-1",
+ "bucket" => "openstreetmap-gps-images",
+ "use_dualstack_endpoint" => true,
+ "upload" => {
+ "acl" => "public-read",
+ "cache_control" => "public, max-age=31536000, immutable"
+ }
}
}
+db_host = if node[:web][:status] == "database_readonly"
+ node[:web][:readonly_database_host]
+ else
+ node[:web][:database_host]
+ end
+
rails_port "www.openstreetmap.org" do
- ruby ruby_version
directory rails_directory
user "rails"
group "rails"
repository "https://git.openstreetmap.org/public/rails.git"
revision "live"
- database_host node[:web][:database_host]
+ database_host db_host
database_name "openstreetmap"
database_username "rails"
database_password db_passwords["rails"]
email_from "OpenStreetMap <web@noreply.openstreetmap.org>"
status node[:web][:status]
messages_domain "messages.openstreetmap.org"
- gpx_dir "/store/rails/gpx"
- attachments_dir "/store/rails/attachments"
log_path "#{node[:web][:log_directory]}/rails.log"
logstash_path "#{node[:web][:log_directory]}/rails-logstash.log"
memcache_servers node[:web][:memcached_servers]
potlatch2_key web_passwords["potlatch2_key"]
id_key web_passwords["id_key"]
+ id_application web_passwords["id_application"]
oauth_key web_passwords["oauth_key"]
- piwik_configuration "location" => piwik[:location],
- "site" => piwik[:site],
- "goals" => piwik[:goals].to_hash
+ oauth_application web_passwords["oauth_application"]
+ matomo_configuration "location" => matomo[:location],
+ "site" => matomo[:site],
+ "goals" => matomo[:goals].to_hash
google_auth_id "651529786092-6c5ahcu0tpp95emiec8uibg11asmk34t.apps.googleusercontent.com"
google_auth_secret web_passwords["google_auth_secret"]
google_openid_realm "https://www.openstreetmap.org"
trace_use_job_queue true
diary_feed_delay 12
storage_configuration storage
- storage_service "aws"
- storage_url "https://openstreetmap-user-avatars.s3.dualstack.eu-west-1.amazonaws.com"
+ avatar_storage "avatars"
+ trace_file_storage "gps_traces"
+ trace_image_storage "gps_images"
+ trace_icon_storage "gps_images"
+ avatar_storage_url "https://openstreetmap-user-avatars.s3.dualstack.eu-west-1.amazonaws.com"
+ trace_image_storage_url "https://openstreetmap-gps-images.s3.dualstack.eu-west-1.amazonaws.com"
+ overpass_url "https://query.openstreetmap.org/query-features"
end
-gem_package "bundler#{ruby_version}" do
- package_name "bundler"
- gem_binary "gem#{ruby_version}"
- options "--format-executable"
-end
-
-bundle = if File.exist?("/usr/bin/bundle#{ruby_version}")
- "/usr/bin/bundle#{ruby_version}"
- else
- "/usr/local/bin/bundle#{ruby_version}"
- end
-
systemd_service "rails-jobs@" do
description "Rails job queue runner"
type "simple"
environment "RAILS_ENV" => "production", "QUEUE" => "%I"
user "rails"
working_directory rails_directory
- exec_start "#{bundle} exec rake jobs:work"
+ exec_start "#{node[:ruby][:bundle]} exec rails jobs:work"
restart "on-failure"
private_tmp true
private_devices true
mode "755"
end
-gem_package "apachelogregex"
-gem_package "file-tail"
+gem_package "apachelogregex" do
+ gem_binary node[:ruby][:gem]
+end
+
+gem_package "file-tail" do
+ gem_binary node[:ruby][:gem]
+end
template "/usr/local/bin/api-statistics" do
source "api-statistics.erb"
subscribes :restart, "systemd_service[api-statistics]"
end
-gem_package "hpricot"
+gem_package "hpricot" do
+ gem_binary node[:ruby][:gem]
+end
munin_plugin "api_calls_status"
munin_plugin "api_calls_num"
include_recipe "web::base"
-ruby = "ruby#{node[:passenger][:ruby_version]}"
+ruby = "ruby#{node[:ruby][:version]}"
rails_directory = "#{node[:web][:base_directory]}/rails"
template "/usr/local/bin/statistics" do
resource_name :rails_port
provides :rails_port
+unified_mode true
+
default_action :create
property :site, String, :name_property => true
-property :ruby, String, :default => "2.3"
property :directory, String
property :user, String
property :group, String
property :memcache_servers, Array
property :potlatch2_key, String
property :id_key, String
+property :id_application, String
property :oauth_key, String
+property :oauth_application, String
property :nominatim_url, String
-property :osrm_url, String
+property :overpass_url, String
property :google_auth_id, String
property :google_auth_secret, String
property :google_openid_realm, String
property :totp_key, String
property :csp_enforce, [true, false], :default => false
property :csp_report_url, String
-property :piwik_configuration, Hash
+property :matomo_configuration, Hash
+property :storage_service, String, :default => "local"
+property :storage_url, String
property :trace_use_job_queue, [true, false], :default => false
property :diary_feed_delay, Integer
property :storage_configuration, Hash, :default => {}
-property :storage_service, String, :default => "local"
-property :storage_url, String
+property :avatar_storage, String
+property :trace_file_storage, String
+property :trace_image_storage, String
+property :trace_icon_storage, String
+property :avatar_storage_url, String
+property :trace_image_storage_url, String
+property :trace_icon_storage_url, String
property :tile_cdn_url, String
action :create do
package %W[
- ruby#{new_resource.ruby}
- ruby#{new_resource.ruby}-dev
imagemagick
+ libvips42
nodejs
tzdata
]
libjpeg-turbo-progs
]
- gem_package "bundler#{new_resource.ruby}" do
- package_name "bundler"
- version "2.1.4"
- gem_binary "gem#{new_resource.ruby}"
- options "--format-executable"
- end
-
- gem_package "bundler#{new_resource.ruby}" do
- package_name "pkg-config"
- gem_binary "gem#{new_resource.ruby}"
- end
-
declare_resource :directory, rails_directory do
owner new_resource.user
group new_resource.group
depth 1
user new_resource.user
group new_resource.group
- notifies :restart, "passenger_application[#{rails_directory}]"
end
declare_resource :directory, "#{rails_directory}/tmp" do
:name => new_resource.database_name,
:username => new_resource.database_username,
:password => new_resource.database_password
- notifies :restart, "passenger_application[#{rails_directory}]"
end
application_yml = edit_file "#{rails_directory}/config/example.application.yml" do |line|
line.gsub!(/^( *)#geonames_username:.*$/, "\\1geonames_username: \"openstreetmap\"")
- line.gsub!(/^( *)#maxmind_database:.*$/, "\\1maxmind_database: \"/usr/share/GeoIP/GeoLite2-Country.mmdb\"")
+ line.gsub!(/^( *)#maxmind_database:.*$/, "\\1maxmind_database: \"#{node[:geoipupdate][:directory]}/GeoLite2-Country.mmdb\"")
if new_resource.gpx_dir
line.gsub!(/^( *)gpx_trace_dir:.*$/, "\\1gpx_trace_dir: \"#{new_resource.gpx_dir}/traces\"")
line.gsub!(/^( *)#id_key:.*$/, "\\1id_key: \"#{new_resource.id_key}\"")
end
+ if new_resource.id_application
+ line.gsub!(/^( *)#id_application:.*$/, "\\1id_application: \"#{new_resource.id_application}\"")
+ end
+
if new_resource.oauth_key
line.gsub!(/^( *)#oauth_key:.*$/, "\\1oauth_key: \"#{new_resource.oauth_key}\"")
end
+ if new_resource.oauth_application
+ line.gsub!(/^( *)#oauth_application:.*$/, "\\1oauth_application: \"#{new_resource.oauth_application}\"")
+ end
+
if new_resource.nominatim_url
line.gsub!(/^( *)nominatim_url:.*$/, "\\1nominatim_url: \"#{new_resource.nominatim_url}\"")
end
- if new_resource.osrm_url
- line.gsub!(/^( *)osrm_url:.*$/, "\\1osrm_url: \"#{new_resource.osrm_url}\"")
+ if new_resource.overpass_url
+ line.gsub!(/^( *)overpass_url:.*$/, "\\1overpass_url: \"#{new_resource.overpass_url}\"")
end
if new_resource.google_auth_id
group new_resource.group
mode "664"
content application_yml
- notifies :restart, "passenger_application[#{rails_directory}]"
only_if { ::File.exist?("#{rails_directory}/config/example.application.yml") }
end
"logstash_path",
"potlatch2_key",
"id_key",
+ "id_application",
"oauth_key",
+ "oauth_application",
"nominatim_url",
- "osrm_url",
+ "overpass_url",
"google_auth_id",
"google_auth_secret",
"google_openid_realm",
"diary_feed_delay",
"storage_service",
"storage_url",
+ "avatar_storage",
+ "trace_file_storage",
+ "trace_image_storage",
+ "trace_icon_storage",
+ "avatar_storage_url",
+ "trace_image_storage_url",
+ "trace_icon_storage_url",
"tile_cdn_url"
).compact.merge(
"server_protocol" => "https",
"support_email" => "support@openstreetmap.org",
"email_return_path" => "bounces@openstreetmap.org",
"geonames_username" => "openstreetmap",
- "maxmind_database" => "/usr/share/GeoIP/GeoLite2-Country.mmdb"
+ "maxmind_database" => "/usr/share/GeoIP/GeoLite2-Country.mmdb",
+ "max_request_area" => node[:web][:max_request_area],
+ "max_number_of_nodes" => node[:web][:max_number_of_nodes],
+ "max_number_of_way_nodes" => node[:web][:max_number_of_way_nodes],
+ "max_number_of_relation_members" => node[:web][:max_number_of_relation_members]
)
if new_resource.memcache_servers
settings["gpx_image_dir"] = "#{new_resource.gpx_dir}/images"
end
+ if new_resource.matomo_configuration
+ settings["matomo"] = new_resource.matomo_configuration.to_h
+ end
+
file "#{rails_directory}/config/settings.local.yml" do
owner new_resource.user
group new_resource.group
content YAML.dump(storage_configuration)
end
- if new_resource.piwik_configuration
- file "#{rails_directory}/config/piwik.yml" do
- owner new_resource.user
- group new_resource.group
- mode "664"
- content YAML.dump(new_resource.piwik_configuration)
- end
- else
- file "#{rails_directory}/config/piwik.yml" do
- action :delete
- end
+ file "#{rails_directory}/config/piwik.yml" do
+ action :delete
end
- execute "#{rails_directory}/Gemfile" do
+ bundle_install "#{rails_directory}" do
action :nothing
- command "bundle#{new_resource.ruby} install"
- cwd rails_directory
user "root"
group "root"
environment "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "yes"
- subscribes :run, "gem_package[bundler#{new_resource.ruby}]"
subscribes :run, "git[#{rails_directory}]"
- notifies :restart, "passenger_application[#{rails_directory}]"
end
- execute "#{rails_directory}/db/migrate" do
+ bundle_exec "#{rails_directory}/db/migrate" do
action :nothing
- command "bundle#{new_resource.ruby} exec rake db:migrate"
- cwd rails_directory
+ directory rails_directory
+ command "rails db:migrate"
user new_resource.user
group new_resource.group
subscribes :run, "git[#{rails_directory}]"
- notifies :restart, "passenger_application[#{rails_directory}]"
only_if { new_resource.run_migrations }
end
only_if { new_resource.build_assets }
end
- execute "#{rails_directory}/package.json" do
+ bundle_exec "#{rails_directory}/package.json" do
action :nothing
- command "bundle#{new_resource.ruby} exec rake yarn:install"
+ directory rails_directory
+ command "rails yarn:install"
environment "HOME" => rails_directory,
"RAILS_ENV" => "production"
- cwd rails_directory
user new_resource.user
group new_resource.group
subscribes :run, "git[#{rails_directory}]"
only_if { new_resource.build_assets }
end
- execute "#{rails_directory}/app/assets/javascripts/i18n" do
+ bundle_exec "#{rails_directory}/app/assets/javascripts/i18n" do
action :nothing
- command "bundle#{new_resource.ruby} exec rake i18n:js:export"
+ directory rails_directory
+ command "rails i18n:js:export"
environment "HOME" => rails_directory,
"RAILS_ENV" => "production"
- cwd rails_directory
user new_resource.user
group new_resource.group
subscribes :run, "git[#{rails_directory}]"
only_if { new_resource.build_assets }
end
- execute "#{rails_directory}/public/assets" do
+ bundle_exec "#{rails_directory}/public/assets" do
action :nothing
- command "bundle#{new_resource.ruby} exec rake assets:precompile"
+ directory rails_directory
+ command "rails assets:precompile"
environment "HOME" => rails_directory,
"RAILS_ENV" => "production"
- cwd rails_directory
user new_resource.user
group new_resource.group
subscribes :run, "git[#{rails_directory}]"
subscribes :run, "file[create:#{rails_directory}/config/application.yml]"
subscribes :run, "file[#{rails_directory}/config/settings.local.yml]"
subscribes :run, "file[#{rails_directory}/config/storage.yml]"
- subscribes :run, "file[#{rails_directory}/config/piwik.yml]"
- subscribes :run, "execute[#{rails_directory}/package.json]"
- subscribes :run, "execute[#{rails_directory}/app/assets/javascripts/i18n]"
- notifies :restart, "passenger_application[#{rails_directory}]"
+ subscribes :run, "bundle_exec[#{rails_directory}/package.json]"
+ subscribes :run, "bundle_exec[#{rails_directory}/app/assets/javascripts/i18n]"
only_if { new_resource.build_assets }
end
passenger_application rails_directory do
action :nothing
+ subscribes :restart, "git[#{rails_directory}]"
+ subscribes :restart, "file[#{rails_directory}/config/database.yml]"
+ subscribes :restart, "file[create:#{rails_directory}/config/application.yml]"
+ subscribes :restart, "file[#{rails_directory}/config/settings.local.yml]"
+ subscribes :restart, "file[#{rails_directory}/config/storage.yml]"
+ subscribes :restart, "bundle_installl[#{rails_directory}]"
+ subscribes :restart, "bundle_exec[#{rails_directory}/db/migrate]"
+ subscribes :restart, "bundle_exec[#{rails_directory}/package.json]"
+ subscribes :restart, "bundle_exec[#{rails_directory}/app/assets/javascripts/i18n]"
+ subscribes :restart, "bundle_exec[#{rails_directory}/public/assets]"
only_if { ::File.exist?("/usr/bin/passenger-config") }
end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-<VirtualHost *:443>
- #
- # Basic server configuration
- #
- ServerName <%= node[:fqdn] %>
- ServerAlias api.openstreetmap.org www.openstreetmap.org
- ServerAdmin webmaster@openstreetmap.org
-
- #
- # Enable SSL
- #
- SSLEngine on
- SSLCertificateFile /etc/ssl/certs/www.openstreetmap.org.pem
- SSLCertificateKeyFile /etc/ssl/private/www.openstreetmap.org.key
-
- #
- # Setup logging
- #
- LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %Dus %{UNIQUE_ID}e %{SSL_PROTOCOL}x %{SSL_CIPHER}x" combined_with_time
- CustomLog /var/log/apache2/access.log combined_with_time
- ErrorLog /var/log/apache2/error.log
-
- #
- # Turn on the rewrite engine
- #
- RewriteEngine on
-
- #
- # Recover the unique ID from the request headers
- #
- SetEnvIf X-Request-Id ^(.*)$ UNIQUE_ID=$1
-
- #
- # Configure rails
- #
- DocumentRoot <%= node[:web][:base_directory] %>/rails/public
- RailsEnv production
- PassengerMinInstances 3
- PassengerMaxRequests 500
- PassengerPreStart https://www.openstreetmap.org/
- PassengerAppGroupName rails
- SetEnv OPENSTREETMAP_STATUS <%= @status %>
- SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
-
- #
- # Get the real remote IP for requests via a trusted proxy
- #
- RemoteIPHeader X-Forwarded-For
- RemoteIPTrustedProxy 10.0.32.0/24
- RemoteIPTrustedProxy 10.0.48.0/24
-
- #
- # Pass authentication related headers to cgimap
- #
- <Location />
- CGIPassAuth On
- </Location>
-
- #
- # Pass supported calls to cgimap
- #
- RewriteRule ^/api/0\.6/map(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$
- RewriteRule ^/api/0\.6/(node|way|relation|changeset)/[0-9]+(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/history(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+/relations(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteRule ^/api/0\.6/node/[0-9]+/ways(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteRule ^/api/0\.6/(nodes|ways|relations)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
- RewriteRule ^/api/0\.6/changeset/[0-9]+/(upload|download)(\.json|\.xml)?$ fcgi://127.0.0.1:8000$0 [P]
-</VirtualHost>
-
-<Directory <%= node[:web][:base_directory] %>/rails/public>
- Require all granted
-</Directory>
#
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %Dus %{UNIQUE_ID}e %{SSL_PROTOCOL}x %{SSL_CIPHER}x" combined_with_time
CustomLog /var/log/apache2/access.log combined_with_time
+ CustomLog /var/log/apache2/basic.log combined_with_time "expr=%{HTTP:WWW-Authenticate} =~ /^Basic/i"
ErrorLog /var/log/apache2/error.log
#
# https://gist.github.com/Firefishy/86ed5b86991b225179b54bbafbcd769e
#
RewriteCond "%{QUERY_STRING}" "^q=abcde&t=20"
- RewriteRule "^/api/0\.6/notes/search$" - [R=204,L]
+ RewriteRule "^/api/0\.6/notes/search$" - [R=429,L]
#
# Force special MIME type for crossdomain.xml files
SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
Alias /favicon.ico <%= node[:web][:base_directory] %>/rails/app/assets/favicons/favicon.ico
Alias /openlayers <%= node[:web][:base_directory] %>/static/openlayers
- Alias /stats /store/rails/stats
- Alias /user/image /store/rails/user/image
- Alias /attachments /store/rails/attachments
+ RedirectPermanent /stats https://planet.openstreetmap.org/statistics
#
# Pass authentication related headers to cgimap
<Directory <%= node[:web][:base_directory] %>/rails/public>
Require all granted
+ RewriteCond "%{HTTP:Accept-encoding}" "br"
+ RewriteCond "%{REQUEST_FILENAME}\.br" -s
+ RewriteRule "^(.*)\.(css|ico|js|json|svg|xml)$" "$1\.$2\.br" [QSA]
+
RewriteCond "%{HTTP:Accept-encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.(css|ico|js|json|svg|xml)$" "$1\.$2\.gz" [QSA]
- RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
- RewriteRule "\.ico\.gz$" "-" [T=image/vnd.microsoft.icon,E=no-gzip:1]
- RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
- RewriteRule "\.json\.gz$" "-" [T=application/json,E=no-gzip:1]
- RewriteRule "\.svg\.gz$" "-" [T=image/svg+xml,E=no-gzip:1]
- RewriteRule "\.xml\.gz$" "-" [T=application/xml,E=no-gzip:1]
+ RewriteRule "\.css\.(br|gz)$" "-" [T=text/css,E=no-gzip:1,E=no-brotli:1]
+ RewriteRule "\.ico\.(br|gz)$" "-" [T=image/vnd.microsoft.icon,E=no-gzip:1,E=no-brotli:1]
+ RewriteRule "\.js\.(br|gz)$" "-" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
+ RewriteRule "\.json\.(br|gz)$" "-" [T=application/json,E=no-gzip:1,E=no-brotli:1]
+ RewriteRule "\.svg\.(br|gz)$" "-" [T=image/svg+xml,E=no-gzip:1,E=no-brotli:1]
+ RewriteRule "\.xml\.(br|gz)$" "-" [T=application/xml,E=no-gzip:1,E=no-brotli:1]
+
+ <FilesMatch "\.(css|ico|js|json|svg|xml)\.br$">
+ Header append Content-Encoding br
+ Header append Vary Accept-Encoding
+ </FilesMatch>
<FilesMatch "\.(css|ico|js|json|svg|xml)\.gz$">
Header append Content-Encoding gzip
<Directory /srv/www.openstreetmap.org/rails/vendor/assets>
Require all granted
</Directory>
-
-<Directory /store/rails/stats>
- Require all granted
-</Directory>
-
-<Directory /store/rails/user/image>
- Require all granted
-</Directory>
-
-<Directory /store/rails/attachments>
- Require all granted
-</Directory>
create 0660 rails rails
sharedscripts
postrotate
-<% if File.directory?("#{node[:web][:base_directory]}/rails") -%>
- PASSENGER_INSTANCE_REGISTRY_DIR=<%= node[:passenger][:instance_registry_dir] %> /usr/bin/passenger-config restart-app --ignore-app-not-running <%= node[:web][:base_directory] %>/rails > /dev/null
+<% if node[:recipes].include?("web::rails") -%>
+ /bin/sleep 30
+ PASSENGER_INSTANCE_REGISTRY_DIR=<%= node[:passenger][:instance_registry_dir] %> /usr/bin/passenger-config restart-app --ignore-app-not-running --name rails > /dev/null
<% end -%>
-<% if File.directory?("#{node[:web][:base_directory]}/gpx-import") -%>
- /bin/systemctl try-reload-or-restart gpx-import
+<% if node[:recipes].include?("web::frontend") -%>
+ /bin/systemctl try-reload-or-restart rails-jobs@mailers
+ /bin/systemctl try-reload-or-restart rails-jobs@storage
+ /bin/systemctl try-reload-or-restart rails-jobs@traces
<% end -%>
-<% if File.directory?("#{node[:web][:base_directory]}/cgimap") -%>
+<% if node[:recipes].include?("web::cgimap") -%>
/bin/systemctl reload cgimap
/usr/bin/rsync --preallocate <%= node[:web][:log_directory] %>/cgimap.log.2.gz ironbelly::logs/www.openstreetmap.org/cgimap-<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
<% end -%>
<%= @ruby %> -W0 <%= @directory %>/script/statistics > <%= @directory %>/tmp/data_stats.html
# Move new statistics into place
-mv -f <%= @directory %>/tmp/data_stats.html /store/rails/stats
+rsync --quiet <%= @directory %>/tmp/data_stats.html planet.openstreetmap.org::statistics
# Mail statistics to Blackadder
-mail -s "OpenStreetMap Statistics" blackadderajr@gmail.com < /store/rails/stats/data_stats.html
+mail -s "OpenStreetMap Statistics" blackadderajr@gmail.com < <%= @directory %>/tmp/data_stats.html
metanamespace "Wiki"
- recaptcha_public_key "6LdFIQATAAAAAMwtHeI8KDgPqvRbXeNYSq1gujKz"
- recaptcha_private_key passwords["recaptcha"]
+ hcaptcha_public_key "b67a410b-955e-4049-b432-f9c00e0202c0"
+ hcaptcha_private_key passwords["hcaptcha"]
# site_notice "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT."
# site_readonly "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT."
<?php
# DO NOT EDIT - This file is being maintained by Chef
+use MediaWiki\MediaWikiServices;
+use Wikibase\Lib\SettingsArray;
+
$wgEnableWikibaseRepo = true;
$wgEnableWikibaseClient = true;
-require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
-require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
+wfLoadExtension( 'WikibaseRepository', "$IP/extensions/Wikibase/extension-repo.json" );
+wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
// Include Wikibase.searchindex.php to include string and text values in the full text index:
require_once "$IP/extensions/Wikibase/repo/config/Wikibase.searchindex.php";
$wgNamespacesToBeSearchedDefault,
$wgWBRepoSettings;
- $wgContentHandlerUseDB = true;
-
$baseNs = 120;
// Define custom namespaces. Use these exact constant names.
$wgExtraNamespaces[WB_NS_PROPERTY] = 'Property';
$wgExtraNamespaces[WB_NS_PROPERTY_TALK] = 'Property_talk';
- // Tell Wikibase which namespace to use for which kind of entity
- $wgWBRepoSettings['entityNamespaces']['item'] = WB_NS_ITEM;
- $wgWBRepoSettings['entityNamespaces']['property'] = WB_NS_PROPERTY;
+ $wgWBRepoSettings['entitySources'] = function ( SettingsArray $settings ) {
+ global $wgServer;
+
+ $entityNamespaces = [
+ 'item' => WB_NS_ITEM,
+ 'property' => WB_NS_PROPERTY,
+ ];
+
+ $hookContainer = MediaWikiServices::getInstance()->getHookContainer();
+ $hookContainer->run( 'WikibaseRepoEntityNamespaces', [ &$entityNamespaces ] );
+
+ return [
+ $settings->getSetting( 'localEntitySourceName' ) => [
+ 'entityNamespaces' => $entityNamespaces,
+ 'repoDatabase' => false,
+ 'baseUri' => $wgServer . '/entity/',
+ 'rdfNodeNamespacePrefix' => 'wd',
+ 'rdfPredicateNamespacePrefix' => '',
+ 'interwikiPrefix' => '',
+ ],
+ ];
+ };
// Make sure we use the same keys on repo and clients, so we can share cached objects.
- $wgWBRepoSettings['sharedCacheKeyPrefix'] = $wgDBname;
+ $wgWBRepoSettings['sharedCacheKeyPrefix'] = $wgDBname . ':WBL';
+ $wgWBRepoSettings['sharedCacheKeyGroup'] = $wgDBname;
// Include Wikibase items in the regular search result by default
$wgNamespacesToBeSearchedDefault[WB_NS_ITEM] = true;
} );
-// Adapted from "$IP/extensions/Wikibase/client/ExampleSettings.php";
+// Adapted from "$IP/extensions/Wikibase/client/config/WikibaseClient.example.php";
// The global site ID by which this wiki is known on the repo.
// Defaults to $wgDBname.
// $wgWBClientSettings['siteGlobalID'] = "osm";
-// $wgWBClientSettings['injectRecentChanges'] = true;
-// $wgWBClientSettings['showExternalRecentChanges'] = true;
+
+$wgWBClientSettings['injectRecentChanges'] = true;
+$wgWBClientSettings['showExternalRecentChanges'] = true;
+
+// Base URL for building links to the repository.
+// Assumes your wiki is setup as "http://repo.example.org/wiki/"
+// This can be protocol relative, such as "//www.wikidata.org"
+$wgWBClientSettings['repoUrl'] = "https://wiki.openstreetmap.org";
+
+// This setting is optional if you have the same type of setup for your
+// repo and client. It will default to using the client's $wgArticlePath setting,
+// and if you do not have $wgArticlePath set anywhere, MediaWiki has a default for it.
+$wgWBClientSettings['repoArticlePath'] = "/wiki/$1";
+
+// Assuming your wiki is setup with such script path as "http://repo.example.org/w/api.php". This
+// should be the same as the $wgScriptPath setting if you have it set in your repo. If $wgScriptPath
+// is not set, then MediaWiki assumes a default.
+//
+// If your client and repo are setup in the same way, then the below setting is optional and will
+// default to what you have $wgScriptPath set in the client.
+$wgWBClientSettings['repoScriptPath'] = "/w";
+
+// Tell the client which namespace ID on the repo holds which type of entity.
+$baseRepoNs = 120;
+
+define( 'WB_REPO_NS_ITEM', $baseRepoNs );
+define( 'WB_REPO_NS_PROPERTY', $baseRepoNs + 2 );
+
+$wgWBClientSettings['entitySources'] = [
+ 'local' => [
+ 'repoDatabase' => $wgDBname,
+ 'baseUri' => $wgWBClientSettings['repoUrl'] . '/entity',
+ 'entityNamespaces' => [
+ 'item' => WB_REPO_NS_ITEM,
+ 'property' => WB_REPO_NS_PROPERTY
+ ],
+ 'rdfNodeNamespacePrefix' => 'wd',
+ 'rdfPredicateNamespacePrefix' => '',
+ 'interwikiPrefix' => '',
+ ],
+];
$wgWBClientSettings['namespaces'] = [ NS_MAIN ];
require "addressable"
require "httpclient"
-require "php_serialize"
+require "json"
class Chef
module Wordpress
extend Chef::Mixin::ShellOut
@api_responses = {}
- @svn_responses = {}
class << self
def current_version
end
def current_plugin_version(name)
- if svn_cat("https://plugins.svn.wordpress.org/#{name}/trunk/readme.txt") =~ /Stable tag:\s*([^\s\r]*)[\s\r]*/
- Regexp.last_match[1]
- else
- "trunk"
- end
+ plugin_information(name)["version"]
end
private
def core_version_check
- api_get("https://api.wordpress.org/core/version-check/1.6")
+ api_get("https://api.wordpress.org/core/version-check/1.7")
end
- def api_get(url)
- @api_responses[url] ||= ::PHP.unserialize(::HTTPClient.new.get_content(url))
+ def plugin_information(name)
+ api_get("https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=#{name}")
end
- def svn_cat(url)
- unless @svn_responses[url]
- result = shell_out!("svn", "cat", url)
-
- @svn_responses[url] = result.stdout.force_encoding("UTF-8")
- end
-
- @svn_responses[url]
+ def api_get(url)
+ @api_responses[url] ||= ::JSON.parse(::HTTPClient.new.get_content(url))
end
end
end
depends "php"
depends "ssl"
gem "httpclient"
-gem "php_serialize"
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :plugin, :kind_of => String, :name_property => true
action :sync
repository plugin_repository
revision new_resource.revision
- depth 1
user node[:wordpress][:user]
group node[:wordpress][:group]
end
require "securerandom"
+unified_mode true
+
default_action :create
property :site, :kind_of => String, :name_property => true
property :database_password, :kind_of => String, :required => [:create]
property :database_prefix, :kind_of => String, :default => "wp_"
property :urls, :kind_of => Hash, :default => {}
-property :fpm_max_children, :kind_of => Integer, :default => 5
-property :fpm_start_servers, :kind_of => Integer, :default => 2
-property :fpm_min_spare_servers, :kind_of => Integer, :default => 1
-property :fpm_max_spare_servers, :kind_of => Integer, :default => 3
+property :fpm_max_children, :kind_of => Integer, :default => 10
+property :fpm_start_servers, :kind_of => Integer, :default => 4
+property :fpm_min_spare_servers, :kind_of => Integer, :default => 2
+property :fpm_max_spare_servers, :kind_of => Integer, :default => 6
property :fpm_request_terminate_timeout, :kind_of => Integer, :default => 300
property :fpm_prometheus_port, :kind_of => Integer
property :reload_apache, :kind_of => [TrueClass, FalseClass], :default => true
line.gsub!(/('LOGGED_IN_SALT', *)'put your unique phrase here'/, "\\1'#{logged_in_salt}'")
line.gsub!(/('NONCE_SALT', *)'put your unique phrase here'/, "\\1'#{nonce_salt}'")
- if line =~ /define\('WP_DEBUG'/
- line += "\n"
- line += "/**\n"
- line += " * Don't allow file editing.\n"
- line += " */\n"
- line += "define('DISALLOW_FILE_EDIT', true);\n"
- line += "define('FORCE_SSL_LOGIN', true);\n"
- line += "define('FORCE_SSL_ADMIN', true);\n"
+ if line =~ /Add any custom values between this line/
+ line += "\r\n"
+ line += "/**\r\n"
+ line += " * Don't allow file editing.\r\n"
+ line += " */\r\n"
+ line += "define( 'DISALLOW_FILE_EDIT', true);\r\n"
+ line += "define( 'DISALLOW_FILE_MODS', true);\r\n"
+ line += "define( 'AUTOMATIC_UPDATER_DISABLED', true);\r\n"
+ line += "define( 'FORCE_SSL_LOGIN', true);\r\n"
+ line += "define( 'FORCE_SSL_ADMIN', true);\r\n"
end
line
# limitations under the License.
#
+unified_mode true
+
default_action :create
property :theme, :kind_of => String, :name_property => true
action :sync
repository theme_repository
revision new_resource.revision
- depth 1
user node[:wordpress][:user]
group node[:wordpress][:group]
end
:gateway => "fe80::a293:51ff:fea2:ded5"
}
}
- },
- :postgresql => {
- :settings => {
- :defaults => {
- :shared_buffers => "8GB",
- :maintenance_work_mem => "7144MB",
- :effective_cache_size => "16GB"
- }
- }
- },
- :sysctl => {
- :postgres => {
- :comment => "Increase shared memory for postgres",
- :parameters => {
- "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
- "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
- }
- }
- },
- :tile => {
- :database => {
- :cluster => "12/main",
- :postgis => "3"
- },
- :styles => {
- :default => {
- :tile_directories => [
- { :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
- ]
- }
- }
}
)
run_list(
- "role[scaleway]",
- "role[tile]"
+ "role[scaleway]"
)
+++ /dev/null
-name "altavoz"
-description "Role applied to all servers at AltaVoz"
-
-default_attributes(
- :hosted_by => "AltaVoz",
- :location => "Viña del Mar, Chile"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["200.91.44.10", "200.91.41.10"]
- },
- :ntp => {
- :servers => ["0.cl.pool.ntp.org", "1.cl.pool.ntp.org", "south-america.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[cl]"
-)
description "Master role applied to angor"
default_attributes(
- :hardware => {
- :shm_size => "18g"
- },
:networking => {
:interfaces => {
:external_ipv4 => {
:gateway => "2001:43f8:1f4:b00::1"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "capetown.render.openstreetmap.org"
}
)
run_list(
"role[inxza]",
- "role[tilecache]",
"role[ftp]"
)
description "Master role applied to ascalon"
default_attributes(
- :hardware => {
- :shm_size => "20g"
- },
:networking => {
:interfaces => {
:external_ipv4 => {
:gateway => "184.107.48.225"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "montreal.render.openstreetmap.org"
}
)
run_list(
- "role[netalerts]",
- "role[tilecache]"
+ "role[netalerts]"
)
:transfer_logging => false,
:hosts_allow => [
"193.60.236.0/24", # ucl external
- "10.0.48.0/20", # equinix internal
- "130.117.76.0/27", # equinix external
- "2001:978:2:2C::172:0/112", # equinix external
+ "10.0.48.0/20", # amsterdam internal
+ "130.117.76.0/27", # amsterdam external
+ "2001:978:2:2C::172:0/112", # amsterdam external
+ "10.0.64.0/20", # dublin internal
+ "184.104.226.96/27", # dublin external
+ "2001:470:1:b3b::/64", # dublin external
"10.0.32.0/20", # bytemark internal
"89.16.162.16/28", # bytemark external
"2001:41c9:2:d6::/64", # bytemark external
:prefix => "30",
:gateway => "138.44.68.133",
:bond => {
- :slaves => %w[ens14f0 ens14f1]
+ :slaves => %w[ens14f0np0 ens14f1np1]
}
}
}
},
:tile => {
:database => {
- :cluster => "12/main",
+ :cluster => "14/main",
:postgis => "3"
},
+ :mapnik => "3.1",
:styles => {
:default => {
:tile_directories => [
},
:search => ["openstreetmap.org"]
},
+ :prometheus => {
+ :metrics => {
+ :exim_queue_limit => {
+ :help => "Mail queue alert level",
+ :metric => 50
+ }
+ }
+ },
:sysctl => {
:panic => {
:comment => "Reboot automatically after a panic",
:tune_cpu_scheduler => {
:comment => "Tune CPU scheduler for server scheduling",
:parameters => {
- "kernel.sched_migration_cost_ns" => 50000000,
"kernel.sched_autogroup_enabled" => 0
}
}
+++ /dev/null
-name "blix-nl"
-description "Role applied to all servers at Blix NL"
-
-default_attributes(
- :location => "Amsterdam, Netherlands"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.nl.pool.ntp.org", "1.nl.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[nl]",
- "role[blix]"
-)
+++ /dev/null
-name "blix-no"
-description "Role applied to all servers at Blix NO"
-
-default_attributes(
- :location => "Oslo, Norway"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.no.pool.ntp.org", "1.no.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[no]",
- "role[blix]"
-)
+++ /dev/null
-name "blix"
-description "Role applied to all servers at Blix"
-
-default_attributes(
- :accounts => {
- :users => {
- :blixadmin => { :status => :administrator }
- }
- },
- :hosted_by => "Blix Solutions"
-)
+++ /dev/null
-name "boitata"
-description "Master role applied to boitata"
-
-default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens3",
- :role => :external,
- :family => :inet,
- :address => "200.236.31.207",
- :prefix => "25",
- :gateway => "200.236.31.254"
- },
- :external_ipv6 => {
- :interface => "ens3",
- :role => :external,
- :family => :inet6,
- :address => "2801:82:80ff:8002:216:ccff:feaa:21",
- :prefix => "64",
- :gateway => "fe80::92e2:baff:fe0d:e24"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "8192 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "brazil.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[c3sl]",
- "role[tilecache]"
-)
:prefix => "30",
:gateway => "138.44.68.105",
:bond => {
- :slaves => %w[ens14f0 ens14f1]
+ :slaves => %w[ens14f0np0 ens14f0np1]
}
}
}
},
:tile => {
:database => {
- :cluster => "12/main",
+ :cluster => "14/main",
:postgis => "3"
},
+ :mapnik => "3.1",
:styles => {
:default => {
:tile_directories => [
}
},
:web => {
- :backends => %w[rails4 rails5],
:fileserver => "grisu",
- :readonly_database_host => "katla.bm.openstreetmap.org"
+ :readonly_database_host => "snap-02.ucl.openstreetmap.org"
}
)
+++ /dev/null
-name "c3sl"
-description "Role applied to all servers at Centro de Computação CientÃfica e Software Livre"
-
-default_attributes(
- :accounts => {
- :users => {
- :c3sl => { :status => :administrator }
- }
- },
- :hosted_by => "Centro de Computação CientÃfica e Software Livre, Universidade Federal do Paraná",
- :location => "Curitiba, Brazil",
- :networking => {
- :wireguard => { :keepalive => 180 }
- },
- :timezone => "America/Sao_Paulo"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["200.17.202.3", "200.236.31.1"]
- },
- :ntp => {
- :servers => ["0.br.pool.ntp.org", "1.br.pool.ntp.org", "south-america.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[br]"
-)
+++ /dev/null
-name "cherufe"
-description "Master role applied to cherufe"
-
-default_attributes(
- :hardware => {
- :shm_size => "12g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens18",
- :role => :external,
- :family => :inet,
- :address => "200.91.44.37",
- :prefix => "23",
- :gateway => "200.91.44.1"
- }
- }
- },
- :openssh => {
- :port => 45222
- },
- :squid => {
- :version => 4,
- :cache_mem => "8192 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :max_size => "8192M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "vinadelmar.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[altavoz]",
- "role[tilecache]"
-)
+++ /dev/null
-name "chrysophylax"
-description "Master role applied to chrysophylax"
-
-default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens160",
- :role => :external,
- :family => :inet,
- :address => "217.71.244.22",
- :prefix => "30",
- :gateway => "217.71.244.21"
- },
- :external_ipv6 => {
- :interface => "ens160",
- :role => :external,
- :family => :inet6,
- :address => "2001:8e0:40:2039::10",
- :prefix => "64",
- :gateway => "2001:8e0:40:2039::1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :max_size => "16384M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "zurich.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[iway]",
- "role[geodns]",
- "role[tilecache]"
-)
+++ /dev/null
-name "cmok"
-description "Master role applied to cmok"
-
-default_attributes(
- :hardware => {
- :shm_size => "6g"
- },
- :munin => {
- :plugins => {
- "diskstats_latency.sdd" => {
- :avgrdwait => { :warning => "0:30" }
- }
- }
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "enp4s0",
- :role => :external,
- :family => :inet,
- :address => "31.130.201.40",
- :prefix => "27",
- :gateway => "31.130.201.33"
- },
- :external_ipv6 => {
- :interface => "enp4s0",
- :role => :external,
- :family => :inet6,
- :address => "2001:67c:2268:1005:21e:8cff:fe8c:8d3b",
- :prefix => "64",
- :gateway => "fe80::20c:42ff:feb2:8ff8"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "4096 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "minsk.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[datahata]",
- "role[tilecache]"
-)
--- /dev/null
+name "community"
+description "Role applied to all community servers"
+
+default_attributes(
+ :accounts => {
+ :users => {
+ :community => {
+ :status => :role,
+ :members => [:grant, :tomh]
+ }
+ }
+ }
+)
+
+run_list(
+ "recipe[community]"
+)
}
},
:trusted_users => ["www-data"]
+ },
+ :mysql => {
+ :settings => {
+ :mysqld => {
+ :log_bin_trust_function_creators => 1
+ }
+ }
}
)
--- /dev/null
+name "culebre"
+description "Master role applied to culebre"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.9",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[enp68s0f0 enp68s0f1 enp68s0f2 enp68s0f3]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.105"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::9"
+ }
+ }
+ },
+ :postgresql => {
+ :settings => {
+ :defaults => {
+ :shared_buffers => "8GB",
+ :maintenance_work_mem => "7144MB",
+ :effective_cache_size => "16GB"
+ }
+ }
+ },
+ :sysctl => {
+ :postgres => {
+ :comment => "Increase shared memory for postgres",
+ :parameters => {
+ "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
+ "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
+ }
+ }
+ },
+ :tile => {
+ :database => {
+ :cluster => "14/main",
+ :postgis => "3"
+ },
+ :mapnik => "3.1",
+ :styles => {
+ :default => {
+ :tile_directories => [
+ { :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
+ ]
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[tile]"
+)
+++ /dev/null
-name "datahata"
-description "Role applied to all servers at DataHata"
-
-default_attributes(
- :accounts => {
- :users => {
- :kom => { :status => :administrator }
- }
- },
- :hosted_by => "DataHata",
- :location => "Minsk, Belarus"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.by.pool.ntp.org", "1.by.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[by]"
-)
:defaults => {
:wal_level => "logical",
:archive_mode => "on",
- :archive_command => "/usr/local/bin/openstreetmap-wal-e --terse wal-push %p",
- :max_wal_senders => "3",
+ :archive_command => "/usr/local/bin/openstreetmap-wal-g wal-push %p --walg-prevent-wal-overwrite=true",
+ :max_wal_senders => "10",
:max_replication_slots => "1",
:late_authentication_rules => [
- { :database => "replication", :user => "replication", :address => "10.0.48.49/32" },
- { :database => "replication", :user => "replication", :address => "10.0.48.50/32" },
- { :database => "replication", :user => "replication", :address => "10.0.48.5/32" },
- { :database => "replication", :user => "replication", :address => "10.0.0.10/32" },
- { :database => "replication", :user => "replication", :address => "10.0.32.40/32" }
+ { :database => "replication", :user => "replication", :address => "10.0.0.4/32" }, # snap-02
+ { :database => "replication", :user => "replication", :address => "10.0.0.10/32" }, # eddie
+ { :database => "replication", :user => "replication", :address => "10.0.32.40/32" }, # katla
+ { :database => "replication", :user => "replication", :address => "10.0.48.49/32" }, # snap-01
+ { :database => "replication", :user => "replication", :address => "10.0.48.50/32" }, # karm
+ { :database => "replication", :user => "replication", :address => "10.0.64.50/32" } # snap-03
]
}
}
:user => "replication",
:passwords => { :bag => "db", :item => "passwords" }
},
- :restore_command => "/usr/local/bin/openstreetmap-wal-e --terse wal-fetch %f %p"
+ :restore_command => "/usr/local/bin/openstreetmap-wal-g wal-fetch %f %p"
}
}
}
}
}
},
- :nfs => {
- "/store/rails" => { :host => "ironbelly", :path => "/store/rails" }
- },
:postgresql => {
:settings => {
:defaults => {
:listen_addresses => "*",
- :max_connections => "1000",
+ :max_connections => "1500",
:max_stack_depth => "7MB",
:checkpoint_segments => "32",
:max_wal_size => "1536MB",
:log_min_duration_statement => "1000",
:late_authentication_rules => [
{ :address => "10.0.32.0/20" },
- { :address => "10.0.48.0/20" }
+ { :address => "10.0.48.0/20" },
+ { :address => "10.0.64.0/20" }
]
}
}
}
}
)
-
-run_list(
- "recipe[nfs]"
-)
:accounts => {
:users => {
:edgemaster => { :status => :administrator },
- :emacsen => { :status => :administrator },
+ :emacsen => { :status => :user },
:twain => { :status => :user },
:bretth => { :status => :user },
:richard => { :status => :user },
:gregrs => { :status => :user },
:stereo => { :status => :user },
:dmlu => { :status => :user },
+ :antonkh => { :status => :user },
:ooc => {
:status => :role,
:members => [:tomh, :blackadder, :timsc, :ollie]
:microcosms => {
:repository => "https://github.com/openbrian/osm-microcosms.git",
:revision => "microcosms"
- },
- :upload => {
- :repository => "https://git.openstreetmap.org/public/rails.git",
- :revision => "master",
- :cgimap_repository => "https://github.com/zerebubuth/openstreetmap-cgimap.git",
- :cgimap_revision => "feature/bulk_upload"
}
}
},
:postgresql => {
- :versions => ["12"],
+ :versions => ["14"],
:settings => {
:defaults => {
:max_connections => "500",
:max_stack_depth => "4MB",
:effective_cache_size => "4GB"
},
- "12" => {
+ "14" => {
:port => "5432",
:wal_level => "logical",
:max_replication_slots => "1"
"kernel.shmmax" => "17179869184"
}
}
+ },
+ :openssh => {
+ :password_authentication => true
}
)
:zelja => { :status => :administrator }
}
},
- :hardware => {
- :shm_size => "18g"
- },
:location => "Osijek, Croatia",
:networking => {
:interfaces => {
:gateway => "fe80::161:53:30:97"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "osijek.render.openstreetmap.org"
}
)
run_list(
- "role[carnet]",
- "role[tilecache]"
+ "role[carnet]"
)
}
},
:postgresql => {
- :versions => ["13"],
+ :versions => ["14"],
:settings => {
:defaults => {
- :work_mem => "300MB",
- :maintenance_work_mem => "10GB",
- :random_page_cost => "1.5",
- :effective_cache_size => "60GB",
+ :work_mem => "240MB",
:fsync => "on",
:effective_io_concurrency => "500"
}
},
:nominatim => {
:state => "standalone",
- :enable_backup => false,
- :enable_git_updates => true,
- :dbadmins => %w[lonvia tomh],
- :dbcluster => "13/main",
+ :dbcluster => "14/main",
:postgis => "3",
:flatnode_file => "/ssd/nominatim/nodes.store",
- :logdir => "/ssd/nominatim/log",
- :tablespaces => {
- "dosm" => "/ssd/tablespaces/dosm",
- "iosm" => "/ssd/tablespaces/iosm",
- "dplace" => "/ssd/tablespaces/dplace",
- "iplace" => "/ssd/tablespaces/iplace",
- "daddress" => "/ssd/tablespaces/daddress",
- "iaddress" => "/ssd/tablespaces/iaddress",
- "dsearch" => "/ssd/tablespaces/dsearch",
- "isearch" => "/ssd/tablespaces/isearch",
- "daux" => "/ssd/tablespaces/daux",
- "iaux" => "/ssd/tablespaces/iaux"
- }
+ :logdir => "/ssd/nominatim/log"
}
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[nominatim]"
)
-name "equinix"
-description "Role applied to all servers at Equinix"
+name "equinix-ams"
+description "Role applied to all servers at Equinix Amsterdam"
default_attributes(
:networking => {
:prefix => "64",
:gateway => "2001:978:2:2C::172:1",
:routes => {
+ "2001:470:1:b3b::/64" => { :type => "unreachable" },
"2001:978:2:2c::/64" => { :type => "unreachable" },
"2001:4860::/32" => { :type => "unreachable" },
"2a00:1450:4000::/37" => { :type => "unreachable" }
}
},
:web => {
- :backends => %w[rails1 rails2 rails3],
:fileserver => "ironbelly",
:readonly_database_host => "snap-01.ams.openstreetmap.org",
:primary_cluster => true
override_attributes(
:networking => {
- :nameservers => ["66.28.0.45", "66.28.0.61"],
+ :nameservers => ["10.0.48.10", "8.8.8.8", "8.8.4.4"],
:search => ["ams.openstreetmap.org", "openstreetmap.org"]
},
:ntp => {
--- /dev/null
+name "equinix-dub"
+description "Role applied to all servers at Equinix Dublin"
+
+default_attributes(
+ :sysctl => {
+ :enable_bbr_10g => {
+ :comment => "Enable BBR. Equinix Dub has 10G uplink unlikely to buffer overrun",
+ :parameters => {
+ "net.ipv4.tcp_congestion_control" => "bbr",
+ "net.ipv4.tcp_notsent_lowat" => "16384"
+ }
+ }
+ },
+ :networking => {
+ :roles => {
+ :internal => {
+ :inet => {
+ :prefix => "20",
+ :gateway => "10.0.64.2",
+ :routes => {
+ "10.0.0.0/8" => { :via => "10.0.64.2" }
+ }
+ }
+ },
+ :external => {
+ :zone => "dub",
+ :inet => {
+ :prefix => "27",
+ :gateway => "184.104.226.97"
+ },
+ :inet6 => {
+ :prefix => "64",
+ :gateway => "2001:470:1:b3b::1",
+ :routes => {
+ "2001:978:2:2c::/64" => { :type => "unreachable" }
+ }
+ }
+ }
+ }
+ },
+ :web => {
+ :fileserver => "fafnir",
+ :readonly_database_host => "snap-03.dub.openstreetmap.org"
+ }
+)
+
+override_attributes(
+ :networking => {
+ :nameservers => ["10.0.64.2", "8.8.8.8", "8.8.4.4"],
+ :search => ["dub.openstreetmap.org", "openstreetmap.org"]
+ },
+ :ntp => {
+ :servers => ["0.ie.pool.ntp.org", "1.ie.pool.ntp.org", "europe.pool.ntp.org"]
+ }
+)
+
+run_list(
+ "role[ie]"
+)
run_list(
"role[ucl]",
"role[hp-dl360-g6]",
- "role[piwik]"
+ "role[matomo]"
)
description "Master role applied to fafnir"
default_attributes(
- :hardware => {
- :shm_size => "36g"
+ :bind => {
+ :clients => "equinix-dub"
+ },
+ :dhcpd => {
+ :first_address => "10.0.79.1",
+ :last_address => "10.0.79.254"
},
:networking => {
:interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.2",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
:external_ipv4 => {
- :interface => "enp3s0f0",
+ :interface => "bond0.101",
:role => :external,
:family => :inet,
- :address => "130.239.18.114",
- :prefix => "27",
- :gateway => "130.239.18.97"
+ :address => "184.104.226.98"
},
:external_ipv6 => {
- :interface => "enp3s0f0",
+ :interface => "bond0.101",
:role => :external,
:family => :inet6,
- :address => "2001:6b0:e:2a18::114",
- :prefix => "64",
- :gateway => "fe80::5a97:bdff:fe79:dbc0"
+ :address => "2001:470:1:b3b::2"
}
}
},
- :squid => {
- :version => 4,
- :cache_mem => "32768 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "sweden.render.openstreetmap.org"
+ :prometheus => {
+ :snmp => {
+ "pdu1" => { :address => "10.0.64.100", :modules => %w[apcups], :labels => { "site" => "dublin" } },
+ "pdu2" => { :address => "10.0.64.101", :modules => %w[apcups], :labels => { "site" => "dublin" } },
+ "switch1" => { :address => "184.104.226.97", :modules => %w[if_mib juniper_ex4300], :labels => { "site" => "dublin" } }
+ },
+ :metrics => {
+ :uplink_interface => {
+ :help => "Site uplink interface name",
+ :labels => { :site => "dublin", :name => "ae50" }
+ }
+ }
}
)
run_list(
- "role[umu]",
- "role[tilecache]"
+ "role[equinix-dub]",
+ "role[hp-g9]",
+ "role[gateway]",
+ "recipe[dhcpd]"
)
+++ /dev/null
-name "faimaison"
-description "Role applied to all servers at FAImaison"
-
-default_attributes(
- :hosted_by => "FAImaison",
- :location => "France"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.fr.pool.ntp.org", "1.fr.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[fr]"
-)
+++ /dev/null
-name "ffrl"
-description "Role applied to all servers at Freifunk Rheinland"
-
-default_attributes(
- :hosted_by => "Freifunk Rheinland",
- :location => "Berlin, Germany"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.de.pool.ntp.org", "1.de.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[de]"
-)
description "Master role applied to firnen"
default_attributes(
- :hardware => {
- :shm_size => "36g"
- },
:networking => {
:interfaces => {
:external_ipv4 => {
:gateway => "188.241.28.81"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "32768 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "germany.render.openstreetmap.org"
}
)
run_list(
- "role[epix]",
- "role[tilecache]"
+ "role[epix]"
)
:innodb_buffer_pool_size => "512M",
:key_buffer_size => "64M",
:max_connections => "200",
- :query_cache_size => "48M",
- :query_cache_type => "1",
:sort_buffer_size => "8M",
:tmp_table_size => "48M"
}
+++ /dev/null
-name "fume"
-description "Master role applied to fume"
-
-default_attributes(
- :hardware => {
- :shm_size => "6g"
- },
- :networking => {
- :hostname => "seshat.civ.zcu.cz",
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens3",
- :role => :external,
- :family => :inet,
- :address => "147.228.60.16",
- :prefix => "24",
- :gateway => "147.228.60.1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "4096 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "czechia.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[zcu]",
- "role[tilecache]"
-)
--- /dev/null
+name "gorwen"
+description "Master role applied to gorwen"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.11",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 ens1f0 ens1f1]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.107"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::b"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-dl360e-g8]",
+ "role[overpass-query]"
+)
+++ /dev/null
-name "gorynych"
-description "Master role applied to gorynych"
-
-default_attributes(
- :hardware => {
- :ipmi => {
- :excluded_sensors => [3, 4]
- },
- :shm_size => "20g"
- },
- :munin => {
- :plugins => {
- :smart_sdc => {
- :smartctl_exit_status => { :warning => ":8" }
- },
- :smart_sdd => {
- :smartctl_exit_status => { :warning => ":8" }
- }
- }
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth1",
- :role => :external,
- :family => :inet,
- :address => "5.45.248.21",
- :prefix => "30",
- :gateway => "5.45.248.22"
- },
- :external_ipv6 => {
- :interface => "eth1",
- :role => :external,
- :family => :inet6,
- :address => "2a02:6b8:b010:5065::a001",
- :prefix => "64",
- :gateway => "2a02:6b8:b010:5065::1"
- }
- }
- },
- :sysfs => {
- :md_tune => {
- :comment => "Tune the md sync performance so as not to kill system performance",
- :parameters => {
- "block/md0/md/sync_speed_min" => "1",
- "block/md0/md/sync_speed_max" => "100000"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :directory => "/store/nginx-cache/proxy-cache",
- :max_size => "32768M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "moscow.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[yandex]",
- "role[tilecache]"
-)
--- /dev/null
+name "hp-dl360e-g8"
+description "Role applied to all HP DL360e G8 machines"
+
+default_attributes(
+ :munin => {
+ :plugins => {
+ :hpasmcli2_temp => {
+ :temp15 => { :warning => 68, :critical => 80 },
+ :temp16 => { :warning => 68, :critical => 80 }
+ }
+ }
+ }
+)
+++ /dev/null
-name "greenmini"
-description "Role applied to all servers at greenminihost"
-
-default_attributes(
- :accounts => {
- :users => {
- :joris => { :status => :administrator }
- }
- },
- :hosted_by => "greenminihost",
- :location => "Dronten, Netherlands"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["45.148.169.130", "185.200.102.102", "2a0a:aa42:222:2500::2500", "2a0a:aa42:321:2000::53"]
- },
- :ntp => {
- :servers => ["0.nl.pool.ntp.org", "1.nl.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[nl]"
-)
+++ /dev/null
-name "grifon"
-description "Role applied to all servers at Grifon"
-
-default_attributes(
- :accounts => {
- :users => {
- :alarig => { :status => :administrator },
- :gizmo => { :status => :administrator },
- :nemo => { :status => :administrator }
- }
- },
- :hosted_by => "Grifon",
- :location => "Rennes, France",
- :munin => {
- :allow => ["2a00:5884::8"]
- },
- :networking => {
- :firewall => {
- :inet6 => [
- {
- :action => "ACCEPT",
- :source => "net:[2a00:5884::8]",
- :dest => "fw",
- :proto => "tcp",
- :dest_ports => "munin",
- :source_ports => "1024:",
- :rate_limit => "-",
- :connection_limit => "-"
- }
- ]
- }
- }
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.fr.pool.ntp.org", "1.fr.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[fr]"
-)
"role[bytemark]",
"role[hp-dl180-g6]",
"role[gateway]",
- "role[web-storage]",
"role[backup]",
"role[planet]"
# "role[planetdump]"
+++ /dev/null
-name "grnet"
-description "Role applied to all servers at GRNET"
-
-default_attributes(
- :accounts => {
- :users => {
- :grnet => { :status => :administrator }
- }
- },
- :hosted_by => "GRNET",
- :location => "Athens, Greece"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.gr.pool.ntp.org", "1.gr.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[gr]"
-)
+++ /dev/null
-name "hetzner"
-description "Role applied to all servers at Hetzner"
-
-default_attributes(
- :hosted_by => "Hetzner"
-)
-
-override_attributes(
- :networking => {
- :nameservers => [
- "213.133.98.98",
- "213.133.99.99",
- "213.133.100.100",
- "2a01:4f8:0:a111::add:9898",
- "2a01:4f8:0:a102::add:9999",
- "2a01:4f8:0:a0a1::add:1010"
- ]
- },
- :ntp => {
- :servers => ["0.de.pool.ntp.org", "1.de.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[de]"
-)
--- /dev/null
+name "horntail"
+description "Master role applied to horntail"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.10",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[enp25s0f0 enp25s0f1]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.106"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::a"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[geodns]",
+ "role[planet]"
+)
description "Role applied to all HP DL180 G6 machines"
default_attributes(
+ :hardware => {
+ :blacklisted_modules => %w[acpi_power_meter]
+ },
:munin => {
:plugins => {
:hpasmcli2_fans => {
- :fan1 => { :warning => "90", :critical => "100" },
- :fan2 => { :warning => "90", :critical => "100" },
- :fan3 => { :warning => "90", :critical => "100" },
- :fan4 => { :warning => "90", :critical => "100" }
+ :fan1 => { :warning => "98", :critical => "100" },
+ :fan2 => { :warning => "98", :critical => "100" },
+ :fan3 => { :warning => "98", :critical => "100" },
+ :fan4 => { :warning => "98", :critical => "100" }
},
:hpasmcli2_temp => {
:temp3 => { :warning => "80.0", :critical => "85" }
description "Role applied to all HP DL360 G6 machines"
default_attributes(
+ :hardware => {
+ :blacklisted_modules => %w[acpi_power_meter]
+ },
:munin => {
:plugins => {
:hpasmcli2_fans => {
--- /dev/null
+name "idris"
+description "Master role applied to idris"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.6",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.102"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::6"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-g9]"
+)
:users => {
:dmlu => { :status => :user },
:htonl => { :status => :user },
- :stereo => { :status => :user },
+ :stereo => { :status => :administrator },
:imagery => {
:status => :role,
:members => [:grant, :tomh, :dmlu, :htonl, :stereo ]
:parameters => {
"net.core.somaxconn" => 10000
}
- },
- :kernel_scheduler_tune => {
- :comment => "Tune kernel scheduler preempt",
- :parameters => {
- "kernel.sched_min_granularity_ns" => 10000000,
- "kernel.sched_wakeup_granularity_ns" => 15000000
- }
}
},
:nginx => {
:sources => ["ubuntugis-unstable"]
},
:bind => {
- :clients => "equinix"
+ :clients => "equinix-ams"
},
:dhcpd => {
:first_address => "10.0.63.1",
},
:prometheus => {
:snmp => {
- "pdu1" => { :address => "10.0.48.100", :module => "apcups", :labels => { "site" => "amsterdam" } },
- "pdu2" => { :address => "10.0.48.101", :module => "apcups", :labels => { "site" => "amsterdam" } },
- "switch1" => { :address => "130.117.76.2", :module => "if_mib", :labels => { "site" => "amsterdam" } }
+ "pdu1" => { :address => "10.0.48.100", :modules => %w[apcups], :labels => { "site" => "amsterdam" } },
+ "pdu2" => { :address => "10.0.48.101", :modules => %w[apcups], :labels => { "site" => "amsterdam" } },
+ "switch1" => { :address => "130.117.76.2", :modules => %w[if_mib cisco_550x], :labels => { "site" => "amsterdam" } }
+ },
+ :metrics => {
+ :uplink_interface => {
+ :help => "Site uplink interface name",
+ :labels => { :site => "amsterdam", :name => "te[12]/0/1" }
+ }
}
},
:rsyncd => {
:transfer_logging => false,
:hosts_allow => [
"193.60.236.0/24", # ucl external
- "10.0.48.0/20", # equinix internal
- "130.117.76.0/27", # equinix external
- "2001:978:2:2C::172:0/112", # equinix external
+ "10.0.48.0/20", # amsterdam internal
+ "130.117.76.0/27", # amsterdam external
+ "2001:978:2:2C::172:0/112", # amsterdam external
+ "10.0.64.0/20", # dublin internal
+ "184.104.226.96/27", # dublin external
+ "2001:470:1:b3b::/64", # dublin external
"10.0.32.0/20", # bytemark internal
"89.16.162.16/28", # bytemark external
"2001:41c9:2:d6::/64", # bytemark external
"127.0.0.0/8", # localhost
"::1" # localhost
- ],
- :nodes_allow => "roles:tilecache"
+ ]
}
}
}
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[gateway]",
- "role[web-storage]",
"role[supybot]",
"role[backup]",
"role[planet]",
+++ /dev/null
-name "iway"
-description "Role applied to all servers at iWay"
-
-default_attributes(
- :accounts => {
- :users => {
- :cramer => { :status => :administrator }
- }
- },
- :hosted_by => "iWay",
- :location => "Zurich, Switzerland",
- :networking => {
- :firewall => {
- :inet => [
- {
- :action => "ACCEPT",
- :source => "net:212.25.24.64/28",
- :dest => "fw",
- :proto => "udp",
- :dest_ports => "snmp",
- :source_ports => "1024:",
- :rate_limit => "-",
- :connection_limit => "-"
- }
- ]
- }
- }
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.ch.pool.ntp.org", "1.ch.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[ch]"
-)
--- /dev/null
+name "jakelong"
+description "Master role applied to jakelong"
+
+default_attributes(
+ :dhcpd => {
+ :first_address => "10.0.78.1",
+ :last_address => "10.0.78.254"
+ },
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.12",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 ens1f0 ens1f1]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.108"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::c"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-dl360e-g8]",
+ "role[community]",
+ "recipe[dhcpd]"
+)
+++ /dev/null
-name "jump"
-description "Role applied to all servers at Jump Networks"
-
-default_attributes(
- :hosted_by => "Jump Networks",
- :location => "London, England"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["185.73.44.3", "2001:ba8:0:2c02::", "2001:ba8:0:2c03::", "2001:ba8:0:2c04::"]
- },
- :ntp => {
- :servers => ["0.uk.pool.ntp.org", "1.uk.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[gb]"
-)
+++ /dev/null
-name "kalessin"
-description "Master role applied to kalessin"
-
-default_attributes(
- :hardware => {
- :shm_size => "20g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens3",
- :role => :external,
- :family => :inet,
- :address => "185.66.195.245",
- :prefix => "28",
- :gateway => "185.66.195.241"
- },
- :external_ipv6 => {
- :interface => "ens3",
- :role => :external,
- :family => :inet6,
- :address => "2a03:2260:2000:1::5",
- :prefix => "64",
- :gateway => "2a03:2260:2000:1::1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :keys_zone => "proxy_cache_zone:64M",
- :max_size => "2048M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "germany.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[ffrl]",
- "role[tilecache]"
-)
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[db-slave]"
)
+++ /dev/null
-name "keizer"
-description "Master role applied to keizer"
-
-default_attributes(
- :hardware => {
- :shm_size => "12g"
- },
- :location => "Nuremberg, Germany",
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet,
- :address => "195.201.226.63",
- :prefix => "32",
- :gateway => "172.31.1.1"
- },
- :external_ipv6 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet6,
- :address => "2a01:4f8:1c1c:bc54::1",
- :prefix => "64",
- :gateway => "fe80::1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "8192 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "germany.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[hetzner]",
- "role[tilecache]"
-)
+++ /dev/null
-name "kokosnuss"
-description "Master role applied to kokosnuss"
-
-default_attributes(
- :hardware => {
- :shm_size => "12g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "venet0",
- :role => :external,
- :family => :inet,
- :address => "85.214.255.86",
- :prefix => "32",
- :gateway => "85.214.255.86"
- }
- },
- :wireguard => {
- :enabled => false
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "8192 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "germany.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[strato]",
- "role[tilecache]"
-)
--- /dev/null
+name "konqi"
+description "Master role applied to konqi"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.7",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.103"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::7"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-g9]"
+)
+++ /dev/null
-name "ladon"
-description "Master role applied to ladon"
-
-default_attributes(
- :hardware => {
- :shm_size => "36g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "bond0",
- :role => :external,
- :family => :inet,
- :address => "83.212.2.116",
- :prefix => "29",
- :gateway => "83.212.2.113",
- :bond => {
- :mode => "802.3ad",
- :miimon => "100",
- :xmithashpolicy => "layer3+4",
- :slaves => %w[ens1f0 ens1f1]
- }
- },
- :external_ipv6 => {
- :interface => "bond0",
- :role => :external,
- :family => :inet6,
- :address => "2001:648:2ffe:4::116",
- :prefix => "64",
- :gateway => "2001:648:2ffe:4::1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "32768 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "athens.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[grnet]",
- "role[tilecache]"
-)
--- /dev/null
+name "lockheed"
+description "Master role applied to lockheed"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.48.16",
+ :bond => {
+ :slaves => %w[eth0 eth1]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.2",
+ :role => :external,
+ :family => :inet,
+ :address => "130.117.76.16"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.2",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:978:2:2C::172:10"
+ }
+
+ }
+ }
+)
+
+run_list(
+ "role[equinix-ams]",
+ "role[subversion]",
+ "role[trac]",
+ "role[irc]",
+ "recipe[blogs]"
+)
default_attributes(
:apt => {
- :sources => ["elasticsearch6.x"]
+ :sources => ["elasticsearch8.x"]
}
)
description "Master role applied to longma"
default_attributes(
- :exim => {
- :aliases => {
- :root => "ceasar"
- }
- },
- :hardware => {
- :shm_size => "20g"
- },
:networking => {
:interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.13",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[enp68s0f0 enp68s0f1 enp68s0f2 enp68s0f3]
+ }
+ },
:external_ipv4 => {
- :interface => "ens160",
+ :interface => "bond0.101",
:role => :external,
:family => :inet,
- :address => "140.110.240.7",
- :prefix => "24",
- :gateway => "140.110.240.254"
+ :address => "184.104.226.109"
},
:external_ipv6 => {
- :interface => "ens160",
+ :interface => "bond0.101",
:role => :external,
:family => :inet6,
- :address => "2001:e10:2000:240::7",
- :prefix => "64",
- :gateway => "2001:e10:2000:240::254"
+ :address => "2001:470:1:b3b::d"
}
}
},
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store.new-san/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store.new-san/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store.new-san/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store.new-san/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :directory => "/store.new-san/nginx-cache/proxy-cache",
- :max_size => "65536M"
+ :postgresql => {
+ :versions => ["14"],
+ :settings => {
+ :defaults => {
+ :max_connections => "550",
+ :work_mem => "240MB",
+ :fsync => "on",
+ :effective_io_concurrency => "500"
}
}
},
- :tilecache => {
- :tile_parent => "hsinchu.render.openstreetmap.org"
+ :nominatim => {
+ :state => "standalone",
+ :dbcluster => "14/main",
+ :postgis => "3",
+ :enable_qa_tiles => true,
+ :flatnode_file => "/ssd/nominatim/nodes.store",
+ :logdir => "/ssd/nominatim/log",
+ :fpm_pools => {
+ "nominatim.openstreetmap.org" => {
+ :max_children => 200
+ }
+ }
}
)
run_list(
- "role[nchc]",
- "role[tilecache]"
+ "role[equinix-dub]",
+ "role[nominatim]"
)
+++ /dev/null
-name "lysator"
-description "Role applied to all servers at Lysator"
-
-default_attributes(
- :accounts => {
- :users => {
- :aoh => { :status => :administrator },
- :lysroot => { :status => :administrator }
- }
- },
- :hosted_by => "Lysator",
- :location => "Linköping, Sweden"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["130.236.254.225", "2001:6b0:17:f0a0::e1", "130.236.254.4"]
- },
- :ntp => {
- :servers => ["0.se.pool.ntp.org", "1.se.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[se]"
-)
"a.mx.openstreetmaps.org",
"a.mx.osm.io"
],
- :queue_run_max => 5,
+ :queue_run_max => 25,
+ :smtp_accept_max => 200,
:smarthost_name => "mail.openstreetmap.org",
:smarthost_via => false,
- :dns_blacklists => ["zen.spamhaus.org"],
+ :dns_blacklists => ["zen.spamhaus.org!&0.255.255.0"],
:routes => {
:messages => {
:comment => "messages.openstreetmap.org",
:comment => "join.osmfoundation.org",
:domains => ["join.osmfoundation.org"],
:host => "ridley.ucl.openstreetmap.org"
+ },
+ :community => {
+ :comment => "community.openstreetmap.org",
+ :domains => ["community.openstreetmap.org"],
+ :host => "jakelong.dub.openstreetmap.org::2500"
}
},
:dkim_selectors => {
}
}
}
+ },
+ :prometheus => {
+ :metrics => {
+ :exim_queue_limit => { :metric => 250 }
+ }
}
)
-name "piwik"
-description "Role applied to all Piwik servers"
+name "matomo"
+description "Role applied to all Matomo servers"
default_attributes(
:apache => {
)
run_list(
- "recipe[piwik]"
+ "recipe[matomo]"
)
description "Master role applied to meraxes"
default_attributes(
- :hardware => {
- :shm_size => "36g"
- },
:networking => {
:interfaces => {
:external_ipv4 => {
:gateway => "2001:bc8:2::2:258:1"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "32768 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "france.render.openstreetmap.org"
}
)
run_list(
- "role[scaleway]",
- "role[tilecache]"
+ "role[scaleway]"
)
+++ /dev/null
-name "milkywan"
-description "Role applied to all servers at MilkyWan"
-
-default_attributes(
- :accounts => {
- :users => {
- :milkywan => { :status => :administrator }
- }
- },
- :hosted_by => "MilkyWan",
- :location => "Paris, France",
- :networking => {
- :firewall => {
- :inet => [
- {
- :action => "ACCEPT",
- :source => "net:212.25.24.64/28",
- :dest => "fw",
- :proto => "udp",
- :dest_ports => "snmp",
- :source_ports => "1024:",
- :rate_limit => "-",
- :connection_limit => "-"
- }
- ]
- }
- }
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.fr.pool.ntp.org", "1.fr.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[fr]"
-)
name "munin"
description "Role applied to all munin servers"
-default_attributes(
- :munin => {
- :plugins => {
- :munin_update => {
- :contacts => "null"
- }
- }
- }
-)
-
run_list(
"recipe[munin::server]"
)
description "Master role applied to naga"
default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
:networking => {
:interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.8",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
:external_ipv4 => {
- :interface => "ens18",
+ :interface => "bond0.101",
:role => :external,
:family => :inet,
- :address => "45.13.104.40",
- :prefix => "32",
- :gateway => "10.0.4.1"
+ :address => "184.104.226.104"
},
:external_ipv6 => {
- :interface => "ens18",
+ :interface => "bond0.101",
:role => :external,
:family => :inet6,
- :address => "2a0b:cbc0:1101:1::41",
- :prefix => "64",
- :gateway => "2a0b:cbc0:1101:1::1"
+ :address => "2001:470:1:b3b::8"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "france.render.openstreetmap.org"
}
)
run_list(
- "role[milkywan]",
- "role[tilecache]"
+ "role[equinix-dub]",
+ "role[hp-g9]"
)
+++ /dev/null
-name "nchc"
-description "Role applied to all servers at NCHC"
-
-default_attributes(
- :accounts => {
- :users => {
- :steven => { :status => :administrator },
- :ceasar => { :status => :administrator }
- }
- },
- :hosted_by => "NCHC",
- :location => "Hsinchu, Taiwan",
- :networking => {
- :wireguard => { :keepalive => 180 }
- }
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["140.110.16.1", "140.110.4.1"]
- },
- :ntp => {
- :servers => ["0.tw.pool.ntp.org", "1.tw.pool.ntp.org", "asia.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[tw]"
-)
+++ /dev/null
-name "neak"
-description "Master role applied to neak"
-
-default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens18",
- :role => :external,
- :family => :inet,
- :address => "89.234.177.142",
- :prefix => "26",
- :gateway => "89.234.177.129"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "france.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[faimaison]",
- "role[tilecache]"
-)
}
}
},
- :postgresql => {
- :settings => {
- :defaults => {
- :shared_buffers => "8GB",
- :maintenance_work_mem => "7144MB",
- :effective_cache_size => "16GB"
- }
- }
- },
- :sysctl => {
- :postgres => {
- :comment => "Increase shared memory for postgres",
+ :sysfs => {
+ :hdd_tune => {
+ :comment => "Tune the queue for improved performance",
:parameters => {
- "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
- "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
- }
- }
- },
- :tile => {
- :database => {
- :cluster => "12/main",
- :postgis => "3"
- },
- :styles => {
- :default => {
- :tile_directories => [
- { :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
- ]
+ "block/sda/queue/nr_requests" => "975",
+ "block/sdb/queue/rotational" => "0"
}
}
}
)
run_list(
- "role[appliwave]",
- "role[tile]"
+ "role[appliwave]"
)
description "Master role applied to nepomuk"
default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
:networking => {
:firewall => {
:inet => [
}
}
},
- :sysctl => {
- :kvm => {
- :comment => "Tuning for KVM guest",
- :parameters => {
- "kernel.sched_min_granularity_ns" => 10000000,
- "kernel.sched_wakeup_granularity_ns" => 15000000
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
:sysfs => {
:hdd_tune => {
:comment => "Tune the queue for improved performance",
"block/vda/queue/nr_requests" => "128"
}
}
- },
- :tilecache => {
- :tile_parent => "france.render.openstreetmap.org"
}
)
run_list(
- "role[lyonix]",
- "role[tilecache]"
+ "role[lyonix]"
)
description "Master role applied to nidhogg"
default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
:networking => {
:interfaces => {
- :external_ipv4 => {
- :interface => "ens18",
+ :internal_ipv4 => {
+ :interface => "bond0",
:role => :external,
:family => :inet,
- :address => "130.236.254.221",
- :prefix => "24",
- :gateway => "130.236.254.1"
+ :address => "194.71.11.111",
+ :prefix => "25",
+ :gateway => "194.71.11.1",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[enp68s0f0 enp68s0f1 enp68s0f2 enp68s0f3]
+ }
},
:external_ipv6 => {
- :interface => "ens18",
+ :interface => "bond0",
:role => :external,
:family => :inet6,
- :address => "2001:6b0:17:f0a0::dd",
+ :address => "2001:6b0:19:2::111",
:prefix => "64",
- :gateway => "2001:6b0:17:f0a0::1"
+ :gateway => "2001:6b0:19:2::1"
+ }
+ }
+ },
+ :postgresql => {
+ :settings => {
+ :defaults => {
+ :shared_buffers => "8GB",
+ :maintenance_work_mem => "7144MB",
+ :effective_cache_size => "16GB"
}
}
},
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
+ :sysctl => {
+ :postgres => {
+ :comment => "Increase shared memory for postgres",
+ :parameters => {
+ "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
+ "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
+ }
+ }
},
- :tilecache => {
- :tile_parent => "sweden.render.openstreetmap.org"
+ :tile => {
+ :database => {
+ :cluster => "14/main",
+ :postgis => "3"
+ },
+ :mapnik => "3.1",
+ :styles => {
+ :default => {
+ :tile_directories => [
+ { :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
+ ]
+ }
+ }
}
)
run_list(
- "role[lysator]",
- "role[tilecache]"
+ "role[umu]",
+ "role[tile]"
)
:accounts => {
:users => {
:lonvia => { :status => :administrator },
- :twain => { :status => :administrator },
:nominatim => {
:status => :role,
- :members => [:lonvia, :tomh, :twain]
+ :members => [:lonvia, :tomh]
}
}
},
- :apache => {
- :mpm => "event",
- :timeout => 30,
- :keepalive => false,
- :reqtimeout => true,
- :event => {
- :server_limit => 100,
- :max_request_workers => 2400,
- :threads_per_child => 50,
- :min_spare_threads => 125,
- :max_spare_threads => 925,
- :async_request_worker_factor => 4,
- :listen_cores_buckets_ratio => 6
- }
- },
:networking => {
:firewall => {
:http_rate_limit => "s:2/sec:15"
:checkpoint_segments => "32",
:checkpoint_timeout => "10min",
:checkpoint_completion_target => "0.9",
+ :jit => "off",
:shared_buffers => "2GB",
- :autovacuum_max_workers => "1"
+ :autovacuum_max_workers => "1",
+ :max_parallel_workers_per_gather => "0",
+ :maintenance_work_mem => "10GB",
+ :random_page_cost => "1.5",
+ :effective_cache_size => "60GB"
}
}
},
"kernel.shmall" => 26 * 1024 * 1024 * 1024 / 4096
}
},
- :kernel_scheduler_tune => {
- :comment => "Tune kernel scheduler preempt",
- :parameters => {
- "kernel.sched_min_granularity_ns" => 10000000,
- "kernel.sched_wakeup_granularity_ns" => 15000000
- }
- },
:swappiness => {
:comment => "Reduce swap usage",
:parameters => {
"net.netfilter.nf_conntrack_max" => "196608"
}
}
+ },
+ :nominatim => {
+ :dbadmins => %w[lonvia tomh],
+ :tablespaces => {
+ "dosm" => "/ssd/tablespaces/dosm",
+ "iosm" => "/ssd/tablespaces/iosm",
+ "dplace" => "/ssd/tablespaces/dplace",
+ "iplace" => "/ssd/tablespaces/iplace",
+ "daddress" => "/ssd/tablespaces/daddress",
+ "iaddress" => "/ssd/tablespaces/iaddress",
+ "dsearch" => "/ssd/tablespaces/dsearch",
+ "isearch" => "/ssd/tablespaces/isearch",
+ "daux" => "/ssd/tablespaces/daux",
+ "iaux" => "/ssd/tablespaces/iaux"
+ }
}
)
description "Master role applied to norbert"
default_attributes(
- :hardware => {
- :shm_size => "12g"
- },
:networking => {
:interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.48.17",
+ :bond => {
+ :slaves => %w[enp25s0f0 enp25s0f1]
+ }
+ },
:external_ipv4 => {
- :interface => "ens18",
+ :interface => "bond0.2",
:role => :external,
:family => :inet,
- :address => "89.234.186.100",
- :prefix => "27",
- :gateway => "89.234.186.97"
+ :address => "130.117.76.17"
},
:external_ipv6 => {
- :interface => "ens18",
+ :interface => "bond0.2",
:role => :external,
:family => :inet6,
- :address => "2a00:5884:821c::1",
- :prefix => "48",
- :gateway => "fe80::204:92:100:1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :keys_zone => "proxy_cache_zone:64M",
- :max_size => "2048M"
+ :address => "2001:978:2:2C::172:11"
}
+
}
- },
- :tilecache => {
- :tile_parent => "france.render.openstreetmap.org"
}
)
run_list(
- "role[grifon]",
- "role[tilecache]"
+ "role[equinix-ams]",
+ "role[geodns]",
+ "role[planet]"
)
},
:tile => {
:database => {
- :cluster => "12/main",
+ :cluster => "14/main",
:postgis => "3"
},
+ :mapnik => "3.1",
:styles => {
:default => {
:tile_directories => [
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[tile]"
)
+++ /dev/null
-name "orm"
-description "Master role applied to orm"
-
-default_attributes(
- :devices => {
- :arecavoltune => {
- :comment => "Tune scheduler for Areca",
- :type => "block",
- :bus => "scsi",
- :serial => "2001b4d20*",
- :attrs => {
- "queue/scheduler" => "deadline",
- "queue/nr_requests" => "512",
- "queue/read_ahead_kb" => "2048"
- }
- }
- },
- :networking => {
- :interfaces => {
- :internal_ipv4 => {
- :interface => "bond0",
- :role => :internal,
- :family => :inet,
- :address => "10.0.48.3",
- :bond => {
- :slaves => %w[eth0 eth1]
- }
- },
- :external_ipv4 => {
- :interface => "bond0.2",
- :role => :external,
- :family => :inet,
- :address => "130.117.76.3"
- },
- :external_ipv6 => {
- :interface => "bond0.2",
- :role => :external,
- :family => :inet6,
- :address => "2001:978:2:2C::172:3"
- }
- }
- },
- :sysctl => {
- :postgres => {
- :comment => "Increase shared memory for postgres",
- :parameters => {
- "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
- "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
- }
- }
- }
-)
-
-run_list(
- "role[equinix]",
- "role[tyan-s7010]"
-)
:group => "www-data",
:home_directory => "/opt/otrs"
},
+ :otrs_communications => {
+ :comment => "communications@otrs.openstreetmap.org",
+ :domains => ["otrs.openstreetmap.org"],
+ :local_parts => ["communications"],
+ :command => "/opt/otrs/bin/otrs.Console.pl Maint::PostMaster::Read --target-queue 'Communications Working Group'",
+ :user => "otrs",
+ :group => "www-data",
+ :home_directory => "/opt/otrs"
+ },
+ :otrs_communications_freebies => {
+ :comment => "freebies@otrs.openstreetmap.org",
+ :domains => ["otrs.openstreetmap.org"],
+ :local_parts => ["freebies"],
+ :command => "/opt/otrs/bin/otrs.Console.pl Maint::PostMaster::Read --target-queue 'Communications Working Group::Freebies'",
+ :user => "otrs",
+ :group => "www-data",
+ :home_directory => "/opt/otrs"
+ },
:otrs_support => {
:comment => "support@otrs.openstreetmap.org",
:domains => ["otrs.openstreetmap.org"],
--- /dev/null
+name "overpass-query"
+description "Role applied to overpass servers for the query feature."
+
+default_attributes(
+ :accounts => {
+ :users => {
+ :lonvia => { :status => :administrator },
+ :overpass => {
+ :status => :role,
+ :members => [:lonvia, :tomh]
+ }
+ }
+ },
+ :overpass => {
+ :fqdn => "query.openstreetmap.org",
+ :meta_mode => "no",
+ :compression_mode => "no",
+ :restricted_api => true
+ }
+)
+
+run_list(
+ "recipe[overpass::default]"
+)
description "Role applied to all planet servers"
default_attributes(
+ :apache => {
+ :mpm => "event",
+ :keepalive => true,
+ :event => {
+ :server_limit => 20,
+ :max_request_workers => 1000,
+ :threads_per_child => 50,
+ :min_spare_threads => 75,
+ :max_spare_threads => 525,
+ :listen_cores_buckets_ratio => 4
+ }
+ },
+ :networking => {
+ :firewall => {
+ :http_connection_limit => 10
+ }
+ },
+ :prometheus => {
+ :files => %w[
+ /store/planet/notes/planet-notes-latest.osn.bz2
+ /store/planet/pbf/planet-latest.osm.pbf
+ /store/planet/planet/changesets-latest.osm.bz2
+ /store/planet/planet/discussions-latest.osm.bz2
+ /store/planet/planet/planet-latest.osm.bz2
+ /store/planet/replication/changesets/state.yaml
+ /store/planet/replication/day/state.txt
+ /store/planet/replication/hour/state.txt
+ /store/planet/replication/minute/state.txt
+ ]
+ },
:rsyncd => {
:modules => {
:planet => {
:ignore_nonreadable => true,
:timeout => 3600,
:refuse_options => ["checksum"]
+ },
+ :statistics => {
+ :comment => "Statistics",
+ :path => "/store/planet/statistics",
+ :read_only => false,
+ :write_only => true,
+ :list => false,
+ :uid => "planet",
+ :gid => "planet",
+ :transfer_logging => false,
+ :nodes_allow => "roles:web-statistics"
}
}
- },
- :networking => {
- :firewall => {
- :http_connection_limit => 10
- }
- },
- :apache => {
- :mpm => "event",
- :keepalive => true,
- :event => {
- :server_limit => 20,
- :max_request_workers => 1000,
- :threads_per_child => 50,
- :min_spare_threads => 75,
- :max_spare_threads => 525,
- :listen_cores_buckets_ratio => 4
- }
}
)
"role[web-db]",
"recipe[planet]",
"recipe[planet::replication]",
- "recipe[nfs::server]",
"recipe[rsyncd]"
)
:effective_cache_size => "144GB",
:default_statistics_target => "500",
:log_autovacuum_min_duration => "0",
- :autovacuum_max_workers => "10",
- :autovacuum_naptime => "10",
+ :autovacuum_max_workers => "56",
+ :autovacuum_naptime => "1",
:autovacuum_multixact_freeze_max_age => "200000000",
:max_locks_per_transaction => "512"
}
}
},
:postgresql => {
- :versions => ["13"],
+ :versions => ["14"],
:settings => {
:defaults => {
:listen_addresses => "10.0.0.20",
:work_mem => "160MB",
- :maintenance_work_mem => "10GB",
- :random_page_cost => "1.5",
- :effective_cache_size => "60GB",
:effective_io_concurrency => "256",
:fsync => "on"
}
}
},
- :apache => {
- :event => {
- :max_request_workers => 3000,
- :threads_per_child => 70
- }
- },
:nominatim => {
:state => "standalone",
- :dbadmins => %w[lonvia tomh],
- :dbcluster => "13/main",
+ :dbcluster => "14/main",
:postgis => "3",
:enable_backup => true,
:flatnode_file => "/ssd/nominatim/nodes.store",
:tablespaces => {
- "dosm" => "/ssd/tablespaces/dosm",
- "iosm" => "/ssd/tablespaces/iosm",
- "dplace" => "/ssd/tablespaces/dplace",
- "iplace" => "/ssd/tablespaces/iplace",
- "daddress" => "/ssd/tablespaces/daddress",
- "iaddress" => "/ssd/tablespaces/iaddress",
- "dsearch" => "/ssd/tablespaces/dsearch",
- "isearch" => "/ssd/tablespaces/isearch",
"daux" => "/data/tablespaces/daux",
"iaux" => "/data/tablespaces/iaux"
}
+
}
)
},
:tile => {
:database => {
- :cluster => "12/main",
+ :cluster => "14/main",
:postgis => "3"
},
+ :mapnik => "3.1",
:styles => {
:default => {
:tile_directories => [
{ :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
]
}
+ },
+ :ratelimit => {
+ :requests_per_second => 30,
+ :maximum_backlog => 3600
}
}
)
+++ /dev/null
-name "ramoth"
-description "Master role applied to ramoth"
-
-default_attributes(
- :devices => {
- :store_openstreetmap => {
- :comment => "RAID array mounted on /store/postgresql/openstreetmap",
- :type => "block",
- :bus => "scsi",
- :serial => "3600605b00599aa401c02b4f53bf5c805",
- :attrs => {
- "queue/scheduler" => "deadline",
- "queue/nr_requests" => "975"
- }
- },
- :store_system => {
- :comment => "RAID array mounted on /store/postgresql/system",
- :type => "block",
- :bus => "scsi",
- :serial => "3600605b0039483a017092ff8fa5a6332",
- :attrs => {
- "queue/scheduler" => "deadline",
- "queue/nr_requests" => "975"
- }
- }
- },
- :hardware => {
- :watchdog => "w83627hf_wdt"
- },
- :munin => {
- :plugins => {
- :smart_sg0_33 => {
- :smartctl_exit_status => { :warning => ":8" }
- },
- :smart_sg0_34 => {
- :smartctl_exit_status => { :warning => ":8" }
- }
- }
- },
- :networking => {
- :interfaces => {
- :internal_ipv4 => {
- :interface => "bond0",
- :role => :internal,
- :family => :inet,
- :address => "10.0.48.5",
- :bond => {
- :slaves => %w[enp7s0f0 enp7s0f1]
- }
- }
- }
- }
-)
-
-run_list(
- "role[equinix]"
-)
:public_address => "161.53.248.77"
}
}
- },
- :postgresql => {
- :settings => {
- :defaults => {
- :shared_buffers => "8GB",
- :maintenance_work_mem => "7144MB",
- :effective_cache_size => "16GB"
- }
- }
- },
- :sysctl => {
- :postgres => {
- :comment => "Increase shared memory for postgres",
- :parameters => {
- "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
- "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
- }
- }
- },
- :tile => {
- :database => {
- :cluster => "12/main",
- :postgis => "3"
- },
- :styles => {
- :default => {
- :tile_directories => [
- { :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
- ]
- }
- }
}
)
run_list(
- "role[carnet]",
- "role[tile]"
+ "role[carnet]"
)
+++ /dev/null
-name "ridgeback"
-description "Master role applied to ridgeback"
-
-default_attributes(
- :hardware => {
- :ipmi => {
- :excluded_sensors => [19, 20, 21, 22]
- },
- :shm_size => "10g"
- },
- :munin => {
- :plugins => {
- :ipmi_fans => {
- :Fan4 => { :graph => "no", :warning => "0:" },
- :Fan5 => { :graph => "no", :warning => "0:" },
- :Fan6 => { :graph => "no", :warning => "0:" },
- :Fan7CPU1 => { :graph => "no", :warning => "0:" }
- },
- :smart_sda => {
- :smartctl_exit_status => {
- :warning => 8
- }
- },
- :smart_sdb => {
- :smartctl_exit_status => {
- :warning => 8
- }
- }
- }
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet,
- :address => "31.169.50.10",
- :prefix => "30",
- :gateway => "31.169.50.9"
- }
- }
- },
- :sysfs => {
- :md_tune => {
- :comment => "Tune the md sync performance so as not to kill system performance",
- :parameters => {
- "block/md0/md/sync_speed_min" => "1",
- "block/md0/md/sync_speed_max" => "100000",
- "block/md1/md/sync_speed_min" => "1",
- "block/md1/md/sync_speed_max" => "100000"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "8192 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "oslo.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[blix-no]",
- "role[geodns]",
- "role[tilecache]"
-)
:apache => {
:mpm => "event",
:event => {
- :min_spare_threads => 50,
- :max_spare_threads => 150,
- :max_connections_per_child => 10000,
- :async_request_worker_factor => 4,
- :listen_cores_buckets_ratio => 4
+ :start_servers => 12,
+ :server_limit => 48,
+ :min_spare_threads => 25,
+ :max_spare_threads => 75,
+ :max_connections_per_child => 10000
}
},
:bind => {
+++ /dev/null
-name "saphira"
-description "Master role applied to saphira"
-
-default_attributes(
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet,
- :address => "185.73.44.30",
- :prefix => "22",
- :gateway => "185.73.44.1"
- },
- :external_ipv6 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet6,
- :address => "2001:ba8:0:2c1e::",
- :prefix => "64",
- :gateway => "fe80::fcff:ffff:feff:ffff"
- }
- }
- }
-)
-
-run_list(
- "role[jump]",
- "role[geodns]"
-)
+++ /dev/null
-name "sarkany"
-description "Master role applied to sarkany"
-
-default_attributes(
- :hardware => {
- :shm_size => "8g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet,
- :address => "37.17.173.8",
- :prefix => "24",
- :gateway => "37.17.173.254"
- },
- :external_ipv6 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet6,
- :address => "2001:4c48:2:bf04:250:56ff:fe8f:5c81",
- :prefix => "64",
- :gateway => "fe80::224:14ff:fe84:5000"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "6144 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :max_size => "4096M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "budapest.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[szerverem]",
- "role[tilecache]"
-)
:gateway => "2001:41d0:2:fcff:ff:ff:ff:ff"
}
}
- },
- :postgresql => {
- :settings => {
- :defaults => {
- :shared_buffers => "8GB",
- :maintenance_work_mem => "7144MB",
- :effective_cache_size => "16GB"
- }
- }
- },
- :sysctl => {
- :postgres => {
- :comment => "Increase shared memory for postgres",
- :parameters => {
- "kernel.shmmax" => 9 * 1024 * 1024 * 1024,
- "kernel.shmall" => 9 * 1024 * 1024 * 1024 / 4096
- }
- }
- },
- :tile => {
- :database => {
- :cluster => "12/main",
- :postgis => "3"
- },
- :styles => {
- :default => {
- :tile_directories => [
- { :name => "/store/tiles/default", :min_zoom => 0, :max_zoom => 19 }
- ]
- }
- }
}
)
run_list(
- "role[ovh]",
- "role[tile]"
+ "role[ovh]"
)
override_attributes(
:networking => {
+ :dnssec => "false",
:interfaces => {
:external_ipv4 => {
:interface => "eth0",
:gateway => "fe80::1"
}
},
- :nameservers => ["1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001"],
+ :nameservers => ["89.16.162.20", "2001:41c9:2:d6::20"],
:private_address => "10.0.16.100"
}
)
"role[bytemark]",
"role[mail]",
"role[lists]",
- "role[subversion]",
- "role[trac]",
- "role[osqa]",
- "role[irc]",
- "recipe[blogs]"
+ "role[osqa]"
)
+++ /dev/null
-name "shruikan"
-description "Master role applied to shruikan"
-
-default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens18",
- :role => :external,
- :family => :inet,
- :address => "45.148.169.51",
- :prefix => "25",
- :gateway => "45.148.169.1"
- },
- :external_ipv6 => {
- :interface => "ens18",
- :role => :external,
- :family => :inet6,
- :address => "2a0a:aa42:56:1000::1",
- :prefix => "48",
- :gateway => "2a0a:aa42:56::1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 12800 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 16000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 22400 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 22800 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :max_size => "16384M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "netherlands.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[greenmini]",
- "role[tilecache]"
-)
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[db-master]",
"role[db-backup]"
)
:address => "10.0.0.4"
}
}
+ },
+ :postgresql => {
+ :settings => {
+ :defaults => {
+ :shared_buffers => "128GB",
+ :work_mem => "128MB",
+ :maintenance_work_mem => "2GB",
+ :effective_cache_size => "360GB",
+ :effective_io_concurrency => "256",
+ :random_page_cost => "1.1"
+ }
+ }
+ },
+ :sysctl => {
+ :postgres => {
+ :comment => "Increase shared memory for postgres",
+ :parameters => {
+ "kernel.shmmax" => 132 * 1024 * 1024 * 1024,
+ "kernel.shmall" => 132 * 1024 * 1024 * 1024 / 4096
+ }
+ }
}
)
run_list(
- "role[ucl]"
+ "role[ucl]",
+ "role[db-slave]"
)
--- /dev/null
+name "snap-03"
+description "Master role applied to snap-03"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.50",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[enp25s0f0 enp25s0f1]
+ }
+ }
+ }
+ },
+ :postgresql => {
+ :settings => {
+ :defaults => {
+ :shared_buffers => "128GB",
+ :work_mem => "128MB",
+ :maintenance_work_mem => "2GB",
+ :effective_cache_size => "360GB",
+ :effective_io_concurrency => "256",
+ :random_page_cost => "1.1"
+ }
+ }
+ },
+ :sysctl => {
+ :postgres => {
+ :comment => "Increase shared memory for postgres",
+ :parameters => {
+ "kernel.shmmax" => 132 * 1024 * 1024 * 1024,
+ "kernel.shmall" => 132 * 1024 * 1024 * 1024 / 4096
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[db-slave]"
+)
--- /dev/null
+name "spike-01"
+description "Master role applied to spike-01"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.3",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.99"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::3"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-g9]",
+ "role[web-frontend]"
+)
--- /dev/null
+name "spike-02"
+description "Master role applied to spike-02"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.4",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.100"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::4"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-g9]",
+ "role[web-frontend]"
+)
--- /dev/null
+name "spike-03"
+description "Master role applied to spike-03"
+
+default_attributes(
+ :networking => {
+ :interfaces => {
+ :internal_ipv4 => {
+ :interface => "bond0",
+ :role => :internal,
+ :family => :inet,
+ :address => "10.0.64.5",
+ :bond => {
+ :mode => "802.3ad",
+ :lacprate => "fast",
+ :xmithashpolicy => "layer3+4",
+ :slaves => %w[eno1 eno2 eno3 eno4 eno49 eno50]
+ }
+ },
+ :external_ipv4 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet,
+ :address => "184.104.226.101"
+ },
+ :external_ipv6 => {
+ :interface => "bond0.101",
+ :role => :external,
+ :family => :inet6,
+ :address => "2001:470:1:b3b::5"
+ }
+ }
+ }
+)
+
+run_list(
+ "role[equinix-dub]",
+ "role[hp-g9]",
+ "role[web-frontend]"
+)
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[hp-g9]",
"role[web-frontend]",
"role[web-statistics]",
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[hp-g9]",
"role[web-frontend]"
)
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[hp-g9]",
"role[web-frontend]"
)
description "Master role applied to stormfly-03"
default_attributes(
+ :munin => {
+ :plugins => {
+ :hpasmcli2_temp => {
+ :temp2 => { :warning => "68" },
+ :temp3 => { :warning => "68" }
+ },
+ :sensors_temp => {
+ :temp4 => { :warning => "98" },
+ :temp5 => { :warning => "98" },
+ :temp6 => { :warning => "98" },
+ :temp7 => { :warning => "98" },
+ :temp8 => { :warning => "98" },
+ :temp9 => { :warning => "98" },
+ :temp10 => { :warning => "98" },
+ :temp11 => { :warning => "98" },
+ :temp12 => { :warning => "98" },
+ :temp13 => { :warning => "98" },
+ :temp14 => { :warning => "98" },
+ :temp15 => { :warning => "98" },
+ :temp16 => { :warning => "98" },
+ :temp17 => { :warning => "98" },
+ :temp21 => { :warning => "98" },
+ :temp22 => { :warning => "98" },
+ :temp23 => { :warning => "98" },
+ :temp24 => { :warning => "98" },
+ :temp25 => { :warning => "98" },
+ :temp26 => { :warning => "98" },
+ :temp27 => { :warning => "98" },
+ :temp28 => { :warning => "98" },
+ :temp29 => { :warning => "98" },
+ :temp30 => { :warning => "98" },
+ :temp31 => { :warning => "98" },
+ :temp32 => { :warning => "98" },
+ :temp33 => { :warning => "98" },
+ :temp34 => { :warning => "98" }
+ }
+ }
+ },
:networking => {
:interfaces => {
:external_ipv4 => {
}
},
:private_address => "10.0.16.200"
- },
- :tilecache => {
- :tile_parent => "corvallis.render.openstreetmap.org"
}
)
}
},
:postgresql => {
- :versions => ["12"],
+ :versions => ["14"],
:settings => {
:defaults => {
:work_mem => "300MB",
- :maintenance_work_mem => "10GB",
- :random_page_cost => "1.5",
- :effective_cache_size => "60GB",
:fsync => "on",
:effective_io_concurrency => "100"
}
},
:nominatim => {
:state => "standalone",
- :enable_backup => false,
- :enable_git_updates => true,
- :dbadmins => %w[lonvia tomh],
- :dbcluster => "12/main",
- :postgis => "2.5",
+ :dbcluster => "14/main",
+ :postgis => "3",
:flatnode_file => "/ssd/nominatim/nodes.store",
:logdir => "/ssd/nominatim/log",
:fpm_pools => {
"nominatim.openstreetmap.org" => {
:max_children => 100
}
- },
- :tablespaces => {
- "dosm" => "/ssd/tablespaces/dosm",
- "iosm" => "/ssd/tablespaces/iosm",
- "dplace" => "/ssd/tablespaces/dplace",
- "iplace" => "/ssd/tablespaces/iplace",
- "daddress" => "/ssd/tablespaces/daddress",
- "iaddress" => "/ssd/tablespaces/iaddress",
- "dsearch" => "/ssd/tablespaces/dsearch",
- "isearch" => "/ssd/tablespaces/isearch",
- "daux" => "/ssd/tablespaces/daux",
- "iaux" => "/ssd/tablespaces/iaux"
}
}
)
+++ /dev/null
-name "strato"
-description "Role applied to all servers at Strato"
-
-default_attributes(
- :hosted_by => "Strato",
- :location => "Germany"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["85.214.7.22", "81.169.163.106"]
- },
- :ntp => {
- :servers => ["0.de.pool.ntp.org", "1.de.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[de]"
-)
+++ /dev/null
-name "szerverem"
-description "Role applied to all servers at szerverem.hu"
-
-default_attributes(
- :hosted_by => "szerverem.hu",
- :location => "Budapest, Hungary"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.hu.pool.ntp.org", "1.hu.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[hu]"
-)
)
run_list(
- "role[equinix]",
+ "role[equinix-ams]",
"role[hp-g9]",
"role[wiki]",
"recipe[dhcpd]"
+++ /dev/null
-name "takhisis"
-description "Master role applied to takhisis"
-
-default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens18",
- :role => :external,
- :family => :inet,
- :address => "31.3.110.20",
- :prefix => "24",
- :gateway => "31.3.110.1"
- },
- :external_ipv6 => {
- :interface => "ens18",
- :role => :external,
- :family => :inet6,
- :address => "2a03:7900:111:0:31:3:110:20",
- :prefix => "64",
- :gateway => "fe80::225:90ff:fe5d:c1e1"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :directory => "/store/nginx-cache/proxy-cache",
- :max_size => "65536M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "netherlands.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[tuxis]",
- "role[tilecache]"
-)
+++ /dev/null
-name "thorn-01"
-description "Master role applied to thorn-01"
-
-default_attributes(
- :networking => {
- :interfaces => {
- :internal_ipv4 => {
- :interface => "bond0",
- :role => :internal,
- :family => :inet,
- :address => "10.0.48.51",
- :bond => {
- :slaves => %w[eth0 eth1]
- }
- }
- }
- }
-)
-
-run_list(
- "role[equinix]"
-)
)
run_list(
- "role[equinix]"
+ "role[equinix-ams]"
)
)
run_list(
- "role[equinix]"
+ "role[equinix-ams]"
)
:mpm => "event",
:timeout => 60,
:event => {
- :server_limit => 60,
+ :server_limit => 80,
:max_request_workers => 1200,
:threads_per_child => 20,
:min_spare_threads => 300,
:max_connections => "250",
:temp_buffers => "32MB",
:work_mem => "128MB",
+ :max_parallel_workers_per_gather => "0",
:wal_buffers => "1024kB",
:wal_writer_delay => "500ms",
:commit_delay => "10000",
"net.core.somaxconn" => 10000
}
},
- :kernel_scheduler_tune => {
- :comment => "Tune kernel scheduler preempt",
+ :network_conntrack_time_wait => {
+ :comment => "Only track completed connections for 30 seconds",
:parameters => {
- "kernel.sched_min_granularity_ns" => 10000000,
- "kernel.sched_wakeup_granularity_ns" => 15000000
+ "net.netfilter.nf_conntrack_tcp_timeout_time_wait" => "30"
+ }
+ },
+ :network_conntrack_max => {
+ :comment => "Increase max number of connections tracked",
+ :parameters => {
+ "net.netfilter.nf_conntrack_max" => "524288"
+ }
+ },
+ :no_tcp_slow_start => {
+ :comment => "Disable TCP slow start",
+ :parameters => {
+ "net.ipv4.tcp_slow_start_after_idle" => "0"
+ }
+ },
+ :tcp_use_bbr => {
+ :comment => "Use TCP BBR Congestion Control",
+ :parameters => {
+ "net.core.default_qdisc" => "fq",
+ "net.ipv4.tcp_congestion_control" => "bbr"
}
}
},
:styles => {
:default => {
:repository => "https://github.com/gravitystorm/openstreetmap-carto.git",
- :revision => "v5.3.0",
+ :revision => "v5.5.1",
:max_zoom => 19
}
}
+++ /dev/null
-name "tilecache"
-description "Role applied to all tile cache servers"
-
-default_attributes(
- :accounts => {
- :groups => {
- :proxy => {
- :members => [:tomh, :grant, :matt, :jburgess]
- }
- }
- },
- :nginx => {
- :access_log => false
- },
- :sysctl => {
- :sockets => {
- :comment => "Increase size of connection queue",
- :parameters => {
- "net.core.somaxconn" => 10000
- }
- },
- :network_conntrack_time_wait => {
- :comment => "Only track completed connections for 30 seconds",
- :parameters => {
- "net.netfilter.nf_conntrack_tcp_timeout_time_wait" => "30"
- }
- },
- :network_conntrack_max => {
- :comment => "Increase max number of connections tracked",
- :parameters => {
- "net.netfilter.nf_conntrack_max" => "524288"
- }
- },
- :network_local_port_range => {
- :comment => "Increase available local port range",
- :parameters => {
- "net.ipv4.ip_local_port_range" => "1024\t65535"
- }
- },
- :network_tcp_timewait_reuse => {
- :comment => "Allow tcp timewait reuse",
- :parameters => {
- "net.ipv4.tcp_tw_reuse" => 1
- }
- },
- :squid_swappiness => {
- :comment => "Prefer not to swapout to free memory",
- :parameters => {
- "vm.swappiness" => "1"
- }
- },
- :sched_wakeup => {
- :comment => "Tune scheduler",
- :parameters => {
- "kernel.sched_min_granularity_ns" => "10000000",
- "kernel.sched_wakeup_granularity_ns" => "15000000"
- }
- }
- },
- :tools => {
- :cron => {
- :load => {
- :nice => 19,
- :io_scheduling_class => "best-effort",
- :io_scheduling_priority => 7
- }
- }
- }
-)
-
-run_list(
- "recipe[tilecache]"
-)
+++ /dev/null
-name "toothless"
-description "Master role applied to toothless"
-
-default_attributes(
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet,
- :address => "185.73.44.167",
- :prefix => "22",
- :gateway => "185.73.44.1"
- },
- :external_ipv6 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet6,
- :address => "2001:ba8:0:2ca7::",
- :prefix => "64",
- :gateway => "fe80::fcff:ffff:feff:ffff"
- }
- }
- }
-)
-
-run_list(
- "role[jump]"
-)
+++ /dev/null
-name "trogdor"
-description "Master role applied to trogdor"
-
-default_attributes(
- :hardware => {
- :shm_size => "14g"
- },
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "eth0",
- :role => :external,
- :family => :inet,
- :address => "134.90.146.26",
- :prefix => "30",
- :gateway => "134.90.146.25"
- }
- }
- },
- :sysfs => {
- :md_tune => {
- :comment => "Tune the md sync performance so as not to kill system performance",
- :parameters => {
- "block/md0/md/sync_speed_min" => "1",
- "block/md0/md/sync_speed_max" => "100000",
- "block/md1/md/sync_speed_min" => "1",
- "block/md1/md/sync_speed_max" => "100000"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "10240 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :nginx => {
- :cache => {
- :proxy => {
- :max_size => "131072M"
- }
- }
- },
- :tilecache => {
- :tile_parent => "netherlands.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[blix-nl]",
- "role[tilecache]"
-)
+++ /dev/null
-name "tuxis"
-description "Role applied to all servers at Tuxis"
-
-default_attributes(
- :hosted_by => "Tuxis",
- :location => "Ede, Netherlands"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["2a03:7900:2:0:31:3:104:61", "2a03:7900:2:0:31:3:104:62"]
- },
- :ntp => {
- :servers => ["0.nl.pool.ntp.org", "1.nl.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[nl]"
-)
override_attributes(
:networking => {
- :nameservers => ["10.0.0.3", "1.1.1.1", "1.0.0.1"],
+ :nameservers => ["10.0.0.3", "8.8.8.8", "8.8.4.4"],
:search => ["ucl.openstreetmap.org", "openstreetmap.org"]
},
:ntp => {
+++ /dev/null
-name "utelecom"
-description "Role applied to all servers at Ukrainian Telecommunication Group"
-
-default_attributes(
- :hosted_by => "Ukrainian Telecommunication Group",
- :location => "Kiev, Ukraine"
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.ua.pool.ntp.org", "1.ua.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[ua]"
-)
+++ /dev/null
-name "vipertooth"
-description "Master role applied to vipertooth"
-
-default_attributes(
- :hardware => {
- :shm_size => "18g"
- },
- :location => "Kiev, Ukraine",
- :networking => {
- :interfaces => {
- :external_ipv4 => {
- :interface => "ens160",
- :role => :external,
- :family => :inet,
- :address => "176.122.99.101",
- :prefix => "26",
- :gateway => "176.122.99.126"
- },
- :external_ipv6 => {
- :interface => "ens160",
- :role => :external,
- :family => :inet6,
- :address => "2001:67c:2d40::65",
- :prefix => "64",
- :gateway => "2001:67c:2d40::fffe"
- }
- }
- },
- :squid => {
- :version => 4,
- :cache_mem => "16384 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "kiev.render.openstreetmap.org"
- }
-)
-
-run_list(
- "role[utelecom]",
- "role[tilecache]"
-)
:anovak => { :status => :administrator }
}
},
- :hardware => {
- :shm_size => "36g"
- },
:location => "Pula, Croatia",
:munin => {
:allow => ["193.198.233.210"]
:gateway => "2001:b68:4cff:3::1"
}
}
- },
- :squid => {
- :version => 4,
- :cache_mem => "32768 MB",
- :cache_dir => [
- "rock /store/squid/rock-4096 20000 swap-timeout=200 slot-size=4096 max-size=3996",
- "rock /store/squid/rock-8192 25000 swap-timeout=200 slot-size=8192 min-size=3997 max-size=8092",
- "rock /store/squid/rock-16384 35000 swap-timeout=200 slot-size=16384 min-size=8093 max-size=16284",
- "rock /store/squid/rock-32768 45000 swap-timeout=200 slot-size=32768 min-size=16285 max-size=262144"
- ]
- },
- :tilecache => {
- :tile_parent => "pula.render.openstreetmap.org"
}
)
run_list(
- "role[carnet]",
- "role[tilecache]"
+ "role[carnet]"
)
+++ /dev/null
-name "web-backend"
-description "Role applied to all web/api backend servers"
-
-default_attributes(
- :apache => {
- :mpm => "event",
- :event => {
- :max_connections_per_child => 10000,
- :async_request_worker_factor => 4
- }
- },
- :logstash => {
- :forwarder => {
- "filebeat.prospectors" => [
- { "input_type" => "log", "paths" => ["/var/log/apache2/access.log"], "fields" => { "type" => "apache" } },
- { "input_type" => "log", "paths" => ["/var/log/web/rails-logstash.log"], "fields" => { "type" => "rails" } }
- ]
- }
- },
- :memcached => {
- :memory_limit => 4096
- },
- :passenger => {
- :max_pool_size => 12
- }
-)
-
-run_list(
- "role[web]",
- "role[logstash-forwarder]",
- "recipe[web::backend]"
-)
},
:logstash => {
:forwarder => {
- "filebeat.prospectors" => [
- { "input_type" => "log", "paths" => ["/var/log/apache2/access.log"], "fields" => { "type" => "apache" } },
- { "input_type" => "log", "paths" => ["/var/log/web/rails-logstash.log"], "fields" => { "type" => "rails" } }
+ "filebeat.inputs" => [
+ { "type" => "filestream", "id" => "apache", "paths" => ["/var/log/apache2/access.log"], "fields" => { "type" => "apache" }, "fields_under_root" => true },
+ { "type" => "filestream", "id" => "rails", "paths" => ["/var/log/web/rails-logstash.log"], "fields" => { "type" => "rails" }, "fields_under_root" => true }
]
}
},
+++ /dev/null
-name "web-storage"
-description "Base role applied to all web/api storage servers"
-
-default_attributes(
- :accounts => {
- :users => {
- :rails => { :status => :role }
- }
- }
-)
-
-run_list(
- "recipe[nfs::server]"
-)
+++ /dev/null
-name "yandex"
-description "Role applied to all servers at Yandex"
-
-default_attributes(
- :hosted_by => "Yandex",
- :location => "Moscow, Russia",
- :timezone => "Europe/Moscow",
- :networking => {
- :wireguard => { :keepalive => 180 }
- }
-)
-
-override_attributes(
- :ntp => {
- :servers => ["0.ru.pool.ntp.org", "1.ru.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[ru]"
-)
},
:tile => {
:database => {
- :cluster => "12/main",
+ :cluster => "14/main",
:postgis => "3"
},
+ :mapnik => "3.1",
:styles => {
:default => {
:tile_directories => [
+++ /dev/null
-name "zcu"
-description "Role applied to all servers at University of West Bohemia"
-
-default_attributes(
- :hosted_by => "University of West Bohemia",
- :location => "Pilsen, Czech Republic"
-)
-
-override_attributes(
- :networking => {
- :nameservers => ["147.228.3.3", "147.228.52.11"]
- },
- :ntp => {
- :servers => ["0.cz.pool.ntp.org", "1.cz.pool.ntp.org", "europe.pool.ntp.org"]
- }
-)
-
-run_list(
- "role[cz]"
-)
--- /dev/null
+{
+ "id": "community",
+ "uid": "527",
+ "comment": "Community"
+}
--- /dev/null
+{
+ "id": "overpass",
+ "uid": "528",
+ "comment": "query.openstreetmap.org",
+ "home": "/srv/query.openstreetmap.org"
+}
--- /dev/null
+{
+ "id": "passwords",
+ "database": "database",
+ "oauth2_client_id": "oauth2_client_id",
+ "oauth2_secret": "oauth2_secret",
+ "mail_receiver_api_key": "mail_receiver_api_key"
+}
--- /dev/null
+{
+ "id": "passwords",
+ "aws_key": "AWS_KEY_VALUE"
+}
{
- "id": "piwik",
- "location": "piwik",
+ "id": "matomo",
+ "location": "matomo",
"site": 100,
"goals": {
"signup": 1001,
{
"database": "database_password",
"admin": "admin_password",
- "recaptcha": "precaptcha_token",
+ "hcaptcha": "precaptcha_token",
"thunderforest": "thunderforest_token"
}
# Required by serverspec
set :backend, :exec
-describe service("cgimap") do
- it { should be_enabled }
- it { should be_running }
+describe package("docker-ce") do
+ it { should be_installed }
end
-describe port(8000) do
- it { should be_listening.with("tcp") }
+describe service("docker") do
+ it { should be_enabled }
+ it { should be_running }
end
--- /dev/null
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe port(80) do
+ it { should be_listening.with("tcp") }
+end
+
+describe port(443) do
+ it { should be_listening.with("tcp") }
+end
# Required by serverspec
set :backend, :exec
-describe service("api-statistics") do
+describe package("docker-ce") do
+ it { should be_installed }
+end
+
+describe service("docker") do
it { should be_enabled }
it { should be_running }
end
--- /dev/null
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe service("prometheus-karma") do
+ it { should be_enabled }
+ it { should be_running }
+end
+
+describe port(8081) do
+ it { should be_listening.with("tcp6") }
+end
+++ /dev/null
-require "serverspec"
-
-# Required by serverspec
-set :backend, :exec
-
-describe package("squid") do
- it { should be_installed }
-end
-
-describe service("squid") do
- it { should be_enabled }
- it { should be_running }
-end
-
-describe port(3128) do
- it { should be_listening.with("tcp") }
-end
-
-describe port(8080) do
- it { should be_listening.with("tcp") }
-end
+++ /dev/null
-require "serverspec"
-
-# Required by serverspec
-set :backend, :exec
-
-describe package("subversion") do
- it { should be_installed }
-end
+++ /dev/null
-require "serverspec"
-
-# Required by serverspec
-set :backend, :exec
-
-describe package("nginx") do
- it { should be_installed }
-end
-
-describe service("nginx") do
- it { should be_enabled }
- it { should be_running }
-end
-
-describe port(80) do
- it { should be_listening.with("tcp") }
-end
-
-describe port(443) do
- it { should be_listening.with("tcp") }
-end
-
-describe port(8050) do
- it { should be_listening.with("tcp") }
-end
+++ /dev/null
-require "serverspec"
-
-# Required by serverspec
-set :backend, :exec
-
-describe package("squid") do
- it { should be_installed }
-end
-
-describe service("squid") do
- it { should be_enabled }
- it { should be_running }
-end
-
-describe port(3128) do
- it { should be_listening.with("tcp") }
-end
-
-describe port(8080) do
- it { should be_listening.with("tcp") }
-end