#5473 - v12: Consider *_compiled directories

  • By
  • Added
  • 15 views
Identifier #5473
Issue type Feature request or suggestion
Title v12: Consider *_compiled directories
Status Completed
Tags

Risk: Changes core website behaviour (custom)

Roadmap: Over the horizon (custom)

Handling member PDStig
Addon core
Description In v12, consider making *_compiled directories in addition to the * and *_custom directories. Composr CMS will create / update PHP files in these directories containing the final compiled code when considering *_custom and contentious overrides.

When requiring code, ultimately use the *_compiled file.

This will make development easier especially regarding stack traces. With our current set-up, stack traces often mask the origin of errors due to eval code. We want to minimize use of eval so we can get proper stack traces. In this case, the stack trace would come from the *_compiled file.
Steps to reproduce

Additional information Perhaps make other considerations as well...

Whenever an override was made, a comment is automatically added in the *_compiled PHP file indicating the location/file and line number of where the override takes place. Then add an END comment where that particular override ends.

The *_compiled files should be treated as a cache and therefore a website cleanup tool should have the option of cleaning this out.

Document that *_compiled files are not meant for editing (just like * files without _custom). Edits should be made by making or editing an override.

In production, *_compiled files should normally be generated on-the-fly as needed. But have a script available that can be run by developers to compile the entire code base at once.

When requiring, Composr should check the last file modification date/time for the * and *_custom files and compare it with the *_compiled file. If either are newer than the *_compiled file, then regenerate the *_compiled file, else just load the current *_compiled file. Of course, if config option to minimize disk accesses is set, then this does not happen and *_compiled files must be deleted (or the cleanup tools run) to regenerate them. (Need to consider how we would achieve the same for contentious overrides).

If using an editor in Composr, it should automatically delete the relevant *_compiled file when saving so it can be regenerated. Or perhaps also regenerate it then and there.

Perhaps we should consider whether or not this should be a "development only" feature, e.g. production builds do not include *_compiled directories and do not use them (instead using eval like before). And such feature only activates in dev mode or when running in a git repository. Normally, this feature would have little to no benefit outside of development.

Consider modifying git hooks to clear out *_compiled files on pull. Also consider clearing out *_compiled files on decache.

Consider utilizing *_compiled system when accessing /root (I'm not sure if contentious overrides currently apply to /root files).
Related to

#3856 - Addon isolation via virtual subtrees

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated