generated from jric11/baseProject
ChatGPT's update to harden software and run db updates.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
final class BackupValidation {
|
||||
/** mariadb-dump writes the completion comment at the end; never load the dump. */
|
||||
public static function complete(string $path): bool {
|
||||
clearstatcache(true,$path);
|
||||
if(!is_file($path)||filesize($path)<100)return false;
|
||||
$stream=fopen($path,'rb');if(!$stream)return false;
|
||||
try{
|
||||
if(fseek($stream,max(0,filesize($path)-8192),SEEK_SET)!==0)return false;
|
||||
$tail=fread($stream,8192);
|
||||
return $tail!==false&&preg_match('/(?:\A|\r?\n)-- Dump completed on [^\r\n]+(?:\r?\n)*\z/',$tail)===1;
|
||||
}finally{fclose($stream);}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user