diff --git a/CLScript/CloudLinuxDomains.py b/CLScript/CloudLinuxDomains.py index e9d8b2811..6bfa2893b 100755 --- a/CLScript/CloudLinuxDomains.py +++ b/CLScript/CloudLinuxDomains.py @@ -26,23 +26,47 @@ class CloudLinuxDomains(CLMain): def listAll(self): data = {} - if self.owner !=None: + if self.owner != None: websites = Websites.objects.filter(externalApp=self.owner) else: websites = Websites.objects.all() - for webs in websites: if self.name != None: if self.name != webs.domain: continue - data[webs.domain] = {"owner": webs.externalApp, - "document_root": "/home/%s/public_html/" % (webs.domain), - "is_main": True} - for webs in webs.childdomains_set.all(): - data[webs.domain] = {"owner": webs.master.externalApp, - "document_root": webs.path, - "is_main": False} + + if self.with_php: + completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{webs.domain}/vhost.conf' + from plogical.phpUtilities import phpUtilities + from managePHP.phpManager import PHPManager + phpVersion = phpUtilities.WrapGetPHPVersionFromFileToGetVersionWithPHP(completePathToConfigFile) + php = PHPManager.getPHPString(phpVersion) + + data[webs.domain] = { + "owner": webs.externalApp, + "document_root": "/home/%s/public_html/" % (webs.domain), + "is_main": True, + "php": { + "version": php, + "ini_path": f"/usr/local/lsws/lsphp{php}/etc/php.d ", + "is_native": False + } + + } + for webs in webs.childdomains_set.all(): + data[webs.domain] = {"owner": webs.master.externalApp, + "document_root": webs.path, + "is_main": False} + + else: + data[webs.domain] = {"owner": webs.externalApp, + "document_root": "/home/%s/public_html/" % (webs.domain), + "is_main": True} + for webs in webs.childdomains_set.all(): + data[webs.domain] = {"owner": webs.master.externalApp, + "document_root": webs.path, + "is_main": False} final = {'data': data, 'metadata': self.initialMeta} print(json.dumps(final)) @@ -64,4 +88,3 @@ if __name__ == '__main__': pi.listAll() except: pi.listAll() -