@codigodoleo/wp-kit 1.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -4
- package/.editorconfig +0 -13
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -24
- package/.github/workflows/publish-npm.yml +0 -32
- package/.github/workflows/release-please.yml +0 -25
- package/.husky/_/post-merge +0 -0
- package/.prettierignore +0 -4
- package/.prettierrc +0 -8
- package/.vscode/settings.json +0 -19
- package/CHANGELOG.md +0 -47
- package/VSCODE_EXTENSIONS.md +0 -11
- package/docs/HOOKS-SYSTEM.md +0 -172
- package/git-deploy.sh +0 -74
- package/index.php +0 -17
- package/release-please-config.json +0 -17
- package/server/php/php.ini +0 -48
- package/server/www/rocket.conf +0 -283
- package/test-copy-directory.js +0 -43
- package/test-overwrite.js +0 -45
- package/wp-config.php +0 -190
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codigodoleo/wp-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Kit opinativo para padronizar projetos WordPress com CI/CD dinâmico.",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,9 +10,14 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/",
|
|
15
|
+
"lib/",
|
|
16
|
+
"modules/",
|
|
17
|
+
"templates/",
|
|
18
|
+
".cspell.json",
|
|
19
|
+
".gitkeep"
|
|
20
|
+
],
|
|
16
21
|
"scripts": {
|
|
17
22
|
"lint": "eslint .",
|
|
18
23
|
"format": "prettier --write .",
|
package/.editorconfig
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps maintain consistent coding styles across editors
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
end_of_line = lf
|
|
7
|
-
insert_final_newline = true
|
|
8
|
-
indent_style = space
|
|
9
|
-
indent_size = 2
|
|
10
|
-
trim_trailing_whitespace = true
|
|
11
|
-
|
|
12
|
-
[*.md]
|
|
13
|
-
trim_trailing_whitespace = false
|
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"env": {
|
|
4
|
-
"es2022": true,
|
|
5
|
-
"node": true
|
|
6
|
-
},
|
|
7
|
-
"extends": ["eslint:recommended", "prettier"],
|
|
8
|
-
"plugins": ["import"],
|
|
9
|
-
"parserOptions": {
|
|
10
|
-
"ecmaVersion": "latest",
|
|
11
|
-
"sourceType": "module"
|
|
12
|
-
},
|
|
13
|
-
"rules": {
|
|
14
|
-
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
|
|
15
|
-
"no-console": "off",
|
|
16
|
-
"import/order": [
|
|
17
|
-
"warn",
|
|
18
|
-
{
|
|
19
|
-
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
20
|
-
"newlines-between": "always"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: publish-npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published, released, created]
|
|
6
|
-
workflow_dispatch:
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- name: Checkout
|
|
13
|
-
uses: actions/checkout@v4
|
|
14
|
-
with:
|
|
15
|
-
fetch-depth: 0
|
|
16
|
-
|
|
17
|
-
- name: Setup Node
|
|
18
|
-
uses: actions/setup-node@v4
|
|
19
|
-
with:
|
|
20
|
-
node-version: '22'
|
|
21
|
-
registry-url: 'https://registry.npmjs.org'
|
|
22
|
-
|
|
23
|
-
- name: Install deps
|
|
24
|
-
run: npm ci --no-audit --no-fund
|
|
25
|
-
|
|
26
|
-
- name: Build (skip if not needed)
|
|
27
|
-
run: echo "No build step"
|
|
28
|
-
|
|
29
|
-
- name: Publish to npm
|
|
30
|
-
env:
|
|
31
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
32
|
-
run: npm publish --access public
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: release-please
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: write
|
|
10
|
-
pull-requests: write
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
release:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- uses: google-github-actions/release-please-action@v4
|
|
17
|
-
with:
|
|
18
|
-
release-type: node
|
|
19
|
-
package-name: "@codigodoleo/wp-kit"
|
|
20
|
-
changelog-types: |
|
|
21
|
-
[{"type":"feat","section":"Features","hidden":false},
|
|
22
|
-
{"type":"fix","section":"Bug Fixes","hidden":false},
|
|
23
|
-
{"type":"docs","section":"Documentation","hidden":false},
|
|
24
|
-
{"type":"refactor","section":"Refactors","hidden":false},
|
|
25
|
-
{"type":"chore","section":"Chores","hidden":false}]
|
package/.husky/_/post-merge
DELETED
|
File without changes
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.formatOnSave": false,
|
|
3
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
4
|
-
"files.trimTrailingWhitespace": true,
|
|
5
|
-
"files.insertFinalNewline": true,
|
|
6
|
-
"editor.codeActionsOnSave": {
|
|
7
|
-
"source.fixAll": "explicit"
|
|
8
|
-
},
|
|
9
|
-
"files.associations": {
|
|
10
|
-
"*.hbs": "plaintext",
|
|
11
|
-
"*.yml.hbs": "yaml",
|
|
12
|
-
"*.json.hbs": "jsonc",
|
|
13
|
-
"*.php.hbs": "php",
|
|
14
|
-
"*.js.hbs": "javascript",
|
|
15
|
-
"*.css.hbs": "css",
|
|
16
|
-
"*.scss.hbs": "scss",
|
|
17
|
-
"*.vue.hbs": "vue"
|
|
18
|
-
}
|
|
19
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 1.0.0 (2025-09-27)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
### Features
|
|
7
|
-
|
|
8
|
-
* add build templates for GitLab CI/CD ([4880c40](https://github.com/lgobatto/wp-kit/commit/4880c40d9c39925e1d112aa617001cd3b1a546f7))
|
|
9
|
-
* **cli:** implementar CLI para scaffolding de projetos WordPress DevOps com comandos de inicialização e prompts interativos ([a65dd0c](https://github.com/lgobatto/wp-kit/commit/a65dd0c6c1f8552b68b4de9e4e17da6c629f134b))
|
|
10
|
-
* **config:** adicionar arquivo .editorconfig e atualizar composer.json e cspell.json com novas configurações e palavras-chave ([fadae79](https://github.com/lgobatto/wp-kit/commit/fadae7950b78c37cf946999bee756e7953cbd629))
|
|
11
|
-
* **config:** adicionar arquivos de configuração do PHP, NGINX e templates para instalação do WordPress, incluindo suporte a variáveis de ambiente e otimizações de cache ([ae4a66d](https://github.com/lgobatto/wp-kit/commit/ae4a66d3223fa2fdcba29228eb7fbeb3607804c8))
|
|
12
|
-
* **config:** adicionar arquivos de configuração para ESLint, Prettier e CSpell, além de recomendações de extensões para VSCode ([e487f54](https://github.com/lgobatto/wp-kit/commit/e487f5451f12df5643ffedf623dedce9ffffa84c))
|
|
13
|
-
* **copy-directory:** implementar funcionalidade de cópia de diretórios com controle de sobrescrita, incluindo testes e documentação atualizada ([baf1eb6](https://github.com/lgobatto/wp-kit/commit/baf1eb6a96539bab656bcb82fcdcc4e0c68ace22))
|
|
14
|
-
* **cspell:** adicionar arquivo de configuração .cspell.json e atualizar associações de arquivos no VSCode ([314a83d](https://github.com/lgobatto/wp-kit/commit/314a83dcb5fbf9de2601734b17998670dfd41987))
|
|
15
|
-
* **cspell:** adicionar novas palavras ao dicionário de verificação ortográfica ([50ab73c](https://github.com/lgobatto/wp-kit/commit/50ab73c39c1d7c72be6359de5e661d75bee652f5))
|
|
16
|
-
* **cspell:** adicionar novas palavras ao dicionário no arquivo .cspell.json para melhorar a verificação ortográfica ([f2f22ed](https://github.com/lgobatto/wp-kit/commit/f2f22edd463e6b57e8eeb4010a65b1732c7e83e7))
|
|
17
|
-
* **cspell:** atualizar configurações do arquivo .cspell.json, adicionando novas palavras e organizando dicionários e tipos de arquivo ([a23ee3b](https://github.com/lgobatto/wp-kit/commit/a23ee3bc458fcbe135cb7c1d57280db8ab7a3c23))
|
|
18
|
-
* **deploy:** adicionar script git-deploy.sh para inicialização de repositório, configuração de remote e push forçado, além de implementar templates de CI/CD para validação e segurança no GitLab ([ad5a37a](https://github.com/lgobatto/wp-kit/commit/ad5a37a9e98489cd0bd18704cad7b8c882a6c0d7))
|
|
19
|
-
* **deploy:** adicionar suporte a configurações de implantação com Docker, incluindo prompts para seleção de estratégia e provedor, além de criar arquivos de configuração necessários ([d42e269](https://github.com/lgobatto/wp-kit/commit/d42e26964748769a79853e465d268f84eaf75a30))
|
|
20
|
-
* **docs:** adicionar documentação completa sobre arquitetura, desenvolvimento, infraestrutura e monitoramento do site Pipefy, incluindo guias de configuração e melhores práticas ([9ed8521](https://github.com/lgobatto/wp-kit/commit/9ed85211b8a378403ef0a31e039879e7c79b54df))
|
|
21
|
-
* **docs:** adicionar novos templates de documentação para configuração, desenvolvimento, infraestrutura e monitoramento do site Pipefy, incluindo guias detalhados e melhores práticas ([ac4653c](https://github.com/lgobatto/wp-kit/commit/ac4653c3a7550e31e90d243cf33c3d13045e86a7))
|
|
22
|
-
* **editorconfig:** adicionar arquivo .editorconfig para padronização de estilos de codificação ([669cbf4](https://github.com/lgobatto/wp-kit/commit/669cbf46d3fd4cfd5cc0c0f12e60b801ecbda421))
|
|
23
|
-
* enhance GitLab CI/CD pipeline with advanced features ([0436062](https://github.com/lgobatto/wp-kit/commit/0436062433d14c694368aafee31d57f3cdb71ba6))
|
|
24
|
-
* **generator:** atualizar a função de geração de arquivos para usar lodash.mergewith e adicionar suporte a estratégias de merge de arrays ([eb5d701](https://github.com/lgobatto/wp-kit/commit/eb5d701dbfcc008dd2229ab558d3446bd1f1851f))
|
|
25
|
-
* **git-workspace:** adicionar suporte para geração de arquivo de workspace do VSCode e novos prompts de configuração para Git ([55670af](https://github.com/lgobatto/wp-kit/commit/55670af798d98f0177f5118fc04e079aa4ee3e78))
|
|
26
|
-
* **git:** adicionar arquivo .gitkeep para manter diretório vazio no repositório ([8bab8e6](https://github.com/lgobatto/wp-kit/commit/8bab8e6d5d87507749df39f12db5f0a5933f7ff7))
|
|
27
|
-
* **git:** adicionar documentação e templates para Conventional Commits, incluindo instruções de uso, configurações do VS Code e melhorias no sistema de hooks para commits automáticos. ([9603051](https://github.com/lgobatto/wp-kit/commit/96030513a607845e894aaa396171c187cf22e2c9))
|
|
28
|
-
* **git:** adicionar suporte a configuração de Git com commitlint, lint-staged e husky, incluindo templates e scripts necessários ([64fa435](https://github.com/lgobatto/wp-kit/commit/64fa435c43371eecd3151801b40a195a469aa547))
|
|
29
|
-
* **git:** adicionar templates e configurações para Conventional Commits, incluindo snippets, documentação e validação de mensagens ([77897ce](https://github.com/lgobatto/wp-kit/commit/77897ce3ed67eb01979e6b6e09c6a6bd242f1877))
|
|
30
|
-
* **hooks:** implementar sistema de hooks para execução de callbacks em momentos específicos, incluindo a adição de um gerenciador de hooks e execução de hooks pós-configuração. ([8ca5679](https://github.com/lgobatto/wp-kit/commit/8ca567986a386b5c5934943daf27ca113da59045))
|
|
31
|
-
* **init:** adicionar arquivo .gitignore e atualizar templates de configuração do Lando para suporte a linting com Yarn ([f697fe2](https://github.com/lgobatto/wp-kit/commit/f697fe22ae268b35f0e4e6a8a2256bea7f1941c7))
|
|
32
|
-
* **init:** adicionar arquivos de configuração do WordPress, incluindo index.php e wp-config.php, com suporte a variáveis de ambiente e configuração para Docker ([d2d8b51](https://github.com/lgobatto/wp-kit/commit/d2d8b51de08abaace6cccf337d3dce79ac816ae9))
|
|
33
|
-
* **init:** adicionar opção de debug e suporte a estratégia de merge 'concat' na geração de arquivos ([b7ea6a2](https://github.com/lgobatto/wp-kit/commit/b7ea6a29b47d2660a9e54a528e594703cdb07a90))
|
|
34
|
-
* **lando:** adicionar instalação do Node.js e Yarn no template .lando.yml.hbs, além de executar script de instalação do WordPress durante o build ([4e6c5fd](https://github.com/lgobatto/wp-kit/commit/4e6c5fd5300d37b0aabdd376a81619e8a85ee55b))
|
|
35
|
-
* **lando:** atualizar configuração do Lando para incluir comandos de build e otimização do tema Sage ([c1125c3](https://github.com/lgobatto/wp-kit/commit/c1125c3461caa6fe98dca127844281904ea6ee6f))
|
|
36
|
-
* **lando:** reorganizar scripts de build e instalação no template .lando.yml.hbs, unificando comandos para o appserver e removendo dependências desnecessárias do serviço node. ([bbe44d9](https://github.com/lgobatto/wp-kit/commit/bbe44d9813b83b1386e80c5aabb6d4e9bab6bcfd))
|
|
37
|
-
* **lint:** adicionar suporte a ferramentas de linting e formatação com ESLint, Prettier e Stylelint, incluindo templates e prompts de configuração ([f8e1823](https://github.com/lgobatto/wp-kit/commit/f8e182383f1ebeaef897f6e13e2a2e4eeb6fdac7))
|
|
38
|
-
* **lint:** atualizar configurações de linting e formatação no workspace.json.hbs, substituir scripts PHP por Pint, e remover wrappers desnecessários, além de adicionar novas tarefas para o Lando. ([59ed719](https://github.com/lgobatto/wp-kit/commit/59ed719676f91ee21f9b2bf02ee54ce3e3deb46a))
|
|
39
|
-
* **lint:** atualizar scripts de linting no package.json e adicionar novo arquivo wp-translation-downloader.lock ao .gitignore ([13db50b](https://github.com/lgobatto/wp-kit/commit/13db50b22f7068f97152ff87529be7edec5ed311))
|
|
40
|
-
* **php:** adicionar scripts wrapper para suporte a ferramentas PHP e configuração no ambiente Lando, incluindo documentação no README.md ([d4bb95e](https://github.com/lgobatto/wp-kit/commit/d4bb95e5b26542a8df4e2f4b615ef637be5fbc51))
|
|
41
|
-
* **setup:** adicionar suporte a CLI com wp-devops-setup, incluindo README.md, configuração do package.json e melhorias nos comandos de inicialização ([514c1e5](https://github.com/lgobatto/wp-kit/commit/514c1e50000434b682495d4d2c6bc66dee1c7a47))
|
|
42
|
-
* **tests:** adicionar script 'open-cursor' ao package.json para abrir o workspace do projeto de teste após a configuração ([481d729](https://github.com/lgobatto/wp-kit/commit/481d7296063889aeef35d890b1dc7013d4a6d195))
|
|
43
|
-
* **tests:** adicionar scripts de configuração e limpeza para testes automatizados ([a376538](https://github.com/lgobatto/wp-kit/commit/a376538a5b725e5433cc5530a6ca5e024b0827c1))
|
|
44
|
-
* **vscode:** adicionar associações de arquivos para suporte a diferentes tipos de templates no settings.json ([f38a1db](https://github.com/lgobatto/wp-kit/commit/f38a1db61e75961b94ba1f3717de9f52baa4c19f))
|
|
45
|
-
* **workspace:** adicionar configurações de busca e salvamento automático no template workspace.json.hbs ([fcbe381](https://github.com/lgobatto/wp-kit/commit/fcbe381a20f6a202f49b4069069dd29d64c1a2ac))
|
|
46
|
-
* **workspace:** adicionar configurações de formatação para Blade, JavaScript, TypeScript, CSS e SCSS no template workspace.json.hbs ([62548c2](https://github.com/lgobatto/wp-kit/commit/62548c2fce183ef0d1717cc49f477dfb1fde202e))
|
|
47
|
-
* **workspace:** adicionar configurações de GitLens no template de workspace ([1c7f39b](https://github.com/lgobatto/wp-kit/commit/1c7f39b4691758a66499b3f7115660ca7173585a))
|
package/VSCODE_EXTENSIONS.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# 🔌 Recommended VSCode Extensions
|
|
2
|
-
|
|
3
|
-
These extensions ensure consistency and formatting in this project:
|
|
4
|
-
|
|
5
|
-
- [Prettier – Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
6
|
-
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
7
|
-
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
|
|
8
|
-
|
|
9
|
-
Optional:
|
|
10
|
-
|
|
11
|
-
- [Stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
|
package/docs/HOOKS-SYSTEM.md
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Sistema de Hooks e Utilitários
|
|
2
|
-
|
|
3
|
-
O wp-devops-setup inclui um sistema de hooks inspirado no WordPress e utilitários para cópia de arquivos e pastas.
|
|
4
|
-
|
|
5
|
-
## Sistema de Hooks
|
|
6
|
-
|
|
7
|
-
O sistema de hooks do wp-devops-setup é inspirado no sistema de hooks do WordPress e permite que módulos registrem callbacks para serem executados em momentos específicos durante o processo de setup.
|
|
8
|
-
|
|
9
|
-
## Hooks Disponíveis
|
|
10
|
-
|
|
11
|
-
### `after_setup_complete`
|
|
12
|
-
Executado após todo o setup dos módulos ser concluído. Útil para operações que dependem de todos os arquivos terem sido criados.
|
|
13
|
-
|
|
14
|
-
**Parâmetros:**
|
|
15
|
-
- `context` - Contexto do projeto com todas as configurações
|
|
16
|
-
- `generator` - Instância do Generator
|
|
17
|
-
|
|
18
|
-
**Exemplo:**
|
|
19
|
-
```javascript
|
|
20
|
-
// No seu módulo (modules/seu-modulo/index.js)
|
|
21
|
-
export async function setupModule(context, generator) {
|
|
22
|
-
// ... seu setup normal ...
|
|
23
|
-
|
|
24
|
-
// Registra um hook para executar após todo o setup
|
|
25
|
-
generator.hooks.addAction('after_setup_complete', async (context, generator) => {
|
|
26
|
-
// Seu código aqui será executado após todo o setup
|
|
27
|
-
console.log('Setup completo!');
|
|
28
|
-
}, 10); // Prioridade 10
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Métodos do HookManager
|
|
33
|
-
|
|
34
|
-
### addAction(hookName, callback, priority, acceptedArgs)
|
|
35
|
-
Registra uma função para ser executada em um hook específico.
|
|
36
|
-
|
|
37
|
-
**Parâmetros:**
|
|
38
|
-
- `hookName` (string) - Nome do hook
|
|
39
|
-
- `callback` (Function) - Função a ser executada
|
|
40
|
-
- `priority` (number) - Prioridade (padrão: 10, menor número = maior prioridade)
|
|
41
|
-
- `acceptedArgs` (number) - Número de argumentos aceitos pela função
|
|
42
|
-
|
|
43
|
-
### addFilter(hookName, callback, priority, acceptedArgs)
|
|
44
|
-
Registra uma função que retorna um valor (filtro).
|
|
45
|
-
|
|
46
|
-
### doAction(hookName, ...args)
|
|
47
|
-
Executa todos os callbacks registrados para um hook.
|
|
48
|
-
|
|
49
|
-
### applyFilters(hookName, value, ...args)
|
|
50
|
-
Executa um filtro e retorna o valor modificado.
|
|
51
|
-
|
|
52
|
-
### removeAction(hookName, callback, priority)
|
|
53
|
-
Remove um callback de um hook.
|
|
54
|
-
|
|
55
|
-
### hasAction(hookName)
|
|
56
|
-
Verifica se um hook tem callbacks registrados.
|
|
57
|
-
|
|
58
|
-
## Prioridades
|
|
59
|
-
|
|
60
|
-
As prioridades funcionam da seguinte forma:
|
|
61
|
-
- **Menor número = Maior prioridade**
|
|
62
|
-
- Prioridade padrão: 10
|
|
63
|
-
- Hooks com prioridade menor são executados primeiro
|
|
64
|
-
|
|
65
|
-
**Exemplos de prioridades:**
|
|
66
|
-
- `1` - Muito alta prioridade (executa primeiro)
|
|
67
|
-
- `5` - Alta prioridade
|
|
68
|
-
- `10` - Prioridade padrão
|
|
69
|
-
- `15` - Baixa prioridade
|
|
70
|
-
- `20` - Muito baixa prioridade (executa por último)
|
|
71
|
-
|
|
72
|
-
## Exemplos de Uso
|
|
73
|
-
|
|
74
|
-
### Exemplo 1: Commit Git Inicial
|
|
75
|
-
```javascript
|
|
76
|
-
generator.hooks.addAction('after_setup_complete', async (context, generator) => {
|
|
77
|
-
// Faz commit inicial após todo o setup
|
|
78
|
-
execSync('git add .', { cwd: generator.cwd });
|
|
79
|
-
execSync('git commit -m "feat: initial setup"', { cwd: generator.cwd });
|
|
80
|
-
}, 10);
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Exemplo 2: Instalação de Dependências
|
|
84
|
-
```javascript
|
|
85
|
-
generator.hooks.addAction('after_setup_complete', async (context, generator) => {
|
|
86
|
-
// Instala dependências após todo o setup
|
|
87
|
-
execSync('npm install', { cwd: generator.cwd });
|
|
88
|
-
}, 5); // Alta prioridade
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Exemplo 3: Configuração Final
|
|
92
|
-
```javascript
|
|
93
|
-
generator.hooks.addAction('after_setup_complete', async (context, generator) => {
|
|
94
|
-
// Configurações finais que dependem de tudo estar pronto
|
|
95
|
-
console.log('Projeto configurado com sucesso!');
|
|
96
|
-
}, 20); // Baixa prioridade - executa por último
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Exemplo 4: Usando Filtros
|
|
100
|
-
```javascript
|
|
101
|
-
// Registra um filtro
|
|
102
|
-
generator.hooks.addFilter('project_name', (name) => {
|
|
103
|
-
return name.toUpperCase();
|
|
104
|
-
}, 10);
|
|
105
|
-
|
|
106
|
-
// Aplica o filtro
|
|
107
|
-
const finalName = generator.hooks.applyFilters('project_name', 'meu-projeto');
|
|
108
|
-
// Resultado: 'MEU-PROJETO'
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Boas Práticas
|
|
112
|
-
|
|
113
|
-
1. **Use prioridades adequadas**: Hooks que dependem de outros devem ter prioridade menor
|
|
114
|
-
2. **Trate erros**: Sempre use try/catch nos seus callbacks
|
|
115
|
-
3. **Logs informativos**: Use o sistema de logs para informar o que está acontecendo
|
|
116
|
-
4. **Verificações**: Sempre verifique se as condições necessárias estão atendidas antes de executar
|
|
117
|
-
|
|
118
|
-
## Hooks Futuros
|
|
119
|
-
|
|
120
|
-
Outros hooks que podem ser adicionados no futuro:
|
|
121
|
-
- `before_setup_start` - Antes de qualquer setup
|
|
122
|
-
- `after_module_setup` - Após cada módulo individual
|
|
123
|
-
- `before_file_generation` - Antes de gerar arquivos
|
|
124
|
-
- `after_file_generation` - Após gerar arquivos
|
|
125
|
-
|
|
126
|
-
## Utilitários de Cópia
|
|
127
|
-
|
|
128
|
-
### copyFile(sourcePathRelative, moduleName, outputName)
|
|
129
|
-
Copia um arquivo individual.
|
|
130
|
-
|
|
131
|
-
**Parâmetros:**
|
|
132
|
-
- `sourcePathRelative` (string) - Caminho relativo do arquivo de origem
|
|
133
|
-
- `moduleName` (string|null) - Nome do módulo (opcional)
|
|
134
|
-
- `outputName` (string) - Nome do arquivo de destino (opcional)
|
|
135
|
-
|
|
136
|
-
**Exemplo:**
|
|
137
|
-
```javascript
|
|
138
|
-
await generator.copyFile('.gitignore');
|
|
139
|
-
await generator.copyFile('config.json', 'meu-modulo', 'custom-config.json');
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### copyDirectory(sourcePathRelative, moduleName, outputName, overwrite)
|
|
143
|
-
Copia uma pasta inteira com controle sobre sobrescrita.
|
|
144
|
-
|
|
145
|
-
**Parâmetros:**
|
|
146
|
-
- `sourcePathRelative` (string) - Caminho relativo da pasta de origem
|
|
147
|
-
- `moduleName` (string|null) - Nome do módulo (opcional)
|
|
148
|
-
- `outputName` (string) - Nome da pasta de destino (opcional)
|
|
149
|
-
- `overwrite` (boolean) - Se deve sobrescrever arquivos existentes (padrão: true)
|
|
150
|
-
|
|
151
|
-
**Comportamento:**
|
|
152
|
-
- Se a pasta de destino não existe: copia toda a pasta
|
|
153
|
-
- Se a pasta de destino existe e `overwrite = true`: mescla conteúdo (sobrescreve arquivos)
|
|
154
|
-
- Se a pasta de destino existe e `overwrite = false`: pula a cópia
|
|
155
|
-
|
|
156
|
-
**Exemplo:**
|
|
157
|
-
```javascript
|
|
158
|
-
// Copia pasta simples (sobrescreve por padrão)
|
|
159
|
-
await generator.copyDirectory('assets', 'meu-modulo');
|
|
160
|
-
|
|
161
|
-
// Copia pasta com nome personalizado
|
|
162
|
-
await generator.copyDirectory('assets', 'meu-modulo', 'custom-assets');
|
|
163
|
-
|
|
164
|
-
// Copia pasta sem sobrescrever
|
|
165
|
-
await generator.copyDirectory('assets', 'meu-modulo', 'protected-assets', false);
|
|
166
|
-
|
|
167
|
-
// Copia pasta de um módulo específico
|
|
168
|
-
await generator.copyDirectory('assets', 'meu-modulo', 'module-assets');
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**Recursividade:**
|
|
172
|
-
A função copia recursivamente todas as subpastas e arquivos, mantendo a estrutura de diretórios.
|
package/git-deploy.sh
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Script para inicializar git, adicionar remote e fazer push forçado
|
|
4
|
-
# Uso: ./git-deploy.sh [remote-url] [branch] [commit-message]
|
|
5
|
-
|
|
6
|
-
set -e # Sai se algum comando falhar
|
|
7
|
-
|
|
8
|
-
# Configurações padrão
|
|
9
|
-
DEFAULT_REMOTE="git@gitlab.com:pipefy/wordpress/web-template.git"
|
|
10
|
-
DEFAULT_BRANCH="main"
|
|
11
|
-
DEFAULT_COMMIT_MESSAGE="Initial commit"
|
|
12
|
-
|
|
13
|
-
# Parâmetros
|
|
14
|
-
REMOTE_URL=${1:-$DEFAULT_REMOTE}
|
|
15
|
-
BRANCH=${2:-$DEFAULT_BRANCH}
|
|
16
|
-
COMMIT_MESSAGE=${3:-$DEFAULT_COMMIT_MESSAGE}
|
|
17
|
-
|
|
18
|
-
echo "🚀 Iniciando processo de deploy..."
|
|
19
|
-
echo "Remote: $REMOTE_URL"
|
|
20
|
-
echo "Branch: $BRANCH"
|
|
21
|
-
echo "Commit message: $COMMIT_MESSAGE"
|
|
22
|
-
echo ""
|
|
23
|
-
|
|
24
|
-
# Verificar se estamos em um diretório com arquivos
|
|
25
|
-
if [ ! "$(ls -A .)" ]; then
|
|
26
|
-
echo "❌ Erro: Diretório vazio. Adicione alguns arquivos antes de executar."
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
# Inicializar git
|
|
31
|
-
echo "📦 Inicializando repositório Git..."
|
|
32
|
-
git init
|
|
33
|
-
|
|
34
|
-
# Verificar se o remote já existe e remover se necessário
|
|
35
|
-
if git remote get-url origin &>/dev/null; then
|
|
36
|
-
echo "🔄 Removendo remote origin existente..."
|
|
37
|
-
git remote remove origin
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
# Adicionar remote
|
|
41
|
-
echo "🔗 Adicionando remote origin..."
|
|
42
|
-
git remote add origin "$REMOTE_URL"
|
|
43
|
-
|
|
44
|
-
# Verificar se há arquivos para adicionar
|
|
45
|
-
echo "📋 Adicionando arquivos ao stage..."
|
|
46
|
-
git add .
|
|
47
|
-
|
|
48
|
-
# Verificar se há algo para commitar
|
|
49
|
-
if git diff --cached --quiet; then
|
|
50
|
-
echo "ℹ️ Nenhuma mudança para commitar."
|
|
51
|
-
else
|
|
52
|
-
echo "💾 Criando commit..."
|
|
53
|
-
git commit -m "$COMMIT_MESSAGE"
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# Confirmar push forçado
|
|
57
|
-
echo ""
|
|
58
|
-
echo "⚠️ ATENÇÃO: Este comando fará um push FORÇADO para a branch '$BRANCH'."
|
|
59
|
-
echo " Isso pode sobrescrever o histórico existente no repositório remoto."
|
|
60
|
-
echo ""
|
|
61
|
-
read -p "Deseja continuar? (y/N): " -n 1 -r
|
|
62
|
-
echo ""
|
|
63
|
-
|
|
64
|
-
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
65
|
-
echo "🚀 Fazendo push forçado para $BRANCH..."
|
|
66
|
-
git push -f origin "$BRANCH"
|
|
67
|
-
echo ""
|
|
68
|
-
echo "✅ Deploy concluído com sucesso!"
|
|
69
|
-
echo "🔗 Repositório: $REMOTE_URL"
|
|
70
|
-
echo "🌿 Branch: $BRANCH"
|
|
71
|
-
else
|
|
72
|
-
echo "❌ Deploy cancelado pelo usuário."
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
package/index.php
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Front to the WordPress application. This file doesn't do anything, but loads
|
|
4
|
-
* wp-blog-header.php which does and tells WordPress to load the theme.
|
|
5
|
-
*
|
|
6
|
-
* @package WordPress
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Tells WordPress to load the WordPress theme and output it.
|
|
11
|
-
*
|
|
12
|
-
* @var bool
|
|
13
|
-
*/
|
|
14
|
-
define( 'WP_USE_THEMES', true );
|
|
15
|
-
|
|
16
|
-
/** Loads the WordPress Environment and Template */
|
|
17
|
-
require __DIR__ . '/wp/wp-blog-header.php';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
|
-
"release-type": "node",
|
|
4
|
-
"packages": {
|
|
5
|
-
".": {
|
|
6
|
-
"changelog-path": "CHANGELOG.md"
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
|
-
"changelog-types": [
|
|
10
|
-
{ "type": "feat", "section": "Features", "hidden": false },
|
|
11
|
-
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
|
|
12
|
-
{ "type": "docs", "section": "Documentation", "hidden": false },
|
|
13
|
-
{ "type": "refactor", "section": "Refactors", "hidden": false },
|
|
14
|
-
{ "type": "chore", "section": "Chores", "hidden": false }
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
|
package/server/php/php.ini
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
[PHP]
|
|
2
|
-
|
|
3
|
-
;;;;;;;;;;;;;;;
|
|
4
|
-
; PHP Globals ;
|
|
5
|
-
;;;;;;;;;;;;;;;
|
|
6
|
-
|
|
7
|
-
short_open_tag = Off
|
|
8
|
-
output_buffering = 4096
|
|
9
|
-
allow_call_time_pass_reference = Off
|
|
10
|
-
request_order = "GP"
|
|
11
|
-
register_long_arrays = Off
|
|
12
|
-
register_argc_argv = Off
|
|
13
|
-
magic_quotes_gpc = Off
|
|
14
|
-
enable_dl = Off
|
|
15
|
-
allow_url_fopen = On
|
|
16
|
-
realpath_cache_size = "800K"
|
|
17
|
-
realpath_cache_ttl = "86400"
|
|
18
|
-
disable_functions =
|
|
19
|
-
sendmail_path=/bin/true
|
|
20
|
-
|
|
21
|
-
[Date]
|
|
22
|
-
date.timezone = "UTC"
|
|
23
|
-
|
|
24
|
-
;;;;;;;;;;;;;;;;;;;;;;
|
|
25
|
-
;; PACKAGE SETTINGS ;;
|
|
26
|
-
;;;;;;;;;;;;;;;;;;;;;;
|
|
27
|
-
|
|
28
|
-
[xdebug]
|
|
29
|
-
xdebug.mode=debug
|
|
30
|
-
xdebug.start_with_request=yes
|
|
31
|
-
xdebug.client_host=host.docker.internal
|
|
32
|
-
xdebug.client_port=9003
|
|
33
|
-
xdebug.log_level=0
|
|
34
|
-
xdebug.idekey=VSCODE
|
|
35
|
-
|
|
36
|
-
; Globals
|
|
37
|
-
expose_php = on
|
|
38
|
-
max_execution_time = 90
|
|
39
|
-
max_input_time = 900
|
|
40
|
-
max_input_vars = 10000
|
|
41
|
-
memory_limit = 512M
|
|
42
|
-
upload_max_filesize = 100M
|
|
43
|
-
post_max_size = 100M
|
|
44
|
-
error_reporting = E_ALL & ~E_DEPRECATED
|
|
45
|
-
ignore_repeated_errors = on
|
|
46
|
-
html_errors = off
|
|
47
|
-
display_errors = on
|
|
48
|
-
log_errors = on
|
package/server/www/rocket.conf
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
###################################################################################################
|
|
2
|
-
# Rocket-Nginx
|
|
3
|
-
#
|
|
4
|
-
# Rocket-Nginx is a NGINX configuration to speedup your WordPress
|
|
5
|
-
# website with the cache plugin WP-Rocket (http://wp-rocket.me)
|
|
6
|
-
#
|
|
7
|
-
# Author: Maxime Jobin
|
|
8
|
-
# Maintainer: SatelliteWP.com
|
|
9
|
-
# URL: https://github.com/satellitewp/rocket-nginx
|
|
10
|
-
#
|
|
11
|
-
# Tested with WP-Rocket version: 3.16.2.1
|
|
12
|
-
# Tested with NGINX: 1.26.1 (mainline)
|
|
13
|
-
#
|
|
14
|
-
# Version 3.1.0
|
|
15
|
-
#
|
|
16
|
-
###################################################################################################
|
|
17
|
-
|
|
18
|
-
# Add debug information into header
|
|
19
|
-
set $rocket_debug 1;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
###################################################################################################
|
|
23
|
-
# Do not alter theses values
|
|
24
|
-
#
|
|
25
|
-
set $rocket_bypass 1; # Should NGINX bypass WordPress and call cache file directly ?
|
|
26
|
-
set $rocket_encryption ""; # Is GZIP accepted by client ?
|
|
27
|
-
set $rocket_file ""; # Filename to look for
|
|
28
|
-
set $rocket_is_bypassed "MISS"; # Header text added to check if the bypass worked or not. Header: X-Rocket-Nginx-Serving-Static
|
|
29
|
-
set $rocket_reason ""; # Reason why cache file was not used. If cache file is used, what file was used
|
|
30
|
-
set $rocket_https_prefix ""; # HTTPS prefix to use when cached files are using HTTPS
|
|
31
|
-
set $rocket_mobile_prefix ""; # Mobile prefix to use when mobile device is detected and mobile cache is activated
|
|
32
|
-
set $rocket_is_https 0; # Checks if the request is HTTPS
|
|
33
|
-
set $rocket_dynamic ""; # Dynamic value to add to cached filename
|
|
34
|
-
set $rocket_device "desktop"; # Device type (desktop or mobile)
|
|
35
|
-
|
|
36
|
-
###################################################################################################
|
|
37
|
-
# PAGE CACHE
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
# Define Rocket-Nginx $is_args
|
|
41
|
-
set $rocket_is_args $is_args;
|
|
42
|
-
|
|
43
|
-
# Get query string without the parameters (before the '?')
|
|
44
|
-
set $rocket_uri_path $request_uri;
|
|
45
|
-
if ($request_uri ~* "^([^?]*)(\?.+)$") {
|
|
46
|
-
set $rocket_uri_path $1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
# Is GZIP accepted by client ?
|
|
50
|
-
if ($http_accept_encoding ~ gzip) {
|
|
51
|
-
set $rocket_encryption "_gzip";
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
# Is Brotli accepted by client ?
|
|
55
|
-
if ($http_accept_encoding ~ br) {
|
|
56
|
-
set $rocket_encryption "";
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
# Is HTTPS request ?
|
|
60
|
-
if ($https = "on") { set $rocket_is_https 1; }
|
|
61
|
-
if ($http_x_forwarded_proto = "https") { set $rocket_is_https 1; }
|
|
62
|
-
if ($http_front_end_https = "on") { set $rocket_is_https 1; }
|
|
63
|
-
if ($http_x_forwarded_protocol = "https") { set $rocket_is_https 1; }
|
|
64
|
-
if ($http_x_forwarded_ssl = "on") { set $rocket_is_https 1; }
|
|
65
|
-
if ($http_x_url_scheme = "https") { set $rocket_is_https 1; }
|
|
66
|
-
if ($http_forwarded ~ /proto=https/) { set $rocket_is_https 1; }
|
|
67
|
-
|
|
68
|
-
if ($rocket_is_https = "1") {
|
|
69
|
-
set $rocket_https_prefix "-https";
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
# Set mobile detection file path
|
|
73
|
-
# This variable contains a file to look for. If it exists, WP Rocket is set to
|
|
74
|
-
# generate both Desktop and Mobile cache.
|
|
75
|
-
set $rocket_mobile_detection "$document_root/wp-content/cache/wp-rocket/$http_host/$request_uri/.mobile-active";
|
|
76
|
-
|
|
77
|
-
# Query strings to ignore
|
|
78
|
-
set $rocket_args $args;
|
|
79
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_source=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
80
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_campaign=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
81
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_medium=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
82
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_expid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
83
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_term=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
84
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_content=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
85
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_id=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
86
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_source_platform=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
87
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_creative_format=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
88
|
-
if ($rocket_args ~ (.*)(?:&|^)utm_marketing_tactic=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
89
|
-
if ($rocket_args ~ (.*)(?:&|^)_ga=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
90
|
-
if ($rocket_args ~ (.*)(?:&|^)gclid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
91
|
-
if ($rocket_args ~ (.*)(?:&|^)campaignid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
92
|
-
if ($rocket_args ~ (.*)(?:&|^)adgroupid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
93
|
-
if ($rocket_args ~ (.*)(?:&|^)adid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
94
|
-
if ($rocket_args ~ (.*)(?:&|^)gbraid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
95
|
-
if ($rocket_args ~ (.*)(?:&|^)wbraid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
96
|
-
if ($rocket_args ~ (.*)(?:&|^)gclsrc=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
97
|
-
if ($rocket_args ~ (.*)(?:&|^)ef_id=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
98
|
-
if ($rocket_args ~ (.*)(?:&|^)fb_action_ids=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
99
|
-
if ($rocket_args ~ (.*)(?:&|^)fb_action_types=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
100
|
-
if ($rocket_args ~ (.*)(?:&|^)fb_source=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
101
|
-
if ($rocket_args ~ (.*)(?:&|^)fbclid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
102
|
-
if ($rocket_args ~ (.*)(?:&|^)mc_cid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
103
|
-
if ($rocket_args ~ (.*)(?:&|^)mc_eid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
104
|
-
if ($rocket_args ~ (.*)(?:&|^)mtm_source=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
105
|
-
if ($rocket_args ~ (.*)(?:&|^)mtm_medium=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
106
|
-
if ($rocket_args ~ (.*)(?:&|^)mtm_campaign=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
107
|
-
if ($rocket_args ~ (.*)(?:&|^)mtm_keyword=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
108
|
-
if ($rocket_args ~ (.*)(?:&|^)mtm_cid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
109
|
-
if ($rocket_args ~ (.*)(?:&|^)mtm_content=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
110
|
-
if ($rocket_args ~ (.*)(?:&|^)_ke=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
111
|
-
if ($rocket_args ~ (.*)(?:&|^)age-verified=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
112
|
-
if ($rocket_args ~ (.*)(?:&|^)ao_noptimize=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
113
|
-
if ($rocket_args ~ (.*)(?:&|^)usqp=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
114
|
-
if ($rocket_args ~ (.*)(?:&|^)cn-reloaded=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
115
|
-
if ($rocket_args ~ (.*)(?:&|^)sscid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
116
|
-
if ($rocket_args ~ (.*)(?:&|^)msclkid=[^&]*(.*)) { set $rocket_args $1$2; }
|
|
117
|
-
|
|
118
|
-
# Remove & at the beginning (if needed)
|
|
119
|
-
if ($rocket_args ~ ^&(.*)) { set $rocket_args $1; }
|
|
120
|
-
|
|
121
|
-
# Do not count arguments if part of caching arguments
|
|
122
|
-
if ($rocket_args ~ ^\?$) {
|
|
123
|
-
set $rocket_is_args "";
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
# Adjust $rocket_is_args after processing query strings to ignore
|
|
127
|
-
if ($rocket_args = "") {
|
|
128
|
-
set $rocket_is_args "";
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
# Query string to cache
|
|
132
|
-
# None
|
|
133
|
-
|
|
134
|
-
# Check if device is Mobile
|
|
135
|
-
if ($http_user_agent ~* "(?:phone|windows\s+phone|ipod|blackberry|(?:android|bb\d+|meego|silk|googlebot) .+? mobile|palm|windows\s+ce|opera mini|avantgo|mobilesafari|docomo|kaios)") {
|
|
136
|
-
set $rocket_device "mobile";
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# Set mobile prefix if mobile mode is activated
|
|
140
|
-
if (-f "$rocket_mobile_detection") {
|
|
141
|
-
set $rocket_mobile_prefix "-mobile";
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if ($rocket_device != "mobile") {
|
|
145
|
-
set $rocket_mobile_prefix "";
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
# File/URL to return IF we must bypass WordPress
|
|
149
|
-
# Desktop: index.html
|
|
150
|
-
# Gzip: index.html_gzip
|
|
151
|
-
# HTTPS: index-https.html
|
|
152
|
-
# Mobile: index-mobile-https.html
|
|
153
|
-
set $rocket_file_start "index$rocket_mobile_prefix$rocket_https_prefix";
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
set $rocket_pre_url "/wp-content/cache/wp-rocket/$http_host/$rocket_uri_path/$rocket_args/";
|
|
157
|
-
set $rocket_pre_file "$document_root/wp-content/cache/wp-rocket/$http_host/$rocket_uri_path/$rocket_args/";
|
|
158
|
-
|
|
159
|
-
# Standard cache file format
|
|
160
|
-
set $rocket_url "$rocket_pre_url$rocket_file_start$rocket_dynamic.html";
|
|
161
|
-
set $rocket_file "$rocket_pre_file$rocket_file_start$rocket_dynamic.html";
|
|
162
|
-
|
|
163
|
-
# Check if gzip version cached file is available
|
|
164
|
-
if (-f "$rocket_file$rocket_encryption") {
|
|
165
|
-
set $rocket_file "$rocket_file$rocket_encryption";
|
|
166
|
-
set $rocket_url "$rocket_url$rocket_encryption";
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
# Do not bypass if the cached file does not exist
|
|
170
|
-
if (!-f "$rocket_file") {
|
|
171
|
-
set $rocket_bypass 0;
|
|
172
|
-
set $rocket_is_bypassed "MISS";
|
|
173
|
-
set $rocket_reason "File not cached";
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
# Do not bypass if it's a POST request
|
|
177
|
-
if ($request_method = POST) {
|
|
178
|
-
set $rocket_bypass 0;
|
|
179
|
-
set $rocket_is_bypassed "BYPASS";
|
|
180
|
-
set $rocket_reason "POST request";
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
# Do not bypass if arguments are found (e.g. ?page=2)
|
|
184
|
-
if ($rocket_is_args) {
|
|
185
|
-
set $rocket_bypass 0;
|
|
186
|
-
set $rocket_is_bypassed "BYPASS";
|
|
187
|
-
set $rocket_reason "Arguments found";
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
# Do not bypass if the site is in maintenance mode
|
|
191
|
-
if (-f "$document_root/.maintenance") {
|
|
192
|
-
set $rocket_bypass 0;
|
|
193
|
-
set $rocket_is_bypassed "BYPASS";
|
|
194
|
-
set $rocket_reason "Maintenance mode";
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
# Do not bypass if one of those cookie if found
|
|
198
|
-
# wordpress_logged_in_[hash] : When a user is logged in, this cookie is created (we'd rather let WP-Rocket handle that)
|
|
199
|
-
# wp-postpass_[hash] : When a protected post requires a password, this cookie is created.
|
|
200
|
-
if ($http_cookie ~* "(wordpress_logged_in_|wp\-postpass_|woocommerce_items_in_cart|woocommerce_cart_hash|wptouch_switch_toogle|comment_author_|comment_author_email_)") {
|
|
201
|
-
set $rocket_bypass 0;
|
|
202
|
-
set $rocket_is_bypassed "BYPASS";
|
|
203
|
-
set $rocket_reason "Cookie";
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
# If the bypass token is still on, let's bypass WordPress with the cached URL
|
|
207
|
-
if ($rocket_bypass = 1) {
|
|
208
|
-
set $rocket_is_bypassed "HIT";
|
|
209
|
-
set $rocket_reason "$rocket_url";
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
# Clear variables if debug is not needed
|
|
213
|
-
if ($rocket_debug = 0) {
|
|
214
|
-
set $rocket_reason "";
|
|
215
|
-
set $rocket_file "";
|
|
216
|
-
set $rocket_device "";
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
# If the bypass token is still on, rewrite according to the file linked to the request
|
|
220
|
-
if ($rocket_bypass = 1) {
|
|
221
|
-
rewrite .* "$rocket_url" last;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
# Add header to HTML cached files
|
|
225
|
-
location ~ /wp-content/cache/wp-rocket/.*html$ {
|
|
226
|
-
etag on;
|
|
227
|
-
add_header Vary "Accept-Encoding, Cookie";
|
|
228
|
-
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
229
|
-
add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
|
|
230
|
-
add_header X-Rocket-Nginx-Reason $rocket_reason;
|
|
231
|
-
add_header X-Rocket-Nginx-File $rocket_file;
|
|
232
|
-
add_header X-Rocket-Nginx-Device $rocket_device;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
# Do not gzip cached files that are already gzipped
|
|
236
|
-
location ~ /wp-content/cache/wp-rocket/.*_gzip$ {
|
|
237
|
-
etag on;
|
|
238
|
-
gzip off;
|
|
239
|
-
types {}
|
|
240
|
-
default_type text/html;
|
|
241
|
-
add_header Content-Encoding gzip;
|
|
242
|
-
add_header Vary "Accept-Encoding, Cookie";
|
|
243
|
-
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
244
|
-
add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
|
|
245
|
-
add_header X-Rocket-Nginx-Reason $rocket_reason;
|
|
246
|
-
add_header X-Rocket-Nginx-File $rocket_file;
|
|
247
|
-
add_header X-Rocket-Nginx-Device $rocket_device;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
# Debug header (when file is not cached)
|
|
251
|
-
add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
|
|
252
|
-
add_header X-Rocket-Nginx-Reason $rocket_reason;
|
|
253
|
-
add_header X-Rocket-Nginx-File $rocket_file;
|
|
254
|
-
add_header X-Rocket-Nginx-Device $rocket_device;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
###################################################################################################
|
|
258
|
-
# BROWSER CSS CACHE
|
|
259
|
-
#
|
|
260
|
-
location ~* \.css$ {
|
|
261
|
-
etag on;
|
|
262
|
-
gzip_vary on;
|
|
263
|
-
expires 30d;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
###################################################################################################
|
|
268
|
-
# BROWSER JS CACHE
|
|
269
|
-
#
|
|
270
|
-
location ~* \.js$ {
|
|
271
|
-
etag on;
|
|
272
|
-
gzip_vary on;
|
|
273
|
-
expires 30d;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
###################################################################################################
|
|
278
|
-
# BROWSER MEDIA CACHE
|
|
279
|
-
#
|
|
280
|
-
location ~* \.(ico|gif|jpe?g|png|svg|eot|otf|woff|woff2|ttf|ogg|webp)$ {
|
|
281
|
-
etag on;
|
|
282
|
-
expires 30d;
|
|
283
|
-
}
|
package/test-copy-directory.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Generator } from './lib/core/generator.js';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
|
|
5
|
-
async function testCopyDirectory() {
|
|
6
|
-
const testDir = path.resolve('__test-sandbox__/copy-directory-test');
|
|
7
|
-
const generator = new Generator(testDir);
|
|
8
|
-
|
|
9
|
-
// Limpa e cria diretório de teste
|
|
10
|
-
await fs.remove(testDir);
|
|
11
|
-
await fs.ensureDir(testDir);
|
|
12
|
-
|
|
13
|
-
console.log('🧪 Testing copyDirectory functionality...');
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
// Teste 1: Copiar pasta simples
|
|
17
|
-
await generator.copyDirectory('test-assets', 'test-directory');
|
|
18
|
-
console.log('✅ Test 1 passed: Simple directory copy');
|
|
19
|
-
|
|
20
|
-
// Teste 2: Copiar pasta com nome personalizado
|
|
21
|
-
await generator.copyDirectory('test-assets', 'test-directory', 'custom-assets');
|
|
22
|
-
console.log('✅ Test 2 passed: Custom name directory copy');
|
|
23
|
-
|
|
24
|
-
// Teste 3: Copiar pasta sem sobrescrever
|
|
25
|
-
await generator.copyDirectory('test-assets', 'test-directory', 'protected-assets', false);
|
|
26
|
-
console.log('✅ Test 3 passed: Non-overwrite directory copy');
|
|
27
|
-
|
|
28
|
-
// Teste 4: Copiar pasta de um módulo específico
|
|
29
|
-
await generator.copyDirectory('assets', 'test-directory', 'module-assets');
|
|
30
|
-
console.log('✅ Test 4 passed: Module-specific directory copy');
|
|
31
|
-
|
|
32
|
-
console.log('🎉 All tests passed!');
|
|
33
|
-
|
|
34
|
-
// Lista os arquivos criados
|
|
35
|
-
const files = await fs.readdir(testDir, { recursive: true });
|
|
36
|
-
console.log('📁 Created files:', files);
|
|
37
|
-
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error('❌ Test failed:', error.message);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
testCopyDirectory();
|
package/test-overwrite.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Generator } from './lib/core/generator.js';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
|
|
5
|
-
async function testOverwrite() {
|
|
6
|
-
const testDir = path.resolve('__test-sandbox__/overwrite-test');
|
|
7
|
-
const generator = new Generator(testDir);
|
|
8
|
-
|
|
9
|
-
// Limpa e cria diretório de teste
|
|
10
|
-
await fs.remove(testDir);
|
|
11
|
-
await fs.ensureDir(testDir);
|
|
12
|
-
|
|
13
|
-
console.log('🧪 Testing copyDirectory overwrite behavior...');
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
// Cria um arquivo existente primeiro
|
|
17
|
-
await fs.ensureDir(path.join(testDir, 'test-assets'));
|
|
18
|
-
await fs.writeFile(path.join(testDir, 'test-assets', 'file1.txt'), 'Arquivo original');
|
|
19
|
-
|
|
20
|
-
console.log('📝 Created existing file');
|
|
21
|
-
|
|
22
|
-
// Teste 1: Sobrescrever (padrão)
|
|
23
|
-
await generator.copyDirectory('test-assets', 'test-directory');
|
|
24
|
-
console.log('✅ Test 1 passed: Overwrite (default)');
|
|
25
|
-
|
|
26
|
-
// Verifica se o arquivo foi sobrescrito
|
|
27
|
-
const content1 = await fs.readFile(path.join(testDir, 'test-assets', 'file1.txt'), 'utf8');
|
|
28
|
-
console.log('📄 File content after overwrite:', content1);
|
|
29
|
-
|
|
30
|
-
// Teste 2: Não sobrescrever
|
|
31
|
-
await generator.copyDirectory('test-assets', 'test-directory', 'protected-assets', false);
|
|
32
|
-
console.log('✅ Test 2 passed: No overwrite');
|
|
33
|
-
|
|
34
|
-
// Teste 3: Sobrescrever explicitamente
|
|
35
|
-
await generator.copyDirectory('test-assets', 'test-directory', 'explicit-overwrite', true);
|
|
36
|
-
console.log('✅ Test 3 passed: Explicit overwrite');
|
|
37
|
-
|
|
38
|
-
console.log('🎉 All overwrite tests passed!');
|
|
39
|
-
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error('❌ Test failed:', error.message);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
testOverwrite();
|
package/wp-config.php
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The base configuration for WordPress
|
|
5
|
-
*
|
|
6
|
-
* The wp-config.php creation script uses this file during the installation.
|
|
7
|
-
* You don't have to use the website, you can copy this file to "wp-config.php"
|
|
8
|
-
* and fill in the values.
|
|
9
|
-
*
|
|
10
|
-
* This file contains the following configurations:
|
|
11
|
-
*
|
|
12
|
-
* * Database settings
|
|
13
|
-
* * Secret keys
|
|
14
|
-
* * Database table prefix
|
|
15
|
-
* * ABSPATH
|
|
16
|
-
*
|
|
17
|
-
* This has been slightly modified (to read environment variables) for use in Docker.
|
|
18
|
-
*
|
|
19
|
-
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/
|
|
20
|
-
*
|
|
21
|
-
* @package WordPress
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
// ** Load Composer autoload ** //
|
|
25
|
-
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
|
|
26
|
-
require_once __DIR__ . '/vendor/autoload.php';
|
|
27
|
-
} else {
|
|
28
|
-
die('Error: Composer autoload not found.');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// ** Carregar o .env para variáveis de ambiente ** //
|
|
33
|
-
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
|
34
|
-
$dotenv->safeLoad();
|
|
35
|
-
$requiredEnvs = ['WORDPRESS_DB_NAME', 'WORDPRESS_DB_USER', 'WORDPRESS_DB_PASSWORD', 'WORDPRESS_DB_HOST', 'WORDPRESS_SITE_URL'];
|
|
36
|
-
$dotenv->required($requiredEnvs);
|
|
37
|
-
|
|
38
|
-
// a helper function to lookup "env_FILE", "env", then fallback
|
|
39
|
-
if (!function_exists('getenv_docker')) {
|
|
40
|
-
// https://github.com/docker-library/wordpress/issues/588 (WP-CLI will load this file 2x)
|
|
41
|
-
function getenv_docker($env, $default)
|
|
42
|
-
{
|
|
43
|
-
if (getenv('LANDO_INFO')) {
|
|
44
|
-
// Lando-specific environment variable
|
|
45
|
-
return $_ENV[$env] ?? $default;
|
|
46
|
-
} else if ($fileEnv = getenv($env . '_FILE')) {
|
|
47
|
-
return rtrim(file_get_contents($fileEnv), "\r\n");
|
|
48
|
-
} else if (($val = getenv($env)) !== false) {
|
|
49
|
-
return $val;
|
|
50
|
-
} else {
|
|
51
|
-
return $default;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// ** Database settings - You can get this info from your web host ** //
|
|
57
|
-
/** The name of the database for WordPress */
|
|
58
|
-
define('DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'wordpress'));
|
|
59
|
-
|
|
60
|
-
/** Database username */
|
|
61
|
-
define('DB_USER', getenv_docker('WORDPRESS_DB_USER', 'example username'));
|
|
62
|
-
|
|
63
|
-
/** Database password */
|
|
64
|
-
define('DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'example password'));
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Docker image fallback values above are sourced from the official WordPress installation wizard:
|
|
68
|
-
* https://github.com/WordPress/WordPress/blob/1356f6537220ffdc32b9dad2a6cdbe2d010b7a88/wp-admin/setup-config.php#L224-L238
|
|
69
|
-
* (However, using "example username" and "example password" in your database is strongly discouraged. Please use strong, random credentials!)
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/** Database hostname */
|
|
73
|
-
define('DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'mysql'));
|
|
74
|
-
|
|
75
|
-
/** Database charset to use in creating database tables. */
|
|
76
|
-
define('DB_CHARSET', getenv_docker('WORDPRESS_DB_CHARSET', 'utf8'));
|
|
77
|
-
|
|
78
|
-
/** The database collate type. Don't change this if in doubt. */
|
|
79
|
-
define('DB_COLLATE', getenv_docker('WORDPRESS_DB_COLLATE', ''));
|
|
80
|
-
|
|
81
|
-
/**#@+
|
|
82
|
-
* Authentication unique keys and salts.
|
|
83
|
-
*
|
|
84
|
-
* Change these to different unique phrases! You can generate these using
|
|
85
|
-
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
|
|
86
|
-
*
|
|
87
|
-
* You can change these at any point in time to invalidate all existing cookies.
|
|
88
|
-
* This will force all users to have to log in again.
|
|
89
|
-
*
|
|
90
|
-
* @since 2.6.0
|
|
91
|
-
*/
|
|
92
|
-
define('AUTH_KEY', getenv_docker('WORDPRESS_AUTH_KEY', 'put your unique phrase here'));
|
|
93
|
-
define('SECURE_AUTH_KEY', getenv_docker('WORDPRESS_SECURE_AUTH_KEY', 'put your unique phrase here'));
|
|
94
|
-
define('LOGGED_IN_KEY', getenv_docker('WORDPRESS_LOGGED_IN_KEY', 'put your unique phrase here'));
|
|
95
|
-
define('NONCE_KEY', getenv_docker('WORDPRESS_NONCE_KEY', 'put your unique phrase here'));
|
|
96
|
-
define('AUTH_SALT', getenv_docker('WORDPRESS_AUTH_SALT', 'put your unique phrase here'));
|
|
97
|
-
define('SECURE_AUTH_SALT', getenv_docker('WORDPRESS_SECURE_AUTH_SALT', 'put your unique phrase here'));
|
|
98
|
-
define('LOGGED_IN_SALT', getenv_docker('WORDPRESS_LOGGED_IN_SALT', 'put your unique phrase here'));
|
|
99
|
-
define('NONCE_SALT', getenv_docker('WORDPRESS_NONCE_SALT', 'put your unique phrase here'));
|
|
100
|
-
// (See also https://wordpress.stackexchange.com/a/152905/199287)
|
|
101
|
-
|
|
102
|
-
/**#@-*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* WordPress database table prefix.
|
|
106
|
-
*
|
|
107
|
-
* You can have multiple installations in one database if you give each
|
|
108
|
-
* a unique prefix. Only numbers, letters, and underscores please!
|
|
109
|
-
*
|
|
110
|
-
* At the installation time, database tables are created with the specified prefix.
|
|
111
|
-
* Changing this value after WordPress is installed will make your site think
|
|
112
|
-
* it has not been installed.
|
|
113
|
-
*
|
|
114
|
-
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#table-prefix
|
|
115
|
-
*/
|
|
116
|
-
$table_prefix = getenv_docker('WORDPRESS_TABLE_PREFIX', 'wp_');
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* For developers: WordPress debugging mode.
|
|
120
|
-
*
|
|
121
|
-
* Change this to true to enable the display of notices during development.
|
|
122
|
-
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
|
123
|
-
* in their development environments.
|
|
124
|
-
*
|
|
125
|
-
* For information on other constants that can be used for debugging,
|
|
126
|
-
* visit the documentation.
|
|
127
|
-
*
|
|
128
|
-
* @link https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/
|
|
129
|
-
*/
|
|
130
|
-
define('WP_DEBUG', !!getenv_docker('WORDPRESS_DEBUG', ''));
|
|
131
|
-
|
|
132
|
-
/* Add any custom values between this line and the "stop editing" line. */
|
|
133
|
-
|
|
134
|
-
// If we're running in a Docker container, we need to set the HTTP_HOST and SERVER_PORT
|
|
135
|
-
// to empty strings, otherwise WordPress will try to use the container name as the host.
|
|
136
|
-
// This is necessary for WordPress to work correctly in a Docker environment.
|
|
137
|
-
// This is a workaround for the issue where WordPress tries to use the container name as the host,
|
|
138
|
-
// which can cause issues with SSL and other configurations.
|
|
139
|
-
if (defined('WP_CLI') && constant('WP_CLI')) {
|
|
140
|
-
$_SERVER["HTTP_HOST"] = "";
|
|
141
|
-
$_SERVER['SERVER_PORT'] = 80;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact
|
|
145
|
-
// see also https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy
|
|
146
|
-
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
|
|
147
|
-
$_SERVER['HTTPS'] = 'on';
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** URL routing (Optional, may not be necessary) */
|
|
151
|
-
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
|
|
152
|
-
$siteUrl = getenv_docker('WORDPRESS_SITE_URL', 'localhost');
|
|
153
|
-
$siteUrl = (strpos($siteUrl, 'http') === 0) ? $siteUrl : $protocol . $siteUrl;
|
|
154
|
-
define('WP_HOME', $siteUrl);
|
|
155
|
-
define('WP_SITEURL', $siteUrl . '/wp');
|
|
156
|
-
|
|
157
|
-
// Define the content directory and URL
|
|
158
|
-
// This is where your themes, plugins, and uploads will be stored.
|
|
159
|
-
// The default is to use the "content" directory in the same directory as this file.
|
|
160
|
-
// If you want to use a different directory, you can change the path below.
|
|
161
|
-
// Note: This is not the same as the "wp-content" directory, which is the default location for WordPress content.
|
|
162
|
-
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/content' );
|
|
163
|
-
define( 'WP_CONTENT_URL', 'https://' . $_SERVER['HTTP_HOST'] . '/content' );
|
|
164
|
-
|
|
165
|
-
// Load all WordPress environment variables from the .env file
|
|
166
|
-
$wordpressEnvs = array_filter($_ENV, function ($key) {
|
|
167
|
-
return strpos($key, 'WORDPRESS_') === 0;
|
|
168
|
-
}, ARRAY_FILTER_USE_KEY);
|
|
169
|
-
|
|
170
|
-
// Define all remaining WordPress environment variables
|
|
171
|
-
foreach ($wordpressEnvs as $key => $value) {
|
|
172
|
-
$key = str_replace('WORDPRESS_', '', $key);
|
|
173
|
-
if (!defined($key))
|
|
174
|
-
define($key, $value);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// If there's a WORDPRESS_CONFIG_EXTRA environment variable, evaluate it
|
|
178
|
-
if ($configExtra = getenv_docker('WORDPRESS_CONFIG_EXTRA', '')) {
|
|
179
|
-
eval($configExtra);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/* That's all, stop editing! Happy publishing. */
|
|
183
|
-
|
|
184
|
-
/** Absolute path to the WordPress directory. */
|
|
185
|
-
if (! defined('ABSPATH')) {
|
|
186
|
-
define('ABSPATH', __DIR__ . '/');
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** Sets up WordPress vars and included files. */
|
|
190
|
-
require_once ABSPATH . 'wp-settings.php';
|