4719834dac073473b0cb500999081f8c8d14ae8a
[motion2.git] / server / api / system / system.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x17c1=['send','index','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status'];(function(_0x3358ee,_0x599447){var _0x2d976f=function(_0x26e7af){while(--_0x26e7af){_0x3358ee['push'](_0x3358ee['shift']());}};_0x2d976f(++_0x599447);}(_0x17c1,0x1c2));var _0x117c=function(_0xb1f07c,_0x28311a){_0xb1f07c=_0xb1f07c-0x0;var _0x27da11=_0x17c1[_0xb1f07c];return _0x27da11;};'use strict';var info=require(_0x117c('0x0'));var exec=require(_0x117c('0x1'))[_0x117c('0x2')];var logger=require(_0x117c('0x3'))(_0x117c('0x4'));var util=require(_0x117c('0x5'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x2e633b,_0x466af0,_0xf5804){_0x466af0=_0x466af0||0x1f4;return function(_0x4d4ff9){logger[_0x117c('0x6')](_0x117c('0x7'),_0xf5804,_0x466af0,util['inspect'](_0x4d4ff9,{'showHidden':![],'depth':null}));delete _0x4d4ff9[_0x117c('0x8')];_0x2e633b[_0x117c('0x9')](_0x466af0)[_0x117c('0xa')](_0x4d4ff9);};}exports[_0x117c('0xb')]=function(_0x3e09de,_0x1a54b8){return info[_0x117c('0xc')]()[_0x117c('0xd')](function(_0x19cac6){return _0x1a54b8['status'](0xc8)[_0x117c('0xe')](_0x19cac6);})['catch'](function(_0x1b6ca8){return _0x1a54b8[_0x117c('0x9')](0x1f4)['json'](_0x1b6ca8);});};exports[_0x117c('0xf')]=function(_0x39a780,_0x2fb7c9){var _0x1d863c=['components/import/cm'];return new BPromise(function(_0x2680ef,_0x4e3990){return exec(util[_0x117c('0x10')](_0x117c('0x11'),_0x39a780[_0x117c('0x12')][_0x117c('0x13')]),function(_0x32788d,_0x525c5d,_0x1a5ab5){if(_0x32788d){return _0x4e3990(_0x32788d);}return _0x2680ef(_0x525c5d);});})['then'](function(_0x22a8ca){var _0x14c9b1=![];var _0xde4ed7=_0x22a8ca[_0x117c('0x14')](/\n/);for(var _0x2565ed=0x0,_0x399809=_0x1d863c['length'];_0x2565ed<_0x399809,_0x14c9b1===![];_0x2565ed+=0x1){if(_0x22a8ca['indexOf'](_0x1d863c[_0x2565ed])>=0x0){_0x14c9b1=!![];}}if(!_0x14c9b1){throw new Error(util[_0x117c('0x10')](_0x117c('0x15'),_0x39a780[_0x117c('0x12')]['pid']));}process['kill'](_0x39a780['params'][_0x117c('0x13')],'SIGINT');return _0x2fb7c9['status'](0xc8)[_0x117c('0xe')]({'message':util[_0x117c('0x10')](_0x117c('0x16'),_0x39a780['params'][_0x117c('0x13')])});})['catch'](handleError(_0x2fb7c9,null,_0x117c('0xf')));};