2024-02-27 13:54:57 +01:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* VFS - filesystem check via cli
|
|
|
|
*
|
|
|
|
* @link https://www.egroupware.org
|
|
|
|
* @package filemanager
|
|
|
|
* @author Ralf Becker <rb-AT-egroupware.org>
|
|
|
|
* @copyright (c) 2024 by Ralf Becker <rb-AT-egroupware.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
use EGroupware\api\Vfs\Sqlfs;
|
|
|
|
|
|
|
|
if (php_sapi_name() !== 'cli') // security precaution: forbid calling via web
|
|
|
|
{
|
|
|
|
die('<h1>fsck.php must NOT be called as web-page --> exiting !!!</h1>');
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['egw_info'] = [
|
|
|
|
'flags' => [
|
|
|
|
'currentapp' => 'login',
|
|
|
|
'no_exception_handler' => 'cli',
|
|
|
|
]
|
|
|
|
];
|
|
|
|
require(dirname(__DIR__).'/header.inc.php');
|
|
|
|
|
2024-02-27 16:04:06 +01:00
|
|
|
$msgs = Sqlfs\Utils::fsck($check_only = ($_SERVER['argv'][1] ?? '') !== '--yes');
|
2024-02-27 13:54:57 +01:00
|
|
|
echo implode("\n", $msgs)."\n";
|
|
|
|
if (!$msgs)
|
|
|
|
{
|
2024-02-27 16:04:06 +01:00
|
|
|
echo "fsck found NO problems :)\n";
|
2024-02-27 13:54:57 +01:00
|
|
|
}
|
|
|
|
elseif ($check_only)
|
|
|
|
{
|
2024-02-27 16:04:06 +01:00
|
|
|
echo "\nUse --yes to fix problems found\n";
|
2024-02-27 13:54:57 +01:00
|
|
|
}
|