From a0dcd3f5442d9a95d14b00611eccdcd12851bf1c Mon Sep 17 00:00:00 2001 From: machine62 <28401480+machine62@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:44:11 +0100 Subject: [PATCH] nettoyage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit suppression fichiers non utilisés --- model/model_CST_ALLIANCES.php | 35 ------------- model/model_CST_ALLIANCES_RANK.php | 75 --------------------------- model/model_CST_PLAYERS.php | 37 -------------- model/model_CST_PLAYERS_RANK.php | 82 ------------------------------ model/model_CST_UNIVERSE.php | 81 ----------------------------- 5 files changed, 310 deletions(-) delete mode 100644 model/model_CST_ALLIANCES.php delete mode 100644 model/model_CST_ALLIANCES_RANK.php delete mode 100644 model/model_CST_PLAYERS.php delete mode 100644 model/model_CST_PLAYERS_RANK.php delete mode 100644 model/model_CST_UNIVERSE.php diff --git a/model/model_CST_ALLIANCES.php b/model/model_CST_ALLIANCES.php deleted file mode 100644 index c3e23d8..0000000 --- a/model/model_CST_ALLIANCES.php +++ /dev/null @@ -1,35 +0,0 @@ -sql_escape_string($value["tag"]); - $nb = $db->sql_escape_string($value["nb"]); - - - $temp_query = "( " . $id_alliance . ", '" . my_encodage($tag) . "' , '" . $nb . "' ) "; - $query[] = $temp_query; - $total++; -} - -$db->sql_query('REPLACE INTO ' . TABLE_ALLIANCES . ' (' . $fields . ') VALUES ' . implode(',', $query)); -echo "mise a jour de " . $total . " ligne(s) d' alliance "; - - -insert_config("last_" . $pub_type, $timestamp); diff --git a/model/model_CST_ALLIANCES_RANK.php b/model/model_CST_ALLIANCES_RANK.php deleted file mode 100644 index f563a96..0000000 --- a/model/model_CST_ALLIANCES_RANK.php +++ /dev/null @@ -1,75 +0,0 @@ -sql_escape_string($pub_type)); - -$total = 0; -$query = array(); -$fields = "datadate, rank, id_alliance, points , sender_id "; - - - -foreach ($pub_value as $value) { - $datadate = $timestamp; - $rank = (int)$value["position"]; - $id_alliance = (int)$value["id"]; - $points = (int)$value["score"]; - $sender_id = (int)$user_data['user_id']; - - $temp_query = "( " . $timestamp . ", " . $rank . ", '" . $id_alliance . "' , '" . $points . "' , " . $user_data['user_id'] . " ) "; - $query[] = $temp_query; - $total++; -} - -$db->sql_query('REPLACE INTO ' . TABLE_RANK_ALLIANCES . ' (' . $fields . ') VALUES ' . implode(',', $query)); -echo "mise a jour de " . $total . " ligne(s) classement alliance d' alliance "; - -// on fait la jointure qui va bien pour injecter le bon classement - -$sql = "REPLACE INTO " . $table . " "; -$sql .= " ( `datadate`, `rank`, `ally`, `number_member`, `points` , `sender_id`) "; -$sql .= " SELECT sra.datadate, sra.rank, sa.tag, sa.nb , sra.points , sra.sender_id "; -$sql .= " FROM " . TABLE_ALLIANCES . " as sa "; -$sql .= "INNER JOIN " . TABLE_RANK_ALLIANCES . " as sra "; -$sql .= " on sa.id_alliance = sra.id_alliance ; "; - -$db->sql_query($sql); - -echo "injection de de " . $db->sql_affectedrows() . " ligne(s) classement alliance d' alliance "; - -//REPLACE INTO ogspy_necrotg_rank_ally_points ( `datadate`, `rank`, `ally`, `number_member`, `points` ) -//SELECT sra.datadate, sra.rank, sa.tag, sa.nb , sra.points FROM ogspy_necrotg_superapix_alliances as sa INNER JOIN ogspy_necrotg_superapix_rank_alliance as sra on sa.id_alliance = sra.id_alliance - -// on efface la table rank -$sql = "DELETE FROM " . TABLE_RANK_ALLIANCES . " ;"; -$db->sql_query($sql); - -insert_config("last_" . $pub_type, $timestamp); - - - -function find_table($type) -{ - $tab = array(); - $tab = array( - "CST_ALLIANCES_RANK_POINTS" => TABLE_RANK_ALLY_POINTS, - "CST_ALLIANCES_RANK_ECO" => TABLE_RANK_ALLY_ECO, - "CST_ALLIANCES_RANK_TECHNOLOGY" => TABLE_RANK_ALLY_TECHNOLOGY, - "CST_ALLIANCES_RANK_MILITARY" => TABLE_RANK_ALLY_MILITARY, - "CST_ALLIANCES_RANK_MILITARY_BUILT" => TABLE_RANK_ALLY_MILITARY_BUILT, - "CST_ALLIANCES_RANK_MILITARY_DESTROYED" => TABLE_RANK_ALLY_MILITARY_DESTRUCT, - "CST_ALLIANCES_RANK_MILITARY_LOST" => TABLE_RANK_ALLY_MILITARY_LOOSE, - "CST_ALLIANCES_RANK_MILITARY_HONNOR" => TABLE_RANK_ALLY_HONOR, - ); - $retour = $tab[$type]; - return $retour; -} diff --git a/model/model_CST_PLAYERS.php b/model/model_CST_PLAYERS.php deleted file mode 100644 index fb62777..0000000 --- a/model/model_CST_PLAYERS.php +++ /dev/null @@ -1,37 +0,0 @@ -sql_escape_string($value["name"]); - $status = $db->sql_escape_string($value["status"]); - $id_ally = (int)$value["alliance"]; - - $temp_query = "( " . $id_player . ", '" . my_encodage($name_player) . "' , '" . $status . "', " . $id_ally . " ) "; - $query[] = $temp_query; - $total++; -} - -$db->sql_query('REPLACE INTO ' . TABLE_PLAYERS . ' (' . $fields . ') VALUES ' . implode(',', $query)); -echo "mise a jour de " . $total . " ligne(s) de joueur "; - - - -insert_config("last_" . $pub_type, $timestamp); diff --git a/model/model_CST_PLAYERS_RANK.php b/model/model_CST_PLAYERS_RANK.php deleted file mode 100644 index b00c60f..0000000 --- a/model/model_CST_PLAYERS_RANK.php +++ /dev/null @@ -1,82 +0,0 @@ -sql_escape_string($pub_type)); - -$total = 0; -$query = array(); - -$fields = "datadate, rank, id, points , nb_spacecraft , sender_id "; - - -foreach ($pub_value as $value) { - $datadate = $timestamp; - $rank = (int)$value["position"]; - $id = (int)$value["id"]; - $points = (int)$value["score"]; - $ships = isset($value["ships"]) ? $value["ships"] : 0; - $sender_id = (int)$user_data['user_id']; - - $temp_query = "( " . $datadate . ", " . $rank . ", " . $id . " , " . $points . " , " . (int)$ships . " , " . $user_data['user_id'] . " ) "; - $query[] = $temp_query; - $total++; -} - - -$db->sql_query('REPLACE INTO ' . TABLE_RANK_PLAYERS . ' (' . $fields . ') VALUES ' . implode(',', $query)); -echo "mise a jour de " . $total . " ligne(s) classement player "; - - -// on fait la jointure qui va bien pour injecter le bon classement - -$sql = "REPLACE INTO " . $table . " "; -$sql .= ($table != "CST_PLAYERS_RANK_MILITARY") ? " ( `datadate`, `rank`, `player`, `ally`, `points` , `sender_id`) " : " ( `datadate`, `rank`, `player`, `ally`, `points` , `nb_spacecraft` ,`sender_id`) "; -$sql .= ($table != "CST_PLAYERS_RANK_MILITARY") ? " SELECT srp.datadate, srp.rank,sp.name_player ,sa.tag, srp.points , srp.sender_id " : " SELECT srp.datadate, srp.rank,sp.name_player ,sa.tag, srp.points , srp.nb_spacecraft,srp.sender_id "; -$sql .= " FROM " . TABLE_PLAYERS . " as sp "; -$sql .= "INNER JOIN " . TABLE_RANK_PLAYERS . " as srp "; -$sql .= " on sp.id_player = srp.id "; -$sql .= "INNER JOIN " . TABLE_ALLIANCES . " as sa "; -$sql .= " on sa.id_alliance = sp.id_ally ; "; - -$db->sql_query($sql); -//var_dump($sql); - -//datadate rank player ally points ships sender_id - -echo "injection de de " . $db->sql_affectedrows() . " ligne(s) classement player "; - -//REPLACE INTO ogspy_necrotg_rank_ally_points ( `datadate`, `rank`, `ally`, `number_member`, `points` ) -//SELECT sra.datadate, sra.rank, sa.tag, sa.nb , sra.points FROM ogspy_necrotg_superapix_alliances as sa INNER JOIN ogspy_necrotg_superapix_rank_alliance as sra on sa.id_alliance = sra.id_alliance - -// on efface la table rank -$sql = "DELETE FROM " . TABLE_RANK_PLAYERS . " ;"; -$db->sql_query($sql); - -insert_config("last_" . $pub_type, $timestamp); - -function find_table($type) -{ - $tab = array(); - $tab = array( - "CST_PLAYERS_RANK_POINTS" => TABLE_RANK_PLAYER_POINTS, - "CST_PLAYERS_RANK_ECO" => TABLE_RANK_PLAYER_ECO, - "CST_PLAYERS_RANK_TECHNOLOGY" => TABLE_RANK_PLAYER_TECHNOLOGY, - "CST_PLAYERS_RANK_MILITARY" => TABLE_RANK_PLAYER_MILITARY, - "CST_PLAYERS_RANK_MILITARY_BUILT" => TABLE_RANK_PLAYER_MILITARY_BUILT, - "CST_PLAYERS_RANK_MILITARY_DESTROYED" => TABLE_RANK_PLAYER_MILITARY_DESTRUCT, - "CST_PLAYERS_RANK_MILITARY_LOST" => TABLE_RANK_PLAYER_MILITARY_LOOSE, - "CST_PLAYERS_RANK_MILITARY_HONNOR" => TABLE_RANK_PLAYER_HONOR, - ); - $retour = $tab[$type]; - return $retour; -} diff --git a/model/model_CST_UNIVERSE.php b/model/model_CST_UNIVERSE.php deleted file mode 100644 index f4bd600..0000000 --- a/model/model_CST_UNIVERSE.php +++ /dev/null @@ -1,81 +0,0 @@ -sql_escape_string($value["name_planete"]); - $name_moon = $db->sql_escape_string($value["name_moon"]); - $moon = (int)$value["moon"]; - - - - $temp_query = "( " . $g . ", " . $s . " , " . $r . " , " . $id_player . " , " . $datadate . " , '" . my_encodage($name_planete) . "' , '" . $name_moon . "' , '" . $moon . "' , " . $sender_id . " ) "; - $query[] = $temp_query; - $total++; -} - -$db->sql_query('REPLACE INTO ' . $table . ' (' . $fields . ') VALUES ' . implode(',', $query)); -echo "mise a jour de " . $total . " ligne(s) univers "; - -update_table_universe($uni); -insert_config("last_" . $pub_type, $timestamp); - -function update_table_universe($uni = 0) -{ - global $db; - // requete de mise a jour - $sql = "UPDATE " . TABLE_UNIVERSE . " as U INNER JOIN " . TABLE_UNIVERS . " as T "; - $sql .= " ON "; - $sql .= "( U.galaxy = T.g AND U.row = T.r AND U.system = T.s ) "; - $sql .= "INNER JOIN " . TABLE_PLAYERS . " as P "; - $sql .= " ON "; - $sql .= "( T.id_player = P.id_player ) "; - $sql .= "INNER JOIN " . TABLE_ALLIANCES . " as A "; - $sql .= " ON "; - $sql .= "( A.id_alliance = P.id_ally ) "; - $sql .= " SET "; - $sql .= " U.moon = T.moon , U.name = T.name_planete , U.ally = A.tag , U.player = P.name_player , U.status = P.status , U.last_update = T.datadate, U.last_update_user_id = T.sender_id "; - $sql .= " WHERE "; - $sql .= " U.last_update < T.datadate "; - if ($uni != 0) { - $sql .= " AND "; - $sql .= " U.galaxy = " . $uni . " "; - } - - $db->sql_query($sql); - - prepare_table_universe($datadate); - /// ensuite il faut une requete d update pour mettre a 0 tout ce qui a pas le bon timestamps min : c que pas dans universe.xml -}