大家好,我有以下代码。当我在测试环境中运行它时,它的运行速度非常快,但是当我在生产环境中部署它时,最多需要32秒才能加载所有图标。可能是查询的问题吗?因为在测试中我在数据库中只有很少的记录,但是在生产中2个表每个表都有大约9000个条目...我真的不知道如何加快..我将所有内容都放入$(document).ready,将一些脚本放入页眉和页脚中的3。还是Ajax调用会使所有产品的生产速度变慢? 预先谢谢你
<?php
ini_set('memory_limit', '-1');
session_start();
include("function.php");
// if ( (empty($_SESSION['email']) ) || (empty($_SESSION['password'])) ){
if ( (empty($_SESSION['email'])) && ($_SESSION['flagVariable'] !== 1) ) {
Header("location: index.php");
}
else {
$conn = connessioneDB();
?>
<!--
*
* Copyright �<?php echo date("Y"); ?>. Poste Italiane. All Rights Reserved.
* Permission to use, copy, modify, and distribute this software and its
* documentation for educational, research, and not-for-profit purposes,
* without fee and without a signed licensing agreement, is hereby granted,
* provided that the above copyright notice, this paragraph and in all copies,
* modifications, and distributions.
*
* Contacts for commercial licensing opportunities:
*
* Author: Daniel
* Reviewed By: Emilio
* Email:
* Mobile:
*
*
-->
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PCMDBtool ver 2.2.0 | REPORTS</title>
<meta name="description" content="A responsive, magazine-like website layout with a grid item animation effect when opening the content" />
<meta name="keywords" content="grid, layout, effect, animated, responsive, magazine, template, web design" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="../favicon.ico">
<link rel="shortcut icon" href="DataTables/extensions/Buttons/css/buttons.dataTables.min.css" />
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.3.0/css/font-awesome.min.css" />
<link href="rete/css.css?family=Fjalla+One|Oswald" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style1.css" />
<script src="js/modernizr.custom.js"></script>
<script src="js/jquery-1.12.4.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.dataTables.min.css">
<!--<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">-->
<script src="rete/jquery-1.12.4.js"></script>
<script src="rete/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="zebra_form.css">
<script type="text/javascript" charset="utf8" src="DataTables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/fnSetFilteringDelay.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/dataTables.bootstrap.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/dataTables.scroller.min.js"></script>
<link rel="stylesheet" href="rete/jquery-confirm.min.css">
<script src="rete/jquery-confirm.min.js"></script>
<script language="javascript" type="text/javascript" src="catalog.js"></script>
<link type="text/css" href="css/base.css" rel="stylesheet" />
<link type="text/css" href="css/Spacetree.css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/jit-yc.js"></script>
<script type="text/javascript" charset="utf8" src="js/jquery.sumoselect.min.js"></script>
<link rel="stylesheet" href="css/sumoselect.css">
<style type="text/css">
.blurred{
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
}
</style>
</head>
<body>
<div class="container">
<button id="menu-toggle" class="menu-toggle"><span>Menu</span></button>
<div id="theSidebar" class="sidebar">
<?php navigationRole($_SESSION['role_id']); ?>
<button class="close-button fa fa-fw fa-close"></button>
</div>
<div id="theGrid" class="main">
<section class="grid">
<a class="grid__item hvr-border-fade" onclick="" href="#">
<h2 class="title title--preview">Servizi</h2>
<div class="loader"></div>
<span class="category"><i class="fa fa-angle-right" aria-hidden="true"></i> Elenco Servizi Operativi</span>
</a>
<a class="grid__item hvr-border-fade" onclick="" href="#">
<h2 class="title title--preview">BC</h2>
<div class="loader"></div>
<span class="category"><i class="fa fa-angle-right" aria-hidden="true"></i> Business Criticality</span>
</a>
<a class="grid__item hvr-border-fade" onclick="" href="#">
<h2 class="title title--preview">Apparati/Servizi</h2>
<div class="loader"></div>
<span class="category"><i class="fa fa-angle-right" aria-hidden="true"></i>Elenco Apparati / Servizi </span>
</a>
<a class="grid__item hvr-border-fade" onclick="javascript:AssetSoServ()" href="#">
<h2 class="title title--preview">S.O. in Servizi</h2>
<div class="loader"></div>
<span class="category"><i class="fa fa-angle-right" aria-hidden="true"></i> Vista completa Sistemi Operativi in Servizi</span>
</a>
<a class="grid__item hvr-border-fade" onclick="" href="#">
<h2 class="title title--preview">Tripletta</h2>
<div class="loader"></div>
<span class="category"><i class="fa fa-angle-right" aria-hidden="true"></i> Vista completa Tripletta</span>
</a>
</section>
<section id="content" class="content">
<div class="scroll-wrap">
<script type="text/javascript" class="init">
$(document).ready( function () {
var table = $('#REPORT_SERVIZI').DataTable( {
paging: true,
"processing": true,
"deferLoading": 57,
"deferRender": true,
"scrollY": 350,
"scrollX": true,
"bDestroy": true,
"bRetrieve": true,
"ordering": false,
"iDisplayLength": 100,
"info": true,
"sDom": 'ltipr',
"bDestroy": true
} );
$("#filterboxA").keyup(function() {
table.search(this.value).draw();
});
var tables = $('#TRIPLETTA').DataTable( {
"paging": false,
"bFilter": false,
"processing": true,
"serverSide": false,
"deferLoading": 57,
"deferRender": true,
"scrollY": 300,
"scrollX": true,
"info": false,
"bPaginate": false,
"bRetrieve": true
} );
//tables.fnStandingRedraw();
var tableBC = $('#BC').DataTable( {
paging: true,
"processing": true,
"ajax": "asset_BC.php",
"deferLoading": 57,
"deferRender": true,
"scrollY": 350,
"iDisplayLength": 100,
"scrollX": true,
"bRetrieve": true,
"bDestroy": true,
"ordering": false,
"info": true,
"sDom": 'ltipr',
"bDestroy": true
} );
$("#filterboxE").keyup(function() {
tableBC.search(this.value).draw();
});
tableSA = $('#SA').DataTable(
{
paging: true,
"processing": true,
"ajax": "asset_SA.php",
"deferLoading": 57,
"deferRender": true,
"scrollY": 350,
"iDisplayLength": 100,
"scrollX": true,
"bRetrieve": true,
"bDestroy": true,
"ordering": true,
"info": true,
"sDom": 'ltipr',
"bDestroy": true,
} );
$("#filterboxF").keyup(function() {
tableSA.search(this.value).draw();
});
document.getElementById('filterboxF').addEventListener('keypress', function (e)
{
var keycode = (e.keyCode ? e.keyCode : e.which);
if (keycode == '13') {
tableSA.rows( { search:'applied' } ).data().each(function(value, index) {
//console.log(value, index);
var array = [];
array.push(value);
//console.log(array, index);
});
}
});
//table.buttons().container().appendTo( $('#stampaXls', table.table().container() ) );
tableSO = $('#SO').DataTable(
{
paging: true,
"processing": true,
"ajax": "asset_SO.php",
"deferLoading": 57,
"deferRender": true,
"scrollY": 350,
"iDisplayLength": 100,
"scrollX": true,
"bRetrieve": true,
"bDestroy": true,
"ordering": true,
"info": true,
"sDom": 'ltipr',
"bDestroy": true,
columns:
[{
title: "Operation",
class:"center" },
{ title: "Nome Servizio",
class:"center" },
{ title: "ID Servizio",
class:"center" },
{ title: "S.O.",
class:"center" },
{ title: "Patch Level",
class:"center" },
{ title: "Valida Dal",
class:"center" },
{ title: "N° di Apparati",
class:"center" }
]
} );
$("#filterboxG").keyup(function() {
tableSO.search(this.value).draw();
});
document.getElementById('filterboxG').addEventListener('keypress', function (e)
{
var keycode = (e.keyCode ? e.keyCode : e.which);
if (keycode == '13') {
tableSO.rows( { search:'applied' } ).data().each(function(value, index) {
//console.log(value, index);
var array = [];
array.push(value);
//console.log(array, index);
});
}
});
// when a row is clicked, show a popup menu containing all the devices inside a Service
$('#SO tbody').on('click', 'tr', function () {
var data = tableSO.row( this ).data();
//alert( 'You clicked on '+data[0]+'\'s row' );
$.ajax({
type:'POST',
url:'utility3.php',
data: { opServizio: data[0], servizio: data[1], sistOp: data[3], midware: data[4], valido_dal: data[5] },
success: function(msg) {
$('#contextMenuIdConfApparati').fadeIn('slow');
$('#resultApparatiList').html(msg);
},
error: function(err) {
alert('Errore: ' + err);
}
});
} );
//table.buttons().container().appendTo( $('#stampaXls', table.table().container() ) );
} );
function exportSQL(tab){
location.href = "exportSQL.php?tab=" + tab;
}
var path = "<?php echo $_SERVER['REQUEST_URI']; ?>";
history.pushState(null, null, path + window.location.search);
window.addEventListener('popstate', function (event) {
history.pushState(null, null, path + window.location.search);
});
function clearObscuration(liv){
$("#closing").fadeIn();
$("#" + liv).fadeOut("slow", "swing");
}
function Obscuration(a){
$( a ).addClass("blurred");
removeHref();
}
function refreshDati( a ){
$('#' + a ).empty();
}
function exportREPORTS(tab){
location.href = "exportREPORTS.php?tab=" + tab;
}
function exportREPORTS2(tab){
location.href = "exportREPORTS_SA.php?tab=" + tab;
}
function exportREPORTS3(tab){
location.href = "exportREPORTS_SO.php?tab=" + tab;
}
</script>
<link rel="stylesheet" type="text/css" href="css/jquery.dataTables.min.css">
<script src="js/jquery-1.12.4.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/fnSetFilteringDelay.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/dataTables.bootstrap.js"></script>
<script type="text/javascript" charset="utf8" src="DataTables/media/js/dataTables.scroller.min.js"></script>
<script type="text/javascript" src="DataTables/extensions/Buttons/js/dataTables.buttons.min.js"></script>
<article class="content__item">
<h3 class="title title--fullo"> <i class="fa fa-angle-right" aria-hidden="true"></i> Report: Report Servizi</h3>
<div style="background: #999; color: white; font-weight: normal; padding: 10px; width: 100%">
Ricerca <input type="text" id="filterboxA">
<a style="color: white" href="javascript:exportREPORTS('PCMDB_CAT.REPORTS')"><i class="fa fa-file-excel-o" aria-hidden="true"></i> Esporta Tutto</a>
</div>
<?php
echo "<table id=\"REPORT_SERVIZI\" class=\"display\" cellspacing=\"0\" width=\"100%\">";
echo "<thead>";
echo "<tr>\n";
echo "<th>Codice Iniziativa</th>\n";
echo "<th>Servizio Operativo</th>\n";
echo "<th>Owner</th>\n";
echo "<th>Acronimo</th>\n";
echo "<th>Stato</th>\n";
echo "<th>Piattaforma</th>\n";
echo "<th>Service</th>\n";
echo "<th>DR</th>\n";
echo "<th>Cert</th>\n";
echo "<th>Sla D</th>\n";
echo "<th>Sla T</th>\n";
echo "</tr>\n";
echo "</thead>\n";
echo "<tbody>\n";
$stid = oci_parse($conn, "SELECT * FROM PCMDB_CAT.V_SERVIZIO WHERE STATUS!='Da cancelare' AND NOME_SERVIZIO NOT LIKE 'Dummy%'");
oci_execute($stid);
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
$qq = "select richiesto_dr from PCMDB_CAT.sic_servizio where id_servizio=".$row['ID_SERVIZIO'];
$stid2 = oci_parse($conn, $qq);
oci_execute($stid2);
$row2 = oci_fetch_array($stid2, OCI_ASSOC);
$DR = $row2['RICHIESTO_DR'];
if ($DR != "Si") { $DR = "No"; }
$ss = "select count(*) from PCMDB_CAT.V_VISTA_COMPLETA where ambiente = 'CERTIFICAZIONE' and id_servizio=".$row['ID_SERVIZIO'];
$stid3 = oci_parse($conn, $ss);
oci_execute($stid3);
$row3 = oci_fetch_array($stid3, OCI_ASSOC);
$numCert = $row3['COUNT(*)'];
if ($numCert > 0) { $CERT = "SI"; } else { $CERT = "NO"; }
echo "<tr>\n";
echo "<td>".$row['CODICE_INIZIATIVA']."</td>\n";
echo "<td>".$row['NOME_SERVIZIO']."</td>\n";
echo "<td>".$row['OWNER']."</td>\n";
echo "<td>".$row['ACRONIMO']."</td>\n";
echo "<td>".$row['STATUS']."</td>\n";
echo "<td></td>\n";
echo "<td>".$row['OPERATION']."</td>\n";
echo "<td>".$DR."</td>\n";
echo "<td>".$CERT."</td>\n";
echo "<td>".$row['SLA_D']."</td>\n";
echo "<td>".$row['SLA_T']."</td>\n";
echo "</tr>\n";
$CERT = "";
}
echo "</tbody>\n";
echo "</table><br>\n";
?>
</article>
<article class="content__item">
<h3 class="title title--fullo"> <i class="fa fa-angle-right" aria-hidden="true"></i> Report: Business Criticality</h3>
<div style="background: #999; color: white; font-weight: normal; padding: 10px; width: 100%">
Ricerca <input type="text" id="filterboxE">
</div>
<?php
echo "<table id=\"BC\" class=\"display\" cellspacing=\"0\" width=\"100%\">";
echo "<thead>";
echo "<tr>";
echo "<th>Apparato </th>\n";
echo "<th>BC </th>\n";
echo "<th>Servizio </th>\n";
echo "<th>Dominio </th>\n";
echo "<th>Indirizzo IP </th>\n";
echo "<th>SO </th>\n";
echo "<th>Assegnato a </th>\n";
echo "<th>Tipo </th>\n";
echo "<th>CED </th>\n";
echo "<th>Stato </th>\n";
echo "<th>Ambiente </th>\n";
echo "</tr>";
echo "</thead>";
echo "</table><br>";
?>
</article>
<article class="content__item">
<h3 class="title title--fullo"> <i class="fa fa-angle-right" aria-hidden="true"></i> Report: Elenco Servizi / Apparati</h3>
<div style="background: #999; color: white; font-weight: normal; padding: 10px; width: 100%">
Ricerca <input type="text" id="filterboxF">
<a style="color: white" href="javascript:exportREPORTS2('PCMDB_CAT.REPORTS')"><i class="fa fa-file-excel-o" aria-hidden="true"></i> Esporta Tutto</a>
<a id="partialExport" style="color: white" onclick="var limiter = 0; var arrProva =[]; var arrFinal = []; var count = 0; var countTableRows = tableSA.rows( { search: 'applied' } ).count(); tableSA.rows( { search:'applied' } ).data().each(function(value, index) {
arrProva = [value];
count++;
$.ajax({
type:'POST',
url:'exportREPORTS_SA_Filtered.php',
data: { ok: 1, arrayFiltrato: arrProva, countRows: countTableRows },
success: function(msg) {
$('#downloadPartialExport').html('Download Export Parziale');
$('#downloadPartialExport').attr('href',msg);
$('#downloadPartialExport').css('display','inline-block');
},
error: function(err) {
alert('Errore ' + err);
}
});
});"><i class="fa fa-file-excel-o" aria-hidden="true"></i> Esporta Parziale</a>
<a style="color:white; font-weight: bold;" id="downloadPartialExport" href=""></a>
</div>
<?php
echo "<table id=\"SA\" class=\"display\" cellspacing=\"0\" width=\"100%\">";
echo "<thead>";
echo "<tr>";
echo "<th>SERVIZIO</th>\n";
echo "<th>APPARATO</th>\n";
echo "<th>Ambiente </th>\n";
echo "<th>Indirizzo IP </th>\n";
echo "<th>Dominio </th>\n";
echo "<th>Sistema Operativo </th>\n";
echo "<th>Service Pack</th>";
echo "<th>Tipo </th>\n";
echo "<th>CED </th>\n";
echo "<th>ID Config </th>\n";
echo "<th>Operation </th>\n";
echo "</tr>";
echo "</thead>";
echo "</table><br>";
?>
</article>
<article class="content__item">
<div class="modal fade" id="contextMenuIdConfApparati" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Numero di Apparati</h5>
</div>
<div class="modal-body">
<p> </p>
<ul id="resultApparatiList" class="list-group list-group-flush"><!-- list-group e list-group-flush consentono di definire e stilizzare una lista di item -->
</ul>
<p> </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="document.getElementById('contextMenuIdConfApparati').style.display = 'none';">Close</button>
</div>
</div>
</div>
</div>
<h3 class="title title--fullo"> <i class="fa fa-angle-right" aria-hidden="true"></i> Report: Elenco Sistemi Operativi inclusi in un Servizio</h3>
<div style="background: #999; color: white; font-weight: normal; padding: 10px; width: 100%">
Ricerca <input type="text" id="filterboxG">
<a style="color: white" href="javascript:exportREPORTS3('PCMDB_CAT.REPORTS')"><i class="fa fa-file-excel-o" aria-hidden="true"></i> Esporta Tutto</a>
<a id="partialExport2" style="color: white" onclick="var limiter = 0; var arrFinal = {}; var count = 0; var countTableRows = tableSO.rows( { search: 'applied' } ).count(); tableSO.rows( { search:'applied' } ).data().each(function() {
arrFinal = tableSO.rows( { search:'applied' } ).data();
count++;
});
$.ajax({
type:'POST',
url:'exportREPORTS_SO_filtered.php',
data: { ok: 1, arrayFiltrato: JSON.stringify(arrFinal), countRows: countTableRows },
success: function(msg) {
$('#downloadPartialExport2').html('Download Export Parziale');
$('#downloadPartialExport2').attr('href',msg);
$('#downloadPartialExport2').css('display','inline-block');
},
error: function(err) {
alert('Errore ' + err);
}
});"><i class="fa fa-file-excel-o" aria-hidden="true"></i> Esporta Parziale</a>
<a style="color:white; font-weight: bold;" id="downloadPartialExport2" href=""></a>
</div>
<?php
echo "<table id=\"SO\" class=\"display\" cellspacing=\"0\" width=\"100%\">";
echo "</table><br />";
?>
<button class="close-button"><i class="fa fa-close"></i><span>Close</span></button>
</article>
<article class="content__item">
<h3 class="title title--fullo"> <i class="fa fa-angle-right" aria-hidden="true"></i> Report: Vista Tripletta</h3>
<div style="background: #999; color: white; font-weight: normal; padding: 10px; width: 100%">
Ricerca stringa <input type="text" id="paramic" name="paramic"> <input type="button" value="Trova" onclick="vistaCompletaTripletta()">
</div>
<?php
echo "<table id=\"TRIPLETTA\" class=\"display\" cellspacing=\"0\" width=\"100%\">";
echo "<thead>";
echo "<tr>";
echo "<th>Servizio</th><th>Sottoservizio</th><th>Funzione</th>";
?>
<script>
function vistaCompletaTripletta(){
var paramic = $("#paramic").val();
$.ajax({
type: "GET",
url: "tripletta.php",
data: {
"param": paramic
},
success: function(chicco){
$("#TRIPLETTA").html(chicco);
},
});
//$('#TRIPLETTA').dataTable().fnDestroy();
var table = $('#TRIPLETTA').DataTable( {
"paging": false,
"bFilter": false,
"processing": true,
"serverSide": false,
"deferLoading": 57,
"deferRender": true,
"scrollY": 300,
"scrollX": true,
"bPaginate": false,
"info": false,
"bRetrieve": true
});
}
</script>
</article>
</div>
</section>
</div>
</div><!-- /container -->
<script src="js/classie.js"></script>
<script src="js/json2.js"></script>
<script src="js/main.js"></script>
</body>
</html>
<?php } ?>