New versions of myDBR are released regularly. If your server has a connection to mydbr.com, an update notification is shown when a new major version is available. It is recommended to run the updater once new versions are introduced. The latest versions can contain bug fixes and new functionality. Updates are designed to keep the existing report running as-is.
The preferred update method for myDBR is the built-in automatic update method. myDBR
periodically checks if a new version is available. It will notify the admin user on the main page of the new versions.
At any time, if you wish to update myDBR, you can invoke the update from Admin Tools
-> About / Update
-> Update now...
. If your license has expired and you cannot see the Admin Tools section, you can click on myDBR-logo in the top left corner to bring up the "About / Update"-dialog.
While carrying out the automatic update, myDBR replaces the application and updates the myDBR reporting database to include the latest changes. All the reports will be kept intact. Also, any modifications under the user directory are kept intact (this includes user-specific logos, settings, etc.).
The automatic updater uses HTTPS (443) and HTTP (80) ports for the udpate for domain "www.mydbr.com"
If your server is behind a firewall and cannot contact the myDBR update server. In that case, the proxy settings can be entered in the Environment settings. If you cannot update myDBR with the correct proxy settings, please see that you have php_curl installed.
A manual update must be applied if your server does not have a connection to mydbr.com (direct or through a proxy). A manual update is also required to update the PHP version so that the required SourceGuardian/ionCube loader changes (see myDBR download page). To perform a manual update, do the following:
myDBR will now see the updated application and guide the rest of the installation through the update wizard. All your reports will stay intact.
The automatic updater can also be scripted.
To get the current version as JSON, run the following URL:
% curl "https://myserver.mydomain.com/mydbr/index.php?a=version&export=json"
The result for the version query will be:
{ "version":"4.3.2", "build":"2534" }
The version query URL also supports JSONP, so if your query type is JSONP and you add a callback parameter to the query:
% curl "https://myserver.mydomain.com/mydbr/index.php?a=version&export=jsonp&callback=mycallback"
The result for the version query will be:
mycallback( { "version":"4.3.2", "build":"2534", "key":"bfb61ab9c7" } );
The key will be last the 10 characters of your license. You can use this in your script to verify that the server uses the latest license.
When the update URL (see example) is called, authentication is done using HTTP basic access authentication. myDBR defines, by default, the username 'mydbr_updater' to be used with scripted updates. This is defined in defaults.php and can be overridden in mydbr/user/defaults.php.
To activate the username (mydbr_updater) to be used in scripts, the username must be added to myDBR users. Usernames defined as updater-usernames are limited to the update function only. They cannot be used as normal login users.
The update URL is called using basic access authentication (replace the myserver.mydomain.com/mydbr with your definition):
% curl -H "X-MYDBR-AUTH: 1" -u mydbr_updater:mydbr_updater_password "https://myserver.mydomain.com/mydbr/install/index.php?controller=update&action=update"
The result for the updater is a JSON object with the following fields:
If there is an error in the update process, an "error" entry will be added to the JSON object. The entry has an error message that caused the update to fail.
{ "host":"myserver.mydomain.com", "expiration":"2015-12-22", "version": { "before_update":"4.3.2\/2534", "after_update":"4.4.0\/2697" } }
The update URL also supports JSONP, so that you can use the call in a report's JavaScript. To use JSONP, include the 'callback'-parameter to the URL.
% curl -H "X-MYDBR-AUTH: 1" -u mydbr_updater:mydbr_updater_password "https://myserver.mydomain.com/mydbr/install/index.php?controller=update&action=update&callback=mycallback"
mycallback({ "host":"myserver.mydomain.com", "expiration":"2015-12-22", "version": { "before_update":"4.3.2\/2534", "after_update":"4.4.0\/2697" } });
The most common way to install the license is to copy/paste the license into the license view. Suppose you have many installations. In that case, you should script the license installation to manage all licenses and all versions from a single server. You define one of the installations as a license server and manage other servers from this server. To get the licenses into the license server, you can copy/paste all purchased licenses at once. If you copy the licenses under the 'Copy all licenses'-link in myDBR Shop's order HTML page (https://shop.mydbr.com/index.php?a=order&a=order&id=XXX).
To define an installation as a license server (a server that will contain the latest license and serve those to other servers per request), set the server status to true in user/defaults.php
and create a license server user into myDBR (by default, 'license_checker', can be overridden in the defaults)-
$mydbr_defaults['license_server']['is_server'] = true;
To let the client's server know the existence of the license server, add the following to the client's server's user/defaults.php (it can be the same for all clients).
$mydbr_defaults['license_server']['server_url'] = 'https://myserver.mydomain.com/mydbr';
To issue a license retrieval call to the client use syntax:
% curl -H "X-MYDBR-AUTH: 1" -u license_checker:license_checker_password "https://myclient.mydomain.com/mydbr/index.php?a=license_service&update=1"
When the call is successful, the response will be:
{"status":"ok"}
If there is a problem with the call, the response will look like this:
{"success":"error" errors = {"array of errors"}}
Again, this URL supports JSONP with the additional 'callback' parameter to the URL.
When managing a large number of installations, you can automate the license installing and upgrading process. You can use a scheduled report in clients to ask for new licenses and script the updates. Alternatively, you can use a report to manage license distribution and server updates.
A sample report running is on a defined license server. It fetches the version and license information from the client's servers and allows remote license distribution and version updates. With the report, you can handle a large number of servers from one interface without needing to log in to individual servers.
Preparation
mydbr_updater
and license_checker
to client's server as normal myDBR users (defaults names defined in $mydbr_defaults['updater_users] and in $mydbr_defaults['license_users])license_checker
to license server as normal myDBR users (defined in client servers $mydbr_defaults['license_server']['username'] and $mydbr_defaults['license_server']['password'])$mydbr_defaults['license_server']['server_url']
)$mydbr_defaults['license_server']['is_server'] = true;
to user/defaults.php
What happens during the update:
What happens during the license update:
create procedure sp_DBR_update_license( inVersionBuild varchar(20) ) begin select 'dbr.css', ' .license_status { text-align: center; } .license_update, .version_update { cursor: pointer; background-color: green; padding: 3px 6px 3px 6px; border-radius: 6px; color: white; } .red { background-color: red; } .version { text-align:center; } .version .ajaxspin { margin: auto; } '; select 'dbr.colclass', 'host', 'host'; select 'dbr.colclass', 'license_status', 'license_status'; select 'dbr.colclass', 'version', 'version'; select 'dbr.colclass', 'errors', 'errors'; select 'dbr.html5data', 'host', 'license_key', 'license-key'; select 'dbr.html5data', 'host', 'license_host', 'license-host'; select 'dbr.html5data', 'version', 'version_build', 'version'; select concat('https://', host) as 'Installation URL[host]', l.host as 'license_host', l.license_key, '' as 'Version[version]', '' as 'License OK[license_status]', inVersionBuild as 'version_build', '' as '[errors]' from mydbr_licenses l where host != 'mylicenseserver.mydomain.com'; select 'dbr.javascript', "$(document).ready(function() { // Get installed versions and last 10 characters from the installed license $('.host').each( function() { var $tr = $(this).closest('tr'), url = $(this).text()+'/index.php?a=version&export=jsonp&callback=?'; $.ajax({ url: url, dataType: 'jsonp', success: function(v) { // Query returns 10 last characters from the license. Enough for the matching var $v, vb, key_ok = (v.key == $tr.find('.host').attr('data-license-key').substr(-10)); $v = $tr.find('.version'); vb = v.version+'/'+v.build; if ($v.data('version') !== vb) { $v.html('<span class=\"version_update\">'+vb+'</span>'); } else { $v.text(v.version+'/'+v.build); } if (key_ok) { $tr.find('.license_status').text('OK'); } else { $tr.find('.license_status').html('<span class=\"license_update\">Newer license available</span>'); } }, error: function(e, status, error) { $tr.find('.version').text('Unknown'); $tr.find('.errors').text(e.status+'/'+error); } }); }); // Ask the installation to update the license from the license server $(document).on('click', '.license_update', function() { var url, $tr = $(this).closest('tr'); url=$tr.find('.host').text()+'/index.php?a=license_service&update=1&callback=?'; $.ajax({ url: url, beforeSend: function(xhr) { xhr.withCredentials = true; xhr.setRequestHeader('X-MYDBR-AUTH', '1'); xhr.setRequestHeader('Authorization', 'Basic ' + btoa('license_checker:pass')); }, dataType: 'jsonp', success: function(r) { var i,e=''; if (r.status=='ok') { $tr.find('.license_status').text('OK'); } else { $tr.find('.license_status .license_update').addClass('red'); for(i=0; i<r.errors.length; i++){ e += '<div>'+r.errors[i]+'</div>'; } $tr.find('.errors').html(e); } }, error: function(e, status, error) { $tr.find('.errors').text(e.status+'/'+error); } }); }); // Ask the installation to run the updater $(document).on('click', '.version_update', function() { if (confirm('Update version?')) { var url, $tr = $(this).closest('tr'), $v = $tr.find('.version'); url=$tr.find('.host').text()+'/install/index.php?controller=update&action=update&callback=?'; $v.html('<div class=\"ajaxspin\"></div>'); $.ajax({ url: url, beforeSend: function(xhr) { xhr.withCredentials = true; xhr.setRequestHeader('X-MYDBR-AUTH', '1'); xhr.setRequestHeader('Authorization', 'Basic ' + btoa('mydbr_updater:pass')); }, dataType: 'jsonp', success: function(r) { if (r.error) { $v.text(r.error); } else { if (r.version.after_update) { $v.text(r.version.after_update); } else { $v.text('Unknown error'); } } }, error: function(e, status, error) { $tr.find('.errors').text(e.status+'/'+error); } }); } }); }); "; end