Raised This Month: $127 Target: $400
 31% 

Plugin Autoupdater


Post New Thread Reply   
 
Thread Tools Display Modes
Author
MikeJS
Senior Member
Join Date: Nov 2008
Plugin ID:
875
Plugin Version:
1.5
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    88 
    Plugin Description:
    Allows plugin writers to make their plugins be autoupdated.
    Unapprover:
    Reason for Unapproving:
    Unmaintained, succeeded by https://forums.alliedmods.net/showthread.php?t=169095
    Old 05-08-2009 , 12:44   Plugin Autoupdater
    Reply With Quote #1

    Allows plugin writers to add a few lines of code to their plugin to let it update itself.

    Requires the Socket Extension.

    Thanks to exvel for a seemingly endless stream of bug reports and p3tsin and Matthias Vance for help with downloading files.

    Cvars:
    sm_autoupdate_binary (1) - Download binaries?
    sm_autoupdate_source (1) - Download sources?
    sm_autoupdate_gamedata (1) - Download gamedata files?
    sm_autoupdate_other (1) - Download other files?
    sm_autoupdate_backup (1) - Save backups of old versions? When set to 1, saves backups of old versions to addons/sourcemod/plugins/disabled/backups

    Commands:
    sm_autoupdate_check [filename/idx] - Checks for updates but doesn't download anything. Leave idx blank to check all plugins. (logs results to sourcemod/logs/autoupdate.log)
    sm_autoupdate_download [filename/idx] - Checks for updates and downloads them. Leave idx blank to update all plugins. (logs results to sourcemod/logs/autoupdate.log)
    sm_autoupdate_list - Returns the list of plugins that will be updated.
    sm_autoupdate_rem <filename/idx> - Stops a plugin being autoupdated. Get idx from sm_autoupdate_list.
    sm_autoupdate_block_add <filename> - Adds a plugin to the block list. Plugins in the block list won't be added to the autoupdate list. (eg sm_autoupdate_block_add autoupdate.smx)
    sm_autoupdate_block_rem <filename/idx> - Removes a plugin from the block list.
    sm_autoupdate_block_list - Lists blocked plugins.

    Todo:
    Translation support

    Making your plugin autoupdate:
    Include autoupdate in your plugin and use the AutoUpdate_AddPlugin()/AutoUpdate_RemovePlugin() natives.
    Example plugin:
    PHP Code:
    #pragma semicolon 1
    #include <sourcemod>
    #undef REQUIRE_PLUGIN
    #include <autoupdate>
    #define PL_VERSION "1.0"
    public OnPluginStart() {
        
    RegConsoleCmd("testau"Command_test);
    }
    public 
    OnAllPluginsLoaded() {
        if(
    LibraryExists("pluginautoupdate")) {
            
    // only register myself if the autoupdater is loaded
            // AutoUpdate_AddPlugin(const String:url[], const String:file[], const String:version[])
            
    AutoUpdate_AddPlugin("127.0.0.1""/plugins.xml"PL_VERSION);
        }
    }
    public 
    OnPluginEnd() {
        if(
    LibraryExists("pluginautoupdate")) {
            
    // I don't need updating anymore
            // AutoUpdate_RemovePlugin(Handle:plugin=INVALID_HANDLE) - don't specifiy plugin to remove calling plugin
            
    AutoUpdate_RemovePlugin();
        }
    }
    public 
    Action:Command_test(clientargs) {
        
    PrintToChatAll("Version %s"PL_VERSION);

    127.0.0.1/plugins.xml looks like:
    Code:
    <plugin>
    	<version>1.1</version>
    	<changes>Changed version number.</changes>
    	<binary>/auexample.smx</binary>
    	<source>/auexample.sp</source>
    	<gamedata>/folder/auexample.games.txt</gamedata>
    	<other dir="newdir">/newfile.txt,/folder/newfile2.txt</other>
    	<other dir="newdir2">/newfile3.txt</other>
    </plugin>
    Directory for <other> is relative to the mod folder.

    When sm_autoupdate_download is ran, the plugin will try to download 127.0.0.1/auexample.smx, 127.0.0.1/auexample.sp, 127.0.0.1/folder/auexample.games.txt and so on.
    You do not need to add gamedata/source/other. (you only need the version, but what use would that be?)


    The plugin doesn't update itself because if I didn't keep making stupid mistakes it wouldn't need to
    Attached Files
    File Type: smx autoupdate.smx (11.9 KB, 5913 views)
    File Type: sp Get Plugin or Get Source (autoupdate.sp - 3933 views - 19.0 KB)
    File Type: inc autoupdate.inc (930 Bytes, 6070 views)
    __________________

    Last edited by MikeJS; 08-03-2009 at 09:50.
    MikeJS is offline
    mattressfish
    Member
    Join Date: Feb 2009
    Old 05-08-2009 , 12:59   Re: Plugin Autoupdater
    Reply With Quote #2

    Wow, this is AWESOME. Good work!
    mattressfish is offline
    exvel
    SourceMod Donor
    Join Date: Jun 2006
    Location: Russia
    Old 05-08-2009 , 13:33   Re: Plugin Autoupdater
    Reply With Quote #3

    So I need a hosting for making a such plugin that is able to autoupdate, right?
    Also if answer: yes, you can write a manual of how to post your plugin in free svn service or something like google code.
    __________________
    For admins: My plugins

    For developers: Colors library

    Last edited by exvel; 05-08-2009 at 13:47.
    exvel is offline
    Send a message via ICQ to exvel
    MikeJS
    Senior Member
    Join Date: Nov 2008
    Old 05-08-2009 , 14:02   Re: Plugin Autoupdater
    Reply With Quote #4

    Quote:
    Originally Posted by exvel View Post
    So I need a hosting for making a such plugin that is able to autoupdate, right?
    Also if answer: yes, you can write a manual of how to post your plugin in free svn service or something like google code.
    You do. I'm not sure how google code works, sorry. You should be able to use any free host though.
    __________________
    MikeJS is offline
    exvel
    SourceMod Donor
    Join Date: Jun 2006
    Location: Russia
    Old 05-08-2009 , 14:06   Re: Plugin Autoupdater
    Reply With Quote #5

    Quote:
    Originally Posted by MikeJS View Post
    You do. I'm not sure how google code works, sorry. You should be able to use any free host though.
    I've just created my first project on google code and it seems that it is perfectly suitable. All links are direct so I think it is a perfect place for uploading plugins.

    p.s. anyway, good job +karma
    __________________
    For admins: My plugins

    For developers: Colors library
    exvel is offline
    Send a message via ICQ to exvel
    exvel
    SourceMod Donor
    Join Date: Jun 2006
    Location: Russia
    Old 05-08-2009 , 14:07   Re: Plugin Autoupdater
    Reply With Quote #6

    What should I write here? New version number or update description?
    Quote:
    <changes>Changed version number.</changes>
    __________________
    For admins: My plugins

    For developers: Colors library
    exvel is offline
    Send a message via ICQ to exvel
    exvel
    SourceMod Donor
    Join Date: Jun 2006
    Location: Russia
    Old 05-08-2009 , 14:09   Re: Plugin Autoupdater
    Reply With Quote #7

    Also about a suggestion that is already in your ToDo list. Custom files tag:
    Quote:
    <custom="directory_file_to_put_in">/some_file</custom>
    I think it could be the best way.

    p.s.
    google code example: http://code.google.com/p/showhealth/downloads/list
    __________________
    For admins: My plugins

    For developers: Colors library

    Last edited by exvel; 05-08-2009 at 14:17.
    exvel is offline
    Send a message via ICQ to exvel
    MikeJS
    Senior Member
    Join Date: Nov 2008
    Old 05-08-2009 , 14:32   Re: Plugin Autoupdater
    Reply With Quote #8

    Quote:
    Originally Posted by exvel View Post
    What should I write here? New version number or update description?
    Update description.

    Quote:
    Originally Posted by exvel View Post
    Also about a suggestion that is already in your ToDo list. Custom files tag:

    I think it could be the best way.
    So something like this?
    Code:
    <other dir="sounds">annoying1.mp3,annoying2.mp3,annoying3.mp3</other>
    <other dir="materials">overlay\overlay.vtf,overlay\overlay.vmt</other>
    __________________
    MikeJS is offline
    exvel
    SourceMod Donor
    Join Date: Jun 2006
    Location: Russia
    Old 05-08-2009 , 14:45   Re: Plugin Autoupdater
    Reply With Quote #9

    Yeap this is very close to what I expected but this would be looks better I think:

    Code:
    <other dir="sounds">annoying1.mp3</other>
    <other dir="sounds">annoying2.mp3</other>
    <other dir="sounds">annoying3.mp3</other>
    Also I've tested autoupdater and got an error:
    Code:
    sm_autoupdate_check
    L 05/08/2009 - 22:42:19: [autoupdate.smx] Socket error: 1 (#11004)
    sm_autoupdate_list
    showhealth.smx ver 1.0.0
    Autoupdating 1 plugin.
    p.s. my plugin's source: http://showhealth.googlecode.com/files/showhealth.sp
    __________________
    For admins: My plugins

    For developers: Colors library

    Last edited by exvel; 05-08-2009 at 14:50.
    exvel is offline
    Send a message via ICQ to exvel
    MikeJS
    Senior Member
    Join Date: Nov 2008
    Old 05-08-2009 , 15:03   Re: Plugin Autoupdater
    Reply With Quote #10

    Try AutoUpdate_AddPlugin("showhealth.googlecode.c om", "/files/version.xml", PLUGIN_VERSION);

    edit: I don't know why it's adding a space
    __________________
    MikeJS 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 19:11.


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