summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-04-21 11:28:01 +0200
committerArthur Schiwon (Rebase PR Action) <blizzz@users.noreply.github.com>2023-04-21 14:10:47 +0000
commitbb4b34ff69350bb65672146406cb6c57c65326de (patch)
treeddd50890a2ff4e6b4d863b93d7d82a39f60f2a70 /lib
parent7519949f372c82c6b529766ca2eb48398e62776b (diff)
downloadnextcloud-server-bb4b34ff69350bb65672146406cb6c57c65326de.tar.gz
nextcloud-server-bb4b34ff69350bb65672146406cb6c57c65326de.zip
Read mtime of version.php only once
- in most cases it would read again in \OC_Util::loadVersion anyway - remove some unused use statements Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php6
-rw-r--r--lib/private/legacy/OC_Util.php4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/base.php b/lib/base.php
index ced5433a57e..119e89f6ae0 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -68,7 +68,6 @@ declare(strict_types=1);
use OC\Encryption\HookManager;
use OC\EventDispatcher\SymfonyAdapter;
-use OC\Files\Filesystem;
use OC\Share20\Hooks;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Group\Events\UserRemovedEvent;
@@ -115,6 +114,8 @@ class OC {
public static string $configDir;
+ public static int $VERSION_MTIME = 0;
+
/**
* requested app
*/
@@ -601,7 +602,8 @@ class OC {
// Add default composer PSR-4 autoloader
self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php';
- self::$composerAutoloader->setApcuPrefix('composer_autoload_' . md5(OC::$SERVERROOT . '_' . filemtime(OC::$SERVERROOT . '/version.php')));
+ OC::$VERSION_MTIME = filemtime(OC::$SERVERROOT . '/version.php');
+ self::$composerAutoloader->setApcuPrefix('composer_autoload_' . md5(OC::$SERVERROOT . '_' . OC::$VERSION_MTIME));
try {
self::initPaths();
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index f1f1f810658..a7e1953476a 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -65,7 +65,6 @@
*/
use bantu\IniGetWrapper\IniGetWrapper;
-use OC\AppFramework\Http\Request;
use OC\Files\SetupManager;
use OCP\Files\Template\ITemplateManager;
use OCP\IConfig;
@@ -327,10 +326,9 @@ class OC_Util {
return;
}
- $timestamp = filemtime(OC::$SERVERROOT . '/version.php');
require OC::$SERVERROOT . '/version.php';
/** @var int $timestamp */
- self::$versionCache['OC_Version_Timestamp'] = $timestamp;
+ self::$versionCache['OC_Version_Timestamp'] = \OC::$VERSION_MTIME;
/** @var string $OC_Version */
self::$versionCache['OC_Version'] = $OC_Version;
/** @var string $OC_VersionString */