Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ideas for methods for auto-update identification

Comments in 'Resources' started by PEMapModder, Dec 4, 2014.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Please post below if you have better methods because I want to ask for improvements too!

    1. Using commit SHA
    Methods to locate:
    Methods to check:
    • Use the GitHub API. For example, cURL-get (Utils::getURL()) https://api.github.com/repos/OwnerName/RepoName/commits, JSON-decode it and check if your commit is the newest commit by $decoded[0]["sha"].
    • Host a server that provides information for a plugin about newest commits. You have to make sure its uptime though.
    2. Using a build ID
    Methods to locate/create:
    • Inject into plugin with incrementation when building phar. Same issue with FolderPluginLoader.
    • Make it yourself. This is not good because you will forget it.
    Methods to check:
    • Use GitHub raw content. Download from the repo the latest ID and see if you are having the latest one.
    • Query from your own server. You have to make sure its uptime though.
    3. Using plugin version
    This only applies for release auto-updates.
    To identify: use this in the plugin code:
    PHP:
    $plugin->getDescription()->getVersion();
    To check:
    • Download raw from GitHub, YAML-parse and compare versions
    • Use the GitHub release name

    As you see, all methods have their bad sides. These are some ideas, please suggest better ideas below.
    The thread may seem a little badly-structured because @Lambo is rushing me to the test server :D
    Last edited: Dec 4, 2014
    Falk and iksaku like this.
  2. ProjectInfinity
    Offline

    ProjectInfinity Active Member Plugin Developer

    Joined:
    Sep 7, 2014
    Posts:
    112
    Plugins:
    3
    Minecraft User:
    ProjectInfinity
    I quite like using build IDs and have set my Jenkins to append build numbers to the PHAR.

    I have yet to implement it into the plugin.yml file, but I intend to. Just as I did with my Bukkit version. It was easier for Bukkit though, cause you could simply use Maven for it, whereas with PHAR files you need to create a separate script that greps the line and edits it.
    PEMapModder likes this.
  3. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    And it instó left to download directly from the forums :p the check method here will be easier
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    And how do you check if it is a new version?
    And I was talking about development builds there :D but right, plugin version is a method.
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I only do updates to releases, and I use the GitHub API to see if the current release code is different than the one in the phar metadata. Not fool proof, but simple.
    PEMapModder likes this.
  6. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    I prefer to use only the ones approved here because it will be like a second filter for users to believe that every update is safe :3
    PEMapModder likes this.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I prefer to let users choose their own channels :)
  8. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    That is better :3 let them choose from Stable, Beta and Development like PocketMine xD so... The Stable will be from the forums, the Beta from the Github repo and the Development from your generator :3
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    To get a forum link you must first publish the plugin.
  10. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    I know xD

Share This Page

Advertisement