Phase 14b-2: BasicTheme rewritten on iManager 2.0 stack#20
Merged
Conversation
- composer.json now requires bigins/imanager:2.0.x-dev via a path
repository on ../imanager (symlinked); platform pinned to PHP 8.2
so the lock file matches ServBay's runtime even when the dev
machine has a newer PHP.
- New PSR-4 namespace `Scriptor\Boot\` (-> boot/) holds:
- ImanagerBootstrap::create() — wires PDO + Sqlite storage +
every repository + Sanitizer + FieldTypeRegistry (all 16 v1
field types) + FilesystemCache + LocalFileStorage +
ImageProcessor + FullTextSearch.
- App — process-wide service-locator bridge so legacy code can
reach the container during the 14b–14e transition; emptied
out at the end of Phase 14.
- boot.php is gutted to container-only. The legacy 1.x library
(Scriptor/imanager/) shares the `Imanager\` namespace with the
new vendor package and cannot coexist, so the public site and
editor are intentionally non-functional on this branch until
14b/14c rebuild them. `master` remains the working 1.x build.
- test-bootstrap.php is the §14a smoke page: boots the container,
resolves every registered service, and dumps categories + fields
+ item counts as JSON.
- .gitignore covers vendor/, the migrated SQLite db (+ wal/shm),
the new uploads-2.0 layout, the section cache, and data.bak.*
migration backups.
Migration was run beforehand against /data with the iManager 2.0
CLI (PR #17): 2 categories, 10 fields, 9 items, 12 assets, 0
errors. Backup at data.bak.2026-05-03.
## Summary
- composer.json: path-repo to ../imanager (symlink), `bigins/imanager:2.0.x-dev`,
platform pinned to PHP 8.2 to match ServBay's runtime.
- New PSR-4 namespace `Scriptor\Boot\` (boot/):
- `ImanagerBootstrap::create()` — wires PDO + Sqlite storage + all repos +
Sanitizer + FieldTypeRegistry (16 field types) + FilesystemCache +
LocalFileStorage + ImageProcessor + FullTextSearch.
- `App` — process-wide service locator bridge for the 14b–14e transition.
- `boot.php` gutted to container-only. Legacy 1.x site/editor are
intentionally non-functional on this branch (Imanager\ namespace clash).
`master` remains the working 1.x build as the rollback path.
- `test-bootstrap.php` smoke page resolves every registered service and
reads back categories+fields+item counts from the migrated SQLite DB.
- `.gitignore` for vendor/, imanager.db*, uploads-2.0/, cache/sections/,
data.bak.*.
Migration ran beforehand against /data with the iManager 2.0 CLI:
2 categories, 10 fields, 9 items, 12 assets, 0 errors. Backup at
data.bak.2026-05-03/.
## Test plan
- [x] composer install läuft auf PHP 8.3 (ServBay)
- [x] `php test-bootstrap.php` gibt JSON mit allen Services + Categories aus
- [x] `php -r 'require "boot.php"; ...'` lädt Container ohne Fehler
- [ ] Browser-Smoke: `https://<scriptor-host>/test-bootstrap.php`
Public site renders from the migrated SQLite DB through a brand-new,
container-driven render path. Default-theme files (default.php,
template.php, _head/_header/_footer.php) keep working as adapter
templates — only one $site->version substitution in _footer.php.
New PSR-4 namespace `Scriptor\Boot\Frontend\`:
- Page — readonly DTO around `Imanager\Domain\Item`; surfaces
slug/template/parent/content/menu_title/images plus
any other field via __get against the FieldValueBag.
- PageRepository
— wrapper over CategoryRepository + ItemRepository for
the Pages category; find/findBySlug/findHome/
findByParent/findActiveByParent built on the iManager
Query AST.
- Sanitizer — facade over `Imanager\Validation\Sanitizer` adding
the legacy-only `templateName()` and `pageName()`
helpers themes still call.
- Site — minimal renderer: resolves the requested slug from
`$_SERVER['REQUEST_URI']`, exposes the legacy `$site`
surface (siteUrl, themeUrl, config, version, page,
sanitizer, render(), cache(), throw404(), getTCP()
stub with sane defaults). The render() switch returns
'' for theme-overridable hooks (hero, mainNavItems,
footerNav, …) so the default render path doesn't
crash before BasicTheme reattaches in 14b-2.
boot.php now loads vendor/autoload + container + the legacy
scriptor-config.php (with IS_IM/IM_DATAPATH defines so the legacy file
header doesn't die()). The 1.x `imanager/` library and
`editor/core/scriptor.php` stay disabled — same Imanager\ namespace
clash as 14a.
index.php constructs Frontend\Site directly and includes the theme
template. The basic-theme `_ext.php` (BasicRouter / SuperCache /
BasicTheme) is intentionally NOT loaded here — comes back in 14b-2.
Manual smoke (PHP built-in server):
GET / → 200, 5.3 KB, <h1>Scriptor's Demo Page</h1>
GET /scriptors-demo-page → 200, identical (home slug)
GET /this-does-not-exist → 404, sane fallback
Markdown content rendered via Sanitizer::markdown() (Parsedown +
HTMLPurifier when enabled).
Phase 14b-1: Frontend skeleton on iManager 2.0 container
The bundled basic theme now extends Frontend\Site and pulls every
service from the container — no remaining call into the legacy
imanager() function or editor/core/ classes survives the public
render path. Pagination, theme cache, template fragments, navigation,
archive, hero, contact and subscribe are all on 2.0 plumbing.
Key rewrites:
- BasicTheme (lib/Basic.php) extends Frontend\Site and overrides
init()+render(). Article list / archive use the typed
PageRepository methods (findInTimeRange, findByParent,
countByParent), pagination is built with iManager's Pagination
value object + PaginationRenderer. Single-article rendering
forces template `blog-post` via currentTemplate() instead of
mutating the Page DTO. Contact + subscribe + loadToken endpoints
preserved as a bridge with the new typed Request accessors and
JSON responses; CSRF placeholders are empty until 14c-1 wires
auth back.
- BasicRouter (lib/BasicRouter.php) collapsed to a 22-line wrapper
that dispatches actions and delegates routing to BasicTheme.
- _ext.php sets up BasicTheme + checks the FilesystemCache for a
SuperCache hit before invoking the router.
- lib/subscriber/MailChimp.php: typed properties, removed dead
Imanager\Util import, defensive defaults for missing config.
Frontend\Site additions for the theme surface:
- Properties: input (Imanager\Http\Request), templateParser
(TemplateRenderer), cache (FilesystemCache), msgs[]
- currentTemplate() override hook for blog-style routing
- getBasePath(), getPageUrl() (cycle-safe), addMsg()
- init() empty hook for theme subclasses
Frontend\PageRepository additions:
- findByParent(parent, orderBy, direction, activeOnly, offset, limit)
- findInTimeRange(start, end, parent, orderBy, direction)
- countByParent(parent, activeOnly)
- levels(rootParent, maxDepth, activeOnly, excludeIds) with
visited-set cycle detection (the migrated demo data has page id=8
pointing parent→8 to itself; would otherwise OOM the request)
- descendants(parent) with the same cycle guard
Theme files & data:
- resources/_tpls.php migrated from `[[VAR]]` to `{{var}}` so the
iManager TemplateRenderer (Phase 11) resolves them; pagination
fragments grouped under a `pagination` sub-array with the keys
PaginationRenderer expects (wrapper/link/current/prev/...).
- data/settings/basic-theme-config.php: dropped the static
Scriptor::getConfig() / BasicTheme::VERSION references that
don't autoload on the 2.0 stack — BasicTheme::init() merges the
live values from $site->config.
- template.php uses $site->currentTemplate() so the blog routing
can override without mutating the Page DTO.
- index.php delegates to the theme's _ext.php when present and
bails out cleanly when _ext.php returns early on a SuperCache hit.
Manual smoke (PHP built-in server):
GET / 200, 7.3 KB
GET /scriptors-demo-page 200, 7.5 KB (home alt)
GET /articles/ 200, 7.1 KB (article list)
GET /articles/page2/ 200, 5.8 KB (paginated)
GET /articles/get-started-with-scriptor 200, 7.7 KB (single article)
GET /contact 200, 7.1 KB (form)
GET /this-does-not-exist 404
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bundled basic theme now extends
Frontend\Siteand pulls every service fromthe container — no remaining call into the legacy
imanager()function oreditor/core/classes survives the public render path. Pagination, themecache, template fragments, navigation, archive, hero, contact and subscribe
are all on iManager 2.0 plumbing.
Highlights:
value object + PaginationRenderer + FilesystemCache. Single-article
rendering forces
blog-postviacurrentTemplate()instead of mutatingthe Page DTO.
input(Request),templateParser,cache,currentTemplate(),getBasePath(),getPageUrl()(cycle-safe).findByParent/findInTimeRange/countByParent/levels(all with visited-set cycle detection — themigrated demo data has page id=8 pointing parent→8 to itself, which would
otherwise OOM the request).
[[VAR]]→{{var}}for the iManagerTemplateRenderer; pagination fragments grouped to match
PaginationRenderer's expected keys.
Scriptor::getConfig()/BasicTheme::VERSIONreferences; merged from$site->configat runtime.Imanager\Utilimport,defensive defaults.
Subscribe / contact / loadToken endpoints are kept as a bridge with the new
typed Request accessors and JSON responses; CSRF placeholders are empty
until 14c-1 (auth module) wires CSRF back.
Test plan
GET /200, 7.3 KBGET /scriptors-demo-page200, 7.5 KB (home alt slug)GET /articles/200, 7.1 KB (article list)GET /articles/page2/200, 5.8 KB (paginated)GET /articles/get-started-with-scriptor200, 7.7 KB (single article,forced blog-post template)
GET /contact200, 7.1 KB (form)GET /this-does-not-exist404