fix bug of not cleaning up gravity correctly
This commit is contained in:
parent
d799cdd610
commit
6076512dd0
@ -311,15 +311,19 @@ class VideoParser {
|
||||
$result = $this->conn->query($query);
|
||||
|
||||
while ($r = mysqli_fetch_assoc($result)) {
|
||||
if (!file_exists("../" . $r['movie_url'])) {
|
||||
$query = "SET foreign_key_checks = 0; DELETE FROM videos WHERE movie_id='" . $r['movie_id'] . "'";
|
||||
$movie_id = $r['movie_id'];
|
||||
$url = $r['movie_url'];
|
||||
|
||||
// todo ORDER BY movie_url and erase duplicates also
|
||||
if (!file_exists("../$url")) {
|
||||
$query = "DELETE FROM videos WHERE movie_id=$movie_id";
|
||||
if ($this->conn->query($query) === TRUE) {
|
||||
echo('successfully deleted ' . $r['movie_url'] . " from video gravity\n");
|
||||
$this->writeLog('successfully deleted ' . $r['movie_url'] . " from video gravity\n");
|
||||
echo("successfully deleted $url from video gravity\n");
|
||||
$this->writeLog("successfully deleted $url from video gravity\n");
|
||||
$this->deleted++;
|
||||
} else {
|
||||
echo "failed to delete " . $r['movie_url'] . " from gravity: " . $this->conn->error . "\n";
|
||||
$this->writeLog("failed to delete " . $r['movie_url'] . " from gravity: " . $this->conn->error . "\n");
|
||||
echo "failed to delete $url from gravity: $this->conn->error \n";
|
||||
$this->writeLog("failed to delete $url from gravity: $this->conn->error \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,9 +53,9 @@ class MovieSettings extends React.Component {
|
||||
const updateRequest = new FormData();
|
||||
// fetch all videos available
|
||||
fetch('/api/extractvideopreviews.php', {method: 'POST', body: updateRequest})
|
||||
.then((response) => response.json()
|
||||
.then((response) => response.text()
|
||||
.then((result) => {
|
||||
// todo 2020-07-4: some kind of start event
|
||||
// todo 2020-07-4: some kind of return finished handler
|
||||
console.log("returned");
|
||||
}))
|
||||
.catch(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user