Managable automatic patching of program files regardless of language, platform and design
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
logos
plugins
src
LICENSE
README.md

README.md

SafePatch lets you edit program files and track those changes creating "patches" that can later be reverted or reused in a different setup. Standalone PHP patches can be built providing automated installation and reverting of the bundled safepatch.

Multiple patches are merged together gracefully. Patching is atomic (transactional) so that either it is fully completed or all files are left unchanged.
Intuitive text patch file format (.sp) is used but others (VQMod .xml, FluxBB .txt) can be used as well if the corresponding loader is written.

Non-PHP applications can use SafePatch since no source code integration is required (albeit it's possible). Both text and binary files are supported.

This project has been migrated from Google Code.

Features

  • dependencies-free self-contained core (safepatch.php)
  • web admin panel for managing installed patched, tracking their changes (diff), etc.
  • patch builds with a web interface to revert them - all in one PHP script
  • atomic patching/reverting: if an error occurs (e.g. a file could not be written) all changes are rolled back
  • stability: detection of changes done to the patch or patched files after the patch has been applied
  • high-quality object-oriented code using exceptions instead of die()

The original idea was inspired by VQMod. Main differences are:

  • Files are edited in-place:
  • Independence of the target application language (it might be Python, C or anything else) because no file redirections need to be done.
  • Changes can be done directly to program files and they won't require cache update or anything else apart from changing the file itself.
  • SafePatch code can be removed and all changes will be kept.
  • XML engine is not required to parse SafePatch files
  • There's a plugin to treat VQMod .xml patches as if they were in native SafePatch format - see Configuration for more details

Getting started

Installation process is as straightforward as it can be: download the latest version and extract it somewhere on your server. SafePatch should work with default settings if you give it write permissions to logs/ and state/ and read-only to the rest. Default configuration (basePath) assumes that files to be patched are located one level above the SafePatch root.

You can now open the control panel (http://yourhost.com/safepatch/admin/) and start uploading patches or do other maintenance.

If you're familiar with PHP and the application you're attaching SafePatch to is written in PHP too you can make it automatically refresh patches appearing in patches/ by putting the following code at the beginning of index.php and/or other files that user requests from the Internet: require 'safepatch_root/safepatch.php';

Don't forget to limit access to the control panel using HTTP Authorization (bundled .htaccess has commented-out directives for this), GuestMode plugin or some other means.

Patching process is also intuitive and can be done in two ways:

  • Manual - upload patches (usually files with .sp extensions but might be .xml or .txt) into safepatch_root/patches/; they will be applied automatically if you're put the above PHP code into your web scripts or you can apply them manually via the control panel;
  • Automatic - use the control panel's Patches page to upload patches from your computer; they will be automatically stored in patches/ and applied thereafter.

Keep in mind that it's also possible to create standalone patch builds that work like mini-control panels and don't require the target server to have SafePatch installed - just upload the single file and open it in a web browser.

Control panel

SafePatch control panel screenshot

Installing FluxBB mods video demonstration

http://www.youtube.com/watch?v=uYbu_r75fy8