bootstrap version of site
[Bans.Verniy.xyz-Modern.git] / CronJobs / file_times_updater.php
blob292026d9ccf91e9330b71df8f0eba9364049c74c
1 <?php
2 require_once("../Class/database-construction.php");
3 $database = new DatabaseConstruction("../");
4 $top_file = explode("\n", file_get_contents("../4Chan_Bans_Log-Ledger.txt"))[1];
6 $database_add_array = [];
7 $database_update_array = [];
8 while($top_file >= 0){
9 $current_json_file = explode("\n", file_get_contents("../Logs/4Chan_Bans_Log-Reverse_Chrono-$top_file.json"));
10 echo "<pre>";
11 $newest_entry_time = "" . JSON_Decode(substr($current_json_file[count($current_json_file) - 2], 0, -1), true)["time"];
12 array_push($database_add_array, ["FileNumber"=>$top_file, "NewestTime"=>$newest_entry_time]);
13 $top_file--;
15 //uses duplicate checking
16 $database->massAddToTable("JSONProperties", $database_add_array);