Test Failed
Push — master ( 341c02...c6d5e7 )
by Stefan
07:03
created
core/SanityTests.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 use GeoIp2\Database\Reader;
50 50
 use \Exception;
51 51
 
52
-require_once dirname(dirname(__FILE__)) . "/config/_config.php";
53
-require_once dirname(dirname(__FILE__)) . "/core/PHPMailer/src/PHPMailer.php";
54
-require_once dirname(dirname(__FILE__)) . "/core/PHPMailer/src/SMTP.php";
52
+require_once dirname(dirname(__FILE__))."/config/_config.php";
53
+require_once dirname(dirname(__FILE__))."/core/PHPMailer/src/PHPMailer.php";
54
+require_once dirname(dirname(__FILE__))."/core/PHPMailer/src/SMTP.php";
55 55
 
56 56
 class SanityTests extends CAT {
57 57
     /* in this section set current CAT requirements */
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $this->test_result = [];
125 125
         $this->test_result['global'] = 0;
126 126
         // parse the schema file to find out the number of expected rows...
127
-        $schema = file(dirname(dirname(__FILE__)) . "/schema/schema.sql");
127
+        $schema = file(dirname(dirname(__FILE__))."/schema/schema.sql");
128 128
         $this->profile_option_ct = 0;
129 129
         $passedTheWindmill = FALSE;
130 130
         foreach ($schema as $schemaLine) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     public function runTest($test) {
151 151
         $this->out[$test] = [];
152 152
         $this->name = $test;
153
-        $m_name = 'test' . $test;
153
+        $m_name = 'test'.$test;
154 154
         $this->test_result[$test] = 0;
155 155
         if (!method_exists($this, $m_name)) {
156 156
             $this->storeTestResult(\core\common\Entity::L_ERROR, "Configuration error, no test configured for <strong>$test</strong>.");
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 $matchArray = [];
239 239
                 preg_match('/([^ ]+) ?/', $config['PATHS'][$pathToCheck], $matchArray);
240 240
                 $exe = $matchArray[1];
241
-                $the_path = exec("which " . $config['PATHS'][$pathToCheck]);
241
+                $the_path = exec("which ".$config['PATHS'][$pathToCheck]);
242 242
                 if ($the_path == $exe) {
243 243
                     $exec_is = "EXPLICIT";
244 244
                 } else {
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
      */
258 258
     private function testPhp() {
259 259
         if (version_compare(phpversion(), $this->php_needversion, '>=')) {
260
-            $this->storeTestResult(\core\common\Entity::L_OK, "<strong>PHP</strong> is sufficiently recent. You are running " . phpversion() . ".");
260
+            $this->storeTestResult(\core\common\Entity::L_OK, "<strong>PHP</strong> is sufficiently recent. You are running ".phpversion().".");
261 261
         } else {
262
-            $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->php_needversion, but you only have " . phpversion() . ".");
262
+            $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>PHP</strong> is too old. We need at least $this->php_needversion, but you only have ".phpversion().".");
263 263
         }
264 264
     }
265 265
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             $this->storeTestResult(\core\common\Entity::L_OK, "<strong>cat_base_url</strong> set correctly");
276 276
         } else {
277 277
             $rootFromScript = $m[1] === '' ? '/' : $m[1];
278
-            $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>cat_base_url</strong> is set to <strong>" . CONFIG['PATHS']['cat_base_url'] . "</strong> and should be <strong>$rootFromScript</strong>");
278
+            $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>cat_base_url</strong> is set to <strong>".CONFIG['PATHS']['cat_base_url']."</strong> and should be <strong>$rootFromScript</strong>");
279 279
         }
280 280
     }
281 281
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         if (count($probeReturns) == 0) {
291 291
             $this->storeTestResult(common\Entity::L_OK, "All configured RADIUS/UDP probes are reachable.");
292 292
         } else {
293
-            $this->storeTestResult(common\Entity::L_ERROR, "The following RADIUS probes are NOT reachable: ".implode(', ',$probeReturns));
293
+            $this->storeTestResult(common\Entity::L_ERROR, "The following RADIUS probes are NOT reachable: ".implode(', ', $probeReturns));
294 294
         }
295 295
     }
296 296
 
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
             $SSPconfig = \SimpleSAML_Configuration::getInstance();
308 308
             $sspVersion = explode('.', $SSPconfig->getVersion());
309 309
             if ((int) $sspVersion[0] >= $this->ssp_needversion['major'] && (int) $sspVersion[1] >= $this->ssp_needversion['minor']) {
310
-                $this->storeTestResult(\core\common\Entity::L_OK, "<strong>simpleSAMLphp</strong> is sufficently recent. You are running " . implode('.', $sspVersion));
310
+                $this->storeTestResult(\core\common\Entity::L_OK, "<strong>simpleSAMLphp</strong> is sufficently recent. You are running ".implode('.', $sspVersion));
311 311
             } else {
312
-                $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>simpleSAMLphp</strong> is too old. We need at least " . implode('.', $this->ssp_needversion));
312
+                $this->storeTestResult(\core\common\Entity::L_ERROR, "<strong>simpleSAMLphp</strong> is too old. We need at least ".implode('.', $this->ssp_needversion));
313 313
             }
314 314
         }
315 315
     }
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
      * @return void
364 364
      */
365 365
     private function testLogdir() {
366
-        if (fopen(CONFIG['PATHS']['logdir'] . "/debug.log", "a") == FALSE) {
367
-            $this->storeTestResult(\core\common\Entity::L_WARN, "Log files in <strong>" . CONFIG['PATHS']['logdir'] . "</strong> are not writable!");
366
+        if (fopen(CONFIG['PATHS']['logdir']."/debug.log", "a") == FALSE) {
367
+            $this->storeTestResult(\core\common\Entity::L_WARN, "Log files in <strong>".CONFIG['PATHS']['logdir']."</strong> are not writable!");
368 368
         } else {
369 369
             $this->storeTestResult(\core\common\Entity::L_OK, "Log directory is writable.");
370 370
         }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     private function testOpenssl() {
489 489
         $A = $this->getExecPath('openssl');
490 490
         if ($A['exec'] != "") {
491
-            $t = exec($A['exec'] . ' version');
491
+            $t = exec($A['exec'].' version');
492 492
             if ($A['exec_is'] == "EXPLICIT") {
493 493
                 $this->storeTestResult(\core\common\Entity::L_OK, "<strong>$t</strong> was found and is configured explicitly in your config.");
494 494
             } else {
@@ -515,14 +515,14 @@  discard block
 block discarded – undo
515 515
         }
516 516
         $A = $this->getExecPath('makensis');
517 517
         if ($A['exec'] != "") {
518
-            $t = exec($A['exec'] . ' -VERSION');
518
+            $t = exec($A['exec'].' -VERSION');
519 519
             if ($A['exec_is'] == "EXPLICIT") {
520 520
                 $this->storeTestResult(\core\common\Entity::L_OK, "<strong>makensis $t</strong> was found and is configured explicitly in your config.");
521 521
             } else {
522 522
                 $this->storeTestResult(\core\common\Entity::L_WARN, "<strong>makensis $t</strong> was found, but is not configured with an absolute path in your config.");
523 523
             }
524 524
             $outputArray = [];
525
-            exec($A['exec'] . ' -HELP', $outputArray);
525
+            exec($A['exec'].' -HELP', $outputArray);
526 526
             $t1 = count(preg_grep('/INPUTCHARSET/', $outputArray));
527 527
             if ($t1 == 1 && CONFIG_CONFASSISTANT['NSIS_VERSION'] == 2) {
528 528
                 $this->storeTestResult(\core\common\Entity::L_ERROR, "Declared NSIS_VERSION does not seem to match the file pointed to by PATHS['makensis']!");
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         $NSIS_Module_status = [];
552 552
         foreach ($this->NSIS_Modules as $module) {
553 553
             unset($out);
554
-            exec(CONFIG_CONFASSISTANT['PATHS']['makensis'] . " -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval);
554
+            exec(CONFIG_CONFASSISTANT['PATHS']['makensis']." -V1 '-X!include $module' '-XOutFile $exe' '-XSection X' '-XSectionEnd'", $out, $retval);
555 555
             if ($retval > 0) {
556 556
                 $NSIS_Module_status[$module] = 0;
557 557
             } else {
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
         $locales = shell_exec("locale -a");
615 615
         $allthere = "";
616 616
         foreach (CONFIG['LANGUAGES'] as $onelanguage) {
617
-            if (preg_match("/" . $onelanguage['locale'] . "/", $locales) == 0) {
618
-                $allthere .= $onelanguage['locale'] . " ";
617
+            if (preg_match("/".$onelanguage['locale']."/", $locales) == 0) {
618
+                $allthere .= $onelanguage['locale']." ";
619 619
             }
620 620
         }
621 621
         if ($allthere == "") {
@@ -629,47 +629,47 @@  discard block
 block discarded – undo
629 629
         ["SETTING" => CONFIG['APPEARANCE']['from-mail'],
630 630
             "DEFVALUE" => "[email protected]",
631 631
             "COMPLAINTSTRING" => "APPEARANCE/from-mail ",
632
-            "REQUIRED" => FALSE,],
632
+            "REQUIRED" => FALSE, ],
633 633
         ["SETTING" => CONFIG['APPEARANCE']['support-contact']['url'],
634 634
             "DEFVALUE" => "[email protected]?body=Only%20English%20language%20please!",
635 635
             "COMPLAINTSTRING" => "APPEARANCE/support-contact/url ",
636
-            "REQUIRED" => FALSE,],
636
+            "REQUIRED" => FALSE, ],
637 637
         ["SETTING" => CONFIG['APPEARANCE']['support-contact']['display'],
638 638
             "DEFVALUE" => "[email protected]",
639 639
             "COMPLAINTSTRING" => "APPEARANCE/support-contact/display ",
640
-            "REQUIRED" => FALSE,],
640
+            "REQUIRED" => FALSE, ],
641 641
         ["SETTING" => CONFIG['APPEARANCE']['support-contact']['developer-mail'],
642 642
             "DEFVALUE" => "[email protected]",
643 643
             "COMPLAINTSTRING" => "APPEARANCE/support-contact/mail ",
644
-            "REQUIRED" => FALSE,],
644
+            "REQUIRED" => FALSE, ],
645 645
         ["SETTING" => CONFIG['APPEARANCE']['abuse-mail'],
646 646
             "DEFVALUE" => "[email protected]",
647 647
             "COMPLAINTSTRING" => "APPEARANCE/abuse-mail ",
648
-            "REQUIRED" => FALSE,],
648
+            "REQUIRED" => FALSE, ],
649 649
         ["SETTING" => CONFIG['APPEARANCE']['MOTD'],
650 650
             "DEFVALUE" => "Release Candidate. All bugs to be shot on sight!",
651 651
             "COMPLAINTSTRING" => "APPEARANCE/MOTD ",
652
-            "REQUIRED" => FALSE,],
652
+            "REQUIRED" => FALSE, ],
653 653
         ["SETTING" => CONFIG['APPEARANCE']['webcert_CRLDP'],
654 654
             "DEFVALUE" => ['list', 'of', 'CRL', 'pointers'],
655 655
             "COMPLAINTSTRING" => "APPEARANCE/webcert_CRLDP ",
656
-            "REQUIRED" => TRUE,],
656
+            "REQUIRED" => TRUE, ],
657 657
         ["SETTING" => CONFIG['APPEARANCE']['webcert_OCSP'],
658 658
             "DEFVALUE" => ['list', 'of', 'OCSP', 'pointers'],
659 659
             "COMPLAINTSTRING" => "APPEARANCE/webcert_OCSP ",
660
-            "REQUIRED" => TRUE,],
660
+            "REQUIRED" => TRUE, ],
661 661
         ["SETTING" => CONFIG['DB']['INST']['host'],
662 662
             "DEFVALUE" => "db.host.example",
663 663
             "COMPLAINTSTRING" => "DB/INST ",
664
-            "REQUIRED" => TRUE,],
664
+            "REQUIRED" => TRUE, ],
665 665
         ["SETTING" => CONFIG['DB']['INST']['host'],
666 666
             "DEFVALUE" => "db.host.example",
667 667
             "COMPLAINTSTRING" => "DB/USER ",
668
-            "REQUIRED" => TRUE,],
668
+            "REQUIRED" => TRUE, ],
669 669
         ["SETTING" => CONFIG['DB']['EXTERNAL']['host'],
670 670
             "DEFVALUE" => "customerdb.otherhost.example",
671 671
             "COMPLAINTSTRING" => "DB/EXTERNAL ",
672
-            "REQUIRED" => FALSE,],
672
+            "REQUIRED" => FALSE, ],
673 673
     ];
