$target) { if (str_starts_with((string) $source, 'share:') && !str_contains((string) $source, '/')) { $expected[] = basename((string) $target); } } if ($expected === []) { exit(1); } $conf = []; $prefixeTable = ''; require $databaseConfig; $database = new mysqli( (string) $conf['db_host'], (string) $conf['db_user'], (string) $conf['db_password'], (string) $conf['db_base'] ); $database->set_charset('utf8mb4'); $table = $database->real_escape_string((string) $prefixeTable) . 'categories'; $result = $database->query( 'SELECT dir FROM `' . $table . '` WHERE site_id = 1 AND dir IS NOT NULL' ); $existing = []; while ($row = $result->fetch_assoc()) { $existing[(string) $row['dir']] = true; } foreach ($expected as $directory) { if (!isset($existing[$directory])) { exit(1); } } exit(0);