chore: adjust code to adhere to coding standard

Signed-off-by: Anna Larch <anna@nextcloud.com>
pull/47789/head
Anna Larch 1 year ago
parent 4566cf791d
commit 8af7ecb257
  1. 12
      apps/dav/lib/BackgroundJob/UserStatusAutomation.php
  2. 2
      apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php
  3. 8
      apps/dav/lib/CalDAV/CalDavBackend.php
  4. 4
      apps/dav/lib/CalDAV/CalendarHome.php
  5. 2
      apps/dav/lib/CalDAV/CalendarImpl.php
  6. 14
      apps/dav/lib/CalDAV/EventComparisonService.php
  7. 2
      apps/dav/lib/CalDAV/Reminder/ReminderService.php
  8. 8
      apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
  9. 20
      apps/dav/lib/CalDAV/Schedule/IMipService.php
  10. 20
      apps/dav/lib/CalDAV/Status/StatusService.php
  11. 6
      apps/dav/lib/CalDAV/WebcalCaching/RefreshWebcalService.php
  12. 10
      apps/dav/lib/DAV/Sharing/Backend.php
  13. 2
      apps/dav/lib/Migration/Version1027Date20230504122946.php
  14. 2
      apps/dav/lib/Migration/Version1029Date20221114151721.php
  15. 2
      apps/files/lib/Command/Delete.php
  16. 2
      apps/files/lib/Controller/ViewController.php
  17. 2
      apps/files_external/tests/Storage/SmbTest.php
  18. 2
      apps/files_sharing/lib/Controller/ShareAPIController.php
  19. 2
      apps/files_trashbin/lib/Command/RestoreAllFiles.php
  20. 2
      apps/files_trashbin/lib/Listeners/SyncLivePhotosListener.php
  21. 2
      apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
  22. 10
      apps/theming/lib/Service/ThemeInjectionService.php
  23. 3
      apps/user_ldap/lib/Connection.php
  24. 2
      apps/user_ldap/lib/LDAP.php
  25. 2
      apps/user_status/lib/Listener/OutOfOfficeStatusListener.php
  26. 2
      apps/user_status/lib/Listener/UserLiveStatusListener.php
  27. 4
      apps/user_status/lib/Service/StatusService.php
  28. 112
      apps/webhook_listeners/lib/Service/PHPMongoQuery.php
  29. 2
      build/integration/features/bootstrap/Sharing.php
  30. 4
      core/Command/Db/Migrations/PreviewCommand.php
  31. 2
      core/Controller/TextProcessingApiController.php
  32. 2
      core/Controller/TextToImageApiController.php
  33. 2
      lib/private/AppConfig.php
  34. 2
      lib/private/Comments/Manager.php
  35. 4
      lib/private/DB/QueryBuilder/Sharded/AutoIncrementHandler.php
  36. 2
      lib/private/Files/Cache/SearchBuilder.php
  37. 2
      lib/private/Migration/MetadataManager.php
  38. 2
      lib/private/Search/SearchQuery.php
  39. 2
      lib/private/Security/Ip/Address.php
  40. 4
      lib/private/Share20/Manager.php
  41. 10
      lib/private/TaskProcessing/Manager.php
  42. 2
      lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php
  43. 2
      lib/private/Template/JSConfigHelper.php
  44. 6
      lib/private/TextToImage/Manager.php
  45. 2
      lib/private/TextToImage/RemoveOldTasksBackgroundJob.php
  46. 2
      lib/private/User/Manager.php
  47. 2
      tests/lib/Files/Search/SearchIntegrationTest.php
  48. 2
      tests/lib/TaskProcessing/TaskProcessingTest.php

