diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/App/AppStore/Bundles/EducationBundle.php | 1 | ||||
-rw-r--r-- | lib/private/Authentication/Token/RemoteWipe.php | 10 | ||||
-rw-r--r-- | lib/private/Avatar/UserAvatar.php | 2 | ||||
-rw-r--r-- | lib/private/Contacts/ContactsMenu/ContactsStore.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Quota.php | 27 | ||||
-rw-r--r-- | lib/private/Mail/Mailer.php | 14 | ||||
-rw-r--r-- | lib/private/Mail/Message.php | 17 | ||||
-rw-r--r-- | lib/private/Server.php | 3 | ||||
-rw-r--r-- | lib/private/Template/JSCombiner.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 2 |
11 files changed, 54 insertions, 28 deletions
diff --git a/lib/private/App/AppStore/Bundles/EducationBundle.php b/lib/private/App/AppStore/Bundles/EducationBundle.php index d848befc562..2d1968772d4 100644 --- a/lib/private/App/AppStore/Bundles/EducationBundle.php +++ b/lib/private/App/AppStore/Bundles/EducationBundle.php @@ -42,7 +42,6 @@ class EducationBundle extends Bundle { 'circles', 'groupfolders', 'announcementcenter', - 'admin_notifications', 'quota_warning', 'orcid', 'user_saml', diff --git a/lib/private/Authentication/Token/RemoteWipe.php b/lib/private/Authentication/Token/RemoteWipe.php index 2285ccd2cd8..e0fbf0734f5 100644 --- a/lib/private/Authentication/Token/RemoteWipe.php +++ b/lib/private/Authentication/Token/RemoteWipe.php @@ -57,18 +57,14 @@ class RemoteWipe { } /** - * @param int $id - * + * @param IToken $token * @return bool * * @throws InvalidTokenException * @throws WipeTokenException - * @throws ExpiredTokenException */ - public function markTokenForWipe(int $id): bool { - $token = $this->tokenProvider->getTokenById($id); - - if (!($token instanceof IWipeableToken)) { + public function markTokenForWipe(IToken $token): bool { + if (!$token instanceof IWipeableToken) { return false; } diff --git a/lib/private/Avatar/UserAvatar.php b/lib/private/Avatar/UserAvatar.php index fb434fc6947..485e53c249d 100644 --- a/lib/private/Avatar/UserAvatar.php +++ b/lib/private/Avatar/UserAvatar.php @@ -252,7 +252,7 @@ class UserAvatar extends Avatar { $avatar->putContent($data); $ext = 'png'; - $this->folder->newFile('generated'); + $this->folder->newFile('generated', ''); $this->config->setUserValue($this->user->getUID(), 'avatar', 'generated', 'true'); } diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index 9efa42b9a4d..9dfc803c49e 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -159,7 +159,7 @@ class ContactsStore implements IContactsStore { if ($ownGroupsOnly && $entry->getProperty('isLocalSystemBook') === true) { $uid = $this->userManager->get($entry->getProperty('UID')); - if ($uid === NULL) { + if ($uid === null) { return false; } diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 6f951f978ad..92601e38d13 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -241,7 +241,7 @@ class CacheJail extends CacheWrapper { $results = $this->getCache()->searchQuery($simpleQuery); $results = $this->formatSearchResults($results); - $limit = $query->getLimit() === 0 ? NULL : $query->getLimit(); + $limit = $query->getLimit() === 0 ? null : $query->getLimit(); $results = array_slice($results, $query->getOffset(), $limit); return $results; diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index b5a1be95aaf..d4e4be41f71 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -29,6 +29,7 @@ namespace OC\Files\Storage\Wrapper; +use OC\Files\Filesystem; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Storage\IStorage; @@ -44,6 +45,8 @@ class Quota extends Wrapper { */ protected $sizeRoot; + private $config; + /** * @param array $parameters */ @@ -51,6 +54,7 @@ class Quota extends Wrapper { parent::__construct($parameters); $this->quota = $parameters['quota']; $this->sizeRoot = isset($parameters['root']) ? $parameters['root'] : ''; + $this->config = \OC::$server->getSystemConfig(); } /** @@ -65,16 +69,21 @@ class Quota extends Wrapper { * @param \OC\Files\Storage\Storage $storage */ protected function getSize($path, $storage = null) { - if (is_null($storage)) { - $cache = $this->getCache(); - } else { - $cache = $storage->getCache(); - } - $data = $cache->get($path); - if ($data instanceof ICacheEntry and isset($data['size'])) { - return $data['size']; + if ($this->config->getValue('quota_include_external_storage', false)) { + $rootInfo = Filesystem::getFileInfo('', 'ext'); + return $rootInfo->getSize(true); } else { - return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; + if (is_null($storage)) { + $cache = $this->getCache(); + } else { + $cache = $storage->getCache(); + } + $data = $cache->get($path); + if ($data instanceof ICacheEntry and isset($data['size'])) { + return $data['size']; + } else { + return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; + } } } diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index df5f2687daa..47a7f8a7c9d 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -12,6 +12,7 @@ declare(strict_types=1); * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Arne Hamann <github@arne.email> * * @license AGPL-3.0 * @@ -34,6 +35,7 @@ namespace OC\Mail; use Egulias\EmailValidator\EmailValidator; use Egulias\EmailValidator\Validation\RFCValidation; use OCP\Defaults; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; @@ -42,6 +44,8 @@ use OCP\Mail\IAttachment; use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; use OCP\Mail\IMessage; +use OCP\Mail\Events\BeforeMessageSent; + /** * Class Mailer provides some basic functions to create a mail message that can be used in combination with @@ -74,6 +78,8 @@ class Mailer implements IMailer { private $urlGenerator; /** @var IL10N */ private $l10n; + /** @var IEventDispatcher */ + private $dispatcher; /** * @param IConfig $config @@ -81,17 +87,20 @@ class Mailer implements IMailer { * @param Defaults $defaults * @param IURLGenerator $urlGenerator * @param IL10N $l10n + * @param IEventDispatcher $dispatcher */ public function __construct(IConfig $config, ILogger $logger, Defaults $defaults, IURLGenerator $urlGenerator, - IL10N $l10n) { + IL10N $l10n, + IEventDispatcher $dispatcher) { $this->config = $config; $this->logger = $logger; $this->defaults = $defaults; $this->urlGenerator = $urlGenerator; $this->l10n = $l10n; + $this->dispatcher = $dispatcher; } /** @@ -182,6 +191,9 @@ class Mailer implements IMailer { $mailer->registerPlugin(new \Swift_Plugins_LoggerPlugin($mailLogger)); } + + $this->dispatcher->dispatchTyped(new BeforeMessageSent($message)); + $mailer->send($message->getSwiftMessage(), $failedRecipients); // Debugging logging diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index 4ea9da532b6..9437bd0216f 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -11,6 +11,7 @@ declare(strict_types=1); * @author Morris Jobke <hey@morrisjobke.de> * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Arne Hamann <github@arne.email> * * @license AGPL-3.0 * @@ -112,7 +113,7 @@ class Message implements IMessage { * @return array */ public function getFrom(): array { - return $this->swiftMessage->getFrom(); + return $this->swiftMessage->getFrom() ?? []; } /** @@ -156,7 +157,7 @@ class Message implements IMessage { * @return array */ public function getTo(): array { - return $this->swiftMessage->getTo(); + return $this->swiftMessage->getTo() ?? []; } /** @@ -178,7 +179,7 @@ class Message implements IMessage { * @return array */ public function getCc(): array { - return $this->swiftMessage->getCc(); + return $this->swiftMessage->getCc() ?? []; } /** @@ -200,7 +201,7 @@ class Message implements IMessage { * @return array */ public function getBcc(): array { - return $this->swiftMessage->getBcc(); + return $this->swiftMessage->getBcc() ?? []; } /** @@ -258,6 +259,14 @@ class Message implements IMessage { /** * Get's the underlying SwiftMessage + * @param Swift_Message $swiftMessage + */ + public function setSwiftMessage(Swift_Message $swiftMessage): void { + $this->swiftMessage = $swiftMessage; + } + + /** + * Get's the underlying SwiftMessage * @return Swift_Message */ public function getSwiftMessage(): Swift_Message { diff --git a/lib/private/Server.php b/lib/private/Server.php index 3300920edb7..971b144e1d0 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -988,7 +988,8 @@ class Server extends ServerContainer implements IServerContainer { $c->getLogger(), $c->query(Defaults::class), $c->getURLGenerator(), - $c->getL10N('lib') + $c->getL10N('lib'), + $c->query(IEventDispatcher::class) ); }); $this->registerDeprecatedAlias('Mailer', IMailer::class); diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php index a6908ce8071..83fc717c9c5 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -133,7 +133,7 @@ class JSCombiner { $deps = json_decode($deps, true); - if ($deps === NULL) { + if ($deps === null) { return false; } diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index bf0a1b9bb20..63edf34e029 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -795,7 +795,7 @@ class OC_Util { // is_writable doesn't work for NFS mounts, so try to write a file and check if it exists. $testFile = sprintf('%s/%s.tmp', $CONFIG_DATADIRECTORY, uniqid('data_dir_writability_test_')); $handle = fopen($testFile, 'w'); - if (!$handle || fwrite($handle, 'Test write operation') === FALSE) { + if (!$handle || fwrite($handle, 'Test write operation') === false) { $permissionsHint = $l->t('Permissions can usually be fixed by giving the webserver write access to the root directory. See %s.', [$urlGenerator->linkToDocs('admin-dir_permissions')]); $errors[] = [ |