Skip to content

feat(chunks): keep chunk code in files, deprecate the database column - #2447

Open
elcreator wants to merge 1 commit into
evolution-cms:3.5.xfrom
elcreator:feat-migrate-chunks-db-to-file
Open

feat(chunks): keep chunk code in files, deprecate the database column#2447
elcreator wants to merge 1 commit into
evolution-cms:3.5.xfrom
elcreator:feat-migrate-chunks-db-to-file

Conversation

@elcreator

Copy link
Copy Markdown

A chunk's code now lives in views/chunks/.html. The file is the chunk if it exists; the site_htmlsnippets column is what a chunk nobody has saved since holds, and the mirror the manager's search still reads. Both readers - the parser on demand and the site cache builder, which short circuits it - go through one rule, so a cached chunk does not render the stale column.

No column, no setting and no migration: a site crosses over one save at a time and one that saves nothing keeps rendering what it always did. Every database path is marked @deprecated since 3.5.8 with @todo [remove@3.7], so artisan deprecated:list collects them.

Under views/, not assets/: the root .htaccess passes ^assets/ straight to the filesystem, and chunks are where older extras keep configuration. Verified against Apache - a file under assets/chunks came back 200 with its contents, the same file under views/ came back 403. The directory ships with deny guards, and the store writes them wherever it is pointed.

Chunk names are prose, so hazardous bytes are percent-encoded rather than the name refused, and decoded back exactly: "nav/main" is nav%2Fmain.html, "CON" is %43ON.html, "Кнопка" stays readable. What encoding cannot fix is refused with a reason - invalid UTF-8, not NFC, too long once escaped, or a name that would share one file with another chunk on a case-insensitive filesystem. The form previews the same encoding the store applies.

Renaming or deleting a chunk takes its files with it; one left behind would be adopted silently by the next chunk named the same.

A chunk's code now lives in views/chunks/<name>.html. The file is the chunk if
it exists; the site_htmlsnippets column is what a chunk nobody has saved since
holds, and the mirror the manager's search still reads. Both readers - the
parser on demand and the site cache builder, which short circuits it - go
through one rule, so a cached chunk does not render the stale column.

No column, no setting and no migration: a site crosses over one save at a time
and one that saves nothing keeps rendering what it always did. Every database
path is marked @deprecated since 3.5.8 with @todo [remove@3.7], so
`artisan deprecated:list` collects them.

Under views/, not assets/: the root .htaccess passes ^assets/ straight to the
filesystem, and chunks are where older extras keep configuration. Verified
against Apache - a file under assets/chunks came back 200 with its contents,
the same file under views/ came back 403. The directory ships with deny
guards, and the store writes them wherever it is pointed.

Chunk names are prose, so hazardous bytes are percent-encoded rather than the
name refused, and decoded back exactly: "nav/main" is nav%2Fmain.html, "CON" is
%43ON.html, "Кнопка" stays readable. What encoding cannot fix is refused with a
reason - invalid UTF-8, not NFC, too long once escaped, or a name that would
share one file with another chunk on a case-insensitive filesystem. The form
previews the same encoding the store applies.

Renaming or deleting a chunk takes its files with it; one left behind would be
adopted silently by the next chunk named the same.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9k7KBwVFZ6PSWH27ePZuJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant