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,
    Admin Settings Page
                                                                   Admin Settings Page

    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!” .

    After Updating
                                                                After Updating
  • 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