diff --git a/.dev/020-xdebug.ini b/.dev/020-xdebug.ini new file mode 100644 index 0000000..5f734ea --- /dev/null +++ b/.dev/020-xdebug.ini @@ -0,0 +1,11 @@ +zend_extension = xdebug.so + +; Xdebug +[XDebug] +xdebug.max_nesting_level = 256 +xdebug.show_exception_trace = 0 + +xdebug.mode = debug +xdebug.start_with_request = yes + +xdebug.client_host = ${XDEBUG_HOST} diff --git a/.dev/init.sh b/.dev/init.sh index fd26a06..68174ce 100755 --- a/.dev/init.sh +++ b/.dev/init.sh @@ -6,8 +6,11 @@ mkdir -p /tmp/build_cache /tmp/env; rm -rf /app/.heroku /app/.profile.d /app/vendor/* -STACK=heroku-20 "$PHP_BUILDPACK/bin/compile" /app /tmp/build_cache /tmp/env; \ +STACK=heroku-20 "$PHP_BUILDPACK/bin/compile" /app /tmp/build_cache /tmp/env; + cp -v config/mailhog.ini /app/.heroku/php/etc/php/conf.d/225-mailhog.ini; -rm -rf /app/vendor/* -composer install +rm -rf /app/vendor/*; +composer install; + +exec .dev/xdebug-install.sh; diff --git a/.dev/nginx/default.conf.template b/.dev/nginx/default.conf.template index 8237738..add63d2 100644 --- a/.dev/nginx/default.conf.template +++ b/.dev/nginx/default.conf.template @@ -18,7 +18,7 @@ server { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; - + proxy_set_header Host $host; proxy_pass http://wordpress:3000; } } diff --git a/.dev/xdebug-install.sh b/.dev/xdebug-install.sh new file mode 100755 index 0000000..8cd5ea7 --- /dev/null +++ b/.dev/xdebug-install.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +# Define directories. +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +XDEBUG_VERSION=${XDEBUG_VERSION-3.1.5} + +# echo colors +LED='\033[0;34m' +OK='\033[0;32m' +NC='\033[0m' # No Color +############# + +########################################################################### +# COMPILE PHP xDebug +########################################################################### + +XDEBUG_RELEASE_URI="https://xdebug.org/files/xdebug-$XDEBUG_VERSION.tgz"; +SRC_PATH="/tmp"; +XDEBUG_SRC_PATH=$SRC_PATH/xdebug-$XDEBUG_VERSION + +echo -e "${LED}XDEBUG${NC} Download $XDEBUG_RELEASE_URI ..." +curl -# $XDEBUG_RELEASE_URI| tar --warning=none -xz -C $SRC_PATH +echo -e "${OK}done${NC}" + +# Build from repo +#echo -e "${LED}XDEBUG${NC} Cloning source to $XDEBUG_SRC_PATH ..." +#git clone git://github.com/xdebug/xdebug.git $XDEBUG_SRC_PATH +#echo -e "${OK}done${NC}" + +LOGDIR="${PWD}/.log" +mkdir -p "${LOGDIR}" +LOGFILE="${LOGDIR}/xdebug_build.log" + +echo -e "${LED}XDEBUG${NC} Compile at $XDEBUG_SRC_PATH ..." +( + cd $XDEBUG_SRC_PATH + echo $PWD + echo -e "`date +%H:%M:%S` : Scan workspace" > $LOGFILE + ls -la >> $LOGFILE 2>&1 + echo -e "`date +%H:%M:%S` : Starting work" >> $LOGFILE + phpize >> $LOGFILE 2>&1 + ./configure --enable-xdebug >> $LOGFILE 2>&1 + make -k >> $LOGFILE 2>&1 + echo -e "${OK}done${NC}" + + ########################################################################### + # INSTALL PHP xDebug + ########################################################################### + + EXTENSION_PATH=$( php-config --extension-dir ); + LIB_PATH="$( php-config --prefix )/lib" + INSTALL_PATH=$( php-config --ini-dir ); + XDEBUG_INI="020-xdebug.ini"; + XDEBUG_INI_PATH=$SCRIPT_DIR/$XDEBUG_INI; + + echo -e "${LED}XDEBUG${NC} Install bin to $EXTENSION_PATH ..." + cp -v modules/*.so $EXTENSION_PATH + cp -v modules/*.la $LIB_PATH + echo -e "${OK}done${NC}" + + echo -e "${LED}XDEBUG${NC} Install ini to $INSTALL_PATH ..." + if [ ! -f $XDEBUG_INI_PATH ]; then + echo "zend_extension = xdebug.so" >> $XDEBUG_INI_PATH + fi + + cp -v $XDEBUG_INI_PATH $INSTALL_PATH/$XDEBUG_INI + echo -e "${OK}done${NC}" + + echo -e "${LED}XDEBUG${NC} All Install ${OK}done${NC}" + ########################################################################### +) +exit 0 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bc3ab5c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" diff --git a/.gitignore b/.gitignore index b53ec99..c08405f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Application web/app/plugins/* !web/app/plugins/.gitkeep +web/app/themes/* +!web/app/themes/.gitkeep web/app/mu-plugins/*/ web/app/upgrade web/app/uploads/* @@ -23,6 +25,7 @@ web/.htaccess .*/* !.**/.gitkeep !.dev/* +!.github/* # Composer /vendor diff --git a/.source_me b/.source_me index 3f250a1..d235b02 100644 --- a/.source_me +++ b/.source_me @@ -4,7 +4,7 @@ alias d-wp="docker-compose run --rm --entrypoint=wp wordpress" alias d-heroku="docker-compose run --rm --entrypoint=heroku wordpress" alias d-bash="docker-compose run --rm --entrypoint=bash wordpress -l" alias dc-build="docker-compose build --pull --no-cache" -alias dc-init="docker-compose run --rm --entrypoint ".dev/init.sh" wordpress" +alias dc-init="docker-compose run --rm --entrypoint '.dev/init.sh' wordpress" alias dc-up="docker-compose up -d" alias dc-down="docker-compose down" alias dc-destroy="docker-compose down -v" diff --git a/.source_me.ps1 b/.source_me.ps1 new file mode 100644 index 0000000..d41b6c4 --- /dev/null +++ b/.source_me.ps1 @@ -0,0 +1,11 @@ +Set-Alias -Name d-composer -Value "docker-compose run --rm --entrypoint -Value composer wordpress" +Set-Alias -Name d-wp -Value "docker-compose run --rm --entrypoint -Value wp wordpress" +Set-Alias -Name d-heroku -Value "docker-compose run --rm --entrypoint -Value heroku wordpress" +Set-Alias -Name d-bash -Value "docker-compose run --rm --entrypoint -Value bash wordpress -l" +Set-Alias -Name dc-build -Value "docker-compose build --pull --no-cache" +Set-Alias -Name dc-init -Value "docker-compose run --rm --entrypoint '.dev/init.sh' wordpress" +Set-Alias -Name dc-up -Value "docker-compose up -d" +Set-Alias -Name dc-down -Value "docker-compose down" +Set-Alias -Name dc-destroy -Value "docker-compose down -v" +Set-Alias -Name g-clean -Value "git clean -xd" +Set-Alias -Name g-mk-deploy -Value "git archive -o deploy.tar.gz HEAD" diff --git a/Dockerfile b/Dockerfile index 601d947..5fbe684 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG UID=1000 ARG GID=1000 ARG USER_NAME=heroku -FROM heroku/heroku:20 AS base +FROM heroku/heroku:20-build AS base RUN \ apt-get -qq update; \ apt-get install -y --no-install-recommends \ diff --git a/README.md b/README.md index e69de29..c47739c 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,8 @@ +HVG Blog + +``` +mkcert \ + -cert-file .dev/nginx/lndo.site.crt \ + -key-file .dev/nginx/lndo.site.key \ + *.lndo.site +``` diff --git a/composer.json b/composer.json index ae5b7e5..9ed57f3 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,10 @@ { "type": "vcs", "url": "https://github.com/hvg-dev/hvg-blog-muplugin" + }, + { + "type": "vcs", + "url": "https://github.com/hvg-dev/hvg-blog-general" } ], "require": { @@ -51,7 +55,10 @@ "roots/wordpress": "^6.0", "roots/wp-config": "^1.0.0", "roots/wp-password-bcrypt": "^1.1.0", + "wpackagist-theme/twentytwentytwo": "^1.2", "hvg-dev/hvg-blog-muplugin": "dev-main", + "hvg-dev/hvg-blog-general": "dev-main", + "wpackagist-plugin/wp-webhooks": "^2.0", "wpackagist-plugin/code-snippets": "^3.1" }, diff --git a/composer.lock b/composer.lock index d28f266..3bae701 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "67712c4ba219189964d41855c6c1b5e4", + "content-hash": "784b886c29915068e70bf3fcd927abca", "packages": [ { "name": "composer/installers", @@ -212,12 +212,52 @@ ], "time": "2021-11-21T21:41:47+00:00" }, + { + "name": "hvg-dev/hvg-blog-general", + "version": "dev-main", + "source": { + "type": "git", + "url": "git@github.com:hvg-dev/hvg-blog-general.git", + "reference": "91b04b1dbe9d2e1698f90131bd07ba626e66473d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hvg-dev/hvg-blog-general/zipball/91b04b1dbe9d2e1698f90131bd07ba626e66473d", + "reference": "91b04b1dbe9d2e1698f90131bd07ba626e66473d", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "default-branch": true, + "type": "wordpress-theme", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/Automattic/_s/graphs/contributors" + } + ], + "description": "Hi. I'm a starter theme called _s, or underscores, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for.", + "homepage": "https://github.com/Automattic/_s", + "keywords": [ + "Themes", + "WordPress" + ], + "support": { + "source": "https://github.com/hvg-dev/hvg-blog-general/tree/main", + "issues": "https://github.com/hvg-dev/hvg-blog-general/issues" + }, + "time": "2022-06-08T18:27:15+00:00" + }, { "name": "hvg-dev/hvg-blog-muplugin", "version": "dev-main", "source": { "type": "git", - "url": "https://github.com/hvg-dev/hvg-blog-muplugin.git", + "url": "git@github.com:hvg-dev/hvg-blog-muplugin.git", "reference": "5a237fcba344b4cdf3bb355e08f81dc198eaef08" }, "dist": { @@ -1183,6 +1223,24 @@ }, "type": "wordpress-plugin", "homepage": "https://wordpress.org/plugins/wp-webhooks/" + }, + { + "name": "wpackagist-theme/twentytwentytwo", + "version": "1.2", + "source": { + "type": "svn", + "url": "https://themes.svn.wordpress.org/twentytwentytwo/", + "reference": "1.2" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/theme/twentytwentytwo.1.2.zip" + }, + "require": { + "composer/installers": "^1.0 || ^2.0" + }, + "type": "wordpress-theme", + "homepage": "https://wordpress.org/themes/twentytwentytwo/" } ], "packages-dev": [ @@ -1237,12 +1295,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "e9efa06fbfa1dc84b9d6475eb7270aec6ee9a841" + "reference": "961eba35293ca2e5b37bc281a63836243b35058a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e9efa06fbfa1dc84b9d6475eb7270aec6ee9a841", - "reference": "e9efa06fbfa1dc84b9d6475eb7270aec6ee9a841", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/961eba35293ca2e5b37bc281a63836243b35058a", + "reference": "961eba35293ca2e5b37bc281a63836243b35058a", "shasum": "" }, "conflict": { @@ -1503,7 +1561,7 @@ "pimcore/data-hub": "<1.2.4", "pimcore/pimcore": "<10.4", "pocketmine/bedrock-protocol": "<8.0.2", - "pocketmine/pocketmine-mp": "<4.2.10", + "pocketmine/pocketmine-mp": ">= 4.0.0-BETA5, < 4.4.2|<4.2.10", "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", "prestashop/contactform": ">1.0.1,<4.3", @@ -1727,7 +1785,7 @@ "type": "tidelift" } ], - "time": "2022-06-06T22:04:51+00:00" + "time": "2022-06-07T22:04:20+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -1790,6 +1848,7 @@ "minimum-stability": "dev", "stability-flags": { "hvg-dev/hvg-blog-muplugin": 20, + "hvg-dev/hvg-blog-general": 20, "roave/security-advisories": 20 }, "prefer-stable": true, diff --git a/config/application.php b/config/application.php index b3bc75b..6a7fe80 100644 --- a/config/application.php +++ b/config/application.php @@ -127,6 +127,13 @@ if (file_exists($env_config)) { require_once $env_config; } +$hvgblog_config = __DIR__ . '/hvgblog.php'; + +if (file_exists($hvgblog_config)) { + require_once $hvgblog_config; +} + + Config::apply(); /** diff --git a/config/hvgblog.php b/config/hvgblog.php new file mode 100644 index 0000000..a5b4bc8 --- /dev/null +++ b/config/hvgblog.php @@ -0,0 +1,131 @@ +