Built motion from commit (unavailable).|2.3.94
[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 _0xfcd2=['params','pid','split','length','format','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','getAllData','then','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0xfcd2,0x1a8));var _0x2fcd=function(_0x1ea2d1,_0x26e867){_0x1ea2d1=_0x1ea2d1-0x0;var _0x173b4f=_0xfcd2[_0x1ea2d1];return _0x173b4f;};'use strict';var info=require(_0x2fcd('0x0'));var exec=require(_0x2fcd('0x1'))[_0x2fcd('0x2')];var logger=require(_0x2fcd('0x3'))(_0x2fcd('0x4'));var util=require('util');var BPromise=require(_0x2fcd('0x5'));var _=require(_0x2fcd('0x6'));function handleError(_0x3027c7,_0x512a2a,_0x4f2f2c){_0x512a2a=_0x512a2a||0x1f4;return function(_0x5c213d){logger[_0x2fcd('0x7')](_0x2fcd('0x8'),_0x4f2f2c,_0x512a2a,util[_0x2fcd('0x9')](_0x5c213d,{'showHidden':![],'depth':null}));delete _0x5c213d['name'];_0x3027c7[_0x2fcd('0xa')](_0x512a2a)['send'](_0x5c213d);};}exports[_0x2fcd('0xb')]=function(_0x5d7fc5,_0x5e0077){return info[_0x2fcd('0xc')]()[_0x2fcd('0xd')](function(_0x4e6d3b){return _0x5e0077[_0x2fcd('0xa')](0xc8)[_0x2fcd('0xe')](_0x4e6d3b);})[_0x2fcd('0xf')](function(_0x20e75c){return _0x5e0077['status'](0x1f4)[_0x2fcd('0xe')](_0x20e75c);});};exports['killProcess']=function(_0x38b320,_0x49d2b9){var _0x23a572=[_0x2fcd('0x10')];return new BPromise(function(_0x40e472,_0x2db324){return exec(util['format'](_0x2fcd('0x11'),_0x38b320[_0x2fcd('0x12')][_0x2fcd('0x13')]),function(_0x1a1788,_0x5e9cae,_0x30a50e){if(_0x1a1788){return _0x2db324(_0x1a1788);}return _0x40e472(_0x5e9cae);});})['then'](function(_0x758998){var _0xd5a023=![];var _0x12073a=_0x758998[_0x2fcd('0x14')](/\n/);for(var _0x3cfe45=0x0,_0x35677f=_0x23a572[_0x2fcd('0x15')];_0x3cfe45<_0x35677f,_0xd5a023===![];_0x3cfe45+=0x1){if(_0x758998['indexOf'](_0x23a572[_0x3cfe45])>=0x0){_0xd5a023=!![];}}if(!_0xd5a023){throw new Error(util[_0x2fcd('0x16')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x38b320[_0x2fcd('0x12')][_0x2fcd('0x13')]));}process['kill'](_0x38b320['params']['pid'],_0x2fcd('0x17'));return _0x49d2b9[_0x2fcd('0xa')](0xc8)['json']({'message':util[_0x2fcd('0x16')](_0x2fcd('0x18'),_0x38b320['params'][_0x2fcd('0x13')])});})[_0x2fcd('0xf')](handleError(_0x49d2b9,null,_0x2fcd('0x19')));};