summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/l10n/fr.js2
-rw-r--r--lib/l10n/fr.json2
-rw-r--r--lib/l10n/sv.js2
-rw-r--r--lib/l10n/sv.json2
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php12
-rw-r--r--lib/private/Files/Cache/Propagator.php19
-rw-r--r--lib/private/Files/Storage/Common.php3
-rw-r--r--lib/private/Files/View.php2
-rw-r--r--lib/private/Repair.php2
-rw-r--r--lib/private/Repair/NC15/SetVcardDatabaseUID.php31
-rw-r--r--lib/private/RichObjectStrings/Validator.php10
-rw-r--r--lib/private/Share20/DefaultShareProvider.php1
-rw-r--r--lib/private/legacy/util.php2
-rw-r--r--lib/public/AppFramework/Db/DoesNotExistException.php3
-rw-r--r--lib/public/AppFramework/Db/IMapperException.php30
-rw-r--r--lib/public/AppFramework/Db/MultipleObjectsReturnedException.php3
18 files changed, 101 insertions, 27 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index a365ae15c67..29910544895 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -26,6 +26,7 @@ return array(
'OCP\\AppFramework\\Controller' => $baseDir . '/lib/public/AppFramework/Controller.php',
'OCP\\AppFramework\\Db\\DoesNotExistException' => $baseDir . '/lib/public/AppFramework/Db/DoesNotExistException.php',
'OCP\\AppFramework\\Db\\Entity' => $baseDir . '/lib/public/AppFramework/Db/Entity.php',
+ 'OCP\\AppFramework\\Db\\IMapperException' => $baseDir . '/lib/public/AppFramework/Db/IMapperException.php',
'OCP\\AppFramework\\Db\\Mapper' => $baseDir . '/lib/public/AppFramework/Db/Mapper.php',
'OCP\\AppFramework\\Db\\MultipleObjectsReturnedException' => $baseDir . '/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php',
'OCP\\AppFramework\\Db\\QBMapper' => $baseDir . '/lib/public/AppFramework/Db/QBMapper.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index a85163c6dde..d476460c827 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -56,6 +56,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\AppFramework\\Controller' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Controller.php',
'OCP\\AppFramework\\Db\\DoesNotExistException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Db/DoesNotExistException.php',
'OCP\\AppFramework\\Db\\Entity' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Db/Entity.php',
+ 'OCP\\AppFramework\\Db\\IMapperException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Db/IMapperException.php',
'OCP\\AppFramework\\Db\\Mapper' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Db/Mapper.php',
'OCP\\AppFramework\\Db\\MultipleObjectsReturnedException' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php',
'OCP\\AppFramework\\Db\\QBMapper' => __DIR__ . '/../../..' . '/lib/public/AppFramework/Db/QBMapper.php',
diff --git a/lib/l10n/fr.js b/lib/l10n/fr.js
index 0625fadf008..4154f32bdaa 100644
--- a/lib/l10n/fr.js
+++ b/lib/l10n/fr.js
@@ -195,7 +195,7 @@ OC.L10N.register(
"User disabled" : "Utilisateur désactivé",
"Login canceled by app" : "L'authentification a été annulé par l'application",
"App \"%1$s\" cannot be installed because the following dependencies are not fulfilled: %2$s" : "L'application \"%1$s\" ne peut pas être installée à cause des dépendances suivantes non satisfaites : %2$s",
- "a safe home for all your data" : "un endroit sûr pour toutes vos données",
+ "a safe home for all your data" : "un lieu sûr pour toutes vos données",
"File is currently busy, please try again later" : "Le fichier est actuellement utilisé, veuillez réessayer plus tard",
"Can't read file" : "Impossible de lire le fichier",
"Application is not enabled" : "L'application n'est pas activée",
diff --git a/lib/l10n/fr.json b/lib/l10n/fr.json
index 5b67c88fd35..00503087eae 100644
--- a/lib/l10n/fr.json
+++ b/lib/l10n/fr.json
@@ -193,7 +193,7 @@
"User disabled" : "Utilisateur désactivé",
"Login canceled by app" : "L'authentification a été annulé par l'application",
"App \"%1$s\" cannot be installed because the following dependencies are not fulfilled: %2$s" : "L'application \"%1$s\" ne peut pas être installée à cause des dépendances suivantes non satisfaites : %2$s",
- "a safe home for all your data" : "un endroit sûr pour toutes vos données",
+ "a safe home for all your data" : "un lieu sûr pour toutes vos données",
"File is currently busy, please try again later" : "Le fichier est actuellement utilisé, veuillez réessayer plus tard",
"Can't read file" : "Impossible de lire le fichier",
"Application is not enabled" : "L'application n'est pas activée",
diff --git a/lib/l10n/sv.js b/lib/l10n/sv.js
index 2912e855ef3..3d5b8ec3c9a 100644
--- a/lib/l10n/sv.js
+++ b/lib/l10n/sv.js
@@ -133,7 +133,7 @@ OC.L10N.register(
"Can’t set expiration date more than %s days in the future" : "Kan inte sätta utgångsdatum mer än %s dagar framåt",
"%1$s shared »%2$s« with you" : "%1$s delade »%2$s« med dig",
"%1$s shared »%2$s« with you." : "%1$s delade »%2$s« med dig.",
- "Click the button below to open it." : "Klicka knappen nedan för att öppna det.",
+ "Click the button below to open it." : "Klicka på knappen nedan för att öppna det.",
"The requested share does not exist anymore" : "Den begärda delningen finns inte mer",
"Could not find category \"%s\"" : "Kunde inte hitta kategorin \"%s\"",
"Sunday" : "Söndag",
diff --git a/lib/l10n/sv.json b/lib/l10n/sv.json
index da2a846c213..5cf82b4b56b 100644
--- a/lib/l10n/sv.json
+++ b/lib/l10n/sv.json
@@ -131,7 +131,7 @@
"Can’t set expiration date more than %s days in the future" : "Kan inte sätta utgångsdatum mer än %s dagar framåt",
"%1$s shared »%2$s« with you" : "%1$s delade »%2$s« med dig",
"%1$s shared »%2$s« with you." : "%1$s delade »%2$s« med dig.",
- "Click the button below to open it." : "Klicka knappen nedan för att öppna det.",
+ "Click the button below to open it." : "Klicka på knappen nedan för att öppna det.",
"The requested share does not exist anymore" : "Den begärda delningen finns inte mer",
"Could not find category \"%s\"" : "Kunde inte hitta kategorin \"%s\"",
"Sunday" : "Söndag",
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index 9f596ac4568..fa9f11a65ab 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -295,6 +295,10 @@ class PublicKeyTokenProvider implements IProvider {
// Generate new key
$res = openssl_pkey_new($config);
+ if ($res === false) {
+ $this->logOpensslError();
+ }
+
openssl_pkey_export($res, $privateKey);
// Extract the public key from $res to $pubKey
@@ -343,5 +347,11 @@ class PublicKeyTokenProvider implements IProvider {
}
}
-
+ private function logOpensslError() {
+ $errors = [];
+ while ($error = openssl_error_string()) {
+ $errors[] = $error;
+ }
+ $this->logger->critical('Something is wrong with your openssl setup: ' . implode(', ', $errors));
+ }
}
diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php
index ae51b2e52d8..989a4d0c7d5 100644
--- a/lib/private/Files/Cache/Propagator.php
+++ b/lib/private/Files/Cache/Propagator.php
@@ -46,12 +46,14 @@ class Propagator implements IPropagator {
private $connection;
/**
- * @param \OC\Files\Storage\Storage $storage
- * @param IDBConnection $connection
+ * @var array
*/
- public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection) {
+ private $ignore = [];
+
+ public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection, array $ignore = []) {
$this->storage = $storage;
$this->connection = $connection;
+ $this->ignore = $ignore;
}
@@ -62,6 +64,13 @@ class Propagator implements IPropagator {
* @suppress SqlInjectionChecker
*/
public function propagateChange($internalPath, $time, $sizeDifference = 0) {
+ // Do not propogate changes in ignored paths
+ foreach ($this->ignore as $ignore) {
+ if (strpos($internalPath, $ignore) === 0) {
+ return;
+ }
+ }
+
$storageId = (int)$this->storage->getStorageCache()->getNumericId();
$parents = $this->getParents($internalPath);
@@ -97,9 +106,9 @@ class Propagator implements IPropagator {
->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
->andWhere($builder->expr()->in('path_hash', $hashParams))
->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT)));
- }
- $builder->execute();
+ $builder->execute();
+ }
}
protected function getParents($path) {
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 72fe3a79792..657a8ba611a 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -368,7 +368,8 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
$storage = $this;
}
if (!isset($storage->propagator)) {
- $storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection());
+ $config = \OC::$server->getSystemConfig();
+ $storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection(), ['appdata_' . $config->getValue('instanceid')]);
}
return $storage->propagator;
}
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 19e38717803..21df67cf557 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1157,7 +1157,7 @@ class View {
if ($result && in_array('delete', $hooks) and $result) {
$this->removeUpdate($storage, $internalPath);
}
- if ($result && in_array('write', $hooks) and $operation !== 'fopen') {
+ if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') {
$this->writeUpdate($storage, $internalPath);
}
if ($result && in_array('touch', $hooks)) {
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index da825c9a7ad..8bb3d3327a6 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -147,7 +147,7 @@ class Repair implements IOutput {
new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
- new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig())
+ new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getLogger())
];
}
diff --git a/lib/private/Repair/NC15/SetVcardDatabaseUID.php b/lib/private/Repair/NC15/SetVcardDatabaseUID.php
index 210fc0a862c..cefb1c18111 100644
--- a/lib/private/Repair/NC15/SetVcardDatabaseUID.php
+++ b/lib/private/Repair/NC15/SetVcardDatabaseUID.php
@@ -25,9 +25,11 @@ namespace OC\Repair\NC15;
use OCP\IConfig;
use OCP\IDBConnection;
+use OCP\ILogger;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Sabre\VObject\Reader;
+use Sabre\VObject\ParseException;
class SetVcardDatabaseUID implements IRepairStep {
const MAX_ROWS = 1000;
@@ -38,11 +40,15 @@ class SetVcardDatabaseUID implements IRepairStep {
/** @var IConfig */
private $config;
+ /** @var ILogger */
+ private $logger;
+
private $updateQuery;
- public function __construct(IDBConnection $connection, IConfig $config) {
+ public function __construct(IDBConnection $connection, IConfig $config, ILogger $logger) {
$this->connection = $connection;
$this->config = $config;
+ $this->logger = $logger;
}
public function getName() {
@@ -75,13 +81,20 @@ class SetVcardDatabaseUID implements IRepairStep {
* Extract UID from vcard
*
* @param string $cardData the vcard raw data
+ * @param IOutput $output the output logger
* @return string the uid or empty if none
*/
- private function getUID(string $cardData): string {
- $vCard = Reader::read($cardData);
- if ($vCard->UID) {
- $uid = $vCard->UID->getValue();
- return $uid;
+ private function getUID(string $cardData, IOutput $output): string {
+ try {
+ $vCard = Reader::read($cardData);
+ if ($vCard->UID) {
+ $uid = $vCard->UID->getValue();
+
+ return $uid;
+ }
+ } catch (ParseException $e) {
+ $output->warning('One vCard is broken. We logged the exception and will continue the repair.');
+ $this->logger->logException($e);
}
return '';
@@ -106,7 +119,7 @@ class SetVcardDatabaseUID implements IRepairStep {
$this->updateQuery->execute();
}
- private function repair(): int {
+ private function repair(IOutput $output): int {
$this->connection->beginTransaction();
$entries = $this->getInvalidEntries();
$count = 0;
@@ -116,7 +129,7 @@ class SetVcardDatabaseUID implements IRepairStep {
if (is_resource($cardData)) {
$cardData = stream_get_contents($cardData);
}
- $uid = $this->getUID($cardData);
+ $uid = $this->getUID($cardData, $output);
$this->update($entry['id'], $uid);
}
$this->connection->commit();
@@ -133,7 +146,7 @@ class SetVcardDatabaseUID implements IRepairStep {
public function run(IOutput $output) {
if ($this->shouldRun()) {
- $count = $this->repair();
+ $count = $this->repair($output);
$output->info('Fixed ' . $count . ' vcards');
}
diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php
index 55a50fc2a48..29980885cf8 100644
--- a/lib/private/RichObjectStrings/Validator.php
+++ b/lib/private/RichObjectStrings/Validator.php
@@ -71,11 +71,17 @@ class Validator implements IValidator {
foreach ($matches[1] as $parameter) {
if (!isset($parameters[$parameter])) {
throw new InvalidObjectExeption('Parameter is undefined');
- } else {
- $this->validateParameter($parameters[$parameter]);
}
}
}
+
+ foreach ($parameters as $parameter) {
+ if (!\is_array($parameter)) {
+ throw new InvalidObjectExeption('Parameter is malformed');
+ }
+
+ $this->validateParameter($parameter);
+ }
}
/**
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index a2388012fe7..59aefd54cde 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -272,6 +272,7 @@ class DefaultShareProvider implements IShareProvider {
$qb = $this->dbConn->getQueryBuilder();
$qb->update('share')
->where($qb->expr()->eq('parent', $qb->createNamedParameter($share->getId())))
+ ->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE_USERGROUP)))
->set('uid_owner', $qb->createNamedParameter($share->getShareOwner()))
->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy()))
->set('item_source', $qb->createNamedParameter($share->getNode()->getId()))
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index 07482a693f5..a94ced8bb1f 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -827,7 +827,7 @@ class OC_Util {
),
'functions' => [
'xml_parser_create' => 'libxml',
- 'mb_strcut' => 'mb multibyte',
+ 'mb_strcut' => 'mbstring',
'ctype_digit' => 'ctype',
'json_encode' => 'JSON',
'gd_info' => 'GD',
diff --git a/lib/public/AppFramework/Db/DoesNotExistException.php b/lib/public/AppFramework/Db/DoesNotExistException.php
index b8adc36c7ba..9823a0a1fa8 100644
--- a/lib/public/AppFramework/Db/DoesNotExistException.php
+++ b/lib/public/AppFramework/Db/DoesNotExistException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -30,7 +31,7 @@ namespace OCP\AppFramework\Db;
* entry in the database
* @since 7.0.0
*/
-class DoesNotExistException extends \Exception {
+class DoesNotExistException extends \Exception implements IMapperException {
/**
* Constructor
diff --git a/lib/public/AppFramework/Db/IMapperException.php b/lib/public/AppFramework/Db/IMapperException.php
new file mode 100644
index 00000000000..dbb9883ae88
--- /dev/null
+++ b/lib/public/AppFramework/Db/IMapperException.php
@@ -0,0 +1,30 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2018, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @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 OCP\AppFramework\Db;
+
+/**
+ * @since 16.0.0
+ */
+interface IMapperException {}
diff --git a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php
index a17d95e0ef1..3955c417d57 100644
--- a/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php
+++ b/lib/public/AppFramework/Db/MultipleObjectsReturnedException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
@@ -30,7 +31,7 @@ namespace OCP\AppFramework\Db;
* row
* @since 7.0.0
*/
-class MultipleObjectsReturnedException extends \Exception {
+class MultipleObjectsReturnedException extends \Exception implements IMapperException {
/**
* Constructor