mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 00:54:08 +02:00
Customizable export
This commit is contained in:
@@ -333,3 +333,18 @@ function drop_create($drop, $create, $location, $message_drop, $message_alter, $
|
||||
}
|
||||
return $dropped;
|
||||
}
|
||||
|
||||
/** Get string to add a file in TAR
|
||||
* @param string
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function tar_file($filename, $contents) {
|
||||
$return = pack("a100a8a8a8a12a12", $filename, 644, 0, 0, decoct(strlen($contents)), decoct(time()));
|
||||
$checksum = 8*32; // space for checksum itself
|
||||
for ($i=0; $i < strlen($return); $i++) {
|
||||
$checksum += ord($return{$i});
|
||||
}
|
||||
$return .= sprintf("%06o", $checksum) . "\0 ";
|
||||
return $return . str_repeat("\0", 512 - strlen($return)) . $contents . str_repeat("\0", 511 - (strlen($contents) + 511) % 512);
|
||||
}
|
||||
|
Reference in New Issue
Block a user