@ -55,14 +55,14 @@ class UserStatusAutomation extends TimedJob {
$userId = $argument['userId'];
$user = $this->userManager->get($userId);
if($user === null) {
if ($user === null) {
return;
}
$ooo = $this->coordinator->getCurrentOutOfOfficeData($user);
$continue = $this->processOutOfOfficeData($user, $ooo);
if($continue === false) {
if ($continue === false) {
return;
}
@ -196,7 +196,7 @@ class UserStatusAutomation extends TimedJob {
return;
}
if(!$hasDndForOfficeHours) {
if (!$hasDndForOfficeHours) {
// Office hours are not set to DND, so there is nothing to do.
return;
}
@ -207,7 +207,7 @@ class UserStatusAutomation extends TimedJob {
}
private function processOutOfOfficeData(IUser $user, ?IOutOfOfficeData $ooo): bool {
if(empty($ooo)) {
if (empty($ooo)) {
// Reset the user status if the absence doesn't exist
$this->logger->debug('User has no OOO period in effect, reverting DND status if applicable');
$this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND);
@ -215,12 +215,12 @@ class UserStatusAutomation extends TimedJob {
return true;
}
if(!$this->coordinator->isInEffect($ooo)) {
if (!$this->coordinator->isInEffect($ooo)) {
// Reset the user status if the absence is (no longer) in effect
$this->logger->debug('User has no OOO period in effect, reverting DND status if applicable');
$this->manager->revertUserStatus($user->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND);
if($ooo->getStartDate() > $this->time->getTime()) {
if ($ooo->getStartDate() > $this->time->getTime()) {
// Set the next run to take place at the start of the ooo period if it is in the future
// This might be overwritten if there is an availability setting, but we can't determine
// if this is the case here

@ -115,7 +115,7 @@ class EnablePlugin extends ServerPlugin {
}
$owner = substr($node->getOwner(), 17);
if($owner !== $this->user->getUID()) {
if ($owner !== $this->user->getUID()) {
$this->server->httpResponse->setStatus(403);
return false;
}

@ -2815,7 +2815,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->setMaxResults($limit);
$result = $query->executeQuery();
$count = $result->rowCount();
if($count === 0) {
if ($count === 0) {
return;
}
$ids = array_map(static function (array $id) {
@ -2827,12 +2827,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$deleteQuery = $this->db->getQueryBuilder();
$deleteQuery->delete('schedulingobjects')
->where($deleteQuery->expr()->in('id', $deleteQuery->createParameter('ids'), IQueryBuilder::PARAM_INT_ARRAY));
foreach(array_chunk($ids, 1000) as $chunk) {
foreach (array_chunk($ids, 1000) as $chunk) {
$deleteQuery->setParameter('ids', $chunk, IQueryBuilder::PARAM_INT_ARRAY);
$numDeleted += $deleteQuery->executeStatement();
}
if($numDeleted === $limit) {
if ($numDeleted === $limit) {
$this->logger->info("Deleted $limit scheduling objects, continuing with next batch");
$this->deleteOutdatedSchedulingObjects($modifiedBefore, $limit);
}
@ -3307,7 +3307,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @param array<string> $calendarObjectUris
*/
public function purgeCachedEventsForSubscription(int $subscriptionId, array $calendarObjectIds, array $calendarObjectUris): void {
if(empty($calendarObjectUris)) {
if (empty($calendarObjectUris)) {
return;
}

@ -149,9 +149,9 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
// Calendar - this covers all "regular" calendars, but not shared
// only check if the method is available
if($this->caldavBackend instanceof CalDavBackend) {
if ($this->caldavBackend instanceof CalDavBackend) {
$calendar = $this->caldavBackend->getCalendarByUri($this->principalInfo['uri'], $name);
if(!empty($calendar)) {
if (!empty($calendar)) {
return new Calendar($this->caldavBackend, $calendar, $this->l10n, $this->config, $this->logger);
}
}

@ -84,7 +84,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
/** @var VCalendar $vobj */
$vobj = Reader::read($timezoneProp);
$components = $vobj->getComponents();
if(empty($components)) {
if (empty($components)) {
return null;
}
/** @var VTimeZone $vtimezone */

@ -37,14 +37,14 @@ class EventComparisonService {
*/
private function removeIfUnchanged(VEvent $filterEvent, array &$eventsToFilter): bool {
$filterEventData = [];
foreach(self::EVENT_DIFF as $eventDiff) {
foreach (self::EVENT_DIFF as $eventDiff) {
$filterEventData[] = IMipService::readPropertyWithDefault($filterEvent, $eventDiff, '');
}
/** @var VEvent $component */
foreach ($eventsToFilter as $k => $eventToFilter) {
$eventToFilterData = [];
foreach(self::EVENT_DIFF as $eventDiff) {
foreach (self::EVENT_DIFF as $eventDiff) {
$eventToFilterData[] = IMipService::readPropertyWithDefault($eventToFilter, $eventDiff, '');
}
// events are identical and can be removed
@ -73,23 +73,23 @@ class EventComparisonService {
$newEventComponents = $new->getComponents();
foreach ($newEventComponents as $k => $event) {
if(!$event instanceof VEvent) {
if (!$event instanceof VEvent) {
unset($newEventComponents[$k]);
}
}
if(empty($old)) {
if (empty($old)) {
return ['old' => null, 'new' => $newEventComponents];
}
$oldEventComponents = $old->getComponents();
if(is_array($oldEventComponents) && !empty($oldEventComponents)) {
if (is_array($oldEventComponents) && !empty($oldEventComponents)) {
foreach ($oldEventComponents as $k => $event) {
if(!$event instanceof VEvent) {
if (!$event instanceof VEvent) {
unset($oldEventComponents[$k]);
continue;
}
if($this->removeIfUnchanged($event, $newEventComponents)) {
if ($this->removeIfUnchanged($event, $newEventComponents)) {
unset($oldEventComponents[$k]);
}
}

@ -447,7 +447,7 @@ class ReminderService {
$uniqueReminders = [];
foreach ($reminders as $reminder) {
$key = $reminder['notification_date']. $reminder['event_hash'].$reminder['type'];
if(!isset($uniqueReminders[$key])) {
if (!isset($uniqueReminders[$key])) {
$uniqueReminders[$key] = $reminder;
}
}

@ -94,7 +94,7 @@ class IMipPlugin extends SabreIMipPlugin {
* @param bool $modified modified
*/
public function beforeWriteContent($uri, INode $node, $data, $modified): void {
if(!$node instanceof CalendarObject) {
if (!$node instanceof CalendarObject) {
return;
}
/** @var VCalendar $vCalendar */
@ -151,7 +151,7 @@ class IMipPlugin extends SabreIMipPlugin {
// No changed events after all - this shouldn't happen if there is significant change yet here we are
// The scheduling status is debatable
if(empty($vEvent)) {
if (empty($vEvent)) {
$this->logger->warning('iTip message said the change was significant but comparison did not detect any updated VEvents');
$iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
return;
@ -163,14 +163,14 @@ class IMipPlugin extends SabreIMipPlugin {
// we also might not have an old event as this could be a new
// invitation, or a new recurrence exception
$attendee = $this->imipService->getCurrentAttendee($iTipMessage);
if($attendee === null) {
if ($attendee === null) {
$uid = $vEvent->UID ?? 'no UID found';
$this->logger->debug('Could not find recipient ' . $recipient . ' as attendee for event with UID ' . $uid);
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
return;
}
// Don't send emails to things
if($this->imipService->isRoomOrResource($attendee)) {
if ($this->imipService->isRoomOrResource($attendee)) {
$this->logger->debug('No invitation sent as recipient is room or resource', [
'attendee' => $recipient,
]);

@ -88,7 +88,7 @@ class IMipService {
return $default;
}
$newstring = $vevent->$property->getValue();
if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) {
if (isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) {
$oldstring = $oldVEvent->$property->getValue();
return sprintf($strikethrough, $oldstring, $newstring);
}
@ -143,7 +143,7 @@ class IMipService {
$data = [];
$data['meeting_when'] = $this->generateWhenString($eventReaderCurrent);
foreach(self::STRING_DIFF as $key => $property) {
foreach (self::STRING_DIFF as $key => $property) {
$data[$key] = self::readPropertyWithDefault($vEvent, $property, $defaultVal);
}
@ -153,7 +153,7 @@ class IMipService {
$data['meeting_location_html'] = $locationHtml;
}
if(!empty($oldVEvent)) {
if (!empty($oldVEvent)) {
$oldMeetingWhen = $this->generateWhenString($eventReaderPrevious);
$data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']);
$data['meeting_description_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'DESCRIPTION', $data['meeting_description']);
@ -638,7 +638,7 @@ class IMipService {
return $dtEnd->getDateTime()->getTimeStamp();
}
if(isset($component->DURATION)) {
if (isset($component->DURATION)) {
/** @var \DateTime $endDate */
$endDate = clone $dtStart->getDateTime();
// $component->DTEND->getDateTime() returns DateTimeImmutable
@ -646,7 +646,7 @@ class IMipService {
return $endDate->getTimestamp();
}
if(!$dtStart->hasTime()) {
if (!$dtStart->hasTime()) {
/** @var \DateTime $endDate */
// $component->DTSTART->getDateTime() returns DateTimeImmutable
$endDate = clone $dtStart->getDateTime();
@ -662,7 +662,7 @@ class IMipService {
* @param Property|null $attendee
*/
public function setL10n(?Property $attendee = null) {
if($attendee === null) {
if ($attendee === null) {
return;
}
@ -678,7 +678,7 @@ class IMipService {
* @return bool
*/
public function getAttendeeRsvpOrReqForParticipant(?Property $attendee = null) {
if($attendee === null) {
if ($attendee === null) {
return false;
}
@ -786,10 +786,10 @@ class IMipService {
htmlspecialchars($organizer->getNormalizedValue()),
htmlspecialchars($organizerName ?: $organizerEmail));
$organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail);
if(isset($organizer['PARTSTAT'])) {
if (isset($organizer['PARTSTAT'])) {
/** @var Parameter $partstat */
$partstat = $organizer['PARTSTAT'];
if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
$organizerHTML .= ' ✔';
$organizerText .= ' ✔';
}
@ -961,7 +961,7 @@ class IMipService {
public function isRoomOrResource(Property $attendee): bool {
$cuType = $attendee->offsetGet('CUTYPE');
if(!$cuType instanceof Parameter) {
if (!$cuType instanceof Parameter) {
return false;
}
$type = $cuType->getValue() ?? 'INDIVIDUAL';

@ -39,23 +39,23 @@ class StatusService {
public function processCalendarStatus(string $userId): void {
$user = $this->userManager->get($userId);
if($user === null) {
if ($user === null) {
return;
}
$availability = $this->availabilityCoordinator->getCurrentOutOfOfficeData($user);
if($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) {
if ($availability !== null && $this->availabilityCoordinator->isInEffect($availability)) {
$this->logger->debug('An Absence is in effect, skipping calendar status check', ['user' => $userId]);
return;
}
$calendarEvents = $this->cache->get($userId);
if($calendarEvents === null) {
if ($calendarEvents === null) {
$calendarEvents = $this->getCalendarEvents($user);
$this->cache->set($userId, $calendarEvents, 300);
}
if(empty($calendarEvents)) {
if (empty($calendarEvents)) {
try {
$this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY);
} catch (Exception $e) {
@ -81,7 +81,7 @@ class StatusService {
$currentStatus = null;
}
if(($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL)
if (($currentStatus !== null && $currentStatus->getMessageId() === IUserStatus::MESSAGE_CALL)
|| ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::DND)
|| ($currentStatus !== null && $currentStatus->getStatus() === IUserStatus::INVISIBLE)) {
// We don't overwrite the call status, DND status or Invisible status
@ -101,7 +101,7 @@ class StatusService {
if (isset($component['DTSTART']) && $userStatusTimestamp !== null) {
/** @var DateTimeImmutable $dateTime */
$dateTime = $component['DTSTART'][0];
if($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {
if ($dateTime instanceof DateTimeImmutable && $userStatusTimestamp > $dateTime->getTimestamp()) {
return false;
}
}
@ -112,7 +112,7 @@ class StatusService {
return true;
});
if(empty($applicableEvents)) {
if (empty($applicableEvents)) {
try {
$this->userStatusService->revertUserStatus($userId, IUserStatus::MESSAGE_CALENDAR_BUSY);
} catch (Exception $e) {
@ -130,7 +130,7 @@ class StatusService {
}
// Only update the status if it's neccesary otherwise we mess up the timestamp
if($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) {
if ($currentStatus === null || $currentStatus->getMessageId() !== IUserStatus::MESSAGE_CALENDAR_BUSY) {
// One event that fulfills all status conditions is enough
// 1. Not an OOO event
// 2. Current user status (that is not a calendar status) was not set after the start of this event
@ -148,7 +148,7 @@ class StatusService {
private function getCalendarEvents(User $user): array {
$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $user->getUID());
if(empty($calendars)) {
if (empty($calendars)) {
return [];
}
@ -172,7 +172,7 @@ class StatusService {
$dtEnd = DateTimeImmutable::createFromMutable($this->timeFactory->getDateTime('+5 minutes'));
// Only query the calendars when there's any to search
if($query instanceof CalendarQuery && !empty($query->getCalendarUris())) {
if ($query instanceof CalendarQuery && !empty($query->getCalendarUris())) {
// Query the next hour
$query->setTimerangeStart($dtStart);
$query->setTimerangeEnd($dtEnd);

@ -44,12 +44,12 @@ class RefreshWebcalService {
}
// Check the refresh rate if there is any
if(!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) {
if (!empty($subscription['{http://apple.com/ns/ical/}refreshrate'])) {
// add the refresh interval to the lastmodified timestamp
$refreshInterval = new \DateInterval($subscription['{http://apple.com/ns/ical/}refreshrate']);
$updateTime = $this->time->getDateTime();
$updateTime->setTimestamp($subscription['lastmodified'])->add($refreshInterval);
if($updateTime->getTimestamp() > $this->time->getTime()) {
if ($updateTime->getTimestamp() > $this->time->getTime()) {
return;
}
}
@ -136,7 +136,7 @@ class RefreshWebcalService {
return $dataSet['uri'];
}, $localData);
if(!empty($ids) && !empty($uris)) {
if (!empty($ids) && !empty($uris)) {
// Clean up on aisle 5
// The only events left over in the $localData array should be those that don't exist upstream
// All deleted VObjects from upstream are removed

@ -58,7 +58,7 @@ abstract class Backend {
}
// Don't add share for owner
if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {
if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {
continue;
}
@ -83,7 +83,7 @@ abstract class Backend {
}
// Don't add unshare for owner
if($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {
if ($shareable->getOwner() !== null && strcasecmp($shareable->getOwner(), $principal) === 0) {
continue;
}
@ -92,7 +92,7 @@ abstract class Backend {
// Check if a user has a groupshare that they're trying to free themselves from
// If so we need to add a self::ACCESS_UNSHARED row
if(!str_contains($principal, 'group')
if (!str_contains($principal, 'group')
&& $this->service->hasGroupShare($oldShares)
) {
$this->service->unshare($shareable->getResourceId(), $principal);
@ -130,7 +130,7 @@ abstract class Backend {
$rows = $this->service->getShares($resourceId);
$shares = [];
foreach($rows as $row) {
foreach ($rows as $row) {
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
$shares[] = [
'href' => "principal:{$row['principaluri']}",
@ -155,7 +155,7 @@ abstract class Backend {
$rows = $this->service->getSharesForIds($resourceIds);
$sharesByResource = array_fill_keys($resourceIds, []);
foreach($rows as $row) {
foreach ($rows as $row) {
$resourceId = (int)$row['resourceid'];
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
$sharesByResource[$resourceId][] = [

@ -31,7 +31,7 @@ class Version1027Date20230504122946 extends SimpleMigrationStep {
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
if($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) {
if ($this->userManager->countSeenUsers() > 100 || array_sum($this->userManager->countUsers()) > 100) {
$this->config->setAppValue('dav', 'needs_system_address_book_sync', 'yes');
$output->info('Could not sync system address books during update - too many user records have been found. Please call occ dav:sync-system-addressbook manually.');
return;

@ -28,7 +28,7 @@ class Version1029Date20221114151721 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$calendarObjectsTable = $schema->getTable('calendarobjects');
if(!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) {
if (!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) {
$calendarObjectsTable->addIndex(['classification'], 'calobj_clssfction_index');
return $schema;
}

@ -70,7 +70,7 @@ class Delete extends Command {
$output->writeln('');
foreach ($filesByUsers as $user => $filesByUser) {
$output->writeln($user . ':');
foreach($filesByUser as $file) {
foreach ($filesByUser as $file) {
$output->writeln(' - ' . $file->getPath());
}
}

@ -166,7 +166,7 @@ class ViewController extends Controller {
try {
// If view is files, we use the directory, otherwise we use the root storage
$storageInfo = $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/');
} catch(\Exception $e) {
} catch (\Exception $e) {
$storageInfo = $this->getStorageInfo();
}

@ -75,7 +75,7 @@ class SmbTest extends \Test\Files\Storage\Storage {
public function testNotifyGetChanges() {
$lastError = null;
for($i = 0; $i < 5; $i++) {
for ($i = 0; $i < 5; $i++) {
try {
$this->tryTestNotifyGetChanges();
return;

@ -2108,7 +2108,7 @@ class ShareAPIController extends OCSController {
$provider->sendMailNotification($share);
return new DataResponse();
} catch(OCSBadRequestException $e) {
} catch (OCSBadRequestException $e) {
throw $e;
} catch (Exception $e) {
throw new OCSException($this->l->t('Error while sending mail notification'));

@ -173,7 +173,7 @@ class RestoreAllFiles extends Base {
$prepMsg = $dryRun ? 'Would restore' : 'Preparing to restore';
$output->writeln("$prepMsg <info>$trashCount</info> files...");
$count = 0;
foreach($userTrashItems as $trashItem) {
foreach ($userTrashItems as $trashItem) {
$filename = $trashItem->getName();
$humanTime = $this->l10n->l('datetime', $trashItem->getDeletedTime());
// We use getTitle() here instead of getOriginalLocation() because

@ -112,7 +112,7 @@ class SyncLivePhotosListener implements IEventListener {
* TODO: This should be replaced by a proper method in the TrashManager.
*/
private function getTrashItem(array $trashFolder, string $path): ?ITrashItem {
foreach($trashFolder as $trashItem) {
foreach ($trashFolder as $trashItem) {
if (str_starts_with($path, 'files_trashbin/files'.$trashItem->getTrashPath())) {
if ($path === 'files_trashbin/files'.$trashItem->getTrashPath()) {
return $trashItem;

@ -141,7 +141,7 @@ class ArtificialIntelligence implements IDelegatedSettings {
$json = $this->config->getAppValue('core', $key, '');
if ($json !== '') {
$value = json_decode($json, true);
switch($key) {
switch ($key) {
case 'ai.taskprocessing_provider_preferences':
case 'ai.textprocessing_provider_preferences':
// fill $value with $defaultValue values

@ -52,12 +52,12 @@ class ThemeInjectionService {
$this->addThemeHeaders($defaultTheme);
// Themes applied by media queries
foreach($mediaThemes as $theme) {
foreach ($mediaThemes as $theme) {
$this->addThemeHeaders($theme, true, $theme->getMediaQuery());
}
// Themes
foreach($this->themesService->getThemes() as $theme) {
foreach ($this->themesService->getThemes() as $theme) {
// Ignore default theme as already processed first
if ($theme->getId() === $this->defaultTheme->getId()) {
continue;
@ -99,9 +99,9 @@ class ThemeInjectionService {
$metaHeaders = [];
// Meta headers
foreach($this->themesService->getThemes() as $theme) {
foreach ($this->themesService->getThemes() as $theme) {
if (!empty($theme->getMeta())) {
foreach($theme->getMeta() as $meta) {
foreach ($theme->getMeta() as $meta) {
if (!isset($meta['name']) || !isset($meta['content'])) {
continue;
}
@ -114,7 +114,7 @@ class ThemeInjectionService {
}
}
foreach($metaHeaders as $name => $content) {
foreach ($metaHeaders as $name => $content) {
\OCP\Util::addHeader('meta', [
'name' => $name,
'content' => join(' ', array_unique($content)),

@ -397,8 +397,7 @@ class Connection extends LDAPUtility {
}
foreach (['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute',
'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute']
as $expertSetting => $effectiveSetting) {
'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) {
$uuidOverride = $this->configuration->$expertSetting;
if (!empty($uuidOverride)) {
$this->configuration->$effectiveSetting = $uuidOverride;

@ -293,7 +293,7 @@ class LDAP implements ILDAPWrapper {
private function preFunctionCall(string $functionName, array $args): void {
$this->curArgs = $args;
if(strcasecmp($functionName, 'ldap_bind') === 0 || strcasecmp($functionName, 'ldap_exop_passwd') === 0) {
if (strcasecmp($functionName, 'ldap_bind') === 0 || strcasecmp($functionName, 'ldap_exop_passwd') === 0) {
// The arguments are not key value pairs
// \OCA\User_LDAP\LDAP::bind passes 3 arguments, the 3rd being the pw
// Remove it via direct array access for now, although a better solution could be found mebbe?

@ -37,7 +37,7 @@ class OutOfOfficeStatusListener implements IEventListener {
* @inheritDoc
*/
public function handle(Event $event): void {
if($event instanceof OutOfOfficeClearedEvent) {
if ($event instanceof OutOfOfficeClearedEvent) {
$this->manager->revertUserStatus($event->getData()->getUser()->getUID(), IUserStatus::MESSAGE_OUT_OF_OFFICE, IUserStatus::DND);
$this->jobsList->scheduleAfter(UserStatusAutomation::class, $this->time->getTime(), ['userId' => $event->getData()->getUser()->getUID()]);
return;

@ -72,7 +72,7 @@ class UserLiveStatusListener implements IEventListener {
}
// Don't overwrite the "away" calendar status if it's set
if($userStatus->getMessageId() === IUserStatus::MESSAGE_CALENDAR_BUSY) {
if ($userStatus->getMessageId() === IUserStatus::MESSAGE_CALENDAR_BUSY) {
$event->setUserStatus(new ConnectorUserStatus($userStatus));
return;
}

@ -499,10 +499,10 @@ class StatusService {
return;
}
// If there is a custom message, don't overwrite it
if(empty($status->getCustomMessage())) {
if (empty($status->getCustomMessage())) {
$status->setCustomMessage($predefinedMessage['message']);
}
if(empty($status->getCustomIcon())) {
if (empty($status->getCustomIcon())) {
$status->setCustomIcon($predefinedMessage['icon']);
}
}

@ -28,14 +28,14 @@ abstract class PHPMongoQuery {
* @throws Exception
*/
public static function find(array $query, array $documents, array $options = []): array {
if(empty($documents) || empty($query)) {
if (empty($documents) || empty($query)) {
return [];
}
$ret = [];
$options['_shouldLog'] = !empty($options['logger']) && $options['logger'] instanceof \Psr\Log\LoggerInterface;
$options['_debug'] = !empty($options['debug']);
foreach ($documents as $doc) {
if(static::_executeQuery($query, $doc, $options)) {
if (static::_executeQuery($query, $doc, $options)) {
$ret[] = $doc;
}
}
@ -56,11 +56,11 @@ abstract class PHPMongoQuery {
public static function executeQuery($query, array &$document, array $options = []): bool {
$options['_shouldLog'] = !empty($options['logger']) && $options['logger'] instanceof \Psr\Log\LoggerInterface;
$options['_debug'] = !empty($options['debug']);
if($options['_debug'] && $options['_shouldLog']) {
if ($options['_debug'] && $options['_shouldLog']) {
$options['logger']->debug('executeQuery called', ['query' => $query, 'document' => $document, 'options' => $options]);
}
if(!is_array($query)) {
if (!is_array($query)) {
return (bool)$query;
}
@ -75,10 +75,10 @@ abstract class PHPMongoQuery {
* @throws Exception
*/
private static function _executeQuery(array $query, array &$document, array $options = [], string $logicalOperator = '$and'): bool {
if($logicalOperator !== '$and' && (!count($query) || !isset($query[0]))) {
if ($logicalOperator !== '$and' && (!count($query) || !isset($query[0]))) {
throw new Exception($logicalOperator.' requires nonempty array');
}
if($options['_debug'] && $options['_shouldLog']) {
if ($options['_debug'] && $options['_shouldLog']) {
$options['logger']->debug('_executeQuery called', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]);
}
@ -87,19 +87,19 @@ abstract class PHPMongoQuery {
// to detect an array of key->vals that have numeric IDs vs an array of queries (where keys were not specified)
$queryIsIndexedArray = !empty($query) && array_is_list($query);
foreach($query as $k => $q) {
foreach ($query as $k => $q) {
$pass = true;
if(is_string($k) && substr($k, 0, 1) === '$') {
if (is_string($k) && substr($k, 0, 1) === '$') {
// key is an operator at this level, except $not, which can be at any level
if($k === '$not') {
if ($k === '$not') {
$pass = !self::_executeQuery($q, $document, $options);
} else {
$pass = self::_executeQuery($q, $document, $options, $k);
}
} elseif($logicalOperator === '$and') { // special case for $and
if($queryIsIndexedArray) { // $q is an array of query objects
} elseif ($logicalOperator === '$and') { // special case for $and
if ($queryIsIndexedArray) { // $q is an array of query objects
$pass = self::_executeQuery($q, $document, $options);
} elseif(is_array($q)) { // query is array, run all queries on field. All queries must match. e.g { 'age': { $gt: 24, $lt: 52 } }
} elseif (is_array($q)) { // query is array, run all queries on field. All queries must match. e.g { 'age': { $gt: 24, $lt: 52 } }
$pass = self::_executeQueryOnElement($q, $k, $document, $options);
} else {
// key value means equality
@ -108,30 +108,30 @@ abstract class PHPMongoQuery {
} else { // $q is array of query objects e.g '$or' => [{'fullName' => 'Nick'}]
$pass = self::_executeQuery($q, $document, $options, '$and');
}
switch($logicalOperator) {
switch ($logicalOperator) {
case '$and': // if any fail, query fails
if(!$pass) {
if (!$pass) {
return false;
}
break;
case '$or': // if one succeeds, query succeeds
if($pass) {
if ($pass) {
return true;
}
break;
case '$nor': // if one succeeds, query fails
if($pass) {
if ($pass) {
return false;
}
break;
default:
if($options['_shouldLog']) {
if ($options['_shouldLog']) {
$options['logger']->warning('_executeQuery could not find logical operator', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]);
}
return false;
}
}
switch($logicalOperator) {
switch ($logicalOperator) {
case '$and': // all succeeded, query succeeds
return true;
case '$or': // all failed, query fails
@ -139,7 +139,7 @@ abstract class PHPMongoQuery {
case '$nor': // all failed, query succeeded
return true;
default:
if($options['_shouldLog']) {
if ($options['_shouldLog']) {
$options['logger']->warning('_executeQuery could not find logical operator', ['query' => $query, 'document' => $document, 'logicalOperator' => $logicalOperator]);
}
return false;
@ -152,12 +152,12 @@ abstract class PHPMongoQuery {
* @throws Exception
*/
private static function _executeQueryOnElement(array $query, string $element, array &$document, array $options = []): bool {
if($options['_debug'] && $options['_shouldLog']) {
if ($options['_debug'] && $options['_shouldLog']) {
$options['logger']->debug('_executeQueryOnElement called', ['query' => $query, 'element' => $element, 'document' => $document]);
}
// iterate through query operators
foreach($query as $op => $opVal) {
if(!self::_executeOperatorOnElement($op, $opVal, $element, $document, $options)) {
foreach ($query as $op => $opVal) {
if (!self::_executeOperatorOnElement($op, $opVal, $element, $document, $options)) {
return false;
}
}
@ -176,10 +176,10 @@ abstract class PHPMongoQuery {
if (is_array($v) && is_array($operatorValue)) {
return $v == $operatorValue;
}
if(is_array($v)) {
if (is_array($v)) {
return in_array($operatorValue, $v);
}
if(is_string($operatorValue) && preg_match('/^\/(.*?)\/([a-z]*)$/i', $operatorValue, $matches)) {
if (is_string($operatorValue) && preg_match('/^\/(.*?)\/([a-z]*)$/i', $operatorValue, $matches)) {
return (bool)preg_match('/'.$matches[1].'/'.$matches[2], $v);
}
return $operatorValue === $v;
@ -196,34 +196,34 @@ abstract class PHPMongoQuery {
* @throws Exception Exceptions on invalid operators, invalid unknown operator callback, and invalid operator values
*/
private static function _executeOperatorOnElement(string $operator, $operatorValue, string $element, array &$document, array $options = []): bool {
if($options['_debug'] && $options['_shouldLog']) {
if ($options['_debug'] && $options['_shouldLog']) {
$options['logger']->debug('_executeOperatorOnElement called', ['operator' => $operator, 'operatorValue' => $operatorValue, 'element' => $element, 'document' => $document]);
}
if($operator === '$not') {
if ($operator === '$not') {
return !self::_executeQueryOnElement($operatorValue, $element, $document, $options);
}
$elementSpecifier = explode('.', $element);
$v = & $document;
$exists = true;
foreach($elementSpecifier as $index => $es) {
if(empty($v)) {
foreach ($elementSpecifier as $index => $es) {
if (empty($v)) {
$exists = false;
break;
}
if(isset($v[0])) {
if (isset($v[0])) {
// value from document is an array, so we need to iterate through array and test the query on all elements of the array
// if any elements match, then return true
$newSpecifier = implode('.', array_slice($elementSpecifier, $index));
foreach($v as $item) {
if(self::_executeOperatorOnElement($operator, $operatorValue, $newSpecifier, $item, $options)) {
foreach ($v as $item) {
if (self::_executeOperatorOnElement($operator, $operatorValue, $newSpecifier, $item, $options)) {
return true;
}
}
return false;
}
if(isset($v[$es])) {
if (isset($v[$es])) {
$v = & $v[$es];
} else {
$exists = false;
@ -231,40 +231,40 @@ abstract class PHPMongoQuery {
}
}
switch($operator) {
switch ($operator) {
case '$all':
if(!$exists) {
if (!$exists) {
return false;
}
if(!is_array($operatorValue)) {
if (!is_array($operatorValue)) {
throw new Exception('$all requires array');
}
if(count($operatorValue) === 0) {
if (count($operatorValue) === 0) {
return false;
}
if(!is_array($v)) {
if(count($operatorValue) === 1) {
if (!is_array($v)) {
if (count($operatorValue) === 1) {
return $v === $operatorValue[0];
}
return false;
}
return count(array_intersect($v, $operatorValue)) === count($operatorValue);
case '$e':
if(!$exists) {
if (!$exists) {
return false;
}
return self::_isEqual($v, $operatorValue);
case '$in':
if(!$exists) {
if (!$exists) {
return false;
}
if(!is_array($operatorValue)) {
if (!is_array($operatorValue)) {
throw new Exception('$in requires array');
}
if(count($operatorValue) === 0) {
if (count($operatorValue) === 0) {
return false;
}
if(is_array($v)) {
if (is_array($v)) {
return count(array_intersect($v, $operatorValue)) > 0;
}
return in_array($v, $operatorValue);
@ -274,43 +274,43 @@ abstract class PHPMongoQuery {
case '$gte': return $exists && $v >= $operatorValue;
case '$ne': return (!$exists && $operatorValue !== null) || ($exists && !self::_isEqual($v, $operatorValue));
case '$nin':
if(!$exists) {
if (!$exists) {
return true;
}
if(!is_array($operatorValue)) {
if (!is_array($operatorValue)) {
throw new Exception('$nin requires array');
}
if(count($operatorValue) === 0) {
if (count($operatorValue) === 0) {
return true;
}
if(is_array($v)) {
if (is_array($v)) {
return count(array_intersect($v, $operatorValue)) === 0;
}
return !in_array($v, $operatorValue);
case '$exists': return ($operatorValue && $exists) || (!$operatorValue && !$exists);
case '$mod':
if(!$exists) {
if (!$exists) {
return false;
}
if(!is_array($operatorValue)) {
if (!is_array($operatorValue)) {
throw new Exception('$mod requires array');
}
if(count($operatorValue) !== 2) {
if (count($operatorValue) !== 2) {
throw new Exception('$mod requires two parameters in array: divisor and remainder');
}
return $v % $operatorValue[0] === $operatorValue[1];
default:
if(empty($options['unknownOperatorCallback']) || !is_callable($options['unknownOperatorCallback'])) {
if (empty($options['unknownOperatorCallback']) || !is_callable($options['unknownOperatorCallback'])) {
throw new Exception('Operator '.$operator.' is unknown');
}
$res = call_user_func($options['unknownOperatorCallback'], $operator, $operatorValue, $element, $document);
if($res === null) {
if ($res === null) {
throw new Exception('Operator '.$operator.' is unknown');
}
if(!is_bool($res)) {
if (!is_bool($res)) {
throw new Exception('Return value of unknownOperatorCallback must be boolean, actual value '.$res);
}
return $res;
@ -326,11 +326,11 @@ abstract class PHPMongoQuery {
*/
public static function getDependentFields(array $query) {
$fields = [];
foreach($query as $k => $v) {
if(is_array($v)) {
foreach ($query as $k => $v) {
if (is_array($v)) {
$fields = array_merge($fields, static::getDependentFields($v));
}
if(is_int($k) || $k[0] === '$') {
if (is_int($k) || $k[0] === '$') {
continue;
}
$fields[] = $k;

@ -303,7 +303,7 @@ trait Sharing {
public function isFieldInResponse($field, $contentExpected) {
$data = simplexml_load_string($this->response->getBody())->data[0];
if ((string)$field == 'expiration') {
if(!empty($contentExpected)) {
if (!empty($contentExpected)) {
$contentExpected = date('Y-m-d', strtotime($contentExpected)) . ' 00:00:00';
}
}

@ -94,12 +94,12 @@ class PreviewCommand extends Command {
)->addRow(new TableSeparator());
/** @var MigrationAttribute[] $attributes */
foreach($data as $migration => $attributes) {
foreach ($data as $migration => $attributes) {
$attributesStr = [];
if (empty($attributes)) {
$attributesStr[] = '<comment>(metadata not set)</comment>';
}
foreach($attributes as $attribute) {
foreach ($attributes as $attribute) {
$definition = '<info>' . $attribute->definition() . '</info>';
$definition .= empty($attribute->getDescription()) ? '' : "\n " . $attribute->getDescription();
$definition .= empty($attribute->getNotes()) ? '' : "\n <comment>" . implode("</comment>\n <comment>", $attribute->getNotes()) . '</comment>';

@ -109,7 +109,7 @@ class TextProcessingApiController extends \OCP\AppFramework\OCSController {
try {
try {
$this->textProcessingManager->runOrScheduleTask($task);
} catch(TaskFailureException) {
} catch (TaskFailureException) {
// noop, because the task object has the failure status set already, we just return the task json
}

@ -150,7 +150,7 @@ class TextToImageApiController extends \OCP\AppFramework\OCSController {
$task = $this->textToImageManager->getUserTask($id, $this->userId);
try {
$folder = $this->appData->getFolder('text2image');
} catch(NotFoundException) {
} catch (NotFoundException) {
$res = new DataResponse(['message' => $this->l->t('Image not found')], Http::STATUS_NOT_FOUND);
$res->throttle(['action' => 'text2image']);
return $res;

@ -1378,7 +1378,7 @@ class AppConfig implements IAppConfig {
* @return array<string, string|int|float|bool|array>
*/
private function formatAppValues(string $app, array $values, ?bool $lazy = null): array {
foreach($values as $key => $value) {
foreach ($values as $key => $value) {
try {
$type = $this->getValueType($app, $key, $lazy);
} catch (AppConfigUnknownKeyException $e) {

@ -132,7 +132,7 @@ class Manager implements ICommentsManager {
try {
$comment->getCreationDateTime();
} catch(\LogicException $e) {
} catch (\LogicException $e) {
$comment->setCreationDateTime(new \DateTime());
}

@ -34,7 +34,7 @@ class AutoIncrementHandler {
}
private function getCache(): IMemcache {
if(is_null($this->cache)) {
if (is_null($this->cache)) {
$cache = $this->cacheFactory->createDistributed('shared_autoincrement');
if ($cache instanceof IMemcache) {
$this->cache = $cache;
@ -118,7 +118,7 @@ class AutoIncrementHandler {
$next = $cache->inc($shardDefinition->table);
if (is_int($next) && $next >= self::MIN_VALID_KEY) {
return $next;
} elseif(is_int($next)) {
} elseif (is_int($next)) {
// key got cleared, invalidate and retry
$cache->cas($shardDefinition->table, $next, 'empty-placeholder');
return null;

@ -290,7 +290,7 @@ class SearchBuilder {
$value = $operator->getValue();
$type = $operator->getType();
switch($operator->getExtra()) {
switch ($operator->getExtra()) {
case IMetadataQuery::EXTRA:
$metadataQuery->joinIndex($field); // join index table if not joined yet
$field = $metadataQuery->getMetadataValueField($field);

@ -43,7 +43,7 @@ class MetadataManager {
$ms = new MigrationService($appId, $this->connection);
$metadata = [];
foreach($ms->getAvailableVersions() as $version) {
foreach ($ms->getAvailableVersions() as $version) {
$metadata[$version] = [];
$class = new ReflectionClass($ms->createInstance($version));
$attributes = $class->getAttributes();

@ -25,7 +25,7 @@ class SearchQuery implements ISearchQuery {
private int $limit = self::LIMIT_DEFAULT,
private int|string|null $cursor = null,
private string $route = '',
private array $routeParameters = [],
private array $routeParameters = [],
) {
}

@ -33,7 +33,7 @@ class Address implements IAddress {
}
public function matches(IRange... $ranges): bool {
foreach($ranges as $range) {
foreach ($ranges as $range) {
if ($range->contains($this)) {
return true;
}

@ -275,7 +275,7 @@ class Manager implements IManager {
// If $expirationDate is falsy, noExpirationDate is true and expiration not enforced
// Then skip expiration date validation as null is accepted
if(!$share->getNoExpirationDate() || $isEnforced) {
if (!$share->getNoExpirationDate() || $isEnforced) {
if ($expirationDate !== null) {
$expirationDate->setTimezone($this->dateTimeZone->getTimeZone());
$expirationDate->setTime(0, 0, 0);
@ -353,7 +353,7 @@ class Manager implements IManager {
// If $expirationDate is falsy, noExpirationDate is true and expiration not enforced
// Then skip expiration date validation as null is accepted
if(!($share->getNoExpirationDate() && !$isEnforced)) {
if (!($share->getNoExpirationDate() && !$isEnforced)) {
if ($expirationDate !== null) {
$expirationDate->setTimezone($this->dateTimeZone->getTimeZone());
$expirationDate->setTime(0, 0, 0);

@ -175,7 +175,7 @@ class Manager implements IManager {
}
try {
return ['output' => $this->provider->process($input['input'])];
} catch(\RuntimeException $e) {
} catch (\RuntimeException $e) {
throw new ProcessingException($e->getMessage(), 0, $e);
}
}
@ -306,7 +306,7 @@ class Manager implements IManager {
public function process(?string $userId, array $input, callable $reportProgress): array {
try {
$folder = $this->appData->getFolder('text2image');
} catch(\OCP\Files\NotFoundException) {
} catch (\OCP\Files\NotFoundException) {
$folder = $this->appData->newFolder('text2image');
}
$resources = [];
@ -994,7 +994,7 @@ class Manager implements IManager {
}
$newInputOutput = [];
$spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []);
foreach($spec as $key => $descriptor) {
foreach ($spec as $key => $descriptor) {
$type = $descriptor->getShapeType();
if (!isset($input[$key])) {
continue;
@ -1086,7 +1086,7 @@ class Manager implements IManager {
$folder = $this->appData->newFolder('TaskProcessing');
}
$spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []);
foreach($spec as $key => $descriptor) {
foreach ($spec as $key => $descriptor) {
$type = $descriptor->getShapeType();
if (!isset($output[$key])) {
continue;
@ -1231,7 +1231,7 @@ class Manager implements IManager {
private function validateOutputFileIds(array $output, ...$specs): array {
$newOutput = [];
$spec = array_reduce($specs, fn ($carry, $spec) => $carry + $spec, []);
foreach($spec as $key => $descriptor) {
foreach ($spec as $key => $descriptor) {
$type = $descriptor->getShapeType();
if (!isset($output[$key])) {
continue;

@ -65,7 +65,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob {
* @return void
*/
private function clearFilesOlderThan(ISimpleFolder $folder, int $ageInSeconds): void {
foreach($folder->getDirectoryListing() as $file) {
foreach ($folder->getDirectoryListing() as $file) {
if ($file->getMTime() < time() - $ageInSeconds) {
try {
$file->delete();

@ -281,7 +281,7 @@ class JSConfigHelper {
$result = '';
// Echo it
foreach ($array as $setting => $value) {
foreach ($array as $setting => $value) {
$result .= 'var '. $setting . '='. $value . ';' . PHP_EOL;
}

@ -119,13 +119,13 @@ class Manager implements IManager {
}
try {
$folder = $this->appData->getFolder('text2image');
} catch(NotFoundException) {
} catch (NotFoundException) {
$this->logger->debug('Creating folder in appdata for Text2Image results');
$folder = $this->appData->newFolder('text2image');
}
try {
$folder = $folder->getFolder((string)$task->getId());
} catch(NotFoundException) {
} catch (NotFoundException) {
$this->logger->debug('Creating new folder in appdata Text2Image results folder');
$folder = $folder->newFolder((string)$task->getId());
}
@ -162,7 +162,7 @@ class Manager implements IManager {
if (isset($files, $files[$i])) {
try {
$files[$i]->delete();
} catch(NotPermittedException $e) {
} catch (NotPermittedException $e) {
$this->logger->warning('Failed to clean up Text2Image result file after error', ['exception' => $e]);
}
}

@ -55,7 +55,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob {
}
} catch (Exception $e) {
$this->logger->warning('Failed to delete stale text to image tasks', ['exception' => $e]);
} catch(NotFoundException) {
} catch (NotFoundException) {
// noop
}
}

@ -751,7 +751,7 @@ class Manager extends PublicEmitter implements IUserManager {
$queryBuilder->expr()->eq('p.appid', $queryBuilder->expr()->literal('login')),
$queryBuilder->expr()->eq('p.configkey', $queryBuilder->expr()->literal('lastLogin')))
);
if($search !== '') {
if ($search !== '') {
$queryBuilder->leftJoin('u', 'preferences', 'p1', $queryBuilder->expr()->andX(
$queryBuilder->expr()->eq('p1.userid', 'uid'),
$queryBuilder->expr()->eq('p1.appid', $queryBuilder->expr()->literal('settings')),

@ -33,7 +33,7 @@ class SearchIntegrationTest extends TestCase {
$id = $this->cache->put('file10', ['size' => 1, 'mtime' => 50, 'mimetype' => 'foo/folder']);
$comparisons = [];
for($i = 1; $i <= 1001; $i++) {
for ($i = 1; $i <= 1001; $i++) {
$comparisons[] = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', "file$i");
}
$operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, $comparisons);

@ -351,7 +351,7 @@ class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider {
public function generate(string $prompt, array $resources): void {
$this->ran = true;
foreach($resources as $resource) {
foreach ($resources as $resource) {
fwrite($resource, 'test');
}
}

Loading…
Cancel
Save