File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525
2626\OC ::handleRequests (static function () {
2727 try {
28- \OC ::resetStaticProperties ();
29- \OC ::init ();
28+ \OC ::initForRequest ();
3029 \OC ::handleRequest ();
3130 } catch (ServiceUnavailableException $ ex ) {
3231 Server::get (LoggerInterface::class)->error ($ ex ->getMessage (), [
Original file line number Diff line number Diff line change @@ -666,6 +666,9 @@ private static function addSecurityHeaders(): void {
666666 }
667667 }
668668
669+ /*
670+ * Called only once at the beginning to setup things
671+ */
669672 public static function boot (): void {
670673 // prevent any XML processing from loading external entities
671674 libxml_set_external_entity_loader (static function () {
@@ -726,7 +729,12 @@ public static function boot(): void {
726729 }
727730 }
728731
729- public static function init (): void {
732+ /*
733+ * Called before each request served if the same worker serves several request
734+ */
735+ public static function initForRequest (): void {
736+ self ::resetStaticProperties ();
737+
730738 // First handle PHP configuration and copy auth headers to the expected
731739 // $_SERVER variable before doing anything Server object related
732740 self ::setRequiredIniValues ();
@@ -1329,7 +1337,7 @@ protected static function tryAppAPILogin(OCP\IRequest $request): bool {
13291337 /**
13301338 * @internal
13311339 */
1332- public static function resetStaticProperties (): void {
1340+ private static function resetStaticProperties (): void {
13331341 // FIXME needed because these use a static var
13341342 \OC_Hook::clear ();
13351343 \OC_Util::$ styles = [];
Original file line number Diff line number Diff line change 99require_once __DIR__ . '/OC.php ' ;
1010
1111\OC ::boot ();
12- \OC ::init ();
12+ \OC ::initForRequest ();
Original file line number Diff line number Diff line change 3131\OC ::boot ();
3232
3333\OC ::handleRequests (static function () {
34- \OC ::resetStaticProperties ();
35- \OC ::init ();
34+ \OC ::initForRequest ();
3635 $ request = Server::get (IRequest::class);
3736
3837 if ((Util::needUpgrade () || Server::get (IConfig::class)->getSystemValueBool ('maintenance ' )) && $ request ->getPathInfo () !== '/core/update ' ) {
Original file line number Diff line number Diff line change @@ -103,8 +103,7 @@ function resolveService($service) {
103103
104104\OC ::handleRequests (static function () {
105105 try {
106- \OC ::resetStaticProperties ();
107- \OC ::init ();
106+ \OC ::initForRequest ();
108107
109108 // All resources served via the DAV endpoint should have the strictest possible
110109 // policy. Exempted from this is the SabreDAV browser plugin which overwrites
You can’t perform that action at this time.
0 commit comments