summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php8
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php1
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php19
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php1
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php1
-rw-r--r--lib/private/Memcache/Memcached.php23
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php11
-rw-r--r--lib/private/TemplateLayout.php4
-rw-r--r--lib/public/DB/QueryBuilder/IExpressionBuilder.php1
9 files changed, 44 insertions, 25 deletions
diff --git a/lib/base.php b/lib/base.php
index 0f08102c81f..6578d506796 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -365,10 +365,10 @@ class OC {
$oldTheme = $systemConfig->getValue('theme');
$systemConfig->setValue('theme', '');
- OC_Util::addScript('core', 'common');
- OC_Util::addScript('core', 'main');
- OC_Util::addTranslations('core');
- OC_Util::addScript('update', null, 'core');
+ \OCP\Util::addScript('core', 'common');
+ \OCP\Util::addScript('core', 'main');
+ \OCP\Util::addTranslations('core');
+ \OCP\Util::addScript('core', 'update');
/** @var \OC\App\AppManager $appManager */
$appManager = \OC::$server->getAppManager();
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
index 77a4a02128a..ae4f19f5d18 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
@@ -427,6 +427,7 @@ class ExpressionBuilder implements IExpressionBuilder {
*
* @param string|IQueryFunction $column
* @param mixed $type One of IQueryBuilder::PARAM_*
+ * @psalm-param IQueryBuilder::PARAM_* $type
* @return IQueryFunction
*/
public function castColumn($column, $type): IQueryFunction {
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
index e917ad3ad3a..3bb54d4b26e 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/MySqlExpressionBuilder.php
@@ -26,7 +26,9 @@
namespace OC\DB\QueryBuilder\ExpressionBuilder;
use OC\DB\ConnectionAdapter;
+use OC\DB\QueryBuilder\QueryFunction;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\DB\QueryBuilder\IQueryFunction;
class MySqlExpressionBuilder extends ExpressionBuilder {
@@ -52,4 +54,21 @@ class MySqlExpressionBuilder extends ExpressionBuilder {
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->collation . ' LIKE', $y);
}
+
+ /**
+ * Returns a IQueryFunction that casts the column to the given type
+ *
+ * @param string|IQueryFunction $column
+ * @param mixed $type One of IQueryBuilder::PARAM_*
+ * @psalm-param IQueryBuilder::PARAM_* $type
+ * @return IQueryFunction
+ */
+ public function castColumn($column, $type): IQueryFunction {
+ switch ($type) {
+ case IQueryBuilder::PARAM_STR:
+ return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS CHAR)');
+ default:
+ return parent::castColumn($column, $type);
+ }
+ }
}
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php
index 4cea234779e..f9b58d7d8ed 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php
@@ -163,6 +163,7 @@ class OCIExpressionBuilder extends ExpressionBuilder {
*
* @param string|IQueryFunction $column
* @param mixed $type One of IQueryBuilder::PARAM_*
+ * @psalm-param IQueryBuilder::PARAM_* $type
* @return IQueryFunction
*/
public function castColumn($column, $type): IQueryFunction {
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php
index 4e0de5ef42b..0fba5363a28 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php
@@ -35,6 +35,7 @@ class PgSqlExpressionBuilder extends ExpressionBuilder {
*
* @param string|IQueryFunction $column
* @param mixed $type One of IQueryBuilder::PARAM_*
+ * @psalm-param IQueryBuilder::PARAM_* $type
* @return IQueryFunction
*/
public function castColumn($column, $type): IQueryFunction {
diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php
index 50f3fa66ab3..08880451a73 100644
--- a/lib/private/Memcache/Memcached.php
+++ b/lib/private/Memcache/Memcached.php
@@ -134,27 +134,8 @@ class Memcached extends Cache implements IMemcache {
}
public function clear($prefix = '') {
- $prefix = $this->getNameSpace() . $prefix;
- $allKeys = self::$cache->getAllKeys();
- if ($allKeys === false) {
- // newer Memcached doesn't like getAllKeys(), flush everything
- self::$cache->flush();
- return true;
- }
- $keys = [];
- $prefixLength = strlen($prefix);
- foreach ($allKeys as $key) {
- if (substr($key, 0, $prefixLength) === $prefix) {
- $keys[] = $key;
- }
- }
- if (method_exists(self::$cache, 'deleteMulti')) {
- self::$cache->deleteMulti($keys);
- } else {
- foreach ($keys as $key) {
- self::$cache->delete($key);
- }
- }
+ // Newer Memcached doesn't like getAllKeys(), flush everything
+ self::$cache->flush();
return true;
}
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index fa4c58e4559..abbe77c6637 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -354,9 +354,20 @@ class Throttler {
public function sleepDelayOrThrowOnMax(string $ip, string $action = ''): int {
$delay = $this->getDelay($ip, $action);
if (($delay === self::MAX_DELAY_MS) && $this->getAttempts($ip, $action, 0.5) > self::MAX_ATTEMPTS) {
+ $this->logger->info('IP address blocked because it reached the maximum failed attempts in the last 30 minutes [action: {action}, ip: {ip}]', [
+ 'action' => $action,
+ 'ip' => $ip,
+ ]);
// If the ip made too many attempts within the last 30 mins we don't execute anymore
throw new MaxDelayReached('Reached maximum delay');
}
+ if ($delay > 100) {
+ $this->logger->info('IP address throttled because it reached the attempts limit in the last 30 minutes [action: {action}, delay: {delay}, ip: {ip}]', [
+ 'action' => $action,
+ 'ip' => $ip,
+ 'delay' => $delay,
+ ]);
+ }
usleep($delay * 1000);
return $delay;
}
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 9cfc1aec6dd..d7a86ff92bf 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -98,6 +98,10 @@ class TemplateLayout extends \OC_Template {
$this->initialState->provideInitialState('unified-search', 'limit-default', SearchQuery::LIMIT_DEFAULT);
Util::addScript('core', 'unified-search', 'core');
+ // set logo link target
+ $logoUrl = $this->config->getSystemValueString('logo_url', '');
+ $this->assign('logoUrl', $logoUrl);
+
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
diff --git a/lib/public/DB/QueryBuilder/IExpressionBuilder.php b/lib/public/DB/QueryBuilder/IExpressionBuilder.php
index 4758fd06208..53dc1fa5a7f 100644
--- a/lib/public/DB/QueryBuilder/IExpressionBuilder.php
+++ b/lib/public/DB/QueryBuilder/IExpressionBuilder.php
@@ -433,6 +433,7 @@ interface IExpressionBuilder {
*
* @param string|IQueryFunction $column
* @param mixed $type One of IQueryBuilder::PARAM_*
+ * @psalm-param IQueryBuilder::PARAM_* $type
* @return IQueryFunction
* @since 9.0.0
*