Commit df3d0f43 authored by Laurent Joly's avatar Laurent Joly
Browse files

mise en place de wpkg_orphelin.php

parent 4b860da3
<?php
include ("config.inc.php");
include ("ldap.inc.php");
include ("wpkg_libsql.php");
include ("wpkg_lib.php");
$success = false;
apcu_fetch('wpkg_lock', $success);
if ($success) {
exit();
}
apcu_add('wpkg_lock', 1000);
$wpkg_link = connexion_db_wpkg($config);
/*------*/
$delete_1_query = mysqli_prepare($wpkg_link, "DELETE pa FROM (`poste_app` pa) LEFT JOIN (`postes` p) ON p.id_poste=pa.id_poste WHERE p.id_poste is null");
mysqli_stmt_execute($delete_1_query);
$nb1=mysqli_stmt_affected_rows($delete_1_query);
mysqli_stmt_close($delete_1_query);
if ($nb1!=0)
echo "Table poste_app (postes) : ".$nb1." lignes supprimées<br>";
/*------*/
$delete_2_query = mysqli_prepare($wpkg_link, "DELETE pp FROM (`parc_profile` pp) LEFT JOIN (`postes` p) ON p.id_poste=pp.id_poste WHERE p.id_poste is null");
mysqli_stmt_execute($delete_2_query);
$nb2=mysqli_stmt_affected_rows($delete_2_query);
mysqli_stmt_close($delete_2_query);
if ($nb2!=0)
echo "Table parc_profile (postes) : ".$nb2." lignes supprimées<br>";
/*------*/
$delete_3_query = mysqli_prepare($wpkg_link, "DELETE pp FROM (`parc_profile` pp) LEFT JOIN (`parc` p) ON p.id_parc=pp.id_parc WHERE p.id_parc is null");
mysqli_stmt_execute($delete_3_query);
$nb3=mysqli_stmt_affected_rows($delete_3_query);
mysqli_stmt_close($delete_3_query);
if ($nb3!=0)
echo "Table parc_profile (parc) : ".$nb3." lignes supprimées<br>";
/*------*/
$delete_4_query = mysqli_prepare($wpkg_link, "DELETE ap FROM (`applications_profile` ap) LEFT JOIN (`postes` p) ON p.id_poste=ap.id_entite and ap.type_entite='poste' WHERE p.id_poste is null and ap.type_entite='poste'");
mysqli_stmt_execute($delete_4_query);
$nb4=mysqli_stmt_affected_rows($delete_4_query);
mysqli_stmt_close($delete_4_query);
if ($nb4!=0)
echo "Table applications_profile (poste) : ".$nb4." lignes supprimées<br>";
/*------*/
$delete_5_query = mysqli_prepare($wpkg_link, "DELETE ap FROM (`applications_profile` ap) LEFT JOIN (`parc` p) ON p.id_parc=ap.id_entite and ap.type_entite='parc' WHERE p.id_parc is null and ap.type_entite='parc'");
mysqli_stmt_execute($delete_5_query);
$nb5=mysqli_stmt_affected_rows($delete_5_query);
mysqli_stmt_close($delete_5_query);
if ($nb5!=0)
echo "Table applications_profile (parc) : ".$nb5." lignes supprimées<br>";
/*------*/
deconnexion_db_wpkg($wpkg_link);
apcu_delete('wpkg_lock');
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment