Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/.* export-ignore
/.phpstorm.meta.php -export-ignore
/addons/ export-ignore
/project/ export-ignore
/tests/ export-ignore
/docker-compose.yml export-ignore
/phpstan.dist.neon export-ignore
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ jobs:
run: |
sudo /etc/init.d/mysql start
mysql -uroot -h127.0.0.1 -proot -e 'create database redaxo6;'
php .tools/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php .tools/bin/console config:set --type boolean debug.enabled true -v
php .tools/bin/console config:set --type boolean debug.throw_always_exception true -v
php project/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php project/bin/console config:set --type boolean debug.enabled true -v
php project/bin/console config:set --type boolean debug.throw_always_exception true -v

- name: Run phpstan analysis
if: github.event_name != 'repository_dispatch'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/styles-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ jobs:
run: |
sudo /etc/init.d/mysql start
mysql -uroot -h127.0.0.1 -proot -e 'create database redaxo6;'
php .tools/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php .tools/bin/console config:set --type boolean debug.enabled true -v
php .tools/bin/console config:set --type boolean debug.throw_always_exception true -v
php project/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php project/bin/console config:set --type boolean debug.enabled true -v
php project/bin/console config:set --type boolean debug.throw_always_exception true -v

- name: Compile styles
run: php .tools/bin/console assets:compile-styles --ansi -v
run: php project/bin/console assets:compile-styles --ansi -v

- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
Expand All @@ -92,4 +92,4 @@ jobs:
if: env.writable == 0
run: |
# check if compiling the scss lead to uncommitted changes
git diff HEAD --exit-code --output=/dev/null || (echo "::error::It seems you missed to commit the compiled css files, run '.tools/bin/console assets:compile-styles' and push the changes." && exit 1)
git diff HEAD --exit-code --output=/dev/null || (echo "::error::It seems you missed to commit the compiled css files, run 'project/bin/console assets:compile-styles' and push the changes." && exit 1)
10 changes: 5 additions & 5 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ jobs:
- name: Setup REDAXO
run: |
mysql -uroot -h127.0.0.1 -proot -e 'create database redaxo6;'
php .tools/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php .tools/bin/console config:set --type boolean debug.enabled true -v
php .tools/bin/console config:set --type boolean debug.throw_always_exception true -v
.tools/bin/console addon:install test -v
.tools/bin/console system:report -v
php project/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php project/bin/console config:set --type boolean debug.enabled true -v
php project/bin/console config:set --type boolean debug.throw_always_exception true -v
project/bin/console addon:install test -v
project/bin/console system:report -v

- name: Run phpunit
run: vendor/bin/phpunit --colors=always
28 changes: 14 additions & 14 deletions .github/workflows/visual-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,37 +94,37 @@ jobs:
run: |
sudo /etc/init.d/mysql start
mysql -uroot -h127.0.0.1 -proot -e 'create database redaxo6;'
php .tools/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php .tools/bin/console config:set --type boolean debug.enabled true -v
php .tools/bin/console config:set --type boolean debug.throw_always_exception true -v
php .tools/bin/console addon:install test -v
php project/bin/console setup:run -n --lang=de_de --db-host=127.0.0.1 --db-name=redaxo6 --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword --error-email=test@redaxo.invalid --ansi -v
php project/bin/console config:set --type boolean debug.enabled true -v
php project/bin/console config:set --type boolean debug.throw_always_exception true -v
php project/bin/console addon:install test -v

