The status is not changing so we need more reporting
This commit is contained in:
@@ -4,6 +4,7 @@ require "/home/hpr/php/include.php";
|
||||
if ( $_SERVER['REQUEST_METHOD'] !== 'GET' ) {
|
||||
naughty("438a220a58dc34c200a8669547afc66b REQUEST_METHOD not supported");
|
||||
}
|
||||
logextra( "GET Method used." );
|
||||
|
||||
$num_get_args=0;
|
||||
foreach($_GET as $k => $v) {
|
||||
@@ -14,7 +15,6 @@ if ( $num_get_args !== 2 ){
|
||||
if (!isset($result)) {
|
||||
naughty("cca6408ae1febc3f07974177b2d04375 DB Error");
|
||||
}
|
||||
|
||||
header("Content-type: text/csv");
|
||||
print "timestamp_epoc,ep_num,ep_date,key,status,email\n";
|
||||
# 1649790226_3710_2022-10-21_b291590ce4ba23b519935bde53d0a5936255cd12e96b4
|
||||
@@ -28,6 +28,7 @@ if ( $num_get_args !== 2 ){
|
||||
else {
|
||||
naughty("2dcabda45255713ea9bf04523e804016 Query error");
|
||||
}
|
||||
logextra( "Got status from DB" );
|
||||
mysqli_close($connection);
|
||||
exit;
|
||||
}
|
||||
@@ -35,6 +36,7 @@ if ( $num_get_args !== 2 ){
|
||||
if ( empty($_GET["ep_num"]) or empty($_GET["status"]) ) {
|
||||
naughty("32bedea129648f27701f2f2f3ff4b7b5 Empty ep_num or status");
|
||||
}
|
||||
logextra( "Got non Empty ep_num or status" );
|
||||
|
||||
if ( !in_array($_GET["status"], array('METADATA_PROCESSED','SHOW_POSTED','MEDIA_TRANSCODED','UPLOADED_TO_IA','UPLOADED_TO_RSYNC_NET','REMOVE_RESERVATION'), true ) ) {
|
||||
naughty("88882bc97094e7aabf2a258756f917f5 Wrong enum status");
|
||||
@@ -42,6 +44,7 @@ if ( !in_array($_GET["status"], array('METADATA_PROCESSED','SHOW_POSTED','MEDIA_
|
||||
else {
|
||||
$status = $_GET["status"];
|
||||
}
|
||||
logextra( "Got valid enum status" );
|
||||
|
||||
if ( !empty($_GET["ep_num"]) and isset( $_GET["ep_num"] ) ) {
|
||||
$ep_num = intval( $_GET["ep_num"] );
|
||||
@@ -49,6 +52,7 @@ if ( !empty($_GET["ep_num"]) and isset( $_GET["ep_num"] ) ) {
|
||||
else {
|
||||
naughty("ecb0ebc5b38b4c09226ccbfce05978cb ep_num not correct");
|
||||
}
|
||||
logextra( "Got valid ep_num" );
|
||||
|
||||
// // SELECT MAX(ep_num) FROM `reservations` → 3627
|
||||
// // SELECT MIN(ep_num) FROM `reservations` WHERE ep_num > 0 → 3582
|
||||
@@ -68,18 +72,22 @@ if (!isset($result)) {
|
||||
$min_eps_array = mysqli_fetch_row( $result );
|
||||
$min_eps = $min_eps_array[0];
|
||||
mysqli_free_result($result);
|
||||
logextra( "Got smallest ep_num from db" );
|
||||
|
||||
if ( empty( $ep_num ) ) {
|
||||
naughty("6cf46a9b21e667c61b2c5bf87a7104f9 Empty ep_num");
|
||||
}
|
||||
logextra( "ep_num is not empty" );
|
||||
|
||||
if ( $ep_num < $min_eps ) {
|
||||
naughty("bbcef7cd8a263dc57e85195935ad600a Invalid $ep_num < $min_eps");
|
||||
}
|
||||
logextra( "ep_num is not less than the minimum ep" );
|
||||
|
||||
if ( $ep_num > $max_eps ) {
|
||||
naughty("a75115f3fa706ceee4b61971cd22b8f9 Invalid $ep_num > $max_eps");
|
||||
}
|
||||
logextra( "ep_num is not greater than max ep" );
|
||||
|
||||
// SHOW_SUBMITTED → METADATA_PROCESSED → SHOW_POSTED → MEDIA_TRANSCODED → UPLOADED_TO_IA → UPLOADED_TO_RSYNC_NET
|
||||
switch ($status) {
|
||||
@@ -105,28 +113,35 @@ switch ($status) {
|
||||
$error = "MySQL error ".mysqli_errno( $connection).": ".mysqli_error($connection)."\n";
|
||||
problem("Could not update the show reservation to $status in the db");
|
||||
}
|
||||
logextra( "Was able to remove the reservation for $ep_num" );
|
||||
mysqli_free_result($result);
|
||||
mysqli_close($connection);
|
||||
logextra( "$query");
|
||||
die;
|
||||
}
|
||||
logextra( "Set current status to $current_status" );
|
||||
|
||||
$result = mysqli_query($connection, "SELECT ep_num FROM reservations WHERE `ep_num` = '$ep_num' AND status='$current_status';");
|
||||
if (!isset($result)) {
|
||||
naughty("7f2d7228ca355be6dd2a24769595b18f Cant get reservation");
|
||||
}
|
||||
logextra( "Retrieved the reservation for $ep_num with status of $current_status" );
|
||||
|
||||
$db_ep_num_array = mysqli_fetch_row( $result );
|
||||
$db_ep_num = $db_ep_num_array[0];
|
||||
mysqli_free_result($result);
|
||||
if ( $db_ep_num != $ep_num ){
|
||||
problem("da59731c6ae6d1ce0fa2fa9fc4e1e726 Error $db_ep_num != $ep_num");
|
||||
}
|
||||
logextra( "The ep_num matches the db" );
|
||||
|
||||
$query = "UPDATE reservations SET `status` = '$status' WHERE `ep_num` = '$ep_num' AND status='$current_status';";
|
||||
$result = mysqli_query($connection, $query );
|
||||
if(!isset($result)) {
|
||||
problem("8a76bb408877b1d33bf31ea96b6fc02f Could not UPDATE Reservation");
|
||||
}
|
||||
logextra( "Was able to update the status of $ep_num from $current_status to $status" );
|
||||
|
||||
if (mysqli_errno( $connection )) {
|
||||
$error = "MySQL error ".mysqli_errno( $connection).": ".mysqli_error($connection)."\n";
|
||||
problem("Could not update the show reservation to $status in the db");
|
||||
|
||||
Reference in New Issue
Block a user