-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform_status_module_reporte.inc
More file actions
98 lines (70 loc) · 3.04 KB
/
form_status_module_reporte.inc
File metadata and controls
98 lines (70 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
function form_status_module_reporte($form, &$form_state) {
//$memcache_servers = variable_get('memcache_servers');
//print " memcache_wildcard_flushes: " . print_r(variable_get('memcache_wildcard_flushes')) . "<br/>";
//print " memcache_wildcard_invalidate: " . variable_get('memcache_wildcard_invalidate') . "<br/>";
//print " cache_lifetime: " . variable_get('cache_lifetime') . "<br/>";
//Construir la lista de modulos guardada
$modulesStoreFormat = variable_get('form_status_formNameList');
$tmpList = explode("#=#" , $modulesStoreFormat);
$lst = "";
$tituloReporte = " Estatus de los Módulos ";
foreach($tmpList as $clave => $valor){
if( strlen($valor) != 0 ){
$lst .= ($clave + 1) . ".- ". $valor . "<br/>";
$listaModulos[$valor] = $valor;
}
}
$markup .= "<h1>" . $tituloReporte . "</h1>";
$header = array(
array('data' => t('Nombre del Módulos')),
array('data' => t(' ')),
array('data' => t('Tipo')),
array('data' => t('Estatus'))
);
$dataArray = array();
foreach($listaModulos as $clave => $nombreModulo){
$dataArray = form_status_info_module($nombreModulo);
//$dataArray["count"]
$statusModulo = ($dataArray["status"] == 1)?" Activado ":" Desactivado ";
$rows[] = array( array('data' => $dataArray["name"] ),
array('data' => $dataArray["filename"] ),
array('data' => $dataArray["type"] ),
array('data' => $statusModulo),
);
}
$markup .= theme('table', array('header' => $header, 'rows'=> $rows));
/**
* Estatus de los Servidores de Varnish
*/
$markup .= status_servers_varnish();
return $markup;
}
function form_status_info_module($moduleName){
$lstInfoModule = array();
$q = "SELECT filename, name, type, status FROM {system} WHERE name = :moduleName";
$result = db_query($q, array(':moduleName' => $moduleName))->fetchObject();
$q = "SELECT filename, name, type, status FROM {system} WHERE name = :moduleName";
$numRows = db_query($q, array(':moduleName' => $moduleName))->rowCount();
$lstInfoModule["count"] = $numRows;
$lstInfoModule["filename"] = $result->filename;
$lstInfoModule["name"] = $result->name;
$lstInfoModule["type"] = $result->type;
$lstInfoModule["status"] = $result->status;
return $lstInfoModule;
}
function status_servers_varnish() {
$status = varnish_get_status();
$statusServers = "";
$txtStatus = "";
foreach (varnish_get_status() as $ip => $status) {
if($status == 1){
$txtStatus = " <br/> Estatus: <div style='color:green' align='left'><b>Up</b></div> ";
}else{
$txtStatus = " <br/> Estatus: <div style='color:red' align='left'><b>Down</b></div> ";
}
$statusServers .= " *IP Server ". $ip ." " . $txtStatus . " <br/> ";
}
$statusServers;
return $statusServers;
}