A "Patcher" module is at the planning to do code patching for fixes and changes in between releases. There are 2 solutions in our mind and discussions and inputs are welcome.
Solution 1: Use Patch File
1. Standardized patch files, one patch file per file to be modified (e.g. pf_news.php as the patch file for news.php). Standard format to be determined.
2. Patch file feature include any number of patch blocks including:
(1) search string
(2) replace string
(3) append string
(4) delete string
(5) comment string
3. Upload or paste patch into module interface, and run it. Run steps include:
4. Insert patch identifier (to be determined) into a database table to track
(1) Check if patch has already been applied. Exit if it has
(2) Check if file is writable, or display message "make writable"
(3) Find search string in the file
(4) Run replace, append, or delete
(5) Loop back to step 3 if there are more patches to be applied to that file
(6) When finished check that file is not writable, or display message "make not writable", then go to the next patch file.
Do not allow module to exit if patched files are still writable.
Solution 2: Merge Code with diff
The interface is same as Solution 1. It works as merge code function in CVS or SVN by comparing 3 files: script before change, script after change and the local script that user is working on.
Problem to be solved
Solution 2 will save code distributors from creating patch files but more research is required to decide on the algorithm to compare and merge files.