Raised This Month: $7 Target: $400
 1% 

Updater


Post New Thread Reply   
 
Thread Tools Display Modes
Author
GoD-Tony
Veteran Member
Join Date: Jul 2005
Plugin ID:
2599
Plugin Version:
1.2.1
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    778 
    Plugin Description:
    Automatically updates SourceMod plugins and files
    Old 10-08-2011 , 13:03   Updater
    Reply With Quote #1

    Updater

    Allows developers to automatically update their plugins and files. Updates will be checked on server startup and then once every 24 hours. All updates will be logged to Updater.log in your SourceMod log directory.

    Installation:
    1. Your server must be running at least one of the following extensions:
    2. Extract updater.zip to your SourceMod directory.
    Cvars:
    • sm_updater <1|2|3> - Determines update functionality.
      • 1 = Only notify in the log file when an update is available.
      • 2 = Automatically download and install available updates. *Default
      • 3 = Include the source code with updates.
    Commands:
    • sm_updater_check - Forces Updater to check all plugins for updates. Can only be run once per hour.
    • sm_updater_status - View the status of Updater.
    Attached Files
    File Type: zip updater.zip (37.1 KB, 12937 views)
    __________________

    Last edited by GoD-Tony; 08-28-2020 at 06:39. Reason: BitBucket repo died
    GoD-Tony is offline
    GoD-Tony
    Veteran Member
    Join Date: Jul 2005
    Old 10-08-2011 , 13:04   Re: Updater
    Reply With Quote #2

    Information for Developers
    Code:
    /**  * Adds your plugin to the updater. The URL will be updated if  * your plugin was previously added.  *  * @param url      URL to your plugin's update file.  * @noreturn  */ native Updater_AddPlugin(const String:url[]); /**  * Removes your plugin from the updater. This does not need to  * be called during OnPluginEnd.  *  * @noreturn  */ native Updater_RemovePlugin(); /**  * Forces your plugin to be checked for updates. The behaviour  * of the update is dependant on the server's configuration.  *  * @return    True if an update was triggered. False otherwise.  * @error      Plugin not found in updater.  */ native bool:Updater_ForceUpdate(); /**  * Called when your plugin is about to be checked for updates.  *  * @return    Plugin_Handled to prevent checking, Plugin_Continue to allow it.  */ forward Action:Updater_OnPluginChecking(); /**  * Called when your plugin is about to begin downloading an available update.  *  * @return    Plugin_Handled to prevent downloading, Plugin_Continue to allow it.  */ forward Action:Updater_OnPluginDownloading(); /**  * Called when your plugin's update files have been fully downloaded  * and are about to write to their proper location. This should be used  * to free read-only resources that require write access for your update.  *  * @note OnPluginUpdated will be called later during the same frame.  *  * @noreturn  */ forward Updater_OnPluginUpdating(); /**  * Called when your plugin's update has been completed. It is safe  * to reload your plugin at this time.  *  * @noreturn  */ forward Updater_OnPluginUpdated(); /**  * @brief Reloads a plugin.  *  * @param plugin    Plugin Handle (INVALID_HANDLE uses the calling plugin).  * @noreturn  */ stock ReloadPlugin(Handle:plugin=INVALID_HANDLE);

    When testing an update with your plugin, I recommend that you test it against a debug version of Updater. It will log detailed download information to Updater_Debug.log in case you accidentally used malformed URLs or paths.
    Code:
    /* Line 25: updater.sp */ #define DEBUG   // This will enable verbose logging. Useful for developers testing their updates.

    Example Plugin
    Code:
    #include <sourcemod> #undef REQUIRE_PLUGIN #include <updater> #define UPDATE_URL    "http://website.com/myplugin/updatefile.txt" public OnPluginStart() {     if (LibraryExists("updater"))     {         Updater_AddPlugin(UPDATE_URL)     } } public OnLibraryAdded(const String:name[]) {     if (StrEqual(name, "updater"))     {         Updater_AddPlugin(UPDATE_URL)     } }
    Now let's take a look at what UPDATE_URL is pointing to ...

    Update File Format

    Simple Update - Majority of plugins will use this.
    Code:
    "Updater"
    {
    	"Information"
    	{
    		"Version"
    		{
    			"Latest"	"1.0.1"
    		}
    		
    		"Notes"	"More info @ www.sourcemod.net. Changes in 1.0.1:"
    		"Notes"	"Added new Batman model"
    		"Notes"	"Minor code changes"
    	}
    	
    	"Files"
    	{
    		"Plugin"	"Path_SM/plugins/myplugin.smx"
    		"Plugin"	"Path_SM/translations/myplugin.phrases.txt"
    		"Plugin"	"Path_SM/translations/ru/myplugin.phrases.txt"
    		"Plugin"	"Path_Mod/models/characters/batman.mdl"
    		"Plugin"	"Path_Mod/materials/models/characters/batman.vmt"
    		
    		"Source"	"Path_SM/scripting/myplugin.sp"
    	}
    }
    Patch Update - Useful on large plugins to avoid downloading all files when only a few have changed. Patch files will be used if the "Previous" version matches the server's currently running version.
    Code:
    "Updater"
    {
    	"Information"
    	{
    		"Version"
    		{
    			"Latest"	"1.0.1"
    			"Previous"	"1.0.0"
    		}
    		
    		"Notes"	"More info @ www.sourcemod.net. Changes in 1.0.1:"
    		"Notes"	"Added Russian phrases"
    		"Notes"	"Minor code changes"
    	}
    	
    	"Files"
    	{
    		"Patch"
    		{
    			"Plugin"	"Path_SM/plugins/myplugin.smx"
    			"Plugin"	"Path_SM/translations/ru/myplugin.phrases.txt"
    
    			"Source"	"Path_SM/scripting/myplugin.sp"
    		}
    		
    		"Plugin"	"Path_SM/plugins/myplugin.smx"
    		"Plugin"	"Path_SM/translations/myplugin.phrases.txt"
    		"Plugin"	"Path_SM/translations/ru/myplugin.phrases.txt"
    		"Plugin"	"Path_Mod/models/characters/batman.mdl"
    		"Plugin"	"Path_Mod/materials/models/characters/batman.vmt"
    		
    		"Source"	"Path_SM/scripting/myplugin.sp"
    	}
    }
    All web paths are relative to your plugin's update file (UPDATE_URL in this case). Using the above example, the URLs for this update would look like this:

    Code:
    UPDATE_URL = http://website.com/myplugin/updatefile.txt
    
    http://website.com/myplugin/plugins/myplugin.smx
    http://website.com/myplugin/translations/myplugin.phrases.txt
    http://website.com/myplugin/translations/ru/myplugin.phrases.txt
    http://website.com/myplugin/models/characters/batman.mdl
    http://website.com/myplugin/materials/models/characters/batman.vmt
    http://website.com/myplugin/scripting/myplugin.sp
    Final Notes
    • You should only reload your plugin manually if your plugin can handle late load situations. Otherwise letting it reload automatically during the next mapchange is safest.
    • If you have released a plugin that uses Updater, post a link to it in this thread. I'd like to take a look at it!
    • If you're looking for somewhere to host your update files for free: Updater Integration Using Bitbucket

    Last edited by GoD-Tony; 12-23-2012 at 06:20.
    GoD-Tony is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 11-11-2011 , 22:07   Re: Updater
    Reply With Quote #3

    Quote:
    Originally Posted by GoD-Tony View Post
    If you have released a plugin that uses Updater, post a link to it in this thread. I'd like to take a look at it!
    Very well. I added Updater feature to my SniperRestrict plugin

    Let me know if I did something wrong or if I could do something better

    I use DropBox to host my files it's free and it works

    On a side note. I had put SMAC in a sub folder (SECURITY) and when it updated, it placed the updated SMAC files in the PLUGINS folder and left the old ones in the PLUGINS\SECURITY folder - I had two of each SMAC plugin running

    Last edited by TnTSCS; 11-11-2011 at 22:08.
    TnTSCS is offline
    GoD-Tony
    Veteran Member
    Join Date: Jul 2005
    Old 11-12-2011 , 03:18   Re: Updater
    Reply With Quote #4

    Quote:
    Originally Posted by TnTSCS View Post
    Very well. I added Updater feature to my SniperRestrict plugin

    Let me know if I did something wrong or if I could do something better

    I use DropBox to host my files it's free and it works
    Looks good, and I'm sure others will find the dropbox idea useful too.

    Quote:
    Originally Posted by TnTSCS View Post
    On a side note. I had put SMAC in a sub folder (SECURITY) and when it updated, it placed the updated SMAC files in the PLUGINS folder and left the old ones in the PLUGINS\SECURITY folder - I had two of each SMAC plugin running
    Ouch, I may have to add a variable to use with the Updater file format. Something like this:
    Code:
    "Files"
    {
      "Plugin"  "Path_SM/plugins/{this}.smx"
      "Source"  "Path_SM/scripting/plugin.sp"
    }
    The web path would be directly in the plugins directory, and then the local path would be wherever they stored it.
    __________________
    GoD-Tony is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 11-15-2011 , 23:58   Re: Updater
    Reply With Quote #5

    Quote:
    Originally Posted by GoD-Tony View Post
    If you have released a plugin that uses Updater, post a link to it in this thread. I'd like to take a look at it!
    Here's another one - http://forums.alliedmods.net/showthread.php?t=172135
    TnTSCS is offline
    GoD-Tony
    Veteran Member
    Join Date: Jul 2005
    Old 11-16-2011 , 02:54   Re: Updater
    Reply With Quote #6

    Quote:
    Originally Posted by TnTSCS View Post
    Be sure to add your phrases to the updater file too.
    __________________

    Last edited by GoD-Tony; 11-16-2011 at 02:54.
    GoD-Tony is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 11-16-2011 , 10:39   Re: Updater
    Reply With Quote #7

    Quote:
    Originally Posted by GoD-Tony View Post
    Be sure to add your phrases to the updater file too.
    doh - I forgot about those - thanks I fixed it

    btw... when I was running the plugin enabled with updater but hadn't yet put the .txt file up, updater kept saying something about keyvalue parsing error with a "{" error or something, it happened for 3-4 restarts... I put the files up on the web, restarted the server and that error didn't pop up again.

    Last edited by TnTSCS; 11-16-2011 at 10:44.
    TnTSCS is offline
    GoD-Tony
    Veteran Member
    Join Date: Jul 2005
    Old 11-16-2011 , 10:55   Re: Updater
    Reply With Quote #8

    Quote:
    Originally Posted by TnTSCS View Post
    when I was running the plugin enabled with updater but hadn't yet put the .txt file up, updater kept saying something about keyvalue parsing error with a "{" error or something, it happened for 3-4 restarts... I put the files up on the web, restarted the server and that error didn't pop up again.
    That's because it tries to parse the 404 error page from the website. There's no simple workaround for this but the console spam should be harmless.
    __________________
    GoD-Tony is offline
    bobomaster
    Junior Member
    Join Date: Nov 2011
    Old 11-16-2011 , 18:57   Re: Updater
    Reply With Quote #9

    Quote:
    Originally Posted by GoD-Tony View Post
    If you have released a plugin that uses Updater, post a link to it in this thread. I'd like to take a look at it!
    Here ya go:

    http://forums.alliedmods.net/showthread.php?p=1595691
    bobomaster is offline
    GoD-Tony
    Veteran Member
    Join Date: Jul 2005
    Old 11-17-2011 , 02:00   Re: Updater
    Reply With Quote #10

    Nice to see more plugins are adding support.
    Quote:
    Originally Posted by bobomaster View Post
    Code:
    "Path_SM/source/makemeinvisible.sp"
    source -> scripting
    __________________

    Last edited by GoD-Tony; 11-17-2011 at 02:32.
    GoD-Tony is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 23:53.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode