fixing phpstan errors.

main
Robert 2 years ago
parent 0c7a9ba7a5
commit 3fcd529ad1
  1. 2
      .gitignore
  2. 3
      app/neato.php
  3. 6
      app/neato_enc.php
  4. 2
      app/neato_fns.php
  5. 2
      app/neato_logger.php
  6. 1
      deploy_files/deploy_example.php
  7. 5
      deploy_files/deploy_mysql_ex1.php
  8. 2
      deploy_files/deploy_mysql_ex2.php
  9. 6
      make-installer.sh

2
.gitignore vendored

@ -1,6 +1,6 @@
vendor/
app/deploy_files
sums/
sums/*.sum
run/*.lck
log/*.txt
*.pub

@ -18,7 +18,7 @@ if ($pk === false) {
if (!isset($argv[1])) {
echo 'Please give Script to run, example: ./neato_deploy.sh apache' . PHP_EOL;
echo "Note: deploy_ is added to the beginning of the filename and .php is added to the end!" . PHP_EOL;
echo "Also, the deployment file must be in the same path if local file." . PHP_EOL;
echo "Also, the deployment file must be in the deploy_files path." . PHP_EOL;
echo "Insecure: you may pass a http web site text file: IE http://mysite.com/apache.txt" . PHP_EOL;
exit(1);
}
@ -27,6 +27,7 @@ define('CONFIG_FILE', basename($argv[1]) );
require "neato_common.php";
/** @phpstan-ignore-next-line Variable $os_like might not be defined */
if ($os_like == 'debian') {
putenv("DEBIAN_FRONTEND=noninteractive");
}

@ -33,7 +33,13 @@ class enc {
$my_key = hex2bin($my_key);
/**
* @param false|string $decoded did it base64_code?
* base64_decode may return a false!!!
* Ignore the error in phpstan!! It is all correct here:
*/
$decoded = base64_decode($encrypted);
// @phpstan-ignore-next-line
if ($decoded === false) {
throw new \Exception("The encoding failed!");
}

@ -1,5 +1,5 @@
<?php
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
define('PROJECT_RUN_DIR', $cwd . '/run');
function display($data) {

@ -1,5 +1,5 @@
<?php
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
define('PROJECT_LOGS_DIR', $cwd. '/log');
class logger {

@ -4,6 +4,7 @@ configure::set('logfile', true); // Save to log folder
configure::set('syslog', false);
configure::set('passwords', ['length' => rand(16, 26)]);
/** @phpstan-ignore-next-line Variable $cwd $os might not be defined */
$templates_dir = $cwd . '/templates/' . $os['name'] . '/';
configure::set('preinstall', [

@ -5,8 +5,10 @@ configure::set('syslog', false);
configure::set('passwords', ['length' => rand(16, 26)]);
configure::set('pre_actions', [
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
'make_dir' => [$cwd . '/my_vaults'=>'', '/etc/neato_secrets'=>''],
'chmod_file_or_dir' =>
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
[ $cwd . '/my_vaults' => 'keydir', '/etc/neato_secrets' => 'keydir' ],
]);
@ -18,10 +20,13 @@ file_loop(configure::get('pre_actions'));
$my_key = enc::make_key_file("/etc/neato_secrets/mysql_key");
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
if (!file_exists($cwd . "/my_vaults/mysql_secrets")) {
$root_password = make_password(configure::get('passwords', 'length'));
$obj = new stdClass();
$obj->root = $root_password;
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
enc::encode_file($cwd . "/my_vaults/mysql_secrets", $obj, $my_key);
}

@ -8,6 +8,8 @@ configure::set('syslog', false);
force_root();
$my_key = read_file("/etc/neato_secrets/mysql_key");
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
$o = enc::decode_file($cwd . "/my_vaults/mysql_secrets", $my_key);
echo $o->root;

@ -1,4 +1,10 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
/usr/bin/echo "Please run as root!"
exit
fi
pushd build || exit 2
generate_password() {

Loading…
Cancel
Save