674 674
 
675 675
     /**
@@ -695,11 +695,11 @@  discard block
 block discarded – undo
695 695
 
696 696
         foreach (CONFIG_DIAGNOSTICS['RADIUSTESTS']['TLS-clientcerts'] as $cadata) {
697 697
             foreach ($cadata['certificates'] as $cert_files) {
698
-                if (file_get_contents(ROOT . "/config/cli-certs/" . $cert_files['public']) === FALSE) {
699
-                    $defaultvalues .= "CERTIFICATE/" . $cert_files['public'] . " ";
698
+                if (file_get_contents(ROOT."/config/cli-certs/".$cert_files['public']) === FALSE) {
699
+                    $defaultvalues .= "CERTIFICATE/".$cert_files['public']." ";
700 700
                 }
701
-                if (file_get_contents(ROOT . "/config/cli-certs/" . $cert_files['private']) === FALSE) {
702
-                    $defaultvalues .= "CERTIFICATE/" . $cert_files['private'] . " ";
701
+                if (file_get_contents(ROOT."/config/cli-certs/".$cert_files['private']) === FALSE) {
702
+                    $defaultvalues .= "CERTIFICATE/".$cert_files['private']." ";
703 703
                 }
704 704
             }
705 705
         }
@@ -789,14 +789,14 @@  discard block
 block discarded – undo
789 789
         if ($global_no_cache) {
790 790
             foreach ($Devs as $dev => $D) {
791 791
                 if (empty($D['options']['no_cache']) || $D['options']['no_cache'] != 0) {
792
-                    $no_cache_dev .= $dev . " ";
792
+                    $no_cache_dev .= $dev." ";
793 793
                     $no_cache_dev_count++;
794 794
                 }
795 795
             }
796 796
         } else {
797 797
             foreach ($Devs as $dev => $D) {
798 798
                 if (!empty($D['options']['no_cache']) && $D['options']['no_cache'] != 0) {
799
-                    $no_cache_dev .= $dev . " ";
799
+                    $no_cache_dev .= $dev." ";
800 800
                     $no_cache_dev_count++;
801 801
                 }
802 802
             }
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
         $mail->isHTML(FALSE);
835 835
         $mail->CharSet = 'UTF-8';
836 836
         $mail->From = CONFIG['APPEARANCE']['from-mail'];
837
-        $mail->FromName = CONFIG['APPEARANCE']['productname'] . " Invitation System";
837
+        $mail->FromName = CONFIG['APPEARANCE']['productname']." Invitation System";
838 838
         $mail->addAddress(CONFIG['APPEARANCE']['abuse-mail']);
839 839
         $mail->Subject = "testing CAT configuration mail";
840 840
         $mail->Body = "Testing CAT mailing\n";
841 841
         $sent = $mail->send();
842 842
         if ($sent) {
843
-            $this->storeTestResult(\core\common\Entity::L_OK, "mailer settings appear to be working, check " . CONFIG['APPEARANCE']['abuse-mail'] . " mailbox if the message was receiced.");
843
+            $this->storeTestResult(\core\common\Entity::L_OK, "mailer settings appear to be working, check ".CONFIG['APPEARANCE']['abuse-mail']." mailbox if the message was receiced.");
844 844
         } else {
845 845
             $this->storeTestResult(\core\common\Entity::L_ERROR, "mailer settings failed, check the Config::MAILSETTINGS");
846 846
         }
Please login to merge, or discard this patch.
web/admin/sanity_tests.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
22
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
23 23
 
24 24
 $Tests = [
25 25
     'CatBaseUrl',
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     'RADIUSProbes',
41 41
 ];
42 42
 
43
-if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL" ) {
43
+if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL") {
44 44
     $Tests[] = 'Makensis';
45 45
     $Tests[] = 'Makensis=>NSISmodules';
46 46
 }
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
             $message = "Your configuration appears to be fine.";
75 75
             break;
76 76
         default:
77
-            throw new Exception("The result code level " . $test->test_result['global'] . " is not defined!");
77
+            throw new Exception("The result code level ".$test->test_result['global']." is not defined!");
78 78
     }
79 79
     $uiElements = new web\lib\admin\UIElements();
80
-    $out .= $uiElements->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>");
80
+    $out .= $uiElements->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
81 81
     foreach ($test->out as $testValue) {
82 82
         foreach ($testValue as $o) {
83 83
             $out .= $uiElements->boxFlexible($o['level'], $o['message']);
Please login to merge, or discard this patch.