4 · Track and restore
Objective — make every vendor patch discoverable and re-applicable: log each one as a MOD-NNN, and run one restore script so composer install and vendor updates never quietly drop your work.
Background
Section titled “Background”The overlay re-applies files; the tracking log explains them. Six months from now, a ZAJ:BEGIN MOD-001 marker in a vendor file means nothing without a record of what MOD-001 is, why it exists, and what breaks if it’s missing. The _CUSTOMIZATIONS log is that record — a numbered registry of every vendor modification.
The restore script closes the loop. Because a plain composer install restores vanilla vendor files, the script must run after it to copy your overlaid files back. It is also packaged as a downloadable kit so you can drop it into any project.
flowchart LR L["_CUSTOMIZATIONS log<br/>MOD-NNN registry"] --> O["resources/<br/>vendor-customizations/"] O --> S["restore script<br/>copies overlay → vendor/"]1. Log each customization as a MOD-NNN entry
Section titled “1. Log each customization as a MOD-NNN entry”Every vendor patch gets a numbered, documented entry so it can be re-applied confidently after any update. Treat the log as the single source of truth for “what did we change in vendor code, and why.”
-
Add a
MOD-NNNrow for each customization, recording the fields that make it re-applicable.Field What it captures ID MOD-NNN— a stable identifier matching theZAJ:BEGINmarker in the fileFile the vendor path that was edited (e.g. app/Http/Controllers/HomeController.php)Vendor which CodeCanyon app/version the patch targets Problem what breaks without the patch Impact the user-visible symptom (e.g. wrong migration count → redirect to /update)First added the date, so you can correlate with vendor releases - ✅ Each customization has one numbered row capturing file, vendor, problem, impact, and date.
-
Keep an update checklist that lists every modified file and the action to take when a vendor update lands.
File Modification Action on vendor update app/Http/Controllers/HomeController.phpMOD-001 Re-apply the ZajModules migration-path patch, then run the verification - ✅ The checklist names every file that will conflict on a vendor update and how to re-apply each patch.
2. Run the restore script after composer install
Section titled “2. Run the restore script after composer install”The restore script reads the overlay and copies every customized file back over its vendor counterpart. Run it after any command that rewrites vendor/.
-
Run the script after
composer install(or after a vendor update).Terminal window composer installphp Admin-Local/.../restore-vendor-customizations.php# Expected: "Found N customized package(s)" then a per-package "Restored N file(s)" summary- ✅ The summary lists each customized package and reports the files it restored.
The script scans resources/vendor-customizations/, finds each customized package folder, and recursively copies its files onto the matching package inside vendor/. If a package isn’t present in vendor/ (removed or renamed) it is skipped with a warning rather than failing the run. It also auto-extracts resources/vendor-customizations.zip if the unpacked directory isn’t there yet.
3. Verify the patches actually landed
Section titled “3. Verify the patches actually landed”A restore that reports success still needs a behavioral check — confirm the patched logic produces the right result, not just that files were copied.
-
Re-run the patch’s own verification. For the
MOD-001migration-scanner example, confirm the file count now matches the database count.Terminal window php artisan tinker --execute="\$files = count(File::glob(database_path('migrations/*.php')));\$files += count(File::glob(database_path('migrations-zaj/*.php')));\$files += count(File::glob(base_path('packages/ZajModules/*/src/Database/Migrations/*.php')));\$db = DB::table('migrations')->count();echo 'Files: '.\$files.' | DB: '.\$db.' | Diff: '.(\$files - \$db);"# Expected: Diff: 0 (or close to 0)- ✅ The diff is
0(or near it), confirming the patched scanner now sees every migration path.
- ✅ The diff is
-
Commit the re-applied patch with a message that names the
MOD-NNN, sogit logcross-references the registry.- ✅ The commit message references the
MOD-NNN, e.g. “Re-apply ZajModules migration patch (MOD-001) after vendor update”.
- ✅ The commit message references the
4. Reuse the script as a kit
Section titled “4. Reuse the script as a kit”The restore script is generic — it works for any customized package, not just one — which is why it ships as a reusable kit you can drop into a new project.
-
Grab the packaged restore script from the kits and place it in your project’s scripts folder, then point your install/deploy routine at it.
- ✅ The project has its own copy of
restore-vendor-customizations.phpwired into the install flow.
- ✅ The project has its own copy of
Checklist
Section titled “Checklist”Do not mark this step done until every box below is checked.
- 👤 Every patch logged — each customization has a
MOD-NNNrow (file, vendor, problem, impact, date) and an update-checklist entry. - 🤖 Restore runs —
restore-vendor-customizations.phpruns aftercomposer installand reports each package restored. - 🤖 Patch verified — the patch’s own check passes (e.g. migration
Diff: 0), not just “files copied”. - 🔀 Committed + wired — the re-applied patch is committed referencing its
MOD-NNN, and the restore step is part of the install/deploy routine.
Vendor Updates — apply a new vendor release safely, restoring your customizations as part of the update.