Skip to content

Commit 4a3d010

Browse files
committed
feat(cms): add wp cron contact variable and ignore function
1 parent 98da482 commit 4a3d010

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

pillar/coalition.sls

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,10 @@ phpfpm:
2323
configuration: default
2424
context:
2525
user: coalition
26+
cron_contact:
27+
- sysadmin@open-contracting.org
28+
- root
29+
cron_ignore:
30+
- a-fake-plugin.php
2631
listen_user: www-data
2732
socket: /var/run/php/php-fpm-coalition.sock

pillar/corporate.sls

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ phpfpm:
3030
configuration: default
3131
context:
3232
user: corporate
33+
cron_contact:
34+
- sysadmin@open-contracting.org
35+
- root
3336
listen_user: www-data
3437
socket: /var/run/php/php-fpm-corporate.sock
3538
env:

salt/cms/init.sls

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ allow {{ userdir }} access:
3434
- require:
3535
- user: {{ user }}_user_exists
3636
37-
{{ set_cron_env(user, 'MAILTO', 'sysadmin@open-contracting.org', 'root') }}
37+
{{ set_cron_env(user, 'MAILTO', ','.join(entry.context.cron_contact | default(['root']) ) ) }}
3838
3939
# Assumes that all PHP-FPM sites on the CMS server are WordPress.
40+
{% if entry.context.cron_ignore is defined %}
41+
/usr/local/bin/wp cron event run --quiet --due-now --path={{ userdir }}/public_html | grep -v '{{ '\|'.join(entry.context.cron_ignore) }}':
42+
{% else %}
4043
/usr/local/bin/wp cron event run --quiet --due-now --path={{ userdir }}/public_html:
44+
{% endif %}
4145
cron.present:
4246
- identifier: WORDPRESS_SITE_CRON
4347
- user: {{ user }}

0 commit comments

Comments
 (0)