4 Replies Latest reply on Mar 28, 2011 10:23 AM by alex krylov

    Making a plugin support self updating

    scid

      I noticed a number of plugins have the ability to update themselves.  I was wondering if there was any sample code that anyone is willing to share to implement this.  Even just a  summary of the steps that people generally use to implement this. 

        • 1. Re: Making a plugin support self updating
          areohbee Level 5

          I have written an xml-rpc based update checker - you can access source code here.

           

          It won't install the update automatically, but it will at least check for it automatically (or on demand), so user can download and install.

           

          You will need a server-side counterpart. I have written one in Coldfusion which you can use as example (its posted on the site somewhere but not in source-svn)...

           

          Rob

          • 2. Steps
            alex krylov Level 1

            It's pretty easy.

             

            1. Check if update is available (you'll need server-side script providing this data).
            2. Download this (zipped) update chunk-by-chunk and store it locally. Server-size script to provide chunks, again.
            3. Display progress bar while download.
            4. Unzip it into LR modules dir.
            5. Rename original plugins dir.
            6. Rename updated plugin dir to original.
            7. Display a message to user, suggesting him to reload plugin and block all future plugin's operations until reload.
            • 3. Re: Steps
              muhmu

              I think you are missing a step between 3 and 4... privileges.  No matter what you tell the users to do, they will install the plugin under /Applications or Program Files, and updating the plugin will require administrative privileges, since the user account has no write permissions to the directory. 

               

              This is the reason why I have not implemented self-updating yet.

              • 4. Re: Steps
                alex krylov Level 1

                That's right. But you always can restrict update functionality to the plug-ins, installed into the Modules directory. One can never get all he wants…