Skip to main content

Smart Override Detection

Track, protect, and manage manual changes to compiled files โ€” without losing work.

What Is Smart Override Detection?

Smart Override Detection in JCB refers to the systemโ€™s ability to recognize when a developer has manually modified a compiled file and help preserve those changes intelligently during future compiles. It serves as a safeguard against accidentally overwriting important customizations when rebuilding a component.

JCB scans, compares, and flags modifications in PHP, layout, XML, and asset files โ€” ensuring that your injected logic or edits are either preserved via Insert/Replace tags, moved to backup, or logged as overridden.

This makes Smart Override Detection essential for round-trip development, safe manual tweaks, and working with compiled code collaboratively.

Key Features

  • ๐Ÿง  Override Awareness: Detects if a file or section of code was manually changed since the last compile.
  • ๐Ÿ—ƒ Auto Backup Before Overwrite: JCB automatically stores a backup of overridden files before replacing them during a compile.
  • ๐Ÿ“‚ Override Logging: Detailed compile logs include a summary of overridden files, skipped entities, or changes detected.
  • ๐Ÿ“‹ Insert/Replace Tag Friendly: If youโ€™ve made your changes inside Insert/Replace tags, JCB recognizes and re-injects them โ€” even if the surrounding structure changes.
  • ๐Ÿ”„ Safe Merging for Custom Code: If manual changes are found outside tracked regions, JCB logs them clearly and flags them for developer review.
  • ๐Ÿ“Œ Granular File Comparison: Changes are detected at the file and tag level โ€” not just timestamps or file size โ€” to ensure precise change tracking.
  • ๐Ÿงพ Version-Aware Compilation: Smart override detection works even across different Joomla versions (J3, J4, J5) and template branches.
  • ๐Ÿ“˜ Works with External Editors: Safe to work in your IDE or staging site โ€” changes won't be silently lost during next builds.

Use Cases

  • You manually tweak a controller to test a new behavior โ€” and want JCB to preserve your version on recompile
  • You hand-edit a template HTML file and recompile โ€” JCB backs up your change and warns you
  • You override a layout using insert/replace tags โ€” and JCB injects them back in correctly
  • You forget to tag your manual logic โ€” but JCB logs the diff so you can review it post-build

How It Works

  1. JCB stores metadata and hashes of each compiled file after build.
  2. On the next compile, JCB compares current files with stored snapshots.
  3. If changes are detected:
    • Files with Insert/Replace tags: code is re-injected normally
    • Files with manual edits outside tags: backed up and/or flagged
  4. Logs are updated with exact file names and differences (if enabled)

๐Ÿง  Pro Tip: Enable detailed logging in JCBโ€™s compile settings to monitor every override scenario and backup behavior.

Conclusion

Smart Override Detection is your safety net in complex projects. It encourages responsible manual editing, supports legacy migrations, and ensures you never lose valuable tweaks between compiles. Whether you're prototyping, debugging, or collaborating across teams, JCB