wordpress

This commit is contained in:
Darren 2022-11-03 17:41:04 +08:00 committed by GitHub
parent 41725d3822
commit 4e25ad4cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 93 additions and 37 deletions

View File

@ -1,4 +1,11 @@
# WordPress
* add solution for selection
* add wp-cli
* add wp-cli
## faq
#### what is default-constants.php?
It is a file for defines constants and global variables that can be overridden, generally in wp-config.php.
It not exisit at wp-includes directory

View File

@ -0,0 +1,41 @@
<?php
/**
* Defines constants and global variables that can be overridden, generally in wp-config.php.
*
* @package WordPress
*/
/**
* Defines templating-related WordPress constants.
*
* @since 3.0.0
*/
function wp_templating_constants() {
/**
* Filesystem path to the current active template directory.
*
* @since 1.5.0
*/
define( 'TEMPLATEPATH', get_template_directory() );
/**
* Filesystem path to the current active template stylesheet directory.
*
* @since 2.1.0
*/
define( 'STYLESHEETPATH', get_stylesheet_directory() );
/**
* Slug of the default theme for this installation.
* Used as the default theme when installing new sites.
* It will be used as the fallback if the active theme doesn't exist.
*
* @since 3.0.0
*
* @see WP_Theme::get_core_default_theme()
*/
if ( ! defined( 'WP_DEFAULT_THEME' ) ) {
define( 'WP_DEFAULT_THEME', '{{wordpress_solution}}' );
}
}

View File

@ -3,49 +3,57 @@
vars:
app: "wordpress"
- block:
- name: Copy wp-cli
copy:
src: wp-cli.phar
dest: wp-cli.phar
- name: Install cp-cli
- block:
- name: Copy wp-cli
copy:
src: wp-cli.phar
dest: wp-cli.phar
- name: Add Install wp-cli for init
shell: |
echo "docker cp wp-cli.phar wordpress:/tmp" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker exec -it wordpress chmod +x /tmp/wp-cli.phar" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker exec -it wordpress mv /tmp/wp-cli.phar /usr/local/bin/wp" >> /data/apps/{{appname}}/src/after_up.sh
- name: Add Install wp-cli for init
shell: |
echo "docker cp wp-cli.phar wordpress:/tmp" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker exec -it wordpress chmod +x /tmp/wp-cli.phar" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker exec -it wordpress mv /tmp/wp-cli.phar /usr/local/bin/wp" >> /data/apps/{{appname}}/src/after_up.sh
- block:
- name: Download {{wordpress_solution}} theme to host machine
unarchive:
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{wordpress_theme_meta[wordpress_solution].theme}}.zip"
dest: /data/apps/wordpress/data/backup/theme/{{wordpress_solution}}
owner: www-data
group: www-data
remote_src: yes
- name: Set the theme solution
- block:
- name: Download {{wordpress_solution}} theme to host machine
unarchive:
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{wordpress_theme_meta[wordpress_solution].theme}}.zip"
dest: /data/apps/wordpress/data/backup/theme/{{wordpress_solution}}
owner: www-data
group: www-data
remote_src: yes
- name: Download plugin to host machine
unarchive:
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{item}}.zip"
dest: /data/apps/wordpress/data/backup/plugin/{{wordpress_solution}}
owner: www-data
group: www-data
remote_src: yes
with_items:
- "{{wordpress_theme_meta[wordpress_solution].plugin}}"
when: wordpress_theme_meta[wordpress_solution].plugin !=""
- name: Download plugin to host machine
unarchive:
src: "{{wordpress_theme_download_url}}/{{wordpress_solution}}/{{item}}.zip"
dest: /data/apps/wordpress/data/backup/plugin/{{wordpress_solution}}
owner: www-data
group: www-data
remote_src: yes
with_items:
- "{{wordpress_theme_meta[wordpress_solution].plugin}}"
when: wordpress_theme_meta[wordpress_solution].plugin !=""
- name: Add tasks to init
shell:
echo "docker cp " >> /data/apps/{{appname}}/src/after_up.sh
echo "docker cp " >> /data/apps/{{appname}}/src/after_up.sh
- name: Template default-constants.php
template:
src: default-constants.php
dest: /data/apps/wordpress/data/backup
owner: www-data
group: www-data
when: wordpress_solution != "" and wordpress_solution != "multisite"
- name: Add tasks to init
shell:
echo "docker cp theme" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker cp plugins" >> /data/apps/{{appname}}/src/after_up.sh
echo "docker cp default-constants.php" >> /data/apps/{{appname}}/src/after_up.sh
when: wordpress_solution != "" and wordpress_solution != "multisite"
- name: Modify wordpress for multisite
- name: Set the multisite solution
shell:
echo "add line [define( 'WP_ALLOW_MULTISITE', true );] to wp-config.php" >> /data/apps/{{appname}}/src/after_up.sh
when: wordpress_solution == "multisite"