Code Monkey home page Code Monkey logo

safepatch's Introduction

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

safepatch's People

Contributors

progerxp avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rsepulvedacl

safepatch's Issues

File header: add/patch files unless/if exist; add value-converting params

Enhance file header with the following syntax (square braces mark optional code):

== [+] [?] [[bin base64 etc:XXX ...]] file/name.* [==]

+ - if present, will create a new file which contents is given instead of patch instructions (after the header)

? - if present, patching won't fail if the target file didn't (no '+') or did (with '+') exist

[...] - a set of Value-converting parameters (https://github.com/ProgerXP/SafePatch/blob/master/docs/Syntax.md#Value_convertions) that:

  • in adding mode (with '+') they will be applied to the file contents following the header - can be used to add binary files
  • in patching mode (no '+') they will be added to all instructions in that file block - for example, useful if the file being patched uses non-UTF-8 encoding thus adding [enc:koi8-r] to the file header will autoconvert all values into KOI8-R

See also Syntax: https://github.com/ProgerXP/SafePatch/blob/master/docs/Syntax.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.