How the automatic update feature works in Midrub
From the version 0.0.0.1 Midrub have an automatic update feature which allows you to get updates from the administrator's panel. At the begin the update feature have downloaded each file in real time from my shared hosting and was impossibile to provide large updates from the administrator panel.
From the version 0.0.8.0 Midrub provides a DropBox's link from where is downloaded automatically a zip arhive:
- The zip is extracted in a temporary folder.
- Then Midrub verifies if all files from the update.json are in the temporary folder.
- The update.json contains all files which should be updated.
- Midrub starts to backup each file which should be updated.
- After each success backup, Midrub replaces the copied file with the file from the temporary folder.
- Midrub saves the backup in the backup folder. Even apps and components have a backup folder where are saved the files.
- If for any reason the file from zip can't be copied in the specified location, Midrub will restore the backup.
You can restore the old backup with a click. For apps and components is not possible to restore the backup.
Midrub requires the update's code only for commercial features. Midrub from Github don't has social or apps from CodeCanyon and the update is separate without an access code. The update code for features from CodeCanyon is generated if the user has purchased the item. The access code generator page will save same access code for all your apps from CodeCanyon and you can get all updates with same code. The code is valid for 24 hours.
The Midrub's apps purchased outside Envato, have same access code generation way but is based on the Midrub Api and Clients App.
You can add update support for your apps in the file main.php of your apps:
public function app_info() {
return array(
'app_name' => 'App Name',
'app_slug' => 'App Slug',
'app_icon' => '',
'version' => '',
'update_url' => 'https://update.midrub.com/planner/', // Here should be your update url
'update_code' => TRUE, // This is if code is required
'update_code_url' => 'https://access-codes.midrub.com/', // This is the url from where user could get the code
'min_version' => '0.0.7.9',
'max_version' => '0.0.8.1'
);
}
The update url should have a file with this json:
{
"version": "Version 0.0.9",
"changelogs": "This update contains the automatic update feature.",
"url": "download url which should start immediatelly download"
}
If for any reason after update Midrub is broken, run this url to restore the backup:
https://yourwebsiteurl/admin/ajax/update?action=restore_midrub_backup