Built motion from commit 13c3002c.|2.6.9
[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 _0x5c06=['systeminformation','child_process','exec','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','catch','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x5c06,0x186));var _0x65c0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5c06[_0x397e5f];return _0x5302b8;};'use strict';var info=require(_0x65c0('0x0'));var exec=require(_0x65c0('0x1'))[_0x65c0('0x2')];var logger=require('../../config/logger')(_0x65c0('0x3'));var util=require('util');var BPromise=require(_0x65c0('0x4'));var _=require('lodash');function handleError(_0xbbdab7,_0x5b06fd,_0x53b938){_0x5b06fd=_0x5b06fd||0x1f4;return function(_0x297306){logger[_0x65c0('0x5')](_0x65c0('0x6'),_0x53b938,_0x5b06fd,util[_0x65c0('0x7')](_0x297306,{'showHidden':![],'depth':null}));delete _0x297306[_0x65c0('0x8')];_0xbbdab7[_0x65c0('0x9')](_0x5b06fd)['send'](_0x297306);};}exports[_0x65c0('0xa')]=function(_0x478b31,_0x46bb79){return info['getAllData']()['then'](function(_0x567cc7){return _0x46bb79[_0x65c0('0x9')](0xc8)['json'](_0x567cc7);})[_0x65c0('0xb')](function(_0x87976b){return _0x46bb79[_0x65c0('0x9')](0x1f4)[_0x65c0('0xc')](_0x87976b);});};exports['killProcess']=function(_0x20a99d,_0x3963f9){var _0x5af18e=[_0x65c0('0xd')];return new BPromise(function(_0x2b08da,_0x5871e0){return exec(util[_0x65c0('0xe')](_0x65c0('0xf'),_0x20a99d[_0x65c0('0x10')][_0x65c0('0x11')]),function(_0x4175dc,_0x52c782,_0x153473){if(_0x4175dc){return _0x5871e0(_0x4175dc);}return _0x2b08da(_0x52c782);});})[_0x65c0('0x12')](function(_0x362152){var _0x3c6a74=![];var _0x22c1a1=_0x362152[_0x65c0('0x13')](/\n/);for(var _0x499f31=0x0,_0x1b7fb9=_0x5af18e[_0x65c0('0x14')];_0x499f31<_0x1b7fb9,_0x3c6a74===![];_0x499f31+=0x1){if(_0x362152[_0x65c0('0x15')](_0x5af18e[_0x499f31])>=0x0){_0x3c6a74=!![];}}if(!_0x3c6a74){throw new Error(util['format'](_0x65c0('0x16'),_0x20a99d[_0x65c0('0x10')][_0x65c0('0x11')]));}process[_0x65c0('0x17')](_0x20a99d['params'][_0x65c0('0x11')],'SIGINT');return _0x3963f9[_0x65c0('0x9')](0xc8)[_0x65c0('0xc')]({'message':util[_0x65c0('0xe')](_0x65c0('0x18'),_0x20a99d[_0x65c0('0x10')][_0x65c0('0x11')])});})['catch'](handleError(_0x3963f9,null,_0x65c0('0x19')));};