-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,15 @@ set -Eeuo pipefail | |
echo "Running standard entrypoint to populate wp-config.php" | ||
docker-entrypoint.sh apache2 -l | ||
|
||
# Ensure wordpress core database is installed | ||
if ! wp --path=/usr/src/wordpress core is-installed; then | ||
wp --path=/usr/src/wordpress core install --url=http://localhost:8080 --title="Wordpress" --admin_user="osm_admin" --admin_email="[email protected]" --skip-email | ||
fi | ||
|
||
# Ensure wordpress core database is up to date | ||
wp --path=/usr/src/wordpress core update-db | ||
|
||
# Activate all plugins | ||
wp --path=/usr/src/wordpress plugin activate --all | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,48 @@ | ||
#!/usr/bin/env bash | ||
set -Eeuo pipefail | ||
|
||
curl -Lsg 'https://api.wordpress.org/plugins/info/1.1/?action=plugin_information&request[slug]=wp-fail2ban' | jq -r .download_link | ||
# wp-last-login | ||
# wp-2fa | ||
# wp-fail2ban | ||
install_wordpress_addon() { | ||
local type=$1 | ||
local slug=$2 | ||
|
||
if [[ "$type" != "plugin" && "$type" != "theme" ]]; then | ||
echo "Invalid type. Use 'plugin' or 'theme'." | ||
return 1 | ||
fi | ||
|
||
local api_url="https://api.wordpress.org/${type}s/info/1.2/?action=${type}_information&request[slug]=${slug}" | ||
local download_link=$(curl -Lsg "$api_url" | jq -r '.download_link') | ||
|
||
if [[ -z "$download_link" || "$download_link" == "null" ]]; then | ||
echo "Invalid slug or no download link found." | ||
return 1 | ||
fi | ||
|
||
local target_dir="/usr/src/wordpress/wp-content/${type}s" | ||
mkdir -p "$target_dir" | ||
|
||
curl -L "$download_link" -o "/tmp/${slug}.zip" | ||
unzip -q "/tmp/${slug}.zip" -d "$target_dir" | ||
rm "/tmp/${slug}.zip" | ||
|
||
echo "${type^} '${slug}' installed successfully to ${target_dir}." | ||
} | ||
|
||
remove_wordpress_addon() { | ||
local type=$1 | ||
local slug=$2 | ||
|
||
if [[ "$type" != "plugin" && "$type" != "theme" ]]; then | ||
echo "Invalid type. Use 'plugin' or 'theme'." | ||
return 1 | ||
fi | ||
|
||
rm -Rf "/usr/src/wordpress/wp-content/${type}s/${slug}" | ||
|
||
echo "${type^} '${slug}' removed successfully." | ||
} | ||
|
||
install_wordpress_addon plugin wp-last-login | ||
install_wordpress_addon plugin wp-2fa | ||
install_wordpress_addon plugin wp-fail2ban | ||
remove_wordpress_addon plugin hello.php |