commit 6f0450276d9af0a6f96cdece6118c76e009dd467 Author: Bruno21 Date: Fri Jan 3 08:57:41 2025 +0100 Deleting history diff --git a/.env b/.env new file mode 100644 index 0000000..db284d8 --- /dev/null +++ b/.env @@ -0,0 +1,8 @@ +#bdd +dbuser=root +dbpass=qUtjnFdebz24N5Xy + +#wp +admin_user=bruno +admin_password=kpm97321 +admin_email="bruno@clicclac.info" diff --git a/README.md b/README.md new file mode 100644 index 0000000..7eab4f9 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# wordpress + +Some scripts related to Synology NAS. + + + +#### 1) install_wp-cli.sh + +Usage: ./install_wp-cli.sh + +Download and install wp-cli to /usr/local/bin + + + +#### 2) install_wp.sh + +Usage: ./install_wp.sh + +Download and install WordPress with wp-cli. + +.env file required for credentials. diff --git a/install_wp-cli.sh b/install_wp-cli.sh new file mode 100644 index 0000000..a379c09 --- /dev/null +++ b/install_wp-cli.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Télécharger +curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar + +# Test +php wp-cli.phar --info + +chmod +x wp-cli.phar +sudo mv wp-cli.phar /usr/local/bin/wp + +# Test +wp --info \ No newline at end of file diff --git a/install_wp.sh b/install_wp.sh new file mode 100755 index 0000000..52ebf26 --- /dev/null +++ b/install_wp.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +red="\033[0;31m" +redbold="\033[1;31m" +green="\033[0;32m" +greenbold="\033[1;32m" +yellow="\033[0;33m" +yellowbold="\033[1;33m" +bold="\033[1m" +italic="\033[3m" +#bold_under="\033[1;4m" +underline="\033[4m" +reset="\033[0m" + +#bdd +dbhost=localhost +dbuser= +dbpass= +dbname=wordpress +dbprefix=wp_ + +#wp +url=localhost +title="My WordPress blog" +admin_user= +admin_password= +admin_email= +default_theme=twentyseven +defaults_plugins="admin-post-navigation meow-lightbox" +locale=fr_FR +version=6.7.1 + +dotenv () { + set -a + # shellcheck disable=SC1091 + [ -f ".env" ] && . ".env" || { echo -e "${red}\nNo .env file found ! Needed: admin/pass for bdd, admin/pass/mail for wp.${reset}"; exit 1;} + set +a +} + +dotenv + +# Télécharger WordPress: +$ wp core download --locale=$locale --version=$version + +# Créer le fichier de config (wp-config.php): +#$ wp config create --dbname=testdb --dbuser=wp --dbpass=yourpassword +#$ wp core config --dbname=databasename --dbuser=databaseuser --dbpass=databasepassword --dbhost=localhost --dbprefix=prfx_ + +# Avec Des options supplémentaires: +$ wp core config --dbname=$dbname --dbuser=$dbuser --dbpass=$dbpass --dbhost=$dbhost --dbprefix=$dbprefix --extra-php < SELECT @@character_set_database, @@collation_database; + +# Installer WordPress: +$ wp core install --url=$url --title=$title --admin_user=$admin_user --admin_password=$admin_password --admin_email=$admin_email + +# Changement de la structure des liens pour ne conserver que le nom de l'article +$ wp rewrite structure '/%postname%' + +# Liste les thèmes trouvable dans l'installation +$ wp theme list + +# Installer un thème: +$ wp theme install $default_theme + +# Activer le thème: +$ wp theme activate $default_theme + +# Installer et activer les plugins: +#$ wp plugin install admin-post-navigation jetpack meow-lightbox simple-tags sola-newsletters wp-retina-2x-pro wp-super-cache --activate +$ wp plugin install $defaults_plugins --activate