Skip to content

Commit

Permalink
resolve internal ticket to show php on list site https://app.clickup.…
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 29, 2023
1 parent ff04747 commit 89d0bb7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
10 changes: 10 additions & 0 deletions plogical/phpUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ def GetPHPVersionFromFile(vhFile):
result = result.rsplit("lsphp", 1)[0] + "php"
return result


@staticmethod
def WrapGetPHPVersionFromFileToGetVersionWithPHP(vhFile):
result = phpUtilities.GetPHPVersionFromFile(vhFile)
command = result + " -v | awk '/^PHP/ {print $2}'"
php_version = ProcessUtilities.outputExecutioner(command, None, True).rstrip('\n')
return f"PHP {php_version}"



@staticmethod
def InstallSaidPHP(php):
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
Expand Down
38 changes: 10 additions & 28 deletions websiteFunctions/templates/websiteFunctions/listWebsites.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,66 +61,48 @@ <h2 style="display: inline; color: #414C59;" ng-bind="web.domain"></h2>
</div>

<div class="col-md-12">
<div class="col-md-4 content-box-header">
<div class="col-md-3 content-box-header">
<i class="p fa fa-sticky-note btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="State">&emsp;</i>
<span ng-bind="web.state" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<div class="col-md-3 content-box-header">
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
data-placement="right" title="IP Address">&emsp;</i>
<span ng-bind="web.ipAddress"></span>
</div>
<div class="col-md-4 content-box-header">
<div class="col-md-3 content-box-header">
<i class="p fa fa-lock btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="SSL">&emsp;</i>
<span><a ng-click="issueSSL(web.domain)" href=""
style="text-transform: none">{% trans "Issue SSL" %}</a></span>
</div>
<div class="col-md-3 content-box-header">

<span ng-bind="web.phpVersion"></span>
</div>
</div>

<div class="col-md-12">
<div class="col-md-4 content-box-header">
<div class="col-md-3 content-box-header">
<i class="p fa fa-hdd-o btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Disk Usage">&emsp;</i>
<span ng-bind="web.diskUsed" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<div class="col-md-3 content-box-header">
<i class="p fa fa-cubes btn-icon text-muted" data-toggle="tooltip"
data-placement="right"
title="Packages">&emsp;</i>
<span ng-bind="web.package" style="text-transform: none"></span>
</div>
<div class="col-md-4 content-box-header">
<div class="col-md-3 content-box-header">
<i class="p fa fa-user btn-icon text-muted" data-toggle="tooltip" data-placement="right"
title="Owner">&emsp;</i>
<span ng-bind="web.admin" style="text-transform: none"></span>
</div>
</div>

<!--table cellpadding="0" cellspacing="0" border="0" class="table" style="margin:0px 0px; id="datatable-example">
<thead>
<tr>
<th>IP Address</th>
<th>Package</th>
<th>Owner</th>
<th>State</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td ng-bind="web.ipAddress"></td>
<td ng-bind="web.package"></td>
<td ng-bind="web.admin"></td>
<td ng-bind="web.state"></td>
<td ng-bind="web.adminEmail"></td>
</tr>
</tbody>
</table-->

<div id="listFail" class="alert alert-danger">
<p>{% trans "Cannot list websites. Error message:" %} {$ errorMessage $}</p>
</div>
Expand Down
12 changes: 11 additions & 1 deletion websiteFunctions/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -2411,18 +2411,28 @@ def findWebsitesListJson(self, websites):
logging.CyberCPLogFileWriter.writeToFile("Failed to read machine IP, error:" + str(msg))
ipAddress = "192.168.100.1"

### lets first find php path

from plogical.phpUtilities import phpUtilities



for items in websites:
if items.state == 0:
state = "Suspended"
else:
state = "Active"

vhFile = f'/usr/local/lsws/conf/vhosts/{items.domain}/vhost.conf'

PHPVersionActual = phpUtilities.WrapGetPHPVersionFromFileToGetVersionWithPHP(vhFile)

DiskUsage, DiskUsagePercentage, bwInMB, bwUsage = virtualHostUtilities.FindStats(items)
diskUsed = "%sMB" % str(DiskUsage)

dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress,
'admin': items.admin.userName, 'package': items.package.packageName, 'state': state,
'diskUsed': diskUsed}
'diskUsed': diskUsed, 'phpVersion': PHPVersionActual}

if checker == 0:
json_data = json_data + json.dumps(dic)
Expand Down

0 comments on commit 89d0bb7

Please sign in to comment.