You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -714,24 +723,67 @@ public static function boot(): void {
714
723
print($e->getMessage());
715
724
exit();
716
725
}
726
+
self::setRequiredIniValues();
727
+
728
+
// initialize intl fallback if necessary
729
+
OC_Util::isSetLocaleWorking();
730
+
}
731
+
732
+
/**
733
+
* Run one time checks if not already run. This allows checking after server boot, to have access to translations and pretty error rendering while still checking only once in worker mode.
734
+
*/
735
+
privatestaticfunctiononeTimeChecks(): void {
736
+
if (self::$oneTimeChecksDone) {
737
+
return;
738
+
}
739
+
740
+
// Check for PHP SimpleXML extension earlier since we need it before our other checks and want to provide a useful hint for web users
741
+
// see https://github.com/nextcloud/server/pull/2619
742
+
if (!function_exists('simplexml_load_file')) {
743
+
thrownew \OCP\HintException('The PHP SimpleXML/PHP-XML extension is not installed. Install the extension or make sure it is enabled.');
744
+
}
745
+
746
+
// Check whether the sample configuration has been copied
747
+
if (self::$config->getValue('copied_sample_config', false)) {
$l->t('It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php'),
752
+
503
753
+
);
754
+
return;
755
+
}
756
+
757
+
self::checkConfig();
758
+
759
+
self::$oneTimeChecksDone = true;
717
760
}
718
761
719
-
publicstaticfunctioninit(): void {
762
+
/*
763
+
* Called before each request served if the same worker serves several request
764
+
*/
765
+
publicstaticfunctioninitForRequest(): void {
766
+
self::resetStaticProperties();
767
+
720
768
// First handle PHP configuration and copy auth headers to the expected
721
769
// $_SERVER variable before doing anything Server object related
722
-
self::setRequiredIniValues();
723
770
self::handleAuthHeaders();
724
771
725
772
// setup the basic server
726
773
self::$server = new \OC\Server(\OC::$WEBROOT, self::$config);
727
774
self::$server->boot();
728
775
776
+
self::oneTimeChecks();
777
+
729
778
$loaderStart = microtime(true);
730
779
780
+
$config = Server::get(IConfig::class);
781
+
$request = Server::get(IRequest::class);
782
+
731
783
try {
732
784
$profiler = newBuiltInProfiler(
733
-
Server::get(IConfig::class),
734
-
Server::get(IRequest::class),
785
+
$config,
786
+
$request,
735
787
);
736
788
$profiler->start();
737
789
} catch (\Throwable$e) {
@@ -751,10 +803,6 @@ public static function init(): void {
751
803
error_reporting(E_ALL);
752
804
}
753
805
754
-
// initialize intl fallback if necessary
755
-
OC_Util::isSetLocaleWorking();
756
-
757
-
$config = Server::get(IConfig::class);
758
806
if (!defined('PHPUNIT_RUN')) {
759
807
$errorHandler = newOC\Log\ErrorHandler(
760
808
Server::get(\Psr\Log\LoggerInterface::class),
@@ -778,12 +826,6 @@ public static function init(): void {
$l->t('It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php'),
896
-
503
897
-
);
898
-
return;
899
-
}
900
-
901
-
$request = Server::get(IRequest::class);
902
931
$host = $request->getInsecureServerHost();
903
932
/**
904
933
* if the host passed in headers isn't trusted
905
934
* FIXME: Should not be in here at all :see_no_evil:
0 commit comments