Unifi can be patched between releases by using a special Script Include called hotfix. If you find a bug in Unifi we may issue an update to hotfix so you can get the features you need without having to upgrade.
Upgrading
When upgrading Unifi, you can revert to the latest version of hotfix included in the upgrade. We reset hotfix with each release when the fixes become part of the main application.
Patching
We occasionally release a hotfix when minor issues are found. Simply replace the script in the hotfix Script Include with the one shown below and you will instantly have access to the fixes.
These hotfixes will be shipped as real fixes with the next version of Unifi, so make sure you have the correct hotfix for your version.
/** * Executes a child function corresponding to the object's type property. * The object is passed to the child function so methods and properties can be overridden. * * @param{Object} obj The full class object to be patched. */functionhotfix(obj) {var type =typeof obj ==='function'?obj.prototype.type ||obj.type :obj.type;if (type &&typeof hotfix[type] ==='function') { hotfix[type](obj); }}hotfix.version ='4.3.1.1';hotfix.Transaction=function(Transaction) {TransactionInbound.prototype.prepareForReplay=functionprepareForReplay(c) {c.is_replay =true;if (c.message.isCreate()) {c.bond.isNew(true); // for bond condition }c.target =c.bond.getTarget(); };TransactionInbound.prototype.saveSnapshotToStage=functionsaveSnapshotToStage(c) {if (c.snapshot) {c.snapshot.commit();c.stage.setValue('snapshot',c.snapshot.getUniqueValue()); }c.stage.commit(); };}hotfix.Dataset=function(Dataset) {Dataset.prototype.getRecords=functiongetRecords() {/* We do not use GlideRecordSecure here as this needs to have system access. */var data =newGlideRecord(this.getValue('table'));if (this.getElement('advanced') ==true) {this.evaluateAdvancedQuery(data); } elseif (this.hasValue('query_condition')) {data.addEncodedQuery(this.getValue('query_condition')); }if (this.query_start) {data.addQuery('sys_updated_on','>',this.query_start); }if (this.query_end) {data.addQuery('sys_updated_on','<=',this.query_end); }if (this.query_from) {data.addQuery('sys_id','>=',this.query_from); }data.orderBy('sys_id');data.setLimit(parseInt(this.getValue('max_rows'),10) +1);ws_console.logQuery(data);this.last_successful_time =this.query_end ||newGlideDateTime();return data; };};hotfix.DatasetRequest=function(Dataset) {DatasetRequest.prototype.insertNext=functioninsertNext(next_id) {var dataset =this.getDataset();var request =newDatasetRequest(this.getConfig());var number, query_end;request.initialize();request.setDataset(dataset);request.setDirection('Outbound');request.setType(this.getValue('type'));request.setValue('query_from', next_id);// show the batch by extending the number number =this.getValue('number'); number =utils.partialIncrement(number,1,1);request.setValue('number', number);// prevent infinite exports by fixing the query time query_end =dataset.isFixedQueryTime() ?newGlideDateTime(this.getValue('query_end')) :newGlideDateTime();request.setValue('query_start',newGlideDateTime(this.getValue('query_start')));request.setValue('query_end', query_end);request.setReady();request.commit();return request; };};hotfix._console=function(_console) {_console.DEBUG=gs.getProperty('x_snd_eb.snd_console.debug') =='true';_console._wrapFunction=function_wrapFunction(fn, fn_name, options) {var fn_wrapper; fn_name = fn_name ||_console._getType(fn);// This function has been wrapped - i.e. prototype inheritanceif (fn.$c_display) {fn_wrapper=functionrun_decorated_parent() {returnfn.apply(this, arguments); };fn_wrapper.$c_display =fn.$c_display;if (options.parent_name) {if (fn_wrapper.$c_display.indexOf(options.parent_name) ===0) {fn_wrapper.$c_display ='{unknown}~'+fn_wrapper.$c_display; } else {fn_wrapper.$c_display =options.parent_name +'~'+fn_wrapper.$c_display; } }return fn_wrapper; }fn_wrapper=functionrun_decorated() {var name =_console._getName(this, fn_name), ret, args, scope, e;if (fn.$c_private) { name +='#private'; }try { args =Array.prototype.slice.call(arguments);args.unshift(name); scope =_console.enterScope.apply(_console, args);scope.inside_try =true; // we are in a try/catch - helps with error reporting ret =fn.apply(this, arguments); } catch (ex) {if (!_console.has_error) {_console.error(ex, [], name);_console.has_error =true; }_console.leaveScope('[throwing '+ (ex &&ex.name ?ex.name :typeof ex) +']');throw ex; }return_console.leaveScope(ret,fn.$c_private); };// store the full name on the functionif (options.parent_name) {fn_wrapper.$c_display =options.parent_name + (options.is_static ?'::':'.') + fn_name; } else {fn_wrapper.$c_display = fn_name; }return fn_wrapper; };};