Skip to content

Commit

Permalink
do not unlink -- avoid infinite encoding loops
Browse files Browse the repository at this point in the history
  • Loading branch information
cpg committed Mar 9, 2016
1 parent 361482f commit 667bc5b
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,17 @@
echo "Resulting file is_html5_ready (iPad)?: " . ($html5_ready_ipad ? 'yes' : 'no') . "\n";
echo "Resulting file is_html5_ready (Android)?: " . ($html5_ready_android ? 'yes' : 'no') . "\n";

if ($html5_ready_browser && $html5_ready_mobile && $html5_ready_ipad && $html5_ready_android) {
$query = sprintf("UPDATE files SET queued_for_encode = 'no' WHERE path = '%s'",
mysql_escape_string($row->path)
);
$result = mysql_query($query);
if ($result === FALSE) {
mysql_pconnect('localhost', 'videos5', 'videos5') or die("Can't connect to MySQL database.");
mysql_select_db('videos5') or die("Database 'videos5' not found, or unusable.");
mysql_query($query) or die("Error while updating DB: " . mysql_error() . "\n");
}
insert_video($output_file, $row->rating);
} else {
unlink($output_file);
// do not remove the file, no matter what -- otherwise it gets into infinite loops!
$query = sprintf("UPDATE files SET queued_for_encode = 'no' WHERE path = '%s'",
mysql_escape_string($row->path)
);
$result = mysql_query($query);
if ($result === FALSE) {
mysql_pconnect('localhost', 'videos5', 'videos5') or die("Can't connect to MySQL database.");
mysql_select_db('videos5') or die("Database 'videos5' not found, or unusable.");
mysql_query($query) or die("Error while updating DB: " . mysql_error() . "\n");
}
insert_video($output_file, $row->rating);
} else {
echo "Error: can't find output file ($output_file) after encode.";
}
Expand Down

0 comments on commit 667bc5b

Please sign in to comment.