Auto Upgrade feature in Engelsystem​

In one of my previous blog posts here, I talked about the Upgrade process of Wordpress, how it works. In this blog, I am going to talk about how I implement the Auto-upgrade feature in Engelsystem. The Upgrade process implemented in Engelsystem includes both core and child upgrades. Methodology: A Verison.txt file in included in the repository. It contains the version number of the current release of the Engelsystem. Implemented a check in index.php to compare the version number in the local repository and the `fossasia/engelsystem` repository. In Engelsystem index.php is run every time when we open the System. Therefore, everytime we open Engelsystem, it automatically checks for updates. if ($check_autoupdate_enable == true) { $online_ver = file_get_contents("https://raw.githubusercontent.com/fossasia/engelsystem/master/Version.txt"); $current_ver = file_get_contents(" ./Version.txt"); if (strcmp($current_ver, $online_ver) != 0) { return info('<a href="' . page_link_to("user_settings") . '">' . _('There is an Update available on GitHub! Go to settings and update') . '</a>', true); } } The above code compares the version number in the local server and the fossasia repository. If the version number is different a notification in displayed in the alert box the Engelsystem to the Admin, to update the system. In the Settings page, Admin can update the System as shown in the screenshot below, The admin can click on the "Update System Now!", to update the system to the latest version. The is also an option provided in the UI to enable/disable the Auto-update feature. When the version in the Version.txt on local server and fossasia repository are different, the changes the pulled to the local server using the command: git pull origin master , which will pull the changes from the FOSSASIA repository to the local server, and a Message will be displayed that the "System is Updated to Latest Version!" . Also, there is an option in the UI to check to Updates manually. We are developing new Features for the Engelsystem. Developers who are interested in contributing can work with us. Development: https://github.com/fossasia/engelsystem             Issues/Bugs:https://github.com/fossasia/engelsystem/issues

Continue ReadingAuto Upgrade feature in Engelsystem​

WordPress Upgrade Process

Have you ever wondered how Wordpress handles the automated core, plugin, and theme upgrades? Well, it’s time for some quick education! WordPress is an Open Source project, which means there are hundreds of people all over the world working on it. (More than most commercial platforms.) There are mainly 2 kinds of Automatic upgrades for Wordpress: The main 'Core' upgrades The 'Child' upgrades, that works for themes and plugins that are being used in your Wordpress. We all see the plugin and theme installer while installing any theme or specific plugin required by the user, where it downloads the plugin to /wp-content/upgrade/ , extracts the plugin, deletes the old one (if an old one exists), and copies the new one. It is used every time we install a theme or a plugin to the Wordpress. Since this is used more often than the core updater (most of the time as many different plugins are used), it’s the sort of upgrade we’re all used to and familiar with. And we think ‘WordPress deletes before upgrading, sure.’ This makes sense. After all, you want to make sure to clean out the old files, especially the ones that aren’t used anymore. But that not how the Wordpress Core updates work. Core updates are available when there is a new version of Wordpress is available with new features or some solved bugs. Core updates are subdivided into three types: Core development updates, known as the "bleeding edge" Minor core updates, such as maintenance and security releases Major core release updates By default, every site has automatic updates enabled for minor core releases and translation files. Sites already running a development version also have automatic updates to further development versions enabled by default. The Wordpress updates can be configured by 2 ways: defining constants in wp-config.php, or adding filters using a Plugin Let's discuss for both the methods. Configuration via wp-config.php We can configure the wp-config.php to, disable automatic updates, and the core updates can be disabled or configured based on update type. To completely disable all types of automatic updates, core or otherwise, add the following to your wp-config.php file: define( 'AUTOMATIC_UPDATER_DISABLED', true ); To enable automatic updates for major releases or development purposes, the place to start is with the WP_AUTO_UPDATE_CORE constant. Defining this constant one of three ways allows you to blanket-enable, or blanket-disable several types of core updates at once. define( 'WP_AUTO_UPDATE_CORE', true ); WP_AUTO_UPDATE_CORE can be defined with one of three values, each producing a different behavior: Value of true – Development, minor, and major updates are all enabled Value of false – Development, minor, and major updates are all disabled Value of 'minor' – Minor updates are enabled, development, and major updates are disabled   Configuration via Filters using Plugins Using filters allows for fine-tuned control of automatic updates. The best place to put these filters is a must-use plugin. Do not add add_filter() calls directly in wp-config.php. WordPress isn't fully loaded and can cause conflicts with other applications such as WP-CLI. We can also enable/disable all automatic updates by changing…

Continue ReadingWordPress Upgrade Process