Skip to content

Commit

Permalink
Replace system_cron with disable_wp_cron
Browse files Browse the repository at this point in the history
Update to match Bedrock's new setting
  • Loading branch information
swalkinshaw committed Oct 28, 2015
1 parent 1ccb789 commit b4b8d18
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Update cron variable to match Bedrock ([#394](https://github.com/roots/trellis/pull/394))
* Use curl instead of dig for IP lookups ([#390](https://github.com/roots/trellis/pull/390))
* Update SSL cipher suite ([#386](https://github.com/roots/trellis/pull/386))
* Support for other Vagrant providers (VirtualBox, VMWare, Parallels) ([#340](https://github.com/roots/trellis/pull/340))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ For example: configure the sites on your Vagrant development VM by editing `grou
* `site_title` - WP site title (*development* only, default: project name)
* `db_create` - whether to auto create a database or not (default: `true`)
* `db_import` - Path to local `sql` dump file which will be imported (optional)
* `system_cron` - Disable WP cron and use system's (default: `true`)
* `admin_user` - WP admin user name (*development* only, required)
* `admin_email` - WP admin email address (*development* only, required)
* `admin_password` - WP admin user password (*development* only, required)
Expand All @@ -123,6 +122,7 @@ For example: configure the sites on your Vagrant development VM by editing `grou
* `enabled` - Cache enabled flag (required, set to `false`)
* `duration` - Duration of the cache (default: `30s`)
* `env` - environment variables
* `disable_wp_cron` - Disable WP cron and use system's (default: `true`)
* `wp_home` - `WP_HOME` constant (required)
* `wp_siteurl` - `WP_SITEURL` constant (required)
* `wp_env` - environment (required, matches group name: `development`, `staging`, `production`)
Expand Down
2 changes: 1 addition & 1 deletion group_vars/development/wordpress_sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ wordpress_sites:
cache:
enabled: false
duration: 30s
system_cron: true
env:
disable_wp_cron: true
wp_home: http://example.dev
wp_siteurl: http://example.dev/wp
wp_env: development
Expand Down
2 changes: 1 addition & 1 deletion group_vars/production/wordpress_sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ wordpress_sites:
cache:
enabled: false
duration: 30s
system_cron: true
env:
disable_wp_cron: true
wp_home: http://example.com
wp_siteurl: http://example.com/wp
wp_env: production
Expand Down
2 changes: 1 addition & 1 deletion group_vars/staging/wordpress_sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ wordpress_sites:
cache:
enabled: false
duration: 30s
system_cron: true
env:
disable_wp_cron: true
wp_home: http://staging.example.com
wp_siteurl: http://staging.example.com/wp
wp_env: staging
Expand Down
37 changes: 20 additions & 17 deletions roles/wordpress-setup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@
- include: nginx.yml

- name: Create web root
file: path="{{ www_root }}"
owner="{{ web_user }}"
group="{{ web_group }}"
mode=0755
state=directory
file:
path: "{{ www_root }}"
owner: "{{ web_user }}"
group: "{{ web_group }}"
mode: 0755
state: directory
with_dict: wordpress_sites

- name: Create logs folder of sites
file: path="{{ www_root }}/{{ item.key }}/logs"
owner="{{ web_user }}"
group="{{ web_group }}"
mode=0755
state=directory
file:
path: "{{ www_root }}/{{ item.key }}/logs"
owner: "{{ web_user }}"
group: "{{ web_group }}"
mode: 0755
state: directory
with_dict: wordpress_sites

- name: Setup system cron
cron: name="{{ item.key }} WordPress cron"
minute="*/15"
user="{{ web_user }}"
job="curl -s {{ item.value.env.wp_siteurl }}/wp-cron.php"
cron_file="wordpress-{{ item.key | replace('.', '_') }}"
- name: Setup WP system cron
cron:
name: "{{ item.key }} WordPress cron"
minute: "*/15"
user: "{{ web_user }}"
job: "curl -s {{ item.value.env.wp_siteurl }}/wp-cron.php"
cron_file: "wordpress-{{ item.key | replace('.', '_') }}"
with_dict: wordpress_sites
when: item.value.system_cron | default(False) == True
when: item.value.env.disable_wp_cron | default(false) and not item.value.multisite.enabled | default(false)

0 comments on commit b4b8d18

Please sign in to comment.