mirror of
https://github.com/itflow-org/itflow
synced 2026-08-11 01:57:14 +00:00
More sweeps to replace select * with actual returned column names dramatically reduces php memory usage and speeds up processing dramatically especially in the crons since they run all the time
This commit is contained in:
@@ -387,7 +387,7 @@ if (isset($_POST['bulk_assign_asset_tags'])) {
|
||||
foreach($_POST['tags'] as $tag) {
|
||||
$tag = intval($tag);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM asset_tags WHERE asset_tag_asset_id = $asset_id AND asset_tag_tag_id = $tag");
|
||||
$sql = mysqli_query($mysqli,"SELECT 1 FROM asset_tags WHERE asset_tag_asset_id = $asset_id AND asset_tag_tag_id = $tag");
|
||||
if (mysqli_num_rows($sql) == 0) {
|
||||
mysqli_query($mysqli, "INSERT INTO asset_tags SET asset_tag_asset_id = $asset_id, asset_tag_tag_id = $tag");
|
||||
}
|
||||
@@ -1224,7 +1224,7 @@ if (isset($_POST["import_assets_csv"])) {
|
||||
if (!empty($column[8])) {
|
||||
$contact = escapeSql($column[8]);
|
||||
if ($contact) {
|
||||
$sql_contact = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_name = '$contact' AND contact_client_id = $client_id");
|
||||
$sql_contact = mysqli_query($mysqli,"SELECT contact_id FROM contacts WHERE contact_name = '$contact' AND contact_client_id = $client_id");
|
||||
$row = mysqli_fetch_assoc($sql_contact);
|
||||
$contact_id = intval($row['contact_id']);
|
||||
}
|
||||
@@ -1234,7 +1234,7 @@ if (isset($_POST["import_assets_csv"])) {
|
||||
if (!empty($column[9])) {
|
||||
$location = escapeSql($column[9]);
|
||||
if ($location) {
|
||||
$sql_location = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_name = '$location' AND location_client_id = $client_id");
|
||||
$sql_location = mysqli_query($mysqli,"SELECT location_id FROM locations WHERE location_name = '$location' AND location_client_id = $client_id");
|
||||
$row = mysqli_fetch_assoc($sql_location);
|
||||
$location_id = intval($row['location_id']);
|
||||
}
|
||||
@@ -1911,7 +1911,7 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) {
|
||||
$file_name = $_FILES["file"]["tmp_name"];
|
||||
|
||||
// Get Asset Details for logging
|
||||
$sql_asset = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_id = $asset_id");
|
||||
$sql_asset = mysqli_query($mysqli,"SELECT asset_client_id, asset_name FROM assets WHERE asset_id = $asset_id");
|
||||
$row = mysqli_fetch_assoc($sql_asset);
|
||||
$client_id = intval($row['asset_client_id']);
|
||||
$asset_name = escapeSql($row['asset_name']);
|
||||
@@ -1989,7 +1989,7 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) {
|
||||
if (!empty($column[7])) {
|
||||
$network = escapeSql($column[7]);
|
||||
if ($network) {
|
||||
$sql_network = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_name = '$network' AND network_archived_at IS NULL AND network_client_id = $client_id");
|
||||
$sql_network = mysqli_query($mysqli,"SELECT network_id FROM networks WHERE network_name = '$network' AND network_archived_at IS NULL AND network_client_id = $client_id");
|
||||
$row = mysqli_fetch_assoc($sql_network);
|
||||
$network_id = intval($row['network_id']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user