Built motion from commit 3d6333b4.|2.6.31
[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 _0x2d66=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params'];(function(_0x5b2da2,_0x118788){var _0x4df570=function(_0x5116d0){while(--_0x5116d0){_0x5b2da2['push'](_0x5b2da2['shift']());}};_0x4df570(++_0x118788);}(_0x2d66,0x1b3));var _0x62d6=function(_0x4f7782,_0x175079){_0x4f7782=_0x4f7782-0x0;var _0x21e9aa=_0x2d66[_0x4f7782];return _0x21e9aa;};'use strict';var info=require(_0x62d6('0x0'));var exec=require(_0x62d6('0x1'))[_0x62d6('0x2')];var logger=require(_0x62d6('0x3'))(_0x62d6('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x62d6('0x5'));function handleError(_0x276557,_0x4130f3,_0x38e063){_0x4130f3=_0x4130f3||0x1f4;return function(_0x3a1624){logger[_0x62d6('0x6')](_0x62d6('0x7'),_0x38e063,_0x4130f3,util[_0x62d6('0x8')](_0x3a1624,{'showHidden':![],'depth':null}));delete _0x3a1624[_0x62d6('0x9')];_0x276557[_0x62d6('0xa')](_0x4130f3)[_0x62d6('0xb')](_0x3a1624);};}exports[_0x62d6('0xc')]=function(_0x462405,_0x402a62){return info[_0x62d6('0xd')]()[_0x62d6('0xe')](function(_0x5bdb34){return _0x402a62[_0x62d6('0xa')](0xc8)[_0x62d6('0xf')](_0x5bdb34);})['catch'](function(_0x3e6aa1){return _0x402a62[_0x62d6('0xa')](0x1f4)['json'](_0x3e6aa1);});};exports[_0x62d6('0x10')]=function(_0x2073da,_0x298017){var _0x3c16ab=[_0x62d6('0x11')];return new BPromise(function(_0x4ce527,_0x2fc667){return exec(util[_0x62d6('0x12')](_0x62d6('0x13'),_0x2073da['params'][_0x62d6('0x14')]),function(_0x4d2ba4,_0x11bbfd,_0x309b97){if(_0x4d2ba4){return _0x2fc667(_0x4d2ba4);}return _0x4ce527(_0x11bbfd);});})['then'](function(_0x401989){var _0xaa5319=![];var _0x18b2a4=_0x401989['split'](/\n/);for(var _0x2260d2=0x0,_0x21d813=_0x3c16ab['length'];_0x2260d2<_0x21d813,_0xaa5319===![];_0x2260d2+=0x1){if(_0x401989[_0x62d6('0x15')](_0x3c16ab[_0x2260d2])>=0x0){_0xaa5319=!![];}}if(!_0xaa5319){throw new Error(util['format'](_0x62d6('0x16'),_0x2073da[_0x62d6('0x17')][_0x62d6('0x14')]));}process['kill'](_0x2073da[_0x62d6('0x17')][_0x62d6('0x14')],_0x62d6('0x18'));return _0x298017[_0x62d6('0xa')](0xc8)[_0x62d6('0xf')]({'message':util[_0x62d6('0x12')](_0x62d6('0x19'),_0x2073da[_0x62d6('0x17')]['pid'])});})[_0x62d6('0x1a')](handleError(_0x298017,null,'killProcess'));};