Skip to content

Commit

Permalink
# 0.11.3 (2016-08-24)
Browse files Browse the repository at this point in the history
* (PArns) fix upgrade of adapters
* (bluefox) update "_design/xyz" by upgrade
  • Loading branch information
GermanBluefox committed Aug 24, 2016
1 parent 6aebe43 commit b3fdd95
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 0.11.3 (2016-08-23)
# 0.11.3 (2016-08-24)
* (PArns) fix upgrade of adapters
* (bluefox) update "_design/xyz" by upgrade

# 0.11.2 (2016-08-13)
* (bluefox) fix upgrade of adapters
Expand Down
5 changes: 5 additions & 0 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"controller": true,
"title": "ioBroker.js-controller",
"news": {
"0.11.3": {
"en": "fix upgrade of adapters\nupdate _design/xyz by upgrade",
"de": "Fixe upgrade von Adaptern\nUpdate die Objekte _design/xyz bei Upgrade",
"ru": "Исправлено обновление драйверов\n_design/xyz объекты обновляются при upgrade"
},
"0.11.2": {
"en": "fix upgrade of adapters",
"de": "fix upgrade of adapters",
Expand Down
16 changes: 15 additions & 1 deletion lib/setup/setupUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,12 @@ function Upload(options) {
obj.common.installedVersion = iopack.common.version;

var hostname = tools.getHostName();
var cntr = 0;

objects.setObject('system.adapter.' + name, obj, function () {
// Update all instances of this host
objects.getObjectView('system', 'instance', {startkey: 'system.adapter.' + name + '.', endkey: 'system.adapter.' + name + '.\u9999'}, null, function (err, res) {
var cntr = 0;

if (res) {
for (var i = 0; i < res.rows.length; i++) {
if (res.rows[i].value.common.host === hostname) {
Expand Down Expand Up @@ -445,6 +446,19 @@ function Upload(options) {
}
}
}

// updates "_design/system" and co
if (iopack.objects && typeof iopack.objects === 'object') {
for (var _id in iopack.objects) {
if (!iopack.objects.hasOwnProperty(_id)) continue;
cntr++;
objects.setObject(iopack.objects[_id]._id, iopack.objects[_id], function (err) {
if (err) console.error('Cannot update object: ' + err);
if (!--cntr && callback) callback(name);
});
}
}

if (!cntr && callback) callback(name);
});
});
Expand Down

0 comments on commit b3fdd95

Please sign in to comment.