diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 0000000..f87f24d --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,40 @@ +name: 'Publish to prod' + +on: + push: + branches: + - "main" + +permissions: + id-token: write + contents: read + + +jobs: + upload-prod: + runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' + + steps: + - uses: 'actions/checkout@v3' + - name: Upload + env: + FTP_SERVER: ${{ secrets.FTP_SERVER }} + FTP_USERNAME: ${{ secrets.FTP_USERNAME }} + FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} + run: | + sudo apt install lftp + rm -rf .git .github + mv maintenance.php maintenance-real.php + sed -e 's/false/true/g' maintenance-real.php > maintenance.php + lftp -e " + set sftp:auto-confirm yes; + set ssl:verify-certificate no; + open -u ${FTP_USERNAME},${FTP_PASSWORD} sftp://${FTP_SERVER}; + put maintenance.php -o maintenance.php; + mirror --exclude=maintenance-real.php -e -R ./ ./; + put maintenance-real.php -o maintenance.php; + quit; + " diff --git a/core.php b/core.php index a6019cc..36140e6 100644 --- a/core.php +++ b/core.php @@ -5,7 +5,7 @@ const ROOT = __DIR__; define("MAINTENANCE_MODE", require(ROOT . "/maintenance.php")); if (MAINTENANCE_MODE) { - require(ROOT . "./templates/maintenance.php"); + require(ROOT . "/templates/maintenance.php"); } else { $router = require(ROOT . "/router/Router.php"); diff --git a/html/.htaccess b/html/.htaccess index c6a799b..b23ef4c 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -8,3 +8,6 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] + +php_flag log_errors on +php_value error_log /usr/home/usefula/php.log \ No newline at end of file