Skip to content

Commit

Permalink
Better detection of file end not read.
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoFara committed Dec 28, 2023
1 parent b28b5e0 commit bc0d798
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions inc/session_utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -4528,11 +4528,7 @@ function restore_file($handle, $title): string
$start = true;
$curr_content = '';
$queries_list = array();
while (!feof($handle)) {
$stream = fgets($handle);
if ($stream === false) {
break;
}
while ($stream = fgets($handle)) {
// Check file header
if ($start) {
if (!str_starts_with($stream, "-- lwt-backup-")
Expand Down Expand Up @@ -4560,7 +4556,11 @@ function restore_file($handle, $title): string
foreach ($queries as $query) {
$queries_list[] = trim($query);
}
} // while (! feof($handle))
}
if (!feof($handle) && $install_status["errors"] == 0) {
$message = "Error: cannot read the end of the demo file!";
$install_status["errors"] = 1;
}
fclose($handle);
// Now run all queries
if ($install_status["errors"] == 0) {
Expand Down

0 comments on commit bc0d798

Please sign in to comment.