...

View Full Version : Creating a package system



Zegg90
01-15-2008, 05: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


Edit:
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. --
<id>username:testing123</id>
<version>1.0</version>

-- 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>

<replace>
Yes, another. This time, replacing!
</replace>

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum