don't check for po4a and gzip presence if unused

This commit is contained in:
Miraty 2024-02-10 14:11:28 +01:00
parent cd780914d4
commit 5b1eac852c
1 changed files with 12 additions and 7 deletions

View File

@ -10,12 +10,6 @@ define('ROOT', dirname(realpath($_SERVER['SCRIPT_FILENAME'])));
if (!extension_loaded('tidy'))
echo 'PHP tidy extension unavailable. Feature disabled.' . PHP_EOL;
foreach (['pandoc', 'gzip', 'po4a'] as $command) {
exec('command -v ' . $command, result_code: $code);
if ($code !== 0)
exit($command . ' command not available.' . PHP_EOL);
}
foreach ($argv as $arg) {
if ($arg === '-f')
$opt['force'] = true;
@ -46,6 +40,16 @@ if (!isset($config['id'])) {
file_put_contents(SITE . 'config.ini', 'id = "' . $config['id'] . '"' . LF, FILE_APPEND);
}
foreach (['pandoc', 'gzip', 'po4a'] as $command) {
if ($command === 'po4a' && file_exists(SITE . 'po4a.cfg') === false)
continue;
if ($command === 'gzip' && !$config['gzip'])
continue;
exec('command -v ' . $command, result_code: $code);
if ($code !== 0)
exit($command . ' command not available.' . PHP_EOL);
}
// Determine whether links need to use Onion or DNS
function clearnetOrOnion($clearnet_url, $onion_url) {
return (DESTINATION === 'onion') ? $onion_url : $clearnet_url;
@ -76,7 +80,8 @@ foreach($nodes_src as $node) {
copy($src, $target);
}
exec('po4a ' . SITE . 'po4a.cfg');
if (file_exists(SITE . 'po4a.cfg'))
exec('po4a ' . SITE . 'po4a.cfg');
$nodes_cache = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(SITE . 'cache/', RecursiveDirectoryIterator::SKIP_DOTS));