View Full Version : Creating a package system

01-15-2008, 04:23 PM
Hi, I want to learn how to create a package system like SMF's package system so that I can release modifications to my script easily.

The user can just download a patch file or a mod file, upload it to the server, and then my script would parse the actions, then add/remove/replace code in the files. That way, code modifications are automatic and the user doesn't need to go into the code. I'm wondering how I could create this script.

Does anybody know how the package system in SMF works, and how I could code something similar? It doesn't need to be very advanced, just a simple one will do.

Or, does anybody know of another way in which I can release code modifications easily?

I'm just stuck on how I could parse this kind of file and then perform the actions. What functions would I use for what?

Thanks! :D

btw, here's an example mod file from SMF (it's an old version):

-- This information needs to be the same as that in the package-info.xml. --

-- Edit a specific file.. --
<edit file>$sourcedir/Filename.php</edit file>

-- The code to search for. --
<search for>
Search for some code to add stuff after.
</search for>

-- Add this text when we find it, after what we found. -->
<add after>
This is what to add.
</add after>

<search for>
Another search operation?
</search for>

Yes, another. This time, replacing!

Of course, using a different format for the mod file is fine. I was thinking JSON. SMF currently uses XML.
I have an idea of how I want the format in JSON, and it's in another topic here: http://codingforums.com/showthread.php?t=131314