Hi guys,
some of you might be a bit confused about how exactly updating a block or a plugin works, so hopefully this post will make it a bit more clear.
Unlike updates of the entire template, when updating a block/plugin you simply overwrite ALL files in the block/plugin folder and add any new ones (and you can delete ones that are no longer included). You might be wondering now – ok so can I just simply delete the entire block/plugin folder and replace it with the new one? The answer to this question is “sometimes”. In general, there are two types of blocks/plugins – blocks/plugins which require some setting up from your side and blocks/plugins which don´t. If a particular block/plugin does not require any set up, you can delete the original folder and replace with the new one. However, if you did this for a block/plugin which had some setting, your original settings would be lost and you would have to go through the settings of this block/plugin again.
So how exactly does the block/plugin settings work? When you first download a block/plugin, there is no settings file – this file is always referred to as settings.php. The first time you try to run the block/plugin, the template checks if this block/plugin needs settings file, if not, it executes it, if yes, it gives you a message to go to the Control panel and specify the settings. When you open the Block/Plugin settings page, specify your settings and hit Save, this is the moment when the template creates the settings.php file – and this file is then detected by the template and block/plugin can be used.
Based on the above it therefore means that when you are updating block/plugin, this settings file is not there, and when you update the files, the block/plugin will still use the original settings.php file which you created previously – i.e. you do not lose your original settings and do not have to set up everything again (which would be the case if you replaced the entire folder).
However, there is still one important thing to note. When you update a block/plugin, it could well be that there are some new/changed parameters in the settings. So even if you have the settings file already, after you upload the new files, you should still go to the Block/Plugin settings and check the settings page. In case the parameters did not change, it will simply load what you already specified. If there are some new parameters, your original settings will be loaded where possible and the rest will be set to default, unless you change it, and you should specify the new parameters (if there are any) and by hitting Save you overwrite the original settings.php, which will now have the correct format expected for the new version.
Unlike the updates of the entire template, in case of blocks and plugins you can skip versions. So if for example you are using v3.0 and just downloaded version 8, you can simply replace all the files, go to the Settings (if necessary) and you are ready to go.
In summary, updating a block/plugin:
- open the particular block/plugin folder on your server on one side of your FTP client
- open the particular new version block/plugin folder on your PC on the other side of your FTP client
- upload all the files from the new folder to the other side, this means your FTP client will overwrite the existing files and add new ones
- settings.php (if applicable) will only be on your server and you should not modify it or delete it
- if you see a directory “cache”, delete it
- if this block/plugin requires/required settings, go to the Block/Plugin settings and re-create the settings.php. In case nothing changed, your original setting will be loaded, if something is new, you will be asked to specify it and update the settings.php
- Done 🙂
Have you considered automating the update process a bit? What i mean is that by clicking the update block/plugin button it does the updating on the server side automatically so i wouldnt have to download the zip and unpack and upload it to my server.
Hi Priit,
yes I did of course, but it is very problematic and would not always work. I explained this in detail in one of the newsletters, it is in one of the Q/A section of the newsletter.