- name: Import mock data
run: |
mkdir -p $GITHUB_WORKSPACE/.tools/project/var/data/core/backup && cp -r .tools/visual-tests/fixtures/initial-content.sql $GITHUB_WORKSPACE/.tools/project/var/data/core/backup/
cp -r .tools/visual-tests/fixtures/media/* $GITHUB_WORKSPACE/.tools/project/public/media/
mkdir -p $GITHUB_WORKSPACE/project/var/data/core/backup && cp -r .tools/visual-tests/fixtures/initial-content.sql $GITHUB_WORKSPACE/project/var/data/core/backup/
cp -r .tools/visual-tests/fixtures/media/* $GITHUB_WORKSPACE/project/public/media/
cp -f .tools/visual-tests/fixtures/README.md $GITHUB_WORKSPACE/addons/test/README.de.md
php .tools/bin/console setup:run -n --lang=de_de --db-password=root --db-setup=import --db-import=initial-content --admin-username=myusername --admin-password=mypassword --ansi -v
php project/bin/console setup:run -n --lang=de_de --db-password=root --db-setup=import --db-import=initial-content --admin-username=myusername --admin-password=mypassword --ansi -v
- name: Install packages
run: |
php .tools/bin/console addon:install debug --ansi -v
php project/bin/console addon:install debug --ansi -v

- name: Start php server
run: |
cat <<EOF > .tools/project/public/router.php
cat <<EOF > project/public/router.php
<?php
if (preg_match('@redaxo/(?:bin|data|cache|src)@', \$_SERVER['REQUEST_URI'])) http_response_code(403);
else return false;
EOF
PHP_CLI_SERVER_WORKERS=4 php -S localhost:8080 -t .tools/project/public/ .tools/project/public/router.php &
PHP_CLI_SERVER_WORKERS=4 php -S localhost:8080 -t project/public/ project/public/router.php &

- name: Take screenshots (differential)
run: |
php .tools/bin/console config:set setup true -t boolean --ansi -v
php .tools/bin/console cache:clear --ansi -v
php project/bin/console config:set setup true -t boolean --ansi -v
php project/bin/console cache:clear --ansi -v
node .tools/visual-tests/visual-record.js setup
php .tools/bin/console config:set setup false -t boolean --ansi -v
php .tools/bin/console cache:clear --ansi -v
php project/bin/console config:set setup false -t boolean --ansi -v
php project/bin/console cache:clear --ansi -v
node .tools/visual-tests/visual-record.js
git add .tools/visual-tests/screenshots/
git diff --cached --exit-code --name-only .tools/visual-tests/screenshots/
Expand Down
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
/node_modules/
/vendor/

# Local project for testing
/.tools/project/*
!/.tools/project/public/
/.tools/project/public/*
!/.tools/project/public/index.php
!/.tools/project/public/redaxo/
!/.tools/project/src/

# PhpStorm setting
/.idea/*
!/.idea/encodings.xml
Expand Down
2 changes: 1 addition & 1 deletion .idea/jsonSchemas.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
__DIR__ . '/boot',
__DIR__ . '/fragments',
__DIR__ . '/pages',
__DIR__ . '/project',
__DIR__ . '/setup',
__DIR__ . '/src',
__DIR__ . '/tests',
])
->exclude([
'project/var',
'var',
'vendor',
])
->append([
__FILE__,
__DIR__ . '/.tools/bin/console',
__DIR__ . '/.tools/bin/update-root-composer',
__DIR__ . '/project/bin/console',
__DIR__ . '/assets_src/vendor_files.php',
__DIR__ . '/rector.php',
])
Expand Down
17 changes: 17 additions & 0 deletions .tools/bin/init-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# Initializes the local project instance (project/) for development in this monorepo. The skeleton runs against the
# monorepo's root vendor/ instead of a project-local one, so we generate a gitignored
# project/vendor/autoload_runtime.php shim that delegates to the root runtime (in a created project, symfony/runtime
# provides this file).

set -e

mkdir -p project/vendor

cat > project/vendor/autoload_runtime.php <<'PHP'
<?php

// @generated by .tools/bin/init-project — not part of the project skeleton.
return require dirname(__DIR__, 2) . '/vendor/autoload_runtime.php';
PHP
2 changes: 1 addition & 1 deletion .tools/bin/merge-5x
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fi

git commit --no-edit -m "Merge branch '5.x' into 6.x"

.tools/bin/console assets:compile-styles
project/bin/console assets:compile-styles
composer cs-fixer
composer sa

Expand Down
14 changes: 7 additions & 7 deletions .tools/bin/refresh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
# refreshes the redaxo installation.
# most of the time this is required when working on the REDAXO sources after checking out a Pull Request via GitHub.com

mkdir -p .tools/project/public/assets/core
cp -R assets/* .tools/project/public/assets/core/
php -r 'foreach (require "assets_src/vendor_files.php" as $src => $dst) { $dst = ".tools/project/public/assets/core/" . $dst; @mkdir(dirname($dst), 0775, true); copy("assets_src/" . $src, $dst); }'
mkdir -p project/public/assets/core
cp -R assets/* project/public/assets/core/
php -r 'foreach (require "assets_src/vendor_files.php" as $src => $dst) { $dst = "project/public/assets/core/" . $dst; @mkdir(dirname($dst), 0775, true); copy("assets_src/" . $src, $dst); }'

if [ "true" = $(.tools/bin/console config:get setup) ]; then
.tools/bin/console cache:clear --ansi
if [ "true" = $(project/bin/console config:get setup) ]; then
project/bin/console cache:clear --ansi

echo "Core/Addons can not be re-installed, because the REDAXO setup is not done yet."

exit
fi

.tools/bin/console migrate --ansi
.tools/bin/console cache:clear --ansi
project/bin/console migrate --ansi
project/bin/console cache:clear --ansi

composer update --ansi # update dev-tools
8 changes: 4 additions & 4 deletions .tools/bin/update-all
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ curl -# https://cdn.jsdelivr.net/gh/jquery/jquery@3/dist/jquery.min.map > assets
#printf "\nUpdate assets/jquery-pjax.min.js\n"
#curl -#d output_info=compiled_code -d compilation_level=SIMPLE_OPTIMIZATIONS -d code_url=https://github.com/defunkt/jquery-pjax/raw/master/jquery.pjax.js https://closure-compiler.appspot.com/compile > assets/jquery-pjax.min.js

cp assets/jquery-pjax.min.js .tools/project/public/assets/core
cp assets/jquery.js .tools/project/public/assets/core
cp assets/jquery.min.js .tools/project/public/assets/core
cp assets/jquery.min.map .tools/project/public/assets/core
cp assets/jquery-pjax.min.js project/public/assets/core
cp assets/jquery.js project/public/assets/core
cp assets/jquery.min.js project/public/assets/core
cp assets/jquery.min.map project/public/assets/core
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Project\Module;
namespace Redaxo\Core\Fixtures;

use Override;
use Redaxo\Core\Content\ArticleSlice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?php

namespace Project\Template;
namespace Redaxo\Core\Fixtures;

use Override;
use Redaxo\Core\Content\ArticleContent;
use Redaxo\Core\Content\AsTemplate;
use Redaxo\Core\Content\ContentSection;
use Redaxo\Core\Content\Template;

#[AsTemplate('default', 'Default')]
final class DefaultTemplate extends Template
#[AsTemplate('test', 'Test')]
final class TestTemplate extends Template
{
#[Override]
public function render(ArticleContent $content): string
{
return $content->renderContent();
}

/** @return non-empty-list<ContentSection> */
#[Override]
public function getContentSections(): array
{
Expand Down
14 changes: 0 additions & 14 deletions .tools/project/src/Project.php

This file was deleted.

4 changes: 2 additions & 2 deletions .tools/visual-tests/fixtures/initial-content.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
## Prefix rex_

INSERT IGNORE INTO `rex_article` VALUES
(1,1,0,'test category','test category',1,1,1,'|',1,'default',1,'2021-01-01 11:37:20','myusername','2021-01-01 11:37:20','myusername'),
(2,2,0,'test article','',0,0,1,'|',0,'default',1,'2021-01-01 11:37:20','myusername','2021-01-01 11:37:20','myusername');
(1,1,0,'test category','test category',1,1,1,'|',1,'test',1,'2021-01-01 11:37:20','myusername','2021-01-01 11:37:20','myusername'),
(2,2,0,'test article','',0,0,1,'|',0,'test',1,'2021-01-01 11:37:20','myusername','2021-01-01 11:37:20','myusername');

INSERT IGNORE INTO `rex_article_slice` VALUES
(1,1,1,1,'testmodule1',0,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2021-01-01 11:37:20','myusername','2021-01-01 11:37:20','myusername'),
Expand Down
Binary file modified .tools/visual-tests/screenshots/cronjob_cronjobs_add--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/cronjob_cronjobs_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/index--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/setup_3--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/setup_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/structure_category_edit--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/structure_category_edit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/system_log--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/system_log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 10 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,29 @@ vendor/bin/phpunit tests/Database/SqlTest.php

### Console & Docker
```bash
php .tools/bin/console # List all CLI commands (Symfony Console)
php .tools/bin/console setup:run # Run setup
php .tools/bin/console migrate # Sync DB schema with core + addons after a code update
php project/bin/console # List all CLI commands (Symfony Console)
php project/bin/console setup:run # Run setup
php project/bin/console migrate # Sync DB schema with core + addons after a code update
docker-compose up -d # Start (port 80)
REDAXO_PORT=8080 docker-compose up -d # Start on custom port
```

## Architecture

### What belongs to this repo
This repository contains the **REDAXO core** under `src/` (`Redaxo\Core\`), backend pages (`pages/`), templates (`fragments/`), translations (`lang/`), setup (`setup/`) and assets (`assets/`, `assets_src/`). Two **dev-only addons** live under `addons/`: `debug` and `test`.
This repository **is** the `redaxo/core` package — the package is the whole repository root, not a subdirectory. Everything in the root ships as core except the dev-only paths excluded from the dist via `.gitattributes` `export-ignore` (notably `addons/`, `project/`, `tests/`, the dotfiles and the analysis configs). Core's PHP classes (`Redaxo\Core\`) live in `src/`, but core equally comprises the boot sequence (`boot/`), backend pages (`pages/`), fragment templates (`fragments/`), translations (`lang/`), setup (`setup/`), DB schemas (`schemas/`) and assets (`assets/`, `assets_src/`).

Two addons live under `addons/`, but they are different in nature: **`debug`** is the `redaxo/debug` package — a real, published addon that is split out into a standalone repository via git subtree split and required here only as a dev dependency. **`test`** is an internal helper used solely within this repo for testing and is *not* published.

The **`project/` skeleton** is the `redaxo/project` package — published standalone via git subtree split and used with `composer create-project` — which also doubles as this repo's local development instance (see *Local dev instance* below). Visual-test fixtures (modules/templates) live under `.tools/fixtures/` (namespace `Redaxo\Core\Fixtures`), so they stay out of the shipped skeleton.

### Key concepts
- **`Core` static class** (`src/Core.php`) — central application registry for paths, config, request, current user.
- **Addon system** — `Addon` / `AddonManager` (`src/Addon/`). Each addon is a subclass of `Addon`, registered via composer.json `extra.redaxo.addon-class`. Metadata comes from composer.json; integration happens through overridable hooks — `boot()` (runtime init), `install()`/`uninstall()` (schema/data setup — must be idempotent, runs on every `console migrate`), `getPages()` (backend pages) — plus the `$load` and `$defaultConfig` properties.
- **Extension points** — REDAXO's hook/event system: register listeners with `Extension::register('NAME', ...)`, fire points with `Extension::dispatch(new ExtensionPoint(...))`. Classes live under `Redaxo\Core\ExtensionPoint`. This is the primary integration mechanism for addons.
- **Fragments** (`fragments/`) — template snippets rendered via `Fragment` (`src/View/Fragment.php`).
- **Boot flow** — `AbstractProject` (Symfony `RuntimeInterface`) drives boot via `boot/core.php` → `boot/addons.php` → environment entry (`boot/backend.php`, `boot/frontend.php`, `boot/console.php`).
- **Boot flow** — `AbstractProject` (Symfony `RuntimeInterface`) drives boot via `boot/core.php` → `boot/addons.php` → environment entry (`boot/backend.php`, `boot/frontend.php`, `boot/console.php`). The entry points live in the project (`project/public/index.php`, `project/public/redaxo/index.php`, `project/bin/console`).
- **Local dev instance** — `project/` is loaded as a Composer path repo and symlinked into `vendor/redaxo/project`. `composer install`/`update` runs `.tools/bin/init-project`, which writes the gitignored `project/vendor/autoload_runtime.php` shim (delegating to the root autoloader). Run the app via `project/bin/console` and the `project/public/` document root; runtime data lives in `project/var/` (gitignored).

### Class naming
All core classes live in the `Redaxo\Core\` namespace, mapped to `src/`. Tests live under `tests/` mirroring the `src/` layout, namespace `Redaxo\Core\Tests`, files named `*Test.php`.
Expand Down
Loading
Loading