Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/multiphp_manager/index.cmb.min.js

define("app/services/configService",["angular","cjt/io/api","cjt/util/parse","cjt/util/locale","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/services/APIService"],(function(e,t,n,i,o,a){"use strict";var r;try{r=e.module("App")}catch(t){r=e.module("App",["cjt2.services.api"])}r.factory("configService",["$q","APIService",function(t,a){var r=function(){};return r.prototype=new a,e.extend(r.prototype,{convertResponseToList:function(e){var t=[];if(e.status){for(var i=e.data,o=0,a=i.length;o<a;o++){var r=i[o];r.hasOwnProperty("php_fpm")&&(r.php_fpm=n.parsePerlBoolean(r.php_fpm)),r.hasOwnProperty("is_suspended")&&(r.is_suspended=n.parsePerlBoolean(r.is_suspended)),r.hasOwnProperty("main_domain")&&(r.main_domain=n.parsePerlBoolean(r.main_domain)),r.hasOwnProperty("version")&&(r.display_php_version=this.transformPhpFormat(r.version)),t.push(r)}var s=e.meta;return{items:t,totalItems:s.paginate.total_records||i.length,totalPages:s.paginate.total_pages||1}}return{items:[],totalItems:0,totalPages:0}},checkFPMPackages:function(){var e=new o.Class;return e.initialize("","package_manager_list_packages"),e.addArgument("state","installed"),this.deferred(e).promise.then((function(e){return e.data})).catch((function(e){return t.reject(e)}))},applySystemSetting:function(e){var n=new o.Class;n.initialize("","php_set_system_default_version"),n.addArgument("version",e);var i=this;return this.deferred(n).promise.then((function(e){return i.convertResponseToList(e)})).catch((function(e){return t.reject(e)}))},fetchSystemPhp:function(){var e=new o.Class;return e.initialize("","php_get_system_default_version"),this.deferred(e).promise.then((function(e){return e.data})).catch((function(e){return t.reject(e)}))},applyDomainSetting:function(e,n){var i=new o.Class,a=this;return i.initialize("","php_set_vhost_versions"),i.addArgument("version",e),void 0!==n&&n.length>0&&n.forEach((function(e,t){i.addArgument("vhost-"+t,e)})),this.deferred(i).promise.then((function(e){return a.convertResponseToList(e)})).catch((function(e){return t.reject(e)}))},applyDomainFpm:function(e,n){var i=new o.Class,a=this;return i.initialize("","php_set_vhost_versions"),i.addArgument("php_fpm",e),void 0!==n&&n.length>0&&n.forEach((function(e,t){i.addArgument("vhost-"+t,e)})),this.deferred(i).promise.then((function(e){return a.convertResponseToList(e)})).catch((function(e){return t.reject(e)}))},savePoolOption:function(e){var n=new o.Class,i=this;return n.initialize("","php_set_vhost_versions"),n.addArgument("php_fpm",1),n.addArgument("vhost-0",e.vhost),n.addArgument("php_fpm_pool_parms",JSON.stringify(e.php_fpm_pool_parms)),this.deferred(n).promise.then((function(e){return i.convertResponseToList(e)})).catch((function(e){return t.reject(e)}))},fetchList:function(e){var n=new o.Class,i=this;return n.initialize("","php_get_vhost_versions"),this.deferred(n).promise.then((function(e){return i.convertResponseToList(e)})).catch((function(e){return t.reject(e)}))},fetchVersionHandlerList:function(){var e=new o.Class;e.initialize("","php_get_handlers");var n=this;return this.deferred(e).promise.then((function(e){return n.convertResponseToList(e)})).catch((function(e){return t.reject(e)}))},fetchPHPVersions:function(){var e=new o.Class;return e.initialize("","php_get_installed_versions"),this.deferred(e).promise.then((function(e){return e.data})).catch((function(e){return t.reject(e)}))},fetchImpactedDomains:function(e,t){var n=new o.Class;return n.initialize("","php_get_impacted_domains"),n.addArgument(e,t),this.deferred(n).promise},applyVersionHandler:function(e,n){var i=new o.Class;return i.initialize("","php_set_handler"),i.addArgument("version",e),i.addArgument("handler",n),this.deferred(i).promise.then((function(e){return e.status})).catch((function(e){return t.reject(e)}))},conversionInProgress:function(){var e=new o.Class;return e.initialize("","is_conversion_in_progress"),this.deferred(e).promise.then((function(e){return n.parsePerlBoolean(e.data.inProgress)})).catch((function(e){return t.reject(e)}))},convertAllAccountsToFPM:function(){var e=new o.Class;return e.initialize("","convert_all_domains_to_fpm"),this.deferred(e).promise.then((function(e){return e.data})).catch((function(e){return t.reject(e)}))},fetchFPMStatus:function(){var e=new o.Class;return e.initialize("","php_get_default_accounts_to_fpm"),this.deferred(e).promise.then((function(e){return e.data})).catch((function(e){return t.reject(e)}))},checkFPMEnvironment:function(e,n){var i=new o.Class;return i.initialize("","get_fpm_count_and_utilization"),this.deferred(i).promise.then((function(e){return e.data})).catch((function(e){return t.reject(e)}))},getPHPFPMInfo:function(e,n){var i={environment:this.checkFPMEnvironment(e,n),status:this.fetchFPMStatus(),packages:this.checkFPMPackages()};return t.all(i)},switchSystemFPM:function(e){var n=new o.Class;return n.initialize("","php_set_default_accounts_to_fpm"),n.addArgument("default_accounts_to_fpm",e),this.deferred(n).promise.then((function(e){return!0})).catch((function(e){return t.reject(e)}))},friendlyPhpFormat:function(e){var t=e||"",n=/^\D+-(php)(\d{2,3})$/i;n.test(e)&&(t="PHP "+e.match(n)[2].replace(/(\d)$/,".$1"));return t},transformPhpFormat:function(e){var t=e||"";return/^\D+-(php)(\d{2,3})$/i.test(e)&&(t=(t=this.friendlyPhpFormat(e))+" ("+e+")"),t},parseCloudLinuxData:function(e){return e.cl_is_installed=n.parsePerlBoolean(e.cl_is_installed),e.cl_is_supported=n.parsePerlBoolean(e.cl_is_supported),e.purchase_cl_data.disable_upgrade=n.parsePerlBoolean(e.purchase_cl_data.disable_upgrade),e.purchase_cl_data.is_url=n.parsePerlBoolean(e.purchase_cl_data.is_url),e.purchase_cl_data.server_timeout=n.parsePerlBoolean(e.purchase_cl_data.server_timeout),e},setCloudLinuxInfo:function(e){var t={};if(e){var n=this.parseCloudLinuxData(e),o=n.purchase_cl_data;if(n.cl_is_supported&&!n.cl_is_installed&&!o.disable_upgrade&&(t.showBanner=!0,!o.server_timeout))if(o.is_url)t.purchaseLink=o.url,t.actionText=i.maketext("Upgrade to [asis,CloudLinux]"),t.linkTarget=o.target||"_blank";else{var a="mailto:"+encodeURIComponent(o.email||"")+"?subject="+encodeURIComponent("Upgrade to Cloud Linux")+"&body="+encodeURIComponent("I am interested in more information on how I can benefit from CloudLinux on my cPanel server.");t.purchaseLink=a,t.linkTarget="_top",t.actionText=i.maketext("Email Provider")}t.data=n}return t},getPHPFPMSettings:function(e){var n=new o.Class;return n.initialize("","php_fpm_config_get"),n.json=!0,n.addArgument("domain",e||""),this.deferred(n).promise.then((function(t){return function(e,t){var n={};function i(e){return"on"===e.value||"off"!==e.value&&("pm_max_children"!==e.base_flag_name&&"pm_process_idle_timeout"!==e.base_flag_name&&"pm_max_requests"!==e.base_flag_name||isNaN(parseInt(e.value,10))?"error_reporting"===e.base_flag_name||"disable_functions"===e.base_flag_name?("string"!=typeof e.value||0===e.value.length?e.value=[]:e.value=e.value.split(","),e.value):"doc_root"===e.base_flag_name?("string"==typeof e.value&&t?(e.value=e.value.split("[% documentroot %]")[1],0===e.value.indexOf("/")&&(e.value=e.value.slice(1,e.value.length))):e.value="",e.value):"error_log"===e.base_flag_name?("string"==typeof e.value&&t?e.value=e.value.split("/logs/")[1]:e.value="",e.value):void 0:parseInt(e.value,10))}return e.forEach((function(e){n[e.base_flag_name]={value:i(e),admin:1===e.trinary_admin_value||2!==e.trinary_admin_value&&0}})),n}(t.data.config,e)})).catch((function(e){return t.reject(e)}))},submitPoolOptions:function(e,n,i){var a=new o.Class;return a.initialize("","php_fpm_config_set"),a.json=!0,a.addArgument("validate_only",n),a.addArgument("domain",i||""),a.addArgument("config",function(e){var t=[],n={};function i(e,t){return"allow_url_fopen"===e||"log_errors"===e||"short_open_tag"===e?t=t?"on":"off":"disable_functions"===e||"error_reporting"===e?t=0===t.length?"":t.join(","):"pm_max_children"===e||"pm_max_requests"===e||"pm_process_idle_timeout"===e?t:"error_log"===e?t=""===t?"[% homedir %]/logs/[% scrubbed_domain %].php.error.log":"[% homedir %]/logs/"+t:"doc_root"===e?t=0!==t.indexOf("/")?"[% documentroot %]/"+t:"[% documentroot %]"+t:void 0}for(var o in e)o&&(n.trinary_admin_value=e[o].admin?1:0===e[o].admin?e[o].admin:2,n.base_flag_name=o,n.value=i(o,e[o].value)),t.push(n),n={};return t}(e)),this.deferred(a).promise.then((function(e){return!0})).catch((function(e){return t.reject(e)}))},getEA4Recommendations:function(){var e=new o.Class,t=new a;return e.initialize("","ea4_recommendations"),t.deferred(e).promise}}),new r}])})),define("app/views/impactedDomainsPopup",["angular","lodash","cjt/util/locale","uiBootstrap"],(function(e,t,n){return e.module("App").controller("impactedDomainsPopup",["$scope","$uibModalInstance","data",function(e,t,n){e.modalData={};var i=n;e.modalData=i,e.closeModal=function(){t.close()}}])})),define("app/views/poolOptions",["angular","lodash","cjt/util/parse","cjt/util/locale","uiBootstrap","cjt/directives/alertList","cjt/services/alertService","app/services/configService","cjt/directives/validationContainerDirective","cjt/directives/validationItemDirective","cjt/directives/toggleLabelInfoDirective","cjt/directives/loadingPanel","cjt/directives/actionButtonDirective","cjt/validator/datatype-validators","cjt/validator/compare-validators","cjt/validator/path-validators"],(function(e,t,n,i){"use strict";return e.module("App").controller("poolOptionsController",["$q","$scope","$anchorScroll","$rootScope","alertService","configService",function(n,o,a,r,s,l){function c(e){var t=[];function n(e){var t=e.length-1;return 0!==e.indexOf(" ")&&e.indexOf(" ")!==t?e:(0===e.indexOf(" ")&&(e=e.slice(1)),e.indexOf(" ")===t&&(e=e.slice(0,t)),n(e))}return e.forEach((function(e){e=n(e),t.push(e)})),t}function p(e,t,n,i){return l.submitPoolOptions(e,t,n).then((function(t){return e.disable_functions?(o.poolOptions.disable_functions.value.push(e.disable_functions.value[0]),o.displayValue.disabledFuncsPanelOpen=!0,o.displayValue.disabledFuncs="",i.$setDirty(),e.disable_functions.value[0]):e.error_reporting?(o.displayValue.reportedErrs="",o.poolOptions.error_reporting.value.push(e.error_reporting.value[0]),o.displayValue.errsReportedPanelOpen=!0,i.$setDirty(),e.error_reporting.value[0]):void 0})).catch((function(e){s.add({type:"danger",message:e,closeable:!0})}))}function u(t,n,a,r){return l.submitPoolOptions(t,n,a).then((function(a){var l;n?l=i.maketext("The system successfully validated the [asis,PHP-FPM] configuration."):(r.$setPristine(),o.poolOptionsCache=e.copy(t),l=i.maketext("The system successfully saved the [asis,PHP-FPM] configuration.")),s.add({type:"success",message:l,autoClose:5e3})})).catch((function(e){s.add({type:"danger",message:e,closeable:!0})}))}function d(t){return l.getPHPFPMSettings(t).then((function(n){t&&(n=function(e){var t,n=o.displayValue.selectedDomain.replace(/\./,(function(){return"_"}));return-1!==e.error_log.value.indexOf("[% scrubbed_domain %]")&&(t=function e(t){return 0===t.indexOf(".")?t:e(t=t.slice(1))}(e.error_log.value.split("scrubbed_domain")[1]),t=n+t,e.error_log.value=t),e}(n)),o.poolOptions=n,o.poolOptionsCache=e.copy(o.poolOptions)})).catch((function(e){s.add({type:"danger",message:e,closeable:!0})})).finally((function(){a.yOffset=-100,a("content"),o.actions.initialLoading=!1}))}o.displayValue={selectedDomain:"",docRootDisplayValue:"",logDirDisplayValue:"",reportedErrs:"",disabledFuncs:"",displayMode:null,disabledFuncsPanelOpen:!1,errsReportedPanelOpen:!1,saveReminderDisplayed:!1,saveReminderMessage:i.maketext("Click [output,em,Save Configuration] to save your changes.")},o.poolOptions={},o.poolOptionsCache={},o.additionalResources=[{text:"cPanel Documentation",link:"https://docs.cpanel.net/"},{text:i.maketext("Official [asis,PHP] Configuration Documentation"),link:"https://secure.php.net/manual/en/install.fpm.configuration.php"},{text:"Bottleneck with Child Processes",link:"https://go.cpanel.net/ApachevsPHP-FPMBottleneckwithChildProcesses"}],o.getDefaultButtonClasses=function(){return"btn btn-default"},o.getSmallDefaultButtonClasses=function(){return"btn btn-sm btn-default"},o.getButtonClasses=function(){return"btn btn-default"},o.getPrimaryButtonsClasses=function(){return"btn btn-sm btn-primary"},o.addFunctionsToDisable=function(e,a){var r=function(e,a){var r;e=e.split(","),e=c(e);for(var l,u=[],d=0,f=e.length;d<f;d++){if(-1!==e.indexOf(e[d])&&-1!==e.indexOf(e[d],d+1))return;if(-1===o.poolOptions.disable_functions.value.indexOf(e[d]))(r={disable_functions:{value:[],admin:o.poolOptions.disable_functions.admin}}).disable_functions.value.push(e[d]),l=p(r,!0,o.displayValue.selectedDomain,a),u.push(l);else{var m=i.maketext("The “[_1]” function already appears on the disabled functions list.",t.escape(e[d]));if(s.add({type:"warning",autoClose:5e3,closeable:!0,message:m}),1===f)return}}return n.all(u)}(e,a);if(r)return o.actions.validatingFuncs=!0,r.then((function(e){s.add({type:"success",autoClose:5e3,message:i.maketext("You successfully added the “[_1]” function to the list. Click [output,em,Save Configuration] to save your changes.",t.escape(e))}),o.actions.validatingFuncs=!1}))},o.removeDisabledFunction=function(e,t){for(var n=o.poolOptions.disable_functions.value,i=0,a=o.poolOptions.disable_functions.value.length;i<a;i++)if(e===n[i])return o.poolOptions.disable_functions.value.splice(i,1),void t.$setDirty()},o.addErrsToReport=function(e,a){var r=function(e,a){var r;e=e.split(","),e=c(e);for(var l,u=[],d=0,f=e.length;d<f;d++){if(-1!==e.indexOf(e[d])&&-1!==e.indexOf(e[d],d+1))return;if(-1===o.poolOptions.error_reporting.value.indexOf(e[d]))(r={error_reporting:{value:[],admin:o.poolOptions.error_reporting.admin}}).error_reporting.value.push(e[d]),l=p(r,!0,o.displayValue.selectedDomain,a),u.push(l);else{var m=i.maketext("The “[_1]” error already appears on the errors list.",t.escape(e[d]));if(s.add({type:"warning",autoClose:5e3,closeable:!0,message:m}),1===f)return}}return n.all(u)}(e,a);if(r)return o.actions.validatingErrs=!0,r.then((function(e){s.add({type:"success",autoClose:5e3,message:i.maketext("You successfully added the “[_1]” error to the list. Click [output,em,Save Configuration] to save your changes.",t.escape(e))}),o.actions.validatingErrs=!1}))},o.removeReportedErrs=function(e,t){for(var n=o.poolOptions.error_reporting.value,i=0,a=o.poolOptions.error_reporting.value.length;i<a;i++)if(e===n[i])return o.poolOptions.error_reporting.value.splice(i,1),void t.$setDirty()},o.returnToDomainsList=function(){r.$emit("returnToDomainList")},o.toggleOverrideVal=function(e,t){switch(t.$setDirty(),o.displayValue.saveReminderDisplayed||(s.add({type:"info",closeable:!0,autoClose:5e3,message:o.displayValue.saveReminderMessage}),o.displayValue.saveReminderDisplayed=!0),e){case"allow_url_fopen":o.poolOptions.allow_url_fopen.admin=!o.poolOptions.allow_url_fopen.admin;break;case"log_errors":o.poolOptions.log_errors.admin=!o.poolOptions.log_errors.admin;break;case"short_open_tag":o.poolOptions.short_open_tag.admin=!o.poolOptions.short_open_tag.admin;break;case"doc_root":o.poolOptions.doc_root.admin=!o.poolOptions.doc_root.admin;break;case"error_log":o.poolOptions.error_log.admin=!o.poolOptions.error_log.admin;break;case"disable_functions":o.poolOptions.disable_functions.admin=!o.poolOptions.disable_functions.admin;break;case"error_reporting":o.poolOptions.error_reporting.admin=!o.poolOptions.error_reporting.admin;break;default:throw new Error("DEVELOPER ERROR: invalid override value given")}},o.savePoolOptions=function(e){return u(o.poolOptions,!1,o.displayValue.selectedDomain,e)},o.validatePoolOptions=function(){return u(o.poolOptions,!0,o.displayValue.selectedDomain)},o.deactivateSaveActions=function(e){e.$setPristine()},o.resetPoolOptionsForm=function(t){o.poolOptions=o.poolOptionsCache,o.poolOptionsCache=e.copy(o.poolOptions),t.$setPristine()},o.actions={initialLoading:!0,validatingFuncs:!1,validatingErrs:!1},o.displayValue.displayMode=PAGE.poolOptionsDisplayMode||"default","domain"===o.displayValue.displayMode?(o.displayValue.docRootDisplayValue=PAGE.selectedDomainDocRoot+"/",o.displayValue.logDirDisplayValue=PAGE.selectedDomainHomeDir+"/logs/",o.displayValue.selectedDomain=PAGE.selectedDomainName,d(o.displayValue.selectedDomain)):d()}])})),define("app/views/phpManagerConfig",["angular","lodash","cjt/util/locale","cjt/util/parse","cjt/util/table","uiBootstrap","cjt/directives/alertList","cjt/services/alertService","cjt/decorators/paginationDecorator","cjt/directives/toggleSortDirective","cjt/directives/actionButtonDirective","app/services/configService","app/views/impactedDomainsPopup","app/views/poolOptions"],(function(e,t,n,i,o){"use strict";return e.module("App").controller("phpManagerController",["$scope","$rootScope","$q","configService","$timeout","$uibModal","alertService","PAGE","$interval",function(e,a,r,s,l,c,p,u,d){a.$on("returnToDomainList",(function(){a.editPoolOptionsMode=!1,u.poolOptionsDisplayMode&&delete u.poolOptionsDisplayMode})),a.litespeedRunning=i.parsePerlBoolean(u.litespeed_running);var f=/^alt/,m=n.maketext("We recommend that you update to a supported version of [asis,PHP]. [output,url,_1,Learn more about supported versions,target,_2].","http://php.net/supported-versions.php","_blank");e.actions={initialDataLoading:!0,loadingFPMInfo:!1,fetchingImpactedDomains:!1,settingSystemPHP:!1,fpmConversionRunning:!1,fpmConversionRunningOnLoad:!1,loadingAccountList:!1},e.php={versions:[],versionsInherit:[],systemDefault:{version:"",displayVersion:"",hasFPMInstalled:!1,showEolMsg:!1,eolWarningMsg:n.maketext("[output,strong,Warning]: Your system’s [asis,PHP] version has reached [output,acronym,EOL,End Of Life].")+" "+m},showEolMsg:!1,eolWarningMsg:"",perDomain:{selected:""},accountList:[],compatibleVersions:[],installedVersion:[],systemEditView:!1,totalSelectedDomains:0,paginationMessage:"",inheritWarning:n.maketext("[asis,PHP-FPM] option is disabled when one or more selections contain PHP version of [output,em,inherit]."),incompatibleWarning:n.maketext("[asis,PHP-FPM] option is disabled when one or more selections contain PHP version that doesn’t have corresponding [asis,PHP-FPM] package installed."),noVersions:!1},e.fpm={completePackageData:[],checkingFPMPackage:!1,fpmPackageNeeded:!1,flag:!1,showMemoryWarning:!1,systemStatus:!1,requiredMemoryAmount:0,ea4ReviewLink:"",fcgiMissing:!1,ea4Went:!1,conversionTimer:null,conversionTimerInterval:3e3,convertBuildId:null,fpmConversionStarted:!1,domainSelection:0,missingPackages:[],fpmWarning:n.maketext("The [output,em,inherit] option of [asis,PHP] Version is disabled when one or more selections have [asis,PHP-FPM] on.")},e.applyingPHPVersionTo=[];var h=new o;h.meta.pageSizes=t.concat(h.meta.pageSizes,[500,1e3]);h.setSearchFunction((function(e,t){return t=t.toLowerCase(),-1!==e.account.toLowerCase().indexOf(t)||-1!==e.vhost.toLowerCase().indexOf(t)||-1!==e.account_owner.toLowerCase().indexOf(t)})),h.setSort("vhost,account,account_owner,version,php_fpm","asc"),e.meta=h.getMetadata(),e.getFPMInfo=function(){return L()},e.setFPMFlag=function(){return e.fpm.flag=!1,s.setFPMFlag()},e.editSystemPHP=function(t){t?(e.php.systemEditView=!0,e.impactedDomains={},b(),O("system_default",!0,e.impactedDomains,!0)):e.php.systemEditView=!1},e.applySystemPHP=function(){return w(e.php.systemDefault.selected)},e.requiredMemory=function(){return n.maketext("Your system requires [format_bytes,_1] of memory to convert the remaining domains to [asis,PHP-FPM].",e.fpm.requiredMemoryAmount)},e.switchSystemFPM=function(){e.fpm.systemStatus=!e.fpm.systemStatus;var t=e.fpm.systemStatus?1:0;P(t)},e.convertAllAccountsToFPM=function(){return _()};e.handleEntireListSelection=function(){h.areAllDisplayedRowsSelected()?h.unselectAllDisplayed():h.selectAllDisplayed(),e.php.totalSelectedDomains=h.getTotalRowsSelected(),e.php.accountList=h.getList()},e.handleSingleListSelection=function(t){!function(e){void 0===e.impactedDomains&&(e.impactedDomains={}),O("domain",e.vhost,e.impactedDomains,e.selected)}(t),t.selected?h.selectItem(t):h.unselectItem(t),e.php.allRowsSelected=h.areAllDisplayedRowsSelected(),e.php.totalSelectedDomains=h.getTotalRowsSelected(),e.php.accountList=h.getList()},e.searchByDomainOrAccount=function(){h.update(),e.php.accountList=h.getList(),e.meta=h.getMetadata(),e.php.paginationMessage=h.paginationMessage()},e.areRowsSelected=function(){return 0===h.getTotalRowsSelected()},e.applyPHPToMultipleAccounts=function(){var t=e.php.perDomain.selected.version,n=[];return h.getSelectedList().forEach((function(e){n.push(e.vhost)})),e.php.accountList=h.getList(),g(t,n)},e.applyPHPToSingleAccount=function(e){if("inherit"===e.version&&e.php_fpm){var t=e.display_php_version.split(" ")[2],n=t.length-2;e.version=t.substr(1,n)}else{var i=[];i.push(e.vhost),g(e.version,i)}},e.isAnyDomainInherited=function(){for(var e=h.getSelectedList(),t=0,n=e.length;t<n;t++)if(e[t].inherited)return!0;return!1},e.isAnyDomainFPM=function(){for(var e=h.getSelectedList(),t=0,n=e.length;t<n;t++)if(e[t].php_fpm)return!0;return!1},e.updateTable=function(){h.update(),e.php.accountList=h.getList(),e.meta=h.getMetadata(),e.php.paginationMessage=h.paginationMessage()},e.isAnyDomainIncompatible=function(){var t=h.getSelectedList(),n=[];e.php.compatibleVersions.forEach((function(e){e=e.split("-php-fpm")[0],n.push(e)}));for(var i=0,o=t.length;i<o;i++)if(-1===n.indexOf(t[i].version))return!0;return!1},e.isDomainVersionIncompatible=function(t){if("inherit"===t)return!1;var n=[];e.php.compatibleVersions.forEach((function(e){e=e.split("-php-fpm")[0],n.push(e)}));for(var i=0,o=n.length;i<o;i++)if(t===n[i])return!1;return!0},e.setMultipleDomainFPM=function(){e.actions.applyingFPM=!0;var t=[];return h.getSelectedList().forEach((function(e){t.push(e.vhost)})),v(e.fpm.domainSelection,t)},e.setSingleDomainFPM=function(e){var t=e.php_fpm?0:1,n=[];return n.push(e.vhost),v(t,n)},e.showAllImpactedDomains=function(){var t=e.impactedDomains;c.open({templateUrl:"impactedDomainsPopup.ptt",controller:"impactedDomainsPopup",resolve:{data:function(){return t}}})},e.setPoolOptionsDisplayValues=function(e){u.poolOptionsDisplayMode="domain",u.selectedDomainHomeDir=e.homedir,u.selectedDomainDocRoot=e.documentroot,u.selectedDomainName=e.vhost,a.editPoolOptionsMode=!0};var v=function(i,o){return e.actions.applyingFPM=!0,s.applyDomainFpm(i,o).then((function(e){p.add({type:"success",message:n.maketext("The system successfully updated the [asis,PHP-FPM] setting."),autoClose:5e3,id:"phpFPMSuccessMessage"})})).catch((function(e){p.add({type:"danger",message:t.escape(e),closeable:!0,id:"domainFPMError"})})).finally((function(){e.actions.applyingFPM=!1,A()}))},g=function(i,o){return e.actions.applyingPHPVersion=!0,e.applyingPHPVersionTo=o.slice(),s.applyDomainSetting(i,o).then((function(e){p.add({type:"success",message:n.maketext("The system successfully updated the [asis,PHP] version to “[_1]”.",i),autoClose:5e3,id:"phpDomainSuccessMessage"})})).catch((function(e){p.add({type:"danger",message:t.escape(e),closeable:!0,id:"domainVersionError"})})).finally((function(){l((function(){e.actions.applyingPHPVersion=!1,e.applyingPHPVersionTo=[]}),500),A()}))};e.phpConversionInProgressFor=function(t){return-1!==e.applyingPHPVersionTo.indexOf(t)},e.processInProgress=function(){return e.actions.loadingAccountList||e.actions.applyingPHPVersion||e.actions.applyingFPM||e.fpm.fpmConversionStarted};var _=function(){return e.fpm.fpmConversionStarted=!0,s.convertAllAccountsToFPM().then((function(t){return e.fpm.convertBuildId=t.build,D()})).catch((function(t){"canceled"===t?e.fpm.conversionTimer=null:p.add({type:"danger",message:t,closeable:!0,id:"convertAllAccountsError"})})).finally((function(){e.fpm.fpmConversionStarted=!1,A()}))},P=function(e){return s.switchSystemFPM(e).then((function(e){y()})).catch((function(e){p.add({type:"danger",message:e,closeable:!0,id:"fpmSystemSwitchError"})}))},y=function(){return s.fetchFPMStatus().then((function(t){e.fpm.systemStatus=i.parsePerlBoolean(t.default_accounts_to_fpm)}))},D=function(){return e.fpm.conversionTimer=d((function(){s.conversionInProgress().then((function(t){e.actions.fpmConversionRunning=t,t||(e.actions.fpmConversionRunning=!1,e.actions.fpmConversionRunningOnLoad=!1,d.cancel(e.fpm.conversionTimer))}))}),e.fpm.conversionTimerInterval),e.fpm.conversionTimer},w=function(t){return e.actions.settingSystemPHP=!0,p.clear(),s.applySystemSetting(t.version).then((function(i){void 0!==i&&(p.add({type:"success",message:n.maketext("The system default [asis,PHP] version has been set to “[_1]”.",t.displayVersion),autoClose:1e4,id:"phpSystemSuccess"}),e.php.systemDefault.version=t.version,e.php.systemDefault.displayVersion=s.transformPhpFormat(t.version),e.php.toggleEolWarning("systemDefault",H(e.php.systemDefault.version)))})).catch((function(e){p.add({type:"danger",message:e,closeable:!0,id:"phpSystemError"})})).finally((function(){M(e.fpm.completePackageData),e.php.systemEditView=!1,e.actions.settingSystemPHP=!1,A()}))},b=function(){for(var t=0,n=e.php.versions.length;t<n;t++)if(e.php.versions[t].version===e.php.systemDefault.version)return void(e.php.systemDefault.selected=e.php.versions[t])},O=function(i,o,a,r){r?(e.actions.fetchingImpactedDomains=!0,s.fetchImpactedDomains(i,o).then((function(e){var r=e.data;if(e.status&&r.length>0){a.show=a.warn=!0,a.showMore=r.length>10;var s="domain"===i?n.maketext("A change to the “[output,strong,_1]” domain‘s PHP version affects the following domains:",o):n.maketext("A change to the system default PHP version affects the following domains:");a.text=s,a.domains=t.sortBy(r)}})).catch((function(e){p.add({type:"danger",message:e,closeable:!0,id:"fetchImpactedDomainsError"}),a.show=a.warn=!1})).finally((function(){e.actions.fetchingImpactedDomains=!1,e.impactedDomains=a}))):(a.show=a.warn=!1,e.impactedDomains=a)},S=function(e){var t="";return"ea-apache24-mod_proxy_fcgi"===e[0]&&e.shift(),e.forEach((function(e){"ea-apache24-mod_proxy_fcgi"!==e&&(e=(e=(e=e.split("ea-php"))[1].split("-php-fpm"))[0].split("").join(".")),t=t+e+", "})),t},M=function(n){var i,o;e.fpm.packageChecklist=(i=e.php.versions,o=[],i.forEach((function(e){"inherit"===e.version||f.test(e.version)||o.push(e.version)})),o.push("ea-apache24-mod_proxy_fcgi"),o),e.php.systemDefault.hasFPMInstalled=function(e,t){t+="-php-fpm";for(var n=0,i=e.length;n<i;n++)if(t===e[n].package)return!0;return!1}(n,e.php.systemDefault.version),function(t,n){var i=[],o=[],a=[];n.forEach((function(e){"ea-apache24-mod_proxy_fcgi"!==e&&(e+="-php-fpm"),a.push(e)}));for(var r=0,s=t.length;r<s;r++)for(var l=0,c=a.length;l<c;l++)t[r].package===a[l]&&(o.push(t[r].package),"ea-apache24-mod_proxy_fcgi"!==t[r].package&&i.push(t[r].package),a.splice(a.indexOf(t[r].package),1));e.fpm.missingPackagesDisplay=S(a),e.php.installedVersion=S(o).slice(0,e.php.installedVersion.length-2),e.php.compatibleVersions=i,e.fpm.missingPackages=a}(n,e.fpm.packageChecklist),e.fpm.missingPackages.length&&(e.fpm.ea4ReviewLink=function(e){var n=t.join(t.map(e,(function(e){return"install="+e})),"&");return u.cp_security_token+"/scripts7/EasyApache4/review?"+n}(e.fpm.missingPackages)),e.fpm.fcgiMissing=(e.fpm.missingPackages,-1!==e.fpm.missingPackages.indexOf("ea-apache24-mod_proxy_fcgi"))},L=function(){return e.actions.loadingFPMInfo=!0,s.getPHPFPMInfo().then((function(t){var n;e.fpm.completePackageData=t.packages,e.fpm.systemStatus=(n=t,i.parsePerlBoolean(n.status.default_accounts_to_fpm)),e.fpm.showMemoryWarning=function(t){var n=i.parsePerlBoolean(t.environment.show_warning);return n&&(e.fpm.requiredMemoryAmount=function(e){return 1024*e.environment.memory_needed}(t)),n}(t),M(t.packages)})).catch((function(e){p.add({type:"danger",message:e,closeable:!0,id:"fetchFPMInfoError"})})).finally((function(){e.actions.loadingFPMInfo=!1}))},k=function(e){var t,n=[];return e.forEach((function(e){(t={}).version=e,t.displayVersion=s.transformPhpFormat(e),n.push(t)})),n},x=function(t){t=function(t){var i=[];return e.php.versions.forEach((function(e){i.push(e.version)})),t.forEach((function(e){"inherit"===e.version?e.isUnavailableVersion=!1:-1===i.indexOf(e.version)?(e.isUnavailableVersion=!0,e.isUnavailableVersionMessage=n.maketext("The domain ‘[_1]’ uses a PHP version, ‘[_2]’, that no longer exists in the system. You must select a new PHP version for this domain.",e.vhost,e.version)):e.isUnavailableVersion=!1})),t}(t=function(t){return t.forEach((function(t){if(void 0!==t.phpversion_source){var i="",o="";void 0!==t.phpversion_source.domain?(i="domain",o=t.phpversion_source.domain):void 0!==t.phpversion_source.system_default&&(i="system_default",o=n.maketext("System Default")),("domain"===i&&o!==t.vhost||"system_default"===i)&&(t.version="inherit",t.displayVersion="inherit ("+e.php.systemDefault.version+")",t.inherited=!0,t.inheritedInfo=n.maketext("This domain inherits its [asis,PHP] version “[output,em,_1]” from: [output,strong,_2]",t.display_php_version,o))}})),t}(t)),h.load(t),h.update(),e.meta=h.getMetadata(),e.php.accountList=h.getList(),e.php.paginationMessage=h.paginationMessage()},C=function(e){var t=e.slice();return t.push({version:"inherit",displayVersion:"inherit"}),t},A=function(){return e.actions.loadingAccountList=!0,V(),s.fetchList().then((function(e){x(e.items)})).catch((function(e){p.add({type:"danger",message:e,closeable:!0,id:"fetchTableListError"})})).finally((function(){e.php.allRowsSelected=!1,e.actions.loadingAccountList=!1}))},V=function(){h.clear(),e.php.totalSelectedDomains=0},H=function(n){return t.includes(e.php.eolPhps,n)};e.php.eolWarningClass=function(t){var n="";if("systemDefault"===t)e.php.systemDefault.showEolMsg&&(n="system eol-warning");else n="";return n},e.php.toggleEolWarning=function(t,n){if("systemDefault"===t)e.php.systemDefault.showEolMsg=n;n?e.php.eolWarningClass(t):e.php.eolWarningClass()};!function(){a.editPoolOptionsMode=!1,u.poolOptionsDisplayMode&&delete u.poolOptionsDisplayMode,e.clData=u.cl_data,e.clBannerText=n.maketext("[output,strong,cPanel] provides the most recent stable versions of PHP. If you require legacy versions of PHP, such as PHP [list_and,_3], [asis,CloudLinux] provides hardened and secured [asis,PHP] versions that are patched against all known vulnerabilities. To learn more about [asis,CloudLinux] Advanced PHP Features, please read [output,url,_1,Hardened PHP versions on CloudLinux,target,_2].","https://go.cpanel.net/cloudlinuxhardenedphp","_blank",[4.4,5.1,5.2,5.3]),u.php_versions.data?(e.actions.fpmConversionRunning=e.actions.fpmConversionRunningOnLoad=i.parsePerlBoolean(u.fpm_conversion_in_progress),e.php.noVersions=!1):(e.php.noPHPVersionsError=u.php_versions.metadata.reason,e.php.noVersions=!0),e.actions.fpmConversionRunning&&D();var o={info:L(),versions:s.fetchPHPVersions().then((function(t){e.php.versions=k(t),e.php.versionsInherit=C(e.php.versions)})).catch((function(e){-1===e.indexOf("“PHP” is not installed on the system")&&p.add({type:"danger",message:e,closeable:!0,id:"getPHPVersionsError"})})),system:s.fetchSystemPhp().then((function(t){e.php.systemDefault.version=t.version,e.php.systemDefault.displayVersion=s.transformPhpFormat(t.version)})).catch((function(e){-1===e.indexOf("“PHP” is not installed on the system")&&p.add({type:"danger",message:e,closeable:!0,id:"getSystemPHPError"})}))};r.all(o).then((function(i){return function(){var i=[];if(e.php.versions.length>0)s.getEA4Recommendations().then((function(o){if(o&&void 0!==o.data){var a=t.filter(t.keys(o.data),(function(e){return/^ea-php\d{2}$/.test(e)}));if(a=t.sortBy(t.intersection(a,t.map(e.php.versions,"version"))),t.each(a,(function(e){t.each(o.data[e],(function(n){t.includes(n.filter,"eol")&&i.push(e)}))})),i.length>0){e.php.eolPhps=i;var r=t.map(i,(function(e){return s.friendlyPhpFormat(e)})),l=n.maketext("[output,strong,Warning]: The [asis,PHP] [numerate,_2,version,versions] [list_and,_1] [numerate,_2,has,have] reached [output,acronym,EOL,End Of Life].",r,i.length)+" "+m;e.php.showEolMsg=!0,e.php.eolWarningMsg=l}}})).catch((function(e){p.add({type:"danger",message:e,closeable:!0,id:"recommendationsError"})}))}(),function(){for(var t=0,n=e.php.versionsInherit.length;t<n;t++)if(e.php.versionsInherit[t].version===e.php.systemDefault.version)return void(e.php.perDomain.selected=e.php.versionsInherit[t])}(),A()})).finally((function(t){l((function(){e.php.toggleEolWarning("systemDefault",H(e.php.systemDefault.version))}),0),e.actions.initialDataLoading=!1}))}()}])})),define("app/views/phpHandlers",["angular","lodash","cjt/util/locale","uiBootstrap","cjt/directives/alertList","cjt/services/alertService","app/services/configService"],(function(e,t,n){return e.module("App").controller("phpHandlers",["$scope","$location","$routeParams","$timeout","$filter","configService","spinnerAPI","alertService","growl","growlMessages","$anchorScroll","PAGE",function(e,i,o,a,r,s,l,c,p,u,d,f){e.loadingVersionsList=!1,e.phpVersionsEmpty=!0,e.meta={sortReverse:!1,sortBy:"version",sortDirection:"asc"};var m=r("orderBy");e.sortList=function(){""!==e.meta.sortDirection&&""!==e.meta.sortBy&&(e.phpVersionHandlerList=m(e.phpVersionHandlerList,e.meta.sortBy,"asc"===e.meta.sortDirection))},e.editPhpHandler=function(e){e.editView=!0};var h=function(e){e.conflicts=[],e.showAlert=!1};e.cancelHandlerEdit=function(e){e.editView=!1,e.current_handler=e.originalHandler,h(e)},e.fetchVersionHandlerList=function(){return e.loadingVersionsList=!0,s.fetchVersionHandlerList().then((function(n){var i;i=n.items,e.phpVersionHandlerList=i.map((function(e){return e.editView=!1,e.conflicts=[],e.showAlert=!1,e.originalHandler=e.current_handler,e})),e.lsApiInstalled=t.includes(t.uniq(t.flatten(t.map(e.phpVersionHandlerList,"available_handlers"))),"lsapi")}),(function(e){p.error(e)})).then((function(){e.loadingVersionsList=!1}))},e.applyVersionHandler=function(e){return u.destroyAllMessages(),h(e),s.applyVersionHandler(e.version,e.current_handler).then((function(t){t&&(p.success(n.maketext("Successfully applied the “[_1]” [asis,PHP] handler to the “[_2]” package.",e.current_handler,e.version)),e.originalHandler=e.current_handler,e.editView=!1)})).catch((function(e){p.error(t.escape(e))}))},e.warnUser=function(e,t){e.current_handler!==t?e.showAlert=!0:e.showAlert=!1},e.$on("$viewContentLoaded",(function(){u.destroyAllMessages(),e.fetchVersionHandlerList(),e.clData=f.cl_data,e.clBannerText=n.maketext("To utilize the [asis,LSAPI] handler’s full functionality and performance benefits, upgrade your system to [asis,CloudLinux]. To learn more about this feature, please read [output,url,_1,CloudLinux - Mod_lsapi Feature,target,_2].","https://go.cpanel.net/CL-lsapi","blank")}))}])})),define("app/views/conversion",["angular","lodash","cjt/util/locale","uiBootstrap"],(function(e,t,n){return e.module("App").controller("conversion",["$scope","$sce","$routeParams",function(e,t,n){e.buildId=n.buildId,e.tailingUrl=CPANEL.security_token+"/cgi/process_tail.cgi?process=ConvertToFPM&build_id="+e.buildId,e.tailingUrl=t.trustAsResourceUrl(e.tailingUrl)}])})),define("app/directives/cloudLinuxBanner",["angular","cjt/core","cjt/util/locale","cjt/util/parse","app/services/configService"],(function(e,t,n,i){"use strict";e.module("whm.multiphpManager.cloudLinuxBanner",[]).directive("cloudLinuxBanner",["configService",function(e){var n="directives/cloudLinuxBanner.ptt",i="templates/multiphp_manager/"+n;return{replace:!0,restrict:"E",templateUrl:t.config.debug?t.buildFullPath(i):n,scope:{idPrefix:"@",clData:"=",bannerText:"="},link:function(t,n,i){var o,a,r=e.setCloudLinuxInfo(t.clData);t.data=r.data,t.linkTarget=r.linkTarget,t.purchaseLink=r.purchaseLink,t.showBanner=r.showBanner,t.actionText=r.actionText,t.hideUpgradeOption=(o=t.data,(a=o.purchase_cl_data).server_timeout||a.error_msg&&""!==a.error_msg)}}}])})),define("app/directives/nonStringSelect",["angular"],(function(e){return e.module("App").directive("convertToNumber",(function(){return{require:"ngModel",link:function(e,t,n,i){i.$parsers.push((function(e){return parseInt(e,10)})),i.$formatters.push((function(e){return""+e}))}}}))})),define("app/index",["angular","jquery","lodash","cjt/core","cjt/modules","ngRoute","uiBootstrap"],(function(e,t,n,i){return function(){return e.module("App",["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","cjt2.whm","whm.multiphpManager.cloudLinuxBanner"]),require(["cjt/bootstrap","app/views/phpManagerConfig","app/views/phpHandlers","app/views/conversion","app/directives/cloudLinuxBanner","app/views/poolOptions","app/directives/nonStringSelect","cjt/directives/actionButtonDirective","cjt/directives/pageSizeDirective","cjt/decorators/paginationDecorator","cjt/directives/searchDirective","cjt/directives/toggleSortDirective"],(function(n){var o=e.module("App");o.value("PAGE",PAGE),o.firstLoad={phpAccountList:!0},o.config(["$routeProvider","growlProvider","$animateProvider",function(e,t,n){n.classNameFilter(/INeverWantThisToAnimate/),e.when("/config",{controller:"phpManagerController",templateUrl:i.buildFullPath("multiphp_manager/views/phpManagerConfig.ptt"),reloadOnSearch:!1}).when("/handlers",{controller:"phpHandlers",templateUrl:i.buildFullPath("multiphp_manager/views/phpHandlers.ptt"),reloadOnSearch:!1}).when("/conversion",{controller:"conversion",templateUrl:i.buildFullPath("multiphp_manager/views/conversion.ptt"),reloadOnSearch:!1}).when("/poolOptions",{controller:"poolOptionsController",templateUrl:i.buildFullPath("multiphp_manager/views/poolOptions.ptt"),reloadOnSearch:!1}).otherwise({redirectTo:"/config"})}]),o.run(["$rootScope","$location",function(e,n){t("#content").show(),e.$on("$routeChangeStart",(function(){e.currentRoute=n.path()}))}]),n(document)}))}}));
Back to Directory File Manager