summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php87
-rw-r--r--lib/composer/composer/autoload_classmap.php2
-rw-r--r--lib/composer/composer/autoload_static.php2
-rw-r--r--lib/l10n/es.js2
-rw-r--r--lib/l10n/es.json2
-rw-r--r--lib/l10n/he.js8
-rw-r--r--lib/l10n/he.json8
-rw-r--r--lib/l10n/pt_BR.js1
-rw-r--r--lib/l10n/pt_BR.json1
-rw-r--r--lib/private/App/AppStore/Fetcher/AppFetcher.php4
-rw-r--r--lib/private/Files/Storage/Local.php5
-rw-r--r--lib/private/Installer.php22
-rw-r--r--lib/private/IntegrityCheck/Checker.php47
-rw-r--r--lib/private/Log/ExceptionSerializer.php1
-rw-r--r--lib/private/Preview/MarkDown.php110
-rw-r--r--lib/private/Preview/WebP.php42
-rw-r--r--lib/private/PreviewManager.php4
-rw-r--r--lib/private/Server.php3
-rw-r--r--lib/private/Setup/MySQL.php3
-rw-r--r--lib/private/legacy/OC_Image.php9
-rw-r--r--lib/public/AppFramework/Bootstrap/IRegistrationContext.php3
-rw-r--r--lib/public/EventDispatcher/IEventDispatcher.php6
-rw-r--r--lib/public/User/Events/UserLoggedInEvent.php13
23 files changed, 302 insertions, 83 deletions
diff --git a/lib/base.php b/lib/base.php
index f5b9964b1f8..c42f427ca40 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -211,25 +211,18 @@ class OC {
}
} elseif (file_exists(OC::$SERVERROOT . '/apps')) {
OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true];
- } elseif (file_exists(OC::$SERVERROOT . '/../apps')) {
- OC::$APPSROOTS[] = [
- 'path' => rtrim(dirname(OC::$SERVERROOT), '/') . '/apps',
- 'url' => '/apps',
- 'writable' => true
- ];
}
if (empty(OC::$APPSROOTS)) {
throw new \RuntimeException('apps directory not found! Please put the Nextcloud apps folder in the Nextcloud folder'
- . ' or the folder above. You can also configure the location in the config.php file.');
+ . '. You can also configure the location in the config.php file.');
}
$paths = [];
foreach (OC::$APPSROOTS as $path) {
$paths[] = $path['path'];
if (!is_dir($path['path'])) {
throw new \RuntimeException(sprintf('App directory "%s" not found! Please put the Nextcloud apps folder in the'
- . ' Nextcloud folder or the folder above. You can also configure the location in the'
- . ' config.php file.', $path['path']));
+ . ' Nextcloud folder. You can also configure the location in the config.php file.', $path['path']));
}
}
@@ -273,12 +266,12 @@ class OC {
}
}
- public static function checkInstalled() {
+ public static function checkInstalled(\OC\SystemConfig $systemConfig) {
if (defined('OC_CONSOLE')) {
return;
}
// Redirect to installer if not installed
- if (!\OC::$server->getSystemConfig()->getValue('installed', false) && OC::$SUBURI !== '/index.php' && OC::$SUBURI !== '/status.php') {
+ if (!$systemConfig->getValue('installed', false) && OC::$SUBURI !== '/index.php' && OC::$SUBURI !== '/status.php') {
if (OC::$CLI) {
throw new Exception('Not installed');
} else {
@@ -289,9 +282,9 @@ class OC {
}
}
- public static function checkMaintenanceMode() {
+ public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig) {
// Allow ajax update script to execute without being stopped
- if (((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) && OC::$SUBURI != '/core/ajax/update.php') {
+ if (((bool) $systemConfig->getValue('maintenance', false)) && OC::$SUBURI != '/core/ajax/update.php') {
// send http status 503
http_response_code(503);
header('Retry-After: 120');
@@ -503,14 +496,14 @@ class OC {
* We use an additional cookie since we want to protect logout CSRF and
* also we can't directly interfere with PHP's session mechanism.
*/
- private static function performSameSiteCookieProtection() {
+ private static function performSameSiteCookieProtection(\OCP\IConfig $config) {
$request = \OC::$server->getRequest();
// Some user agents are notorious and don't really properly follow HTTP
// specifications. For those, have an automated opt-out. Since the protection
// for remote.php is applied in base.php as starting point we need to opt out
// here.
- $incompatibleUserAgents = \OC::$server->getConfig()->getSystemValue('csrf.optout');
+ $incompatibleUserAgents = $config->getSystemValue('csrf.optout');
// Fallback, if csrf.optout is unset
if (!is_array($incompatibleUserAgents)) {
@@ -541,7 +534,7 @@ class OC {
self::sendSameSiteCookies();
// Debug mode gets access to the resources without strict cookie
// due to the fact that the SabreDAV browser also lives there.
- if (!\OC::$server->getConfig()->getSystemValue('debug', false)) {
+ if (!$config->getSystemValue('debug', false)) {
http_response_code(\OCP\AppFramework\Http::STATUS_SERVICE_UNAVAILABLE);
exit();
}
@@ -593,8 +586,9 @@ class OC {
// setup the basic server
self::$server = new \OC\Server(\OC::$WEBROOT, self::$config);
self::$server->boot();
- \OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
- \OC::$server->getEventLogger()->start('boot', 'Initialize');
+ $eventLogger = \OC::$server->getEventLogger();
+ $eventLogger->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
+ $eventLogger->start('boot', 'Initialize');
// Override php.ini and log everything if we're troubleshooting
if (self::$config->getValue('loglevel') === ILogger::DEBUG) {
@@ -622,14 +616,16 @@ class OC {
self::setRequiredIniValues();
self::handleAuthHeaders();
- self::registerAutoloaderCache();
+ $systemConfig = \OC::$server->get(\OC\SystemConfig::class);
+ self::registerAutoloaderCache($systemConfig);
// initialize intl fallback if necessary
OC_Util::isSetLocaleWorking();
+ $config = \OC::$server->get(\OCP\IConfig::class);
if (!defined('PHPUNIT_RUN')) {
OC\Log\ErrorHandler::setLogger(\OC::$server->getLogger());
- $debug = \OC::$server->getConfig()->getSystemValue('debug', false);
+ $debug = $config->getSystemValue('debug', false);
OC\Log\ErrorHandler::register($debug);
}
@@ -637,21 +633,21 @@ class OC {
$bootstrapCoordinator = \OC::$server->query(\OC\AppFramework\Bootstrap\Coordinator::class);
$bootstrapCoordinator->runInitialRegistration();
- \OC::$server->getEventLogger()->start('init_session', 'Initialize session');
+ $eventLogger->start('init_session', 'Initialize session');
OC_App::loadApps(['session']);
if (!self::$CLI) {
self::initSession();
}
- \OC::$server->getEventLogger()->end('init_session');
+ $eventLogger->end('init_session');
self::checkConfig();
- self::checkInstalled();
+ self::checkInstalled($systemConfig);
OC_Response::addSecurityHeaders();
- self::performSameSiteCookieProtection();
+ self::performSameSiteCookieProtection($config);
if (!defined('OC_CONSOLE')) {
- $errors = OC_Util::checkServer(\OC::$server->getSystemConfig());
+ $errors = OC_Util::checkServer($systemConfig);
if (count($errors) > 0) {
if (!self::$CLI) {
http_response_code(503);
@@ -677,21 +673,19 @@ class OC {
}
try {
- \OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors));
+ $config->setAppValue('core', 'cronErrors', json_encode($staticErrors));
} catch (\Exception $e) {
echo('Writing to database failed');
}
exit(1);
- } elseif (self::$CLI && \OC::$server->getConfig()->getSystemValue('installed', false)) {
- \OC::$server->getConfig()->deleteAppValue('core', 'cronErrors');
+ } elseif (self::$CLI && $config->getSystemValue('installed', false)) {
+ $config->deleteAppValue('core', 'cronErrors');
}
}
//try to set the session lifetime
$sessionLifeTime = self::getSessionLifeTime();
@ini_set('gc_maxlifetime', (string)$sessionLifeTime);
- $systemConfig = \OC::$server->getSystemConfig();
-
// User and Groups
if (!$systemConfig->getValue("installed", false)) {
self::$server->getSession()->set('user_id', '');
@@ -716,11 +710,10 @@ class OC {
OC_User::setIncognitoMode(true);
}
- self::registerCleanupHooks();
+ self::registerCleanupHooks($systemConfig);
self::registerFilesystemHooks();
- self::registerShareHooks();
- self::registerEncryptionWrapper();
- self::registerEncryptionHooks();
+ self::registerShareHooks($systemConfig);
+ self::registerEncryptionWrapperAndHooks();
self::registerAccountHooks();
self::registerResourceCollectionHooks();
self::registerAppRestrictionsHooks();
@@ -755,7 +748,7 @@ class OC {
*/
if (!OC::$CLI
&& !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host)
- && self::$server->getConfig()->getSystemValue('installed', false)
+ && $config->getSystemValue('installed', false)
) {
// Allow access to CSS resources
$isScssRequest = false;
@@ -789,15 +782,15 @@ class OC {
exit();
}
}
- \OC::$server->getEventLogger()->end('boot');
+ $eventLogger->end('boot');
}
/**
* register hooks for the cleanup of cache and bruteforce protection
*/
- public static function registerCleanupHooks() {
+ public static function registerCleanupHooks(\OC\SystemConfig $systemConfig) {
//don't try to do this before we are properly setup
- if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) {
+ if ($systemConfig->getValue('installed', false) && !\OCP\Util::needUpgrade()) {
// NOTE: This will be replaced to use OCP
$userSession = self::$server->getUserSession();
@@ -831,13 +824,11 @@ class OC {
}
}
- private static function registerEncryptionWrapper() {
+ private static function registerEncryptionWrapperAndHooks() {
$manager = self::$server->getEncryptionManager();
\OCP\Util::connectHook('OC_Filesystem', 'preSetup', $manager, 'setupStorage');
- }
- private static function registerEncryptionHooks() {
- $enabled = self::$server->getEncryptionManager()->isEnabled();
+ $enabled = $manager->isEnabled();
if ($enabled) {
\OCP\Util::connectHook(Share::class, 'post_shared', HookManager::class, 'postShared');
\OCP\Util::connectHook(Share::class, 'post_unshare', HookManager::class, 'postUnshared');
@@ -890,8 +881,8 @@ class OC {
/**
* register hooks for sharing
*/
- public static function registerShareHooks() {
- if (\OC::$server->getSystemConfig()->getValue('installed')) {
+ public static function registerShareHooks(\OC\SystemConfig $systemConfig) {
+ if ($systemConfig->getValue('installed')) {
OC_Hook::connect('OC_User', 'post_deleteUser', Hooks::class, 'post_deleteUser');
OC_Hook::connect('OC_User', 'post_deleteGroup', Hooks::class, 'post_deleteGroup');
@@ -901,14 +892,14 @@ class OC {
}
}
- protected static function registerAutoloaderCache() {
+ protected static function registerAutoloaderCache(\OC\SystemConfig $systemConfig) {
// The class loader takes an optional low-latency cache, which MUST be
// namespaced. The instanceid is used for namespacing, but might be
// unavailable at this point. Furthermore, it might not be possible to
// generate an instanceid via \OC_Util::getInstanceId() because the
// config file may not be writable. As such, we only register a class
// loader cache if instanceid is available without trying to create one.
- $instanceId = \OC::$server->getSystemConfig()->getValue('instanceid', null);
+ $instanceId = $systemConfig->getValue('instanceid', null);
if ($instanceId) {
try {
$memcacheFactory = \OC::$server->getMemCacheFactory();
@@ -948,7 +939,7 @@ class OC {
return;
}
if (substr($requestPath, -3) !== '.js') { // we need these files during the upgrade
- self::checkMaintenanceMode();
+ self::checkMaintenanceMode($systemConfig);
if (\OCP\Util::needUpgrade()) {
if (function_exists('opcache_reset')) {
@@ -999,7 +990,7 @@ class OC {
OC_App::loadApps(['filesystem', 'logging']);
OC_App::loadApps();
}
- OC::$server->get(\OC\Route\Router::class)->match(\OC::$server->getRequest()->getRawPathInfo());
+ OC::$server->get(\OC\Route\Router::class)->match($request->getRawPathInfo());
return;
} catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) {
//header('HTTP/1.0 404 Not Found');
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index b1068d1a4b2..6d93d8c1d51 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -944,6 +944,7 @@ return array(
'OC\\Core\\Migrations\\Version20000Date20201111081915' => $baseDir . '/core/Migrations/Version20000Date20201111081915.php',
'OC\\Core\\Migrations\\Version21000Date20201120141228' => $baseDir . '/core/Migrations/Version21000Date20201120141228.php',
'OC\\Core\\Migrations\\Version21000Date20201202095923' => $baseDir . '/core/Migrations/Version21000Date20201202095923.php',
+ 'OC\\Core\\Migrations\\Version21000Date20210119195004' => $baseDir . '/core/Migrations/Version21000Date20210119195004.php',
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',
@@ -1253,6 +1254,7 @@ return array(
'OC\\Preview\\TXT' => $baseDir . '/lib/private/Preview/TXT.php',
'OC\\Preview\\Watcher' => $baseDir . '/lib/private/Preview/Watcher.php',
'OC\\Preview\\WatcherConnector' => $baseDir . '/lib/private/Preview/WatcherConnector.php',
+ 'OC\\Preview\\WebP' => $baseDir . '/lib/private/Preview/WebP.php',
'OC\\Preview\\XBitmap' => $baseDir . '/lib/private/Preview/XBitmap.php',
'OC\\RedisFactory' => $baseDir . '/lib/private/RedisFactory.php',
'OC\\Remote\\Api\\ApiBase' => $baseDir . '/lib/private/Remote/Api/ApiBase.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index d1e11bbb09a..2b6aa27ea46 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -973,6 +973,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Core\\Migrations\\Version20000Date20201111081915' => __DIR__ . '/../../..' . '/core/Migrations/Version20000Date20201111081915.php',
'OC\\Core\\Migrations\\Version21000Date20201120141228' => __DIR__ . '/../../..' . '/core/Migrations/Version21000Date20201120141228.php',
'OC\\Core\\Migrations\\Version21000Date20201202095923' => __DIR__ . '/../../..' . '/core/Migrations/Version21000Date20201202095923.php',
+ 'OC\\Core\\Migrations\\Version21000Date20210119195004' => __DIR__ . '/../../..' . '/core/Migrations/Version21000Date20210119195004.php',
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',
@@ -1282,6 +1283,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Preview\\TXT' => __DIR__ . '/../../..' . '/lib/private/Preview/TXT.php',
'OC\\Preview\\Watcher' => __DIR__ . '/../../..' . '/lib/private/Preview/Watcher.php',
'OC\\Preview\\WatcherConnector' => __DIR__ . '/../../..' . '/lib/private/Preview/WatcherConnector.php',
+ 'OC\\Preview\\WebP' => __DIR__ . '/../../..' . '/lib/private/Preview/WebP.php',
'OC\\Preview\\XBitmap' => __DIR__ . '/../../..' . '/lib/private/Preview/XBitmap.php',
'OC\\RedisFactory' => __DIR__ . '/../../..' . '/lib/private/RedisFactory.php',
'OC\\Remote\\Api\\ApiBase' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiBase.php',
diff --git a/lib/l10n/es.js b/lib/l10n/es.js
index b8f5d958e55..dfc39ec74c5 100644
--- a/lib/l10n/es.js
+++ b/lib/l10n/es.js
@@ -167,7 +167,7 @@ OC.L10N.register(
"Oct." : "Oct.",
"Nov." : "Nov.",
"Dec." : "Dic.",
- "The user limit has been reached and the user was not created." : "Ha sido alcanzado el límite de usuarios y el usuario no fue creado.",
+ "The user limit has been reached and the user was not created." : "Ha sido alcanzado el límite de usuarios, por tanto el usuario no fue creado.",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Solo los siguientes caracteres están permitidos en un nombre de usuario: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"",
"A valid username must be provided" : "Se debe proporcionar un nombre de usuario válido",
"Username contains whitespace at the beginning or at the end" : "El nombre de usuario contiene espacios en blanco al principio o al final",
diff --git a/lib/l10n/es.json b/lib/l10n/es.json
index 45a3411570d..04dda45afe3 100644
--- a/lib/l10n/es.json
+++ b/lib/l10n/es.json
@@ -165,7 +165,7 @@
"Oct." : "Oct.",
"Nov." : "Nov.",
"Dec." : "Dic.",
- "The user limit has been reached and the user was not created." : "Ha sido alcanzado el límite de usuarios y el usuario no fue creado.",
+ "The user limit has been reached and the user was not created." : "Ha sido alcanzado el límite de usuarios, por tanto el usuario no fue creado.",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Solo los siguientes caracteres están permitidos en un nombre de usuario: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"",
"A valid username must be provided" : "Se debe proporcionar un nombre de usuario válido",
"Username contains whitespace at the beginning or at the end" : "El nombre de usuario contiene espacios en blanco al principio o al final",
diff --git a/lib/l10n/he.js b/lib/l10n/he.js
index ae304992bbe..1ba2c475a94 100644
--- a/lib/l10n/he.js
+++ b/lib/l10n/he.js
@@ -10,6 +10,7 @@ OC.L10N.register(
"The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server." : "הקבצים של היישומון %1$s לא מוקמו במקום הנכון. נא לוודא שזו גרסה שהשרת תומך בה.",
"Sample configuration detected" : "התגלתה דוגמת תצורה",
"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" : "התגלה שדוגמת התצורה הועתקה. דבר זה עלול לשבור את ההתקנה ולא נתמך.יש לקרוא את מסמכי התיעוד לפני שמבצעים שינויים ב- config.php",
+ "Other activities" : "פעילויות אחרות",
"Education Edition" : "מהדורה חינוכית",
"Enterprise bundle" : "מהדורה מסחרית",
"Groupware bundle" : "מהדורה קבוצתית",
@@ -17,10 +18,12 @@ OC.L10N.register(
"PHP %s or higher is required." : "נדרש PHP בגרסת %s ומעלה.",
"PHP with a version lower than %s is required." : "נדרש PHP בגרסה נמוכה מ- %s.",
"%sbit or higher PHP required." : "נדרש PHP בגרסת %s ומעלה.",
+ "The following architectures are supported: %s" : "קיימת תמיכה בתצורות המעבדים הבאות: %s",
"The following databases are supported: %s" : "יש תמיכה במסדי הנתונים הבאים: %s",
"The command line tool %s could not be found" : "כלי שורת הפקודה %s לא אותר",
"The library %s is not available." : "הספריה %s אינה זמינה.",
"Library %1$s with a version lower than %2$s is required - available version %3$s." : "נדרשת ספרייה %1$s עם גרסה מתחת ל־%2$s - הגרסה הזמינה היא %3$s.",
+ "The following platforms are supported: %s" : "קיימת תמיכה בפלטפורמות הבאות: %s",
"Server version %s or higher is required." : "נדרשת גרסה שרת %s ומעלה.",
"Server version %s or lower is required." : "נדרשת גרסה שרת %s ומטה.",
"Logged in user must be an admin" : "על המשתמש שנכנס להיות מנהל",
@@ -46,7 +49,7 @@ OC.L10N.register(
"_in %n minute_::_in %n minutes_" : ["בעוד דקה","בעוד 2 דקות","בעוד %n דקות","בעוד %n דקות"],
"_%n minute ago_::_%n minutes ago_" : ["לפני דקה","לפני 2 דקות","לפני %n דקות","לפני %n דקות"],
"in a few seconds" : "בעוד מספר שניות",
- "seconds ago" : "שניות",
+ "seconds ago" : "לפני מספר שניות",
"Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator." : "המודול עם המזהה: %s לא קיים. נא להפעיל אותו בהגדרות היישומונים שלך או ליצור קשר עם מנהל המערכת.",
"File name is a reserved word" : "שם קובץ הוא מילה שמורה",
"File name contains at least one invalid character" : "שם הקובץ כולל לפחות תו אחד לא חוקי",
@@ -68,6 +71,7 @@ OC.L10N.register(
"%s enter the database username." : "%s נכנס למסד נתוני שמות המשתמשים.",
"%s enter the database name." : "%s נכנס למסד נתוני השמות.",
"%s you may not use dots in the database name" : "%s לא ניתן להשתמש בנקודות בשם מסד הנתונים",
+ "MySQL username and/or password not valid" : "שם המשתמש ו/או הססמה של MySQL אינם תקינים",
"You need to enter details of an existing account." : "עליך להקליד פרטים של חשבון קיים.",
"Oracle connection could not be established" : "לא ניתן היה ליצור חיבור Oracle",
"Oracle username and/or password not valid" : "שם משתמש ו/או סיסמת Oracle אינם תקפים",
@@ -141,10 +145,12 @@ OC.L10N.register(
"Oct." : "אוק׳",
"Nov." : "נוב׳",
"Dec." : "דצמ׳",
+ "The user limit has been reached and the user was not created." : "הגעת למגבלת המשתמשים והמשתמש לא נוצר.",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "רק התווים הבאים מאושרים לשם משתמש: \"a-z\", \"A-Z\", \"0-9\", וגם \"_.@-'\"",
"A valid username must be provided" : "יש לספק שם משתמש תקני",
"Username contains whitespace at the beginning or at the end" : "שם המשתמש מכיל רווח בתחילתו או בסופו",
"Username must not consist of dots only" : "שם המשתמש לא יכול להיות מורכב מנקודות בלבד",
+ "Username is invalid because files already exist for this user" : "שם המשתמש שגוי כיוון שכבר קיימים קבצים למשתמש הזה",
"A valid password must be provided" : "יש לספק ססמה תקנית",
"The username is already being used" : "השם משתמש כבר בשימוש",
"Could not create user" : "לא ניתן ליצור משתמש",
diff --git a/lib/l10n/he.json b/lib/l10n/he.json
index 0b1fc1917cf..90f61059bae 100644
--- a/lib/l10n/he.json
+++ b/lib/l10n/he.json
@@ -8,6 +8,7 @@
"The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server." : "הקבצים של היישומון %1$s לא מוקמו במקום הנכון. נא לוודא שזו גרסה שהשרת תומך בה.",
"Sample configuration detected" : "התגלתה דוגמת תצורה",
"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" : "התגלה שדוגמת התצורה הועתקה. דבר זה עלול לשבור את ההתקנה ולא נתמך.יש לקרוא את מסמכי התיעוד לפני שמבצעים שינויים ב- config.php",
+ "Other activities" : "פעילויות אחרות",
"Education Edition" : "מהדורה חינוכית",
"Enterprise bundle" : "מהדורה מסחרית",
"Groupware bundle" : "מהדורה קבוצתית",
@@ -15,10 +16,12 @@
"PHP %s or higher is required." : "נדרש PHP בגרסת %s ומעלה.",
"PHP with a version lower than %s is required." : "נדרש PHP בגרסה נמוכה מ- %s.",
"%sbit or higher PHP required." : "נדרש PHP בגרסת %s ומעלה.",
+ "The following architectures are supported: %s" : "קיימת תמיכה בתצורות המעבדים הבאות: %s",
"The following databases are supported: %s" : "יש תמיכה במסדי הנתונים הבאים: %s",
"The command line tool %s could not be found" : "כלי שורת הפקודה %s לא אותר",
"The library %s is not available." : "הספריה %s אינה זמינה.",
"Library %1$s with a version lower than %2$s is required - available version %3$s." : "נדרשת ספרייה %1$s עם גרסה מתחת ל־%2$s - הגרסה הזמינה היא %3$s.",
+ "The following platforms are supported: %s" : "קיימת תמיכה בפלטפורמות הבאות: %s",
"Server version %s or higher is required." : "נדרשת גרסה שרת %s ומעלה.",
"Server version %s or lower is required." : "נדרשת גרסה שרת %s ומטה.",
"Logged in user must be an admin" : "על המשתמש שנכנס להיות מנהל",
@@ -44,7 +47,7 @@
"_in %n minute_::_in %n minutes_" : ["בעוד דקה","בעוד 2 דקות","בעוד %n דקות","בעוד %n דקות"],
"_%n minute ago_::_%n minutes ago_" : ["לפני דקה","לפני 2 דקות","לפני %n דקות","לפני %n דקות"],
"in a few seconds" : "בעוד מספר שניות",
- "seconds ago" : "שניות",
+ "seconds ago" : "לפני מספר שניות",
"Module with ID: %s does not exist. Please enable it in your apps settings or contact your administrator." : "המודול עם המזהה: %s לא קיים. נא להפעיל אותו בהגדרות היישומונים שלך או ליצור קשר עם מנהל המערכת.",
"File name is a reserved word" : "שם קובץ הוא מילה שמורה",
"File name contains at least one invalid character" : "שם הקובץ כולל לפחות תו אחד לא חוקי",
@@ -66,6 +69,7 @@
"%s enter the database username." : "%s נכנס למסד נתוני שמות המשתמשים.",
"%s enter the database name." : "%s נכנס למסד נתוני השמות.",
"%s you may not use dots in the database name" : "%s לא ניתן להשתמש בנקודות בשם מסד הנתונים",
+ "MySQL username and/or password not valid" : "שם המשתמש ו/או הססמה של MySQL אינם תקינים",
"You need to enter details of an existing account." : "עליך להקליד פרטים של חשבון קיים.",
"Oracle connection could not be established" : "לא ניתן היה ליצור חיבור Oracle",
"Oracle username and/or password not valid" : "שם משתמש ו/או סיסמת Oracle אינם תקפים",
@@ -139,10 +143,12 @@
"Oct." : "אוק׳",
"Nov." : "נוב׳",
"Dec." : "דצמ׳",
+ "The user limit has been reached and the user was not created." : "הגעת למגבלת המשתמשים והמשתמש לא נוצר.",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "רק התווים הבאים מאושרים לשם משתמש: \"a-z\", \"A-Z\", \"0-9\", וגם \"_.@-'\"",
"A valid username must be provided" : "יש לספק שם משתמש תקני",
"Username contains whitespace at the beginning or at the end" : "שם המשתמש מכיל רווח בתחילתו או בסופו",
"Username must not consist of dots only" : "שם המשתמש לא יכול להיות מורכב מנקודות בלבד",
+ "Username is invalid because files already exist for this user" : "שם המשתמש שגוי כיוון שכבר קיימים קבצים למשתמש הזה",
"A valid password must be provided" : "יש לספק ססמה תקנית",
"The username is already being used" : "השם משתמש כבר בשימוש",
"Could not create user" : "לא ניתן ליצור משתמש",
diff --git a/lib/l10n/pt_BR.js b/lib/l10n/pt_BR.js
index 8e99127b62c..33186b7f293 100644
--- a/lib/l10n/pt_BR.js
+++ b/lib/l10n/pt_BR.js
@@ -167,6 +167,7 @@ OC.L10N.register(
"Oct." : "Out.",
"Nov." : "Nov.",
"Dec." : "Dez.",
+ "The user limit has been reached and the user was not created." : "O limite de usuários foi atingido e o usuário não foi criado.",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Somente os seguintes caracteres são permitidos em um nome de usuário: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-'\"",
"A valid username must be provided" : "Um nome de usuário válido deve ser fornecido",
"Username contains whitespace at the beginning or at the end" : "O nome de usuário contém espaço em branco no início ou no fim",
diff --git a/lib/l10n/pt_BR.json b/lib/l10n/pt_BR.json
index d33c4f9d7dd..73ba5f793ba 100644
--- a/lib/l10n/pt_BR.json
+++ b/lib/l10n/pt_BR.json
@@ -165,6 +165,7 @@
"Oct." : "Out.",
"Nov." : "Nov.",
"Dec." : "Dez.",
+ "The user limit has been reached and the user was not created." : "O limite de usuários foi atingido e o usuário não foi criado.",
"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-'\"" : "Somente os seguintes caracteres são permitidos em um nome de usuário: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-'\"",
"A valid username must be provided" : "Um nome de usuário válido deve ser fornecido",
"Username contains whitespace at the beginning or at the end" : "O nome de usuário contém espaço em branco no início ou no fim",
diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php
index 4dc517879e8..70bf2a37d9d 100644
--- a/lib/private/App/AppStore/Fetcher/AppFetcher.php
+++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php
@@ -113,12 +113,12 @@ class AppFetcher extends Fetcher {
$phpVersion = $versionParser->getVersion($release['rawPhpVersionSpec']);
$minPhpVersion = $phpVersion->getMinimumVersion();
$maxPhpVersion = $phpVersion->getMaximumVersion();
- $minPhpFulfilled = $minPhpVersion === '' || $this->compareVersion->isCompatible(
+ $minPhpFulfilled = $minPhpVersion === '' || version_compare(
PHP_VERSION,
$minPhpVersion,
'>='
);
- $maxPhpFulfilled = $maxPhpVersion === '' || $this->compareVersion->isCompatible(
+ $maxPhpFulfilled = $maxPhpVersion === '' || version_compare(
PHP_VERSION,
$maxPhpVersion,
'<='
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index 81d1d083eb8..944b0b69959 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -86,7 +86,10 @@ class Local extends \OC\Files\Storage\Common {
}
public function mkdir($path) {
- return @mkdir($this->getSourcePath($path), 0777, true);
+ $sourcePath = $this->getSourcePath($path);
+ $result = @mkdir($sourcePath, 0777, true);
+ chmod($sourcePath, 0755);
+ return $result;
}
public function rmdir($path) {
diff --git a/lib/private/Installer.php b/lib/private/Installer.php
index 6dfc9a5f0bb..2a0fdab87ff 100644
--- a/lib/private/Installer.php
+++ b/lib/private/Installer.php
@@ -216,6 +216,18 @@ class Installer {
}
/**
+ * Split the certificate file in individual certs
+ *
+ * @param string $cert
+ * @return string[]
+ */
+ private function splitCerts(string $cert): array {
+ preg_match_all('([\-]{3,}[\S\ ]+?[\-]{3,}[\S\s]+?[\-]{3,}[\S\ ]+?[\-]{3,})', $cert, $matches);
+
+ return $matches[0];
+ }
+
+ /**
* Downloads an app and puts it into the app directory
*
* @param string $appId
@@ -231,12 +243,18 @@ class Installer {
if ($app['id'] === $appId) {
// Load the certificate
$certificate = new X509();
- $certificate->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'));
+ $rootCrt = file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt');
+ $rootCrts = $this->splitCerts($rootCrt);
+ foreach ($rootCrts as $rootCrt) {
+ $certificate->loadCA($rootCrt);
+ }
$loadedCertificate = $certificate->loadX509($app['certificate']);
// Verify if the certificate has been revoked
$crl = new X509();
- $crl->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'));
+ foreach ($rootCrts as $rootCrt) {
+ $crl->loadCA($rootCrt);
+ }
$crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl'));
if ($crl->validateSignature() !== true) {
throw new \Exception('Could not validate CRL signature');
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php
index 504cd391c42..122fac8927f 100644
--- a/lib/private/IntegrityCheck/Checker.php
+++ b/lib/private/IntegrityCheck/Checker.php
@@ -44,7 +44,6 @@ use OCP\Files\IMimeTypeDetector;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
-use OCP\ITempManager;
use phpseclib\Crypt\RSA;
use phpseclib\File\X509;
@@ -66,14 +65,12 @@ class Checker {
private $appLocator;
/** @var FileAccessHelper */
private $fileAccessHelper;
- /** @var IConfig */
+ /** @var IConfig|null */
private $config;
/** @var ICache */
private $cache;
- /** @var IAppManager */
+ /** @var IAppManager|null */
private $appManager;
- /** @var ITempManager */
- private $tempManager;
/** @var IMimeTypeDetector */
private $mimeTypeDetector;
@@ -81,19 +78,17 @@ class Checker {
* @param EnvironmentHelper $environmentHelper
* @param FileAccessHelper $fileAccessHelper
* @param AppLocator $appLocator
- * @param IConfig $config
+ * @param IConfig|null $config
* @param ICacheFactory $cacheFactory
- * @param IAppManager $appManager
- * @param ITempManager $tempManager
+ * @param IAppManager|null $appManager
* @param IMimeTypeDetector $mimeTypeDetector
*/
public function __construct(EnvironmentHelper $environmentHelper,
FileAccessHelper $fileAccessHelper,
AppLocator $appLocator,
- IConfig $config = null,
+ ?IConfig $config,
ICacheFactory $cacheFactory,
- IAppManager $appManager = null,
- ITempManager $tempManager,
+ ?IAppManager $appManager,
IMimeTypeDetector $mimeTypeDetector) {
$this->environmentHelper = $environmentHelper;
$this->fileAccessHelper = $fileAccessHelper;
@@ -101,7 +96,6 @@ class Checker {
$this->config = $config;
$this->cache = $cacheFactory->createDistributed(self::CACHE_KEY);
$this->appManager = $appManager;
- $this->tempManager = $tempManager;
$this->mimeTypeDetector = $mimeTypeDetector;
}
@@ -306,17 +300,30 @@ class Checker {
}
/**
+ * Split the certificate file in individual certs
+ *
+ * @param string $cert
+ * @return string[]
+ */
+ private function splitCerts(string $cert): array {
+ preg_match_all('([\-]{3,}[\S\ ]+?[\-]{3,}[\S\s]+?[\-]{3,}[\S\ ]+?[\-]{3,})', $cert, $matches);
+
+ return $matches[0];
+ }
+
+ /**
* Verifies the signature for the specified path.
*
* @param string $signaturePath
* @param string $basePath
* @param string $certificateCN
+ * @param bool $forceVerify
* @return array
* @throws InvalidSignatureException
* @throws \Exception
*/
- private function verify(string $signaturePath, string $basePath, string $certificateCN): array {
- if (!$this->isCodeCheckEnforced()) {
+ private function verify(string $signaturePath, string $basePath, string $certificateCN, bool $forceVerify = false): array {
+ if (!$forceVerify && !$this->isCodeCheckEnforced()) {
return [];
}
@@ -338,7 +345,11 @@ class Checker {
// Check if certificate is signed by Nextcloud Root Authority
$x509 = new \phpseclib\File\X509();
$rootCertificatePublicKey = $this->fileAccessHelper->file_get_contents($this->environmentHelper->getServerRoot().'/resources/codesigning/root.crt');
- $x509->loadCA($rootCertificatePublicKey);
+
+ $rootCerts = $this->splitCerts($rootCertificatePublicKey);
+ foreach ($rootCerts as $rootCert) {
+ $x509->loadCA($rootCert);
+ }
$x509->loadX509($certificate);
if (!$x509->validateSignature()) {
throw new InvalidSignatureException('Certificate is not valid.');
@@ -495,9 +506,10 @@ class Checker {
*
* @param string $appId
* @param string $path Optional path. If none is given it will be guessed.
+ * @param bool $forceVerify
* @return array
*/
- public function verifyAppSignature(string $appId, string $path = ''): array {
+ public function verifyAppSignature(string $appId, string $path = '', bool $forceVerify = false): array {
try {
if ($path === '') {
$path = $this->appLocator->getAppPath($appId);
@@ -505,7 +517,8 @@ class Checker {
$result = $this->verify(
$path . '/appinfo/signature.json',
$path,
- $appId
+ $appId,
+ $forceVerify
);
} catch (\Exception $e) {
$result = [
diff --git a/lib/private/Log/ExceptionSerializer.php b/lib/private/Log/ExceptionSerializer.php
index ae3e6ba100d..b62293946d0 100644
--- a/lib/private/Log/ExceptionSerializer.php
+++ b/lib/private/Log/ExceptionSerializer.php
@@ -82,6 +82,7 @@ class ExceptionSerializer {
// Encryption
'storeKeyPair',
'setupUser',
+ 'checkSignature',
// files_external: OCA\Files_External\MountConfig
'getBackendStatus',
diff --git a/lib/private/Preview/MarkDown.php b/lib/private/Preview/MarkDown.php
index 91e276eb170..54648ac1837 100644
--- a/lib/private/Preview/MarkDown.php
+++ b/lib/private/Preview/MarkDown.php
@@ -24,6 +24,9 @@
namespace OC\Preview;
+use OCP\Files\File;
+use OCP\IImage;
+
class MarkDown extends TXT {
/**
* {@inheritDoc}
@@ -31,4 +34,111 @@ class MarkDown extends TXT {
public function getMimeType(): string {
return '/text\/(x-)?markdown/';
}
+
+ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
+ $content = $file->fopen('r');
+
+ if ($content === false) {
+ return null;
+ }
+
+ $content = stream_get_contents($content,3000);
+
+ //don't create previews of empty text files
+ if (trim($content) === '') {
+ return null;
+ }
+
+ // Merge text paragraph lines that might belong together
+ $content = preg_replace('/^(\s*)\*\s/mU', '$1- ', $content);
+
+ $content = preg_replace('/((?!^(\s*-|#)).*)(\w|\\|\.)(\r\n|\n|\r)(\w|\*)/mU', '$1 $3', $content);
+
+ // Remove markdown symbols that we cannot easily represent in rendered text in the preview
+ $content = preg_replace('/\*\*(.*)\*\*/U', '$1', $content);
+ $content = preg_replace('/\*(.*)\*/U', '$1', $content);
+ $content = preg_replace('/\_\_(.*)\_\_/U', '$1', $content);
+ $content = preg_replace('/\_(.*)\_/U', '$1', $content);
+ $content = preg_replace('/\~\~(.*)\~\~/U', '$1', $content);
+
+ $content = preg_replace('/\!?\[((.|\n)*)\]\((.*)\)/mU', '$1 ($3)', $content);
+ $content = preg_replace('/\n\n+/', "\n", $content);
+
+ $content = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $content);
+
+ $lines = preg_split("/\r\n|\n|\r/", $content);
+
+ // Define text size of text file preview
+ $fontSize = $maxX ? (int) ((1 / ($maxX >= 512 ? 60 : 40) * $maxX)) : 10;
+
+ $image = imagecreate($maxX, $maxY);
+ imagecolorallocate($image, 255, 255, 255);
+ $textColor = imagecolorallocate($image, 0, 0, 0);
+
+ $fontFile = __DIR__ . '/../../../core/fonts/NotoSans-Regular.ttf';
+ $fontFileBold = __DIR__ . '/../../../core/fonts/NotoSans-Bold.ttf';
+
+ $canUseTTF = function_exists('imagettftext');
+
+ $textOffset = (int)min($maxX * 0.05, $maxY * 0.05);
+ $nextLineStart = 0;
+ $y = $textOffset;
+ foreach ($lines as $line) {
+ $actualFontSize = $fontSize;
+ if (mb_strpos($line, '# ') === 0) {
+ $actualFontSize *= 2;
+ }
+ if (mb_strpos($line, '## ') === 0) {
+ $actualFontSize *= 1.8;
+ }
+ if (mb_strpos($line, '### ') === 0) {
+ $actualFontSize *= 1.6;
+ }
+ if (mb_strpos($line, '#### ') === 0) {
+ $actualFontSize *= 1.4;
+ }
+ if (mb_strpos($line, '##### ') === 0) {
+ $actualFontSize *= 1.2;
+ }
+ if (mb_strpos($line, '###### ') === 0) {
+ $actualFontSize *= 1.1;
+ }
+
+ // Add spacing before headlines
+ if ($actualFontSize !== $fontSize && $y !== $textOffset) {
+ $y += (int)($actualFontSize * 2);
+ }
+
+ $x = $textOffset;
+ $y += (int)($nextLineStart + $actualFontSize);
+
+ if ($canUseTTF === true) {
+ $wordWrap = (int)((1 / $actualFontSize * 1.3) * $maxX);
+
+ // Get rid of markdown symbols that we still needed for the font size
+ $line = preg_replace('/^#*\s/', '', $line);
+
+ $wrappedText = wordwrap($line, $wordWrap,"\n");
+ $linesWrapped = count(explode("\n", $wrappedText));
+ imagettftext($image, $actualFontSize, 0, $x, $y, $textColor, $actualFontSize === $fontSize ? $fontFile : $fontFileBold, $wrappedText);
+ $nextLineStart = (int)($linesWrapped * ceil($actualFontSize * 2));
+ if ($actualFontSize !== $fontSize && $y !== $textOffset) {
+ $nextLineStart -= $actualFontSize;
+ }
+ } else {
+ $y -= (int)$fontSize;
+ imagestring($image, 1, $x, $y, $line, $textColor);
+ $nextLineStart = $fontSize;
+ }
+
+ if ($y >= $maxY) {
+ break;
+ }
+ }
+
+ $imageObject = new \OC_Image();
+ $imageObject->setResource($image);
+
+ return $imageObject->valid() ? $imageObject : null;
+ }
}
diff --git a/lib/private/Preview/WebP.php b/lib/private/Preview/WebP.php
new file mode 100644
index 00000000000..8f10a08206b
--- /dev/null
+++ b/lib/private/Preview/WebP.php
@@ -0,0 +1,42 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Preview;
+
+use OCP\Files\FileInfo;
+
+class WebP extends Image {
+ /**
+ * {@inheritDoc}
+ */
+ public function getMimeType(): string {
+ return '/image\/webp/';
+ }
+
+ public function isAvailable(FileInfo $file): bool {
+ return (bool)(imagetypes() && IMG_WEBP);
+ }
+}
diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php
index 8fa0fc92da5..1d65da8ca59 100644
--- a/lib/private/PreviewManager.php
+++ b/lib/private/PreviewManager.php
@@ -58,7 +58,7 @@ class PreviewManager implements IPreview {
/** @var Generator */
private $generator;
-
+
/** @var GeneratorHelper */
private $helper;
@@ -314,6 +314,7 @@ class PreviewManager implements IPreview {
Preview\HEIC::class,
Preview\XBitmap::class,
Preview\Krita::class,
+ Preview\WebP::class,
];
$this->defaultProviders = $this->config->getSystemValue('enabledPreviewProviders', array_merge([
@@ -360,6 +361,7 @@ class PreviewManager implements IPreview {
$this->registerCoreProvider(Preview\GIF::class, '/image\/gif/');
$this->registerCoreProvider(Preview\BMP::class, '/image\/bmp/');
$this->registerCoreProvider(Preview\XBitmap::class, '/image\/x-xbitmap/');
+ $this->registerCoreProvider(Preview\WebP::class, '/image\/webp/');
$this->registerCoreProvider(Preview\Krita::class, '/application\/x-krita/');
$this->registerCoreProvider(Preview\MP3::class, '/audio\/mpeg/');
$this->registerCoreProvider(Preview\OpenDocument::class, '/application\/vnd.oasis.opendocument.*/');
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 680eea3beca..ba954165799 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -575,7 +575,7 @@ class Server extends ServerContainer implements IServerContainer {
/** @var IEventDispatcher $dispatcher */
$dispatcher = $this->get(IEventDispatcher::class);
- $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin));
+ $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $loginName, $password, $isTokenLogin));
});
$userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) {
/** @var IEventDispatcher $dispatcher */
@@ -942,7 +942,6 @@ class Server extends ServerContainer implements IServerContainer {
$config,
$c->get(ICacheFactory::class),
$appManager,
- $c->get(ITempManager::class),
$c->get(IMimeTypeDetector::class)
);
});
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php
index 21339dc46d0..229d47160f5 100644
--- a/lib/private/Setup/MySQL.php
+++ b/lib/private/Setup/MySQL.php
@@ -36,6 +36,7 @@ use OC\DB\MySqlTools;
use OCP\IDBConnection;
use OCP\ILogger;
use Doctrine\DBAL\Platforms\MySQL80Platform;
+use OCP\Security\ISecureRandom;
class MySQL extends AbstractDatabase {
public $dbprettyname = 'MySQL/MariaDB';
@@ -165,7 +166,7 @@ class MySQL extends AbstractDatabase {
$this->dbUser = $adminUser;
//create a random password so we don't need to store the admin password in the config file
- $this->dbPassword = $this->random->generate(30);
+ $this->dbPassword = $this->random->generate(30, ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER);
$this->createDBUser($connection);
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index b97413aa922..f1b9101045a 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -555,7 +555,7 @@ class OC_Image implements \OCP\IImage {
*/
public function loadFromFile($imagePath = false) {
// exif_imagetype throws "read error!" if file is less than 12 byte
- if (!@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) {
+ if (is_bool($imagePath) || !@is_file($imagePath) || !file_exists($imagePath) || filesize($imagePath) < 12 || !is_readable($imagePath)) {
return false;
}
$iType = exif_imagetype($imagePath);
@@ -608,6 +608,13 @@ class OC_Image implements \OCP\IImage {
case IMAGETYPE_BMP:
$this->resource = $this->imagecreatefrombmp($imagePath);
break;
+ case IMAGETYPE_WEBP:
+ if (imagetypes() & IMG_WEBP) {
+ $this->resource = @imagecreatefromwebp($imagePath);
+ } else {
+ $this->logger->debug('OC_Image->loadFromFile, webp images not supported: ' . $imagePath, ['app' => 'core']);
+ }
+ break;
/*
case IMAGETYPE_TIFF_II: // (intel byte order)
break;
diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
index 002db267293..197275fb8e3 100644
--- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
+++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
@@ -119,7 +119,8 @@ interface IRegistrationContext {
* @psalm-param string|class-string<T> $event preferably the fully-qualified class name of the Event sub class to listen for
* @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
* @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $listener fully qualified class name that can be built by the DI container
- * @param int $priority
+ * @param int $priority The higher this value, the earlier an event
+ * listener will be triggered in the chain (defaults to 0)
*
* @see IEventDispatcher::addServiceListener()
*
diff --git a/lib/public/EventDispatcher/IEventDispatcher.php b/lib/public/EventDispatcher/IEventDispatcher.php
index 6f3adf159c0..f38c0828bce 100644
--- a/lib/public/EventDispatcher/IEventDispatcher.php
+++ b/lib/public/EventDispatcher/IEventDispatcher.php
@@ -40,7 +40,8 @@ interface IEventDispatcher {
* @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class
* @param callable $listener the object that is invoked when a matching event is dispatched
* @psalm-param callable(T):void $listener
- * @param int $priority
+ * @param int $priority The higher this value, the earlier an event
+ * listener will be triggered in the chain (defaults to 0)
*
* @since 17.0.0
*/
@@ -63,7 +64,8 @@ interface IEventDispatcher {
* @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class to listen for
* @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
* @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $className fully qualified class name that can be built by the DI container
- * @param int $priority
+ * @param int $priority The higher this value, the earlier an event
+ * listener will be triggered in the chain (defaults to 0)
*
* @since 17.0.0
*/
diff --git a/lib/public/User/Events/UserLoggedInEvent.php b/lib/public/User/Events/UserLoggedInEvent.php
index e2cb37a64dc..7d0c0bf41de 100644
--- a/lib/public/User/Events/UserLoggedInEvent.php
+++ b/lib/public/User/Events/UserLoggedInEvent.php
@@ -43,14 +43,18 @@ class UserLoggedInEvent extends Event {
/** @var bool */
private $isTokenLogin;
+ /** @var string */
+ private $loginName;
+
/**
* @since 18.0.0
*/
- public function __construct(IUser $user, string $password, bool $isTokenLogin) {
+ public function __construct(IUser $user, string $loginName, string $password, bool $isTokenLogin) {
parent::__construct();
$this->user = $user;
$this->password = $password;
$this->isTokenLogin = $isTokenLogin;
+ $this->loginName = $loginName;
}
/**
@@ -61,6 +65,13 @@ class UserLoggedInEvent extends Event {
}
/**
+ * @since 21.0.0
+ */
+ public function getLoginName(): string {
+ return $this->loginName;
+ }
+
+ /**
* @since 18.0.0
*/
public function getPassword(): string {