run checkup withput wrong assumptions
This commit is contained in:
parent
0f9e66bf90
commit
b9925f232f
|
@ -2,7 +2,6 @@
|
|||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/bindAPI/vendor/composer" />
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="codingStandard" value="Custom" />
|
||||
<option name="customRuleset" value="$PROJECT_DIR$/phpcs.xml.dist" />
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="installedPaths" value="$PROJECT_DIR$/vendor/doctrine/coding-standard/lib/Doctrine" />
|
||||
<option name="useInstalledPaths" value="true" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpCodeSniffer">
|
||||
<phpcs_settings>
|
||||
<PhpCSConfiguration tool_path="$PROJECT_DIR$/vendor/bin/phpcs" />
|
||||
|
@ -72,9 +86,15 @@
|
|||
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpUnit">
|
||||
<phpunit_settings>
|
||||
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" phpunit_phar_path="" />
|
||||
</phpunit_settings>
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
33
bin/console
33
bin/console
|
@ -11,13 +11,11 @@ use Exception;
|
|||
error_reporting(error_level: E_ALL & ~E_DEPRECATED);
|
||||
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
echo 'This application must be run on the command line.' . PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// version, store that somewhere else
|
||||
$version = '0.0.1';
|
||||
|
||||
if (!is_file(filename: dirname(path: __DIR__).'/vendor/autoload.php')) {
|
||||
die('Required runtime components are missing. Try running "composer install".' . PHP_EOL);
|
||||
}
|
||||
|
@ -26,7 +24,7 @@ require dirname(path: __DIR__) . '/vendor/autoload.php';
|
|||
|
||||
|
||||
$shortOpts = 'v::'; // version
|
||||
$shortOpts = 'q::'; // version
|
||||
$shortOpts .= 'q::'; // quiet
|
||||
$shortOpts .= "V::"; // verbose
|
||||
$shortOpts .= "h::"; // help
|
||||
|
||||
|
@ -39,28 +37,29 @@ $longOpts = [
|
|||
|
||||
$options = getopt(short_options: $shortOpts, long_options: $longOpts, rest_index: $restIndex);
|
||||
|
||||
$arguments = array_slice(array: $argv, offset: $restIndex);
|
||||
|
||||
if (array_key_exists(key: 'v', array: $options) || array_key_exists(key: 'version', array: $options)) {
|
||||
$arguments = 'showVersion';
|
||||
|
||||
$composerJson = json_decode(json: file_get_contents(filename: dirname(path: __DIR__) . '/composer.json'), associative: true);
|
||||
$name = $composerJson['name'];
|
||||
$decription = $composerJson['decription'];
|
||||
$description = $composerJson['description'];
|
||||
$version = $composerJson['version'];
|
||||
$build_number = $composerJson['build_number'];
|
||||
$buildNumber = $composerJson['build_number'];
|
||||
$authorName = $composerJson['authors'][0]['name'];
|
||||
$authorEmail = $composerJson['authors'][0]['email'];
|
||||
|
||||
echo "Name: $name\n";
|
||||
echo "Description: $decription\n";
|
||||
echo "Description: $description\n";
|
||||
echo "Version: $version\n";
|
||||
echo "Build Number: $build_number\n";
|
||||
echo "Build Number: $buildNumber\n";
|
||||
echo "Author: $authorName ($authorEmail)\n";
|
||||
|
||||
print("bindAPI version: $version" . PHP_EOL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (array_key_exists(key: 'h', array: $options) || array_key_exists(key: 'help', array: $options)) {
|
||||
print("Help …" . PHP_EOL);
|
||||
exit(0);
|
||||
$arguments = "showUsage";
|
||||
}
|
||||
|
||||
if (array_key_exists(key: 'q', array: $options) || array_key_exists(key: 'quiet', array: $options)) {
|
||||
|
@ -76,7 +75,6 @@ if (array_key_exists(key: 'V', array: $options) || array_key_exists(key: 'verbos
|
|||
$verbose = false;
|
||||
}
|
||||
|
||||
$arguments = array_slice(array: $argv, offset: $restIndex);
|
||||
|
||||
try {
|
||||
$app = new BindAPI(verbose: $verbose, quiet: $quiet);
|
||||
|
@ -88,13 +86,6 @@ try {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param String $message
|
||||
* @param array $options
|
||||
* @param string $default
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function confirm(string $message = 'Are you sure? ', array $options = ['y', 'n'], string $default = 'n'): bool
|
||||
{
|
||||
// first $options means true, any other false
|
||||
|
@ -102,7 +93,7 @@ function confirm(string $message = 'Are you sure? ', array $options = ['y', 'n']
|
|||
$first = true;
|
||||
foreach ($options as $option) {
|
||||
// mark default
|
||||
if ($option == $default) {
|
||||
if ($option === $default) {
|
||||
$option = strtoupper(string: $option);
|
||||
}
|
||||
if ($first) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "24unix/bindapi",
|
||||
"decription": "fo",
|
||||
"description": "manage Bind9 DNS server via REST API",
|
||||
"version": "2023.0.1",
|
||||
"build_number": "1",
|
||||
"build_number": "322",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Micha Espey",
|
||||
|
|
|
@ -37,9 +37,6 @@ if (php_sapi_name() !== 'cli') {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CLIController
|
||||
{
|
||||
private array $arguments;
|
||||
|
@ -261,12 +258,12 @@ class CLIController
|
|||
$this->webmailDelete();
|
||||
},
|
||||
mandatoryParameters: ['ID'])));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function runCheckSetup(): void
|
||||
{
|
||||
if (!$this->domainController->checkPermissions(disableVerbose: false)) {
|
||||
if (!$this->domainController->checkPermissions(verbose: false)) {
|
||||
echo COLOR_RED . 'You need to setup the bindAPI first.' . COLOR_DEFAULT .PHP_EOL;
|
||||
}
|
||||
|
||||
|
@ -317,11 +314,6 @@ class CLIController
|
|||
|
||||
$debug = $this->configController->getConfig(configKey: 'debug');
|
||||
echo 'bindAPI version: todo (env: todo) ';
|
||||
if ($debug) {
|
||||
echo 'true';
|
||||
} else {
|
||||
echo 'false';
|
||||
}
|
||||
echo COLOR_DEFAULT . ')' . PHP_EOL;
|
||||
|
||||
echo COLOR_YELLOW . 'Usage:' . PHP_EOL;
|
||||
|
|
|
@ -141,18 +141,18 @@ class DomainController
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function checkPermissions(bool $disableVerbose = false): bool
|
||||
function checkPermissions(bool $verbose = false, bool $quiet = false): bool
|
||||
{
|
||||
$this->logger->debug(message: "checkPermissions()");
|
||||
$setupIsValid = true;
|
||||
|
||||
|
||||
if (!$disableVerbose) {
|
||||
if (!$verbose) {
|
||||
$verbose = $this->configController->getConfig(configKey: 'verbose');
|
||||
} else {
|
||||
$verbose = false;
|
||||
}
|
||||
|
||||
$this->logger->debug(message: "checkPermissions()");
|
||||
if (!$quiet) {
|
||||
$quiet = $this->configController->getConfig(configKey: 'quiet');
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
echo 'Checking permissions...' . PHP_EOL;
|
||||
|
@ -227,7 +227,6 @@ class DomainController
|
|||
echo COLOR_RED . "\t❌Group needs write permission!" . PHP_EOL;
|
||||
}
|
||||
}
|
||||
echo 'setup is valid:' . $setupIsValid ? 'true' : 'false';
|
||||
return $setupIsValid;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue