Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
d357f4b10f
commit
d9015a8c94
|
@ -31,17 +31,17 @@ return [
|
|||
'ocs' => [
|
||||
[
|
||||
'name' => 'Config#getConfig',
|
||||
'url' => '/api/v1/config',
|
||||
'url' => '/api/v1/config',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
[
|
||||
'name' => 'Config#setConfig',
|
||||
'url' => '/api/v1/config/{key}',
|
||||
'url' => '/api/v1/config/{key}',
|
||||
'verb' => 'PUT',
|
||||
],
|
||||
[
|
||||
'name' => 'Config#deleteConfig',
|
||||
'url' => '/api/v1/config/{key}',
|
||||
'url' => '/api/v1/config/{key}',
|
||||
'verb' => 'DELETE',
|
||||
],
|
||||
]
|
||||
|
|
|
@ -53,41 +53,41 @@ class AccessibilityProvider {
|
|||
public function __construct(string $appName,
|
||||
IURLGenerator $urlGenerator,
|
||||
IL10N $l) {
|
||||
$this->appName = $appName;
|
||||
$this->appName = $appName;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->l = $l;
|
||||
$this->l = $l;
|
||||
}
|
||||
|
||||
public function getThemes() {
|
||||
return [
|
||||
[
|
||||
'id' => 'dark',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'theme-dark.jpg'),
|
||||
'id' => 'dark',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'theme-dark.jpg'),
|
||||
'title' => $this->l->t('Dark theme'),
|
||||
'enableLabel' => $this->l->t('Enable dark theme'),
|
||||
'text' => $this->l->t('A dark theme to ease your eyes by reducing the overall luminosity and brightness. It is still under development, so please report any issues you may find.')
|
||||
'text' => $this->l->t('A dark theme to ease your eyes by reducing the overall luminosity and brightness. It is still under development, so please report any issues you may find.')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getHighContrast() {
|
||||
return [
|
||||
'id' => 'highcontrast',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'mode-highcontrast.jpg'),
|
||||
'id' => 'highcontrast',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'mode-highcontrast.jpg'),
|
||||
'title' => $this->l->t('High contrast mode'),
|
||||
'enableLabel' => $this->l->t('Enable high contrast mode'),
|
||||
'text' => $this->l->t('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.')
|
||||
'text' => $this->l->t('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.')
|
||||
];
|
||||
}
|
||||
|
||||
public function getFonts() {
|
||||
return [
|
||||
[
|
||||
'id' => 'fontdyslexic',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'font-opendyslexic.jpg'),
|
||||
'id' => 'fontdyslexic',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'font-opendyslexic.jpg'),
|
||||
'title' => $this->l->t('Dyslexia font'),
|
||||
'enableLabel' => $this->l->t('Enable dyslexia font'),
|
||||
'text' => $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.')
|
||||
'text' => $this->l->t('OpenDyslexic is a free typeface/font designed to mitigate some of the common reading errors caused by dyslexia.')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
@ -113,19 +113,19 @@ class AccessibilityController extends Controller {
|
|||
IconsCacher $iconsCacher,
|
||||
\OC_Defaults $defaults) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userManager = $userManager;
|
||||
$this->logger = $logger;
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userManager = $userManager;
|
||||
$this->logger = $logger;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
$this->iconsCacher = $iconsCacher;
|
||||
$this->defaults = $defaults;
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
$this->iconsCacher = $iconsCacher;
|
||||
$this->defaults = $defaults;
|
||||
|
||||
$this->serverRoot = \OC::$SERVERROOT;
|
||||
$this->appRoot = $this->appManager->getAppPath($this->appName);
|
||||
$this->appRoot = $this->appManager->getAppPath($this->appName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,8 +136,8 @@ class AccessibilityController extends Controller {
|
|||
* @return DataDisplayResponse
|
||||
*/
|
||||
public function getCss(): DataDisplayResponse {
|
||||
$css = '';
|
||||
$imports = '';
|
||||
$css = '';
|
||||
$imports = '';
|
||||
if ($this->userSession->isLoggedIn()) {
|
||||
$userValues = $this->getUserValues();
|
||||
} else {
|
||||
|
@ -182,7 +182,7 @@ class AccessibilityController extends Controller {
|
|||
|
||||
// Rebase all urls
|
||||
$appWebRoot = substr($this->appRoot, strlen($this->serverRoot) - strlen(\OC::$WEBROOT));
|
||||
$css = $this->rebaseUrls($css, $appWebRoot . '/css');
|
||||
$css = $this->rebaseUrls($css, $appWebRoot . '/css');
|
||||
|
||||
if (in_array('dark', $userValues) && $this->iconsCacher->getCachedList() && $this->iconsCacher->getCachedList()->getSize() > 0) {
|
||||
$iconsCss = $this->invertSvgIconsColor($this->iconsCacher->getCachedList()->getContent());
|
||||
|
@ -215,7 +215,7 @@ class AccessibilityController extends Controller {
|
|||
*/
|
||||
private function getUserValues(): array {
|
||||
$userTheme = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false);
|
||||
$userFont = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false);
|
||||
$userFont = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false);
|
||||
$userHighContrast = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'highcontrast', false);
|
||||
|
||||
return [$userTheme, $userHighContrast, $userFont];
|
||||
|
@ -240,7 +240,7 @@ class AccessibilityController extends Controller {
|
|||
* @return string
|
||||
*/
|
||||
private function rebaseUrls(string $css, string $webDir): string {
|
||||
$re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x';
|
||||
$re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x';
|
||||
$subst = 'url(\'' . $webDir . '/$1\')';
|
||||
|
||||
return preg_replace($re, $subst, $css);
|
||||
|
|
|
@ -75,11 +75,11 @@ class ConfigController extends OCSController {
|
|||
IUserSession $userSession,
|
||||
AccessibilityProvider $accessibilityProvider) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userSession = $userSession;
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userSession = $userSession;
|
||||
$this->accessibilityProvider = $accessibilityProvider;
|
||||
$this->userId = $userSession->getUser()->getUID();
|
||||
$this->userId = $userSession->getUser()->getUID();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +115,7 @@ class ConfigController extends OCSController {
|
|||
|
||||
$themes = $this->accessibilityProvider->getThemes();
|
||||
$highcontrast = [$this->accessibilityProvider->getHighContrast()];
|
||||
$fonts = $this->accessibilityProvider->getFonts();
|
||||
$fonts = $this->accessibilityProvider->getFonts();
|
||||
|
||||
$availableOptions = array_map(function ($option) {
|
||||
return $option['id'];
|
||||
|
|
|
@ -74,13 +74,13 @@ class Personal implements ISettings {
|
|||
IURLGenerator $urlGenerator,
|
||||
AccessibilityProvider $accessibilityProvider,
|
||||
IInitialStateService $initialStateService) {
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userSession = $userSession;
|
||||
$this->l = $l;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->appName = $appName;
|
||||
$this->config = $config;
|
||||
$this->userSession = $userSession;
|
||||
$this->l = $l;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->accessibilityProvider = $accessibilityProvider;
|
||||
$this->initialStateService = $initialStateService;
|
||||
$this->initialStateService = $initialStateService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,14 +93,14 @@ class Personal implements ISettings {
|
|||
|
||||
$availableConfig = [
|
||||
'themes' => $this->accessibilityProvider->getThemes(),
|
||||
'fonts' => $this->accessibilityProvider->getFonts(),
|
||||
'fonts' => $this->accessibilityProvider->getFonts(),
|
||||
'highcontrast' => $this->accessibilityProvider->getHighContrast()
|
||||
];
|
||||
|
||||
$userConfig = [
|
||||
'highcontrast' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'highcontrast', false),
|
||||
'theme' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false),
|
||||
'font' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false)
|
||||
'theme' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'theme', false),
|
||||
'font' => $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'font', false)
|
||||
];
|
||||
|
||||
$this->initialStateService->provideInitialState($this->appName, 'available-config', $availableConfig);
|
||||
|
|
|
@ -48,9 +48,9 @@ class PersonalSection implements IIconSection {
|
|||
public function __construct(string $appName,
|
||||
IURLGenerator $urlGenerator,
|
||||
IL10N $l) {
|
||||
$this->appName = $appName;
|
||||
$this->appName = $appName;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->l = $l;
|
||||
$this->l = $l;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ class Rotate extends TimedJob {
|
|||
use RotationTrait;
|
||||
|
||||
public function __construct() {
|
||||
$this->setInterval(60*60*3);
|
||||
$this->setInterval(60 * 60 * 3);
|
||||
}
|
||||
|
||||
protected function run($argument) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class EventHandler implements ICommentsEventHandler {
|
|||
private $notificationListener;
|
||||
|
||||
public function __construct(ActivityListener $activityListener, NotificationListener $notificationListener) {
|
||||
$this->activityListener = $activityListener;
|
||||
$this->activityListener = $activityListener;
|
||||
$this->notificationListener = $notificationListener;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class CommentersSorterTest extends TestCase {
|
|||
$commentMocks = [];
|
||||
foreach ($data['actors'] as $actorType => $actors) {
|
||||
foreach ($actors as $actorId => $noOfComments) {
|
||||
for ($i=0;$i<$noOfComments;$i++) {
|
||||
for ($i = 0;$i < $noOfComments;$i++) {
|
||||
$mock = $this->createMock(IComment::class);
|
||||
$mock->expects($this->atLeastOnce())
|
||||
->method('getActorType')
|
||||
|
|
|
@ -38,7 +38,7 @@ class CleanupDirectLinksJob extends TimedJob {
|
|||
private $mapper;
|
||||
|
||||
public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) {
|
||||
$this->setInterval(60*60*24);
|
||||
$this->setInterval(60 * 60 * 24);
|
||||
|
||||
$this->timeFactory = $timeFactory;
|
||||
$this->mapper = $mapper;
|
||||
|
@ -46,6 +46,6 @@ class CleanupDirectLinksJob extends TimedJob {
|
|||
|
||||
protected function run($argument) {
|
||||
// Delete all shares expired 24 hours ago
|
||||
$this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24);
|
||||
$this->mapper->deleteExpired($this->timeFactory->getTime() - 60 * 60 * 24);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class UploadCleanup extends TimedJob {
|
|||
$this->jobList = $jobList;
|
||||
|
||||
// Run once a day
|
||||
$this->setInterval(60*60*24);
|
||||
$this->setInterval(60 * 60 * 24);
|
||||
}
|
||||
|
||||
protected function run($argument) {
|
||||
|
@ -65,7 +65,7 @@ class UploadCleanup extends TimedJob {
|
|||
$uploads = $userRoot->get('uploads');
|
||||
/** @var Folder $uploadFolder */
|
||||
$uploadFolder = $uploads->get($folder);
|
||||
} catch (NotFoundException|NoUserException $e) {
|
||||
} catch (NotFoundException | NoUserException $e) {
|
||||
$this->jobList->remove(self::class, $argument);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class BirthdayService {
|
|||
$this->calDavBackEnd->createCalendar($principal, self::BIRTHDAY_CALENDAR_URI, [
|
||||
'{DAV:}displayname' => 'Contact birthdays',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => '#E9D859',
|
||||
'components' => 'VEVENT',
|
||||
'components' => 'VEVENT',
|
||||
]);
|
||||
|
||||
return $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI);
|
||||
|
@ -427,8 +427,8 @@ class BirthdayService {
|
|||
*/
|
||||
private function formatTitle(string $field,
|
||||
string $name,
|
||||
int $year=null,
|
||||
bool $supports4Byte=true):string {
|
||||
int $year = null,
|
||||
bool $supports4Byte = true):string {
|
||||
if ($supports4Byte) {
|
||||
switch ($field) {
|
||||
case 'BDAY':
|
||||
|
|
|
@ -126,11 +126,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @var array
|
||||
*/
|
||||
public $propertyMap = [
|
||||
'{DAV:}displayname' => 'displayname',
|
||||
'{DAV:}displayname' => 'displayname',
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
|
||||
'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
|
||||
'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -139,12 +139,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @var array
|
||||
*/
|
||||
public $subscriptionPropertyMap = [
|
||||
'{DAV:}displayname' => 'displayname',
|
||||
'{http://apple.com/ns/ical/}refreshrate' => 'refreshrate',
|
||||
'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
|
||||
'{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos',
|
||||
'{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms',
|
||||
'{DAV:}displayname' => 'displayname',
|
||||
'{http://apple.com/ns/ical/}refreshrate' => 'refreshrate',
|
||||
'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
|
||||
'{http://calendarserver.org/ns/}subscribed-strip-todos' => 'striptodos',
|
||||
'{http://calendarserver.org/ns/}subscribed-strip-alarms' => 'stripalarms',
|
||||
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments',
|
||||
];
|
||||
|
||||
|
@ -311,7 +311,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
|
||||
];
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$principals = array_map(function ($principal) {
|
||||
return urldecode($principal);
|
||||
}, $principals);
|
||||
$principals[]= $principalUri;
|
||||
$principals[] = $principalUri;
|
||||
|
||||
$fields = array_values($this->propertyMap);
|
||||
$fields[] = 'a.id';
|
||||
|
@ -389,7 +389,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$readOnlyPropertyName => $readOnly,
|
||||
];
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
|
||||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
||||
];
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
|
||||
];
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
|
||||
];
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
||||
];
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -679,7 +679,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
||||
];
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -705,7 +705,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->from('calendarsubscriptions')
|
||||
->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
||||
->orderBy('calendarorder', 'asc');
|
||||
$stmt =$query->execute();
|
||||
$stmt = $query->execute();
|
||||
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
@ -714,16 +714,16 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
$subscription = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'principaluri' => $row['principaluri'],
|
||||
'source' => $row['source'],
|
||||
'source' => $row['source'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
|
||||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
||||
];
|
||||
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
|
||||
if (!is_null($row[$dbName])) {
|
||||
$subscription[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
@ -746,11 +746,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
public function createCalendar($principalUri, $calendarUri, array $properties) {
|
||||
$values = [
|
||||
'principaluri' => $this->convertPrincipal($principalUri, true),
|
||||
'uri' => $calendarUri,
|
||||
'synctoken' => 1,
|
||||
'transparent' => 0,
|
||||
'components' => 'VEVENT,VTODO',
|
||||
'displayname' => $calendarUri
|
||||
'uri' => $calendarUri,
|
||||
'synctoken' => 1,
|
||||
'transparent' => 0,
|
||||
'components' => 'VEVENT,VTODO',
|
||||
'displayname' => $calendarUri
|
||||
];
|
||||
|
||||
// Default value
|
||||
|
@ -771,7 +771,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
|
||||
}
|
||||
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||
if (isset($properties[$xmlName])) {
|
||||
$values[$dbName] = $properties[$xmlName];
|
||||
}
|
||||
|
@ -939,7 +939,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
public function getCalendarObjects($calendarId, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
|
||||
public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
|
||||
->from('calendarobjects')
|
||||
|
@ -950,14 +950,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result = [];
|
||||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
$result[] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'calendarid' => $row['calendarid'],
|
||||
'size' => (int)$row['size'],
|
||||
'component' => strtolower($row['componenttype']),
|
||||
'classification'=> (int)$row['classification']
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'calendarid' => $row['calendarid'],
|
||||
'size' => (int)$row['size'],
|
||||
'component' => strtolower($row['componenttype']),
|
||||
'classification' => (int)$row['classification']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -981,7 +981,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array|null
|
||||
*/
|
||||
public function getCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function getCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
|
||||
->from('calendarobjects')
|
||||
|
@ -996,15 +996,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
return [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'calendarid' => $row['calendarid'],
|
||||
'size' => (int)$row['size'],
|
||||
'calendardata' => $this->readBlob($row['calendardata']),
|
||||
'component' => strtolower($row['componenttype']),
|
||||
'classification'=> (int)$row['classification']
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'calendarid' => $row['calendarid'],
|
||||
'size' => (int)$row['size'],
|
||||
'calendardata' => $this->readBlob($row['calendardata']),
|
||||
'component' => strtolower($row['componenttype']),
|
||||
'classification' => (int)$row['classification']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
|
||||
public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
|
||||
if (empty($uris)) {
|
||||
return [];
|
||||
}
|
||||
|
@ -1042,14 +1042,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
while ($row = $result->fetch()) {
|
||||
$objects[] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'calendarid' => $row['calendarid'],
|
||||
'size' => (int)$row['size'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'calendarid' => $row['calendarid'],
|
||||
'size' => (int)$row['size'],
|
||||
'calendardata' => $this->readBlob($row['calendardata']),
|
||||
'component' => strtolower($row['componenttype']),
|
||||
'component' => strtolower($row['componenttype']),
|
||||
'classification' => (int)$row['classification']
|
||||
];
|
||||
}
|
||||
|
@ -1078,7 +1078,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return string
|
||||
*/
|
||||
public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$extraData = $this->getDenormalizedData($calendarData);
|
||||
|
||||
$q = $this->db->getQueryBuilder();
|
||||
|
@ -1169,7 +1169,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return string
|
||||
*/
|
||||
public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$extraData = $this->getDenormalizedData($calendarData);
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendarobjects')
|
||||
|
@ -1252,7 +1252,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return void
|
||||
*/
|
||||
public function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
|
||||
if (is_array($data)) {
|
||||
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
|
||||
|
@ -1345,7 +1345,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
public function calendarQuery($calendarId, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array {
|
||||
public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array {
|
||||
$componentType = null;
|
||||
$requirePostFilter = true;
|
||||
$timeRange = null;
|
||||
|
@ -1439,7 +1439,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param integer|null $offset
|
||||
* @return array
|
||||
*/
|
||||
public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) {
|
||||
public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
|
||||
$calendars = $this->getCalendarsForUser($principalUri);
|
||||
$ownCalendars = [];
|
||||
$sharedCalendars = [];
|
||||
|
@ -1932,7 +1932,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
// Current synctoken
|
||||
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
|
||||
$stmt->execute([ $calendarId ]);
|
||||
|
@ -1944,15 +1944,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$result = [
|
||||
'syncToken' => $currentToken,
|
||||
'added' => [],
|
||||
'modified' => [],
|
||||
'deleted' => [],
|
||||
'added' => [],
|
||||
'modified' => [],
|
||||
'deleted' => [],
|
||||
];
|
||||
|
||||
if ($syncToken) {
|
||||
$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
|
||||
if ($limit>0) {
|
||||
$query.= " LIMIT " . (int)$limit;
|
||||
if ($limit > 0) {
|
||||
$query .= " LIMIT " . (int)$limit;
|
||||
}
|
||||
|
||||
// Fetching all changes
|
||||
|
@ -2037,22 +2037,22 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->from('calendarsubscriptions')
|
||||
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
|
||||
->orderBy('calendarorder', 'asc');
|
||||
$stmt =$query->execute();
|
||||
$stmt = $query->execute();
|
||||
|
||||
$subscriptions = [];
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$subscription = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
'principaluri' => $row['principaluri'],
|
||||
'source' => $row['source'],
|
||||
'source' => $row['source'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
|
||||
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
|
||||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
||||
];
|
||||
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
|
||||
if (!is_null($row[$dbName])) {
|
||||
$subscription[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
@ -2082,14 +2082,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$values = [
|
||||
'principaluri' => $principalUri,
|
||||
'uri' => $uri,
|
||||
'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
|
||||
'uri' => $uri,
|
||||
'source' => $properties['{http://calendarserver.org/ns/}source']->getHref(),
|
||||
'lastmodified' => time(),
|
||||
];
|
||||
|
||||
$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
|
||||
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
|
||||
if (array_key_exists($xmlName, $properties)) {
|
||||
$values[$dbName] = $properties[$xmlName];
|
||||
if (in_array($dbName, $propertiesBoolean)) {
|
||||
|
@ -2147,7 +2147,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
|
||||
$newValues = [];
|
||||
|
||||
foreach ($mutations as $propertyName=>$propertyValue) {
|
||||
foreach ($mutations as $propertyName => $propertyValue) {
|
||||
if ($propertyName === '{http://calendarserver.org/ns/}source') {
|
||||
$newValues['source'] = $propertyValue->getHref();
|
||||
} else {
|
||||
|
@ -2159,7 +2159,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendarsubscriptions')
|
||||
->set('lastmodified', $query->createNamedParameter(time()));
|
||||
foreach ($newValues as $fieldName=>$value) {
|
||||
foreach ($newValues as $fieldName => $value) {
|
||||
$query->set($fieldName, $query->createNamedParameter($value));
|
||||
}
|
||||
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
||||
|
@ -2252,11 +2252,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
return [
|
||||
'uri' => $row['uri'],
|
||||
'uri' => $row['uri'],
|
||||
'calendardata' => $row['calendardata'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2282,10 +2282,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
$result[] = [
|
||||
'calendardata' => $row['calendardata'],
|
||||
'uri' => $row['uri'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2338,7 +2338,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return void
|
||||
*/
|
||||
protected function addChange($calendarId, $objectUri, $operation, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
|
@ -2388,7 +2388,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$uid = null;
|
||||
$classification = self::CLASSIFICATION_PUBLIC;
|
||||
foreach ($vObject->getComponents() as $component) {
|
||||
if ($component->name!=='VTIMEZONE') {
|
||||
if ($component->name !== 'VTIMEZONE') {
|
||||
$componentType = $component->name;
|
||||
$uid = (string)$component->UID;
|
||||
break;
|
||||
|
@ -2446,7 +2446,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'size' => strlen($calendarData),
|
||||
'componentType' => $componentType,
|
||||
'firstOccurence' => is_null($firstOccurrence) ? null : max(0, $firstOccurrence),
|
||||
'lastOccurence' => $lastOccurrence,
|
||||
'lastOccurence' => $lastOccurrence,
|
||||
'uid' => $uid,
|
||||
'classification' => $classification
|
||||
];
|
||||
|
@ -2493,7 +2493,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param int $calendarType
|
||||
* @return array
|
||||
*/
|
||||
public function getShares($resourceId, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function getShares($resourceId, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
return $this->calendarSharingBackend->getShares($resourceId);
|
||||
}
|
||||
|
||||
|
@ -2574,7 +2574,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $calendarData
|
||||
* @param int $calendarType
|
||||
*/
|
||||
public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||
public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
|
||||
$objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
|
||||
|
||||
try {
|
||||
|
|
|
@ -138,7 +138,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
* @return array
|
||||
*/
|
||||
public function getACL() {
|
||||
$acl = [
|
||||
$acl = [
|
||||
[
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => $this->getOwner(),
|
||||
|
@ -191,7 +191,7 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
}
|
||||
|
||||
if ($this->getOwner() !== parent::getOwner()) {
|
||||
$acl[] = [
|
||||
$acl[] = [
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => parent::getOwner(),
|
||||
'protected' => true,
|
||||
|
|
|
@ -52,7 +52,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
|||
private $pluginManager;
|
||||
|
||||
/** @var bool */
|
||||
private $returnCachedSubscriptions=false;
|
||||
private $returnCachedSubscriptions = false;
|
||||
|
||||
public function __construct(BackendInterface $caldavBackend, $principalInfo) {
|
||||
parent::__construct($caldavBackend, $principalInfo);
|
||||
|
@ -183,7 +183,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
|||
* @param integer|null $limit
|
||||
* @param integer|null $offset
|
||||
*/
|
||||
public function calendarSearch(array $filters, $limit=null, $offset=null) {
|
||||
public function calendarSearch(array $filters, $limit = null, $offset = null) {
|
||||
$principalUri = $this->principalInfo['uri'];
|
||||
return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class CalendarImpl implements ICalendar {
|
|||
* @return array an array of events/journals/todos which are arrays of key-value-pairs
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function search($pattern, array $searchProperties=[], array $options=[], $limit=null, $offset=null) {
|
||||
public function search($pattern, array $searchProperties = [], array $options = [], $limit = null, $offset = null) {
|
||||
return $this->backend->search($this->calendarInfo, $pattern,
|
||||
$searchProperties, $options, $limit, $offset);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ use OCP\IDBConnection;
|
|||
* @package OCA\DAV\CalDAV\Proxy
|
||||
*/
|
||||
class ProxyMapper extends QBMapper {
|
||||
public const PERMISSION_READ = 1;
|
||||
public const PERMISSION_READ = 1;
|
||||
public const PERMISSION_WRITE = 2;
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,5 +47,5 @@ interface INotificationProvider {
|
|||
*/
|
||||
public function send(VEvent $vevent,
|
||||
string $calendarDisplayName,
|
||||
array $users=[]): void;
|
||||
array $users = []): void;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ abstract class AbstractProvider implements INotificationProvider {
|
|||
*/
|
||||
abstract public function send(VEvent $vevent,
|
||||
string $calendarDisplayName,
|
||||
array $users=[]): void;
|
||||
array $users = []): void;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
|
|
|
@ -83,7 +83,7 @@ class EmailProvider extends AbstractProvider {
|
|||
*/
|
||||
public function send(VEvent $vevent,
|
||||
string $calendarDisplayName,
|
||||
array $users=[]):void {
|
||||
array $users = []):void {
|
||||
$fallbackLanguage = $this->getFallbackLanguage();
|
||||
|
||||
$emailAddressesOfSharees = $this->getEMailAddressesOfAllUsersWithWriteAccessToCalendar($users);
|
||||
|
|
|
@ -86,8 +86,8 @@ class PushProvider extends AbstractProvider {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function send(VEvent $vevent,
|
||||
string $calendarDisplayName=null,
|
||||
array $users=[]):void {
|
||||
string $calendarDisplayName = null,
|
||||
array $users = []):void {
|
||||
if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -330,10 +330,10 @@ class ReminderService {
|
|||
*/
|
||||
private function getRemindersForVAlarm(VAlarm $valarm,
|
||||
array $objectData,
|
||||
string $eventHash=null,
|
||||
string $alarmHash=null,
|
||||
bool $isRecurring=false,
|
||||
bool $isRecurrenceException=false):array {
|
||||
string $eventHash = null,
|
||||
string $alarmHash = null,
|
||||
bool $isRecurring = false,
|
||||
bool $isRecurrenceException = false):array {
|
||||
if ($eventHash === null) {
|
||||
$eventHash = $this->getEventHash($valarm->parent);
|
||||
}
|
||||
|
|
|
@ -435,7 +435,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
* @param String[] $metadata
|
||||
* @return Array
|
||||
*/
|
||||
private function rowToPrincipal(array $row, array $metadata=[]):array {
|
||||
private function rowToPrincipal(array $row, array $metadata = []):array {
|
||||
return array_merge([
|
||||
'uri' => $this->principalPrefix . '/' . $row['backend_id'] . '-' . $row['resource_id'],
|
||||
'{DAV:}displayname' => $row['displayname'],
|
||||
|
|
|
@ -293,7 +293,7 @@ class IMipPlugin extends SabreIMipPlugin {
|
|||
$failed = $this->mailer->send($message);
|
||||
$iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip';
|
||||
if ($failed) {
|
||||
$this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]);
|
||||
$this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]);
|
||||
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
|
|
|
@ -208,7 +208,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
|
|||
}
|
||||
|
||||
$dtstart = $vevent->DTSTART;
|
||||
$dtend = $this->getDTEndFromVEvent($vevent);
|
||||
$dtend = $this->getDTEndFromVEvent($vevent);
|
||||
$uid = $vevent->UID->getValue();
|
||||
$sequence = isset($vevent->SEQUENCE) ? $vevent->SEQUENCE->getValue() : 0;
|
||||
$recurrenceId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->serialize() : '';
|
||||
|
@ -455,20 +455,20 @@ EOF;
|
|||
'start' => $start,
|
||||
'end' => $end,
|
||||
],
|
||||
'comp-filters' => [],
|
||||
'prop-filters' => [],
|
||||
'comp-filters' => [],
|
||||
'prop-filters' => [],
|
||||
],
|
||||
[
|
||||
'name' => 'VEVENT',
|
||||
'is-not-defined' => false,
|
||||
'time-range' => null,
|
||||
'comp-filters' => [],
|
||||
'prop-filters' => [
|
||||
'comp-filters' => [],
|
||||
'prop-filters' => [
|
||||
[
|
||||
'name' => 'UID',
|
||||
'name' => 'UID',
|
||||
'is-not-defined' => false,
|
||||
'time-range' => null,
|
||||
'text-match' => [
|
||||
'time-range' => null,
|
||||
'text-match' => [
|
||||
'value' => $ignoreUID,
|
||||
'negate-condition' => true,
|
||||
'collation' => 'i;octet',
|
||||
|
@ -549,7 +549,7 @@ EOF;
|
|||
* @return string
|
||||
*/
|
||||
private function stripOffMailTo(string $email): string {
|
||||
if (stripos($email, 'mailto:') === 0) {
|
||||
if (stripos($email, 'mailto:') === 0) {
|
||||
return substr($email, 7);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,20 +87,20 @@ class CalendarSearchReport implements XmlDeserializable {
|
|||
*/
|
||||
public static function xmlDeserialize(Reader $reader) {
|
||||
$elems = $reader->parseInnerTree([
|
||||
'{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
|
||||
'{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
|
||||
'{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
|
||||
'{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
|
||||
'{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter',
|
||||
'{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
|
||||
'{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
|
||||
'{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
|
||||
'{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
'{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter',
|
||||
'{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter',
|
||||
'{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter',
|
||||
'{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
]);
|
||||
|
||||
$newProps = [
|
||||
'filters' => [],
|
||||
'filters' => [],
|
||||
'properties' => [],
|
||||
'limit' => null,
|
||||
'offset' => null
|
||||
'limit' => null,
|
||||
'offset' => null
|
||||
];
|
||||
|
||||
if (!is_array($elems)) {
|
||||
|
|
|
@ -49,7 +49,7 @@ class Plugin extends ServerPlugin {
|
|||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $enabled=false;
|
||||
private $enabled = false;
|
||||
|
||||
/**
|
||||
* @var Server
|
||||
|
|
|
@ -105,7 +105,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
}
|
||||
|
||||
public function getACL() {
|
||||
$acl = [
|
||||
$acl = [
|
||||
[
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => $this->getOwner(),
|
||||
|
@ -130,7 +130,7 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
}
|
||||
|
||||
if ($this->getOwner() !== parent::getOwner()) {
|
||||
$acl[] = [
|
||||
$acl[] = [
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => parent::getOwner(),
|
||||
'protected' => true,
|
||||
|
|
|
@ -1044,7 +1044,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
|
||||
$query2 = $this->db->getQueryBuilder();
|
||||
|
||||
$addressBookOr = $query2->expr()->orX();
|
||||
$addressBookOr = $query2->expr()->orX();
|
||||
foreach ($addressBookIds as $addressBookId) {
|
||||
$addressBookOr->add($query2->expr()->eq('cp.addressbookid', $query2->createNamedParameter($addressBookId)));
|
||||
}
|
||||
|
|
|
@ -124,9 +124,9 @@ class Converter {
|
|||
$elements = explode(' ', $fullName);
|
||||
$result = ['', '', '', '', ''];
|
||||
if (count($elements) > 2) {
|
||||
$result[0] = implode(' ', array_slice($elements, count($elements)-1));
|
||||
$result[0] = implode(' ', array_slice($elements, count($elements) - 1));
|
||||
$result[1] = $elements[0];
|
||||
$result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
|
||||
$result[2] = implode(' ', array_slice($elements, 1, count($elements) - 2));
|
||||
} elseif (count($elements) === 2) {
|
||||
$result[0] = $elements[1];
|
||||
$result[1] = $elements[0];
|
||||
|
|
|
@ -99,7 +99,7 @@ class HasPhotoPlugin extends ServerPlugin {
|
|||
*/
|
||||
public function getPluginInfo() {
|
||||
return [
|
||||
'name' => $this->getPluginName(),
|
||||
'name' => $this->getPluginName(),
|
||||
'description' => 'Return a boolean stating if the vcard have a photo property set or not.'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
|
|||
|
||||
// Get the xml response
|
||||
$responseBody = $response->getBodyAsString();
|
||||
$responseXml = $this->server->xml->parse($responseBody);
|
||||
$responseXml = $this->server->xml->parse($responseBody);
|
||||
|
||||
// Reduce the vcards into one string
|
||||
$output = array_reduce($responseXml->getResponses(), function ($vcf, $card) {
|
||||
|
@ -114,7 +114,7 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
|
|||
*/
|
||||
public function getPluginInfo() {
|
||||
return [
|
||||
'name' => $this->getPluginName(),
|
||||
'name' => $this->getPluginName(),
|
||||
'description' => 'Intercept a multi-get request and return a single vcf file instead.'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ class PhotoCache {
|
|||
|
||||
return [
|
||||
'Content-Type' => $type,
|
||||
'body' => $val
|
||||
'body' => $val
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->logException($e, [
|
||||
|
|
|
@ -256,7 +256,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
|||
$result[self::PROPERTY_NAME_MENTIONS] = $this->composeMentionsPropertyValue();
|
||||
|
||||
$unread = null;
|
||||
$user = $this->userSession->getUser();
|
||||
$user = $this->userSession->getUser();
|
||||
if (!is_null($user)) {
|
||||
$readUntil = $this->commentsManager->getReadMark(
|
||||
$this->comment->getObjectType(),
|
||||
|
@ -295,8 +295,8 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
|||
|
||||
return [
|
||||
self::PROPERTY_NAME_MENTION => [
|
||||
self::PROPERTY_NAME_MENTION_TYPE => $mention['type'],
|
||||
self::PROPERTY_NAME_MENTION_ID => $mention['id'],
|
||||
self::PROPERTY_NAME_MENTION_TYPE => $mention['type'],
|
||||
self::PROPERTY_NAME_MENTION_ID => $mention['id'],
|
||||
self::PROPERTY_NAME_MENTION_DISPLAYNAME => $displayName,
|
||||
]
|
||||
];
|
||||
|
|
|
@ -48,9 +48,9 @@ class CommentsPlugin extends ServerPlugin {
|
|||
// namespace
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
|
||||
public const REPORT_NAME = '{http://owncloud.org/ns}filter-comments';
|
||||
public const REPORT_PARAM_LIMIT = '{http://owncloud.org/ns}limit';
|
||||
public const REPORT_PARAM_OFFSET = '{http://owncloud.org/ns}offset';
|
||||
public const REPORT_NAME = '{http://owncloud.org/ns}filter-comments';
|
||||
public const REPORT_PARAM_LIMIT = '{http://owncloud.org/ns}limit';
|
||||
public const REPORT_PARAM_OFFSET = '{http://owncloud.org/ns}offset';
|
||||
public const REPORT_PARAM_TIMESTAMP = '{http://owncloud.org/ns}datetime';
|
||||
|
||||
/** @var ICommentsManager */
|
||||
|
|
|
@ -42,7 +42,7 @@ use Sabre\DAV\PropPatch;
|
|||
* @package OCA\DAV\Comments
|
||||
*/
|
||||
class EntityCollection extends RootCollection implements IProperties {
|
||||
public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
|
||||
public const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker';
|
||||
|
||||
/** @var string */
|
||||
protected $id;
|
||||
|
|
|
@ -32,8 +32,8 @@ use Sabre\DAV\PropFind;
|
|||
use Sabre\DAV\ServerPlugin;
|
||||
|
||||
class CommentPropertiesPlugin extends ServerPlugin {
|
||||
public const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href';
|
||||
public const PROPERTY_NAME_COUNT = '{http://owncloud.org/ns}comments-count';
|
||||
public const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href';
|
||||
public const PROPERTY_NAME_COUNT = '{http://owncloud.org/ns}comments-count';
|
||||
public const PROPERTY_NAME_UNREAD = '{http://owncloud.org/ns}comments-unread';
|
||||
|
||||
/** @var \Sabre\DAV\Server */
|
||||
|
@ -131,7 +131,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
|||
* @return mixed|string
|
||||
*/
|
||||
public function getCommentsLink(Node $node) {
|
||||
$href = $this->server->getBaseUri();
|
||||
$href = $this->server->getBaseUri();
|
||||
$entryPoint = strpos($href, '/remote.php/');
|
||||
if ($entryPoint === false) {
|
||||
// in case we end up somewhere else, unexpectedly.
|
||||
|
|
|
@ -49,7 +49,7 @@ class FilesReportPlugin extends ServerPlugin {
|
|||
|
||||
// namespace
|
||||
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
|
||||
public const REPORT_NAME = '{http://owncloud.org/ns}filter-files';
|
||||
public const REPORT_NAME = '{http://owncloud.org/ns}filter-files';
|
||||
public const SYSTEMTAG_PROPERTYNAME = '{http://owncloud.org/ns}systemtag';
|
||||
public const CIRCLE_PROPERTYNAME = '{http://owncloud.org/ns}circle';
|
||||
|
||||
|
|
|
@ -192,8 +192,8 @@ class InvitationResponseController extends Controller {
|
|||
* @param string|null $comment
|
||||
* @return Message
|
||||
*/
|
||||
private function buildITipResponse(array $row, string $partStat, int $guests=null,
|
||||
string $comment=null):Message {
|
||||
private function buildITipResponse(array $row, string $partStat, int $guests = null,
|
||||
string $comment = null):Message {
|
||||
$iTipMessage = new Message();
|
||||
$iTipMessage->uid = $row['uid'];
|
||||
$iTipMessage->component = 'VEVENT';
|
||||
|
|
|
@ -198,7 +198,7 @@ class Backend {
|
|||
$shares = [];
|
||||
while ($row = $result->fetch()) {
|
||||
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
|
||||
$shares[]= [
|
||||
$shares[] = [
|
||||
'href' => "principal:${row['principaluri']}",
|
||||
'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
|
||||
'status' => 1,
|
||||
|
|
|
@ -46,7 +46,7 @@ class ShareRequest implements XmlDeserializable {
|
|||
|
||||
public static function xmlDeserialize(Reader $reader) {
|
||||
$elements = $reader->parseInnerTree([
|
||||
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
'{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
]);
|
||||
|
||||
|
@ -63,10 +63,10 @@ class ShareRequest implements XmlDeserializable {
|
|||
$commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name';
|
||||
|
||||
$set[] = [
|
||||
'href' => $sharee['{DAV:}href'],
|
||||
'href' => $sharee['{DAV:}href'],
|
||||
'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null,
|
||||
'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null,
|
||||
'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee),
|
||||
'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null,
|
||||
'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee),
|
||||
];
|
||||
break;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class TasksSearchProvider extends ACalendarSearchProvider {
|
|||
$formattedDate = $this->l10n->l('date', $dueDateTime, ['width' => 'medium']);
|
||||
|
||||
if ($taskComponent->DUE->hasTime()) {
|
||||
$formattedTime = $this->l10n->l('time', $dueDateTime, ['width' => 'short']);
|
||||
$formattedTime = $this->l10n->l('time', $dueDateTime, ['width' => 'short']);
|
||||
return $this->l10n->t('Due on %s by %s', [$formattedDate, $formattedTime]);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ class EnablePluginTest extends TestCase {
|
|||
$this->server->xml->expects($this->once())
|
||||
->method('parse')
|
||||
->willReturnCallback(function ($requestBody, $url, &$documentType) {
|
||||
$documentType = '{http://nextcloud.com/ns}disable-birthday-calendar';
|
||||
$documentType = '{http://nextcloud.com/ns}disable-birthday-calendar';
|
||||
});
|
||||
|
||||
$this->config->expects($this->never())
|
||||
|
|
|
@ -563,7 +563,7 @@ EOD;
|
|||
}
|
||||
|
||||
public function providesSchedulingData() {
|
||||
$data =<<<EOS
|
||||
$data = <<<EOS
|
||||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//Sabre//Sabre VObject 3.5.0//EN
|
||||
|
@ -888,7 +888,7 @@ END:VCALENDAR
|
|||
EOD;
|
||||
|
||||
$uriCount = count($uris);
|
||||
for ($i=0; $i < $uriCount; $i++) {
|
||||
for ($i = 0; $i < $uriCount; $i++) {
|
||||
$this->backend->createCalendarObject($calendarId,
|
||||
$uris[$i], $calData[$i]);
|
||||
}
|
||||
|
|
|
@ -381,7 +381,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
|
|||
* @param array $replyTo
|
||||
* @return IMessage
|
||||
*/
|
||||
private function getMessageMock(string $toMail, IEMailTemplate $templateMock, array $replyTo=null):IMessage {
|
||||
private function getMessageMock(string $toMail, IEMailTemplate $templateMock, array $replyTo = null):IMessage {
|
||||
$message = $this->createMock(IMessage::class);
|
||||
$i = 0;
|
||||
|
||||
|
@ -473,7 +473,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
|
|||
return $vcalendar;
|
||||
}
|
||||
|
||||
private function setupURLGeneratorMock(int $times=1):void {
|
||||
private function setupURLGeneratorMock(int $times = 1):void {
|
||||
for ($i = 0; $i < $times; $i++) {
|
||||
$this->urlGenerator
|
||||
->expects($this->at(8 * $i))
|
||||
|
|
|
@ -397,7 +397,7 @@ EOD;
|
|||
'is_relative' => false,
|
||||
'notification_date' => 1465344000,
|
||||
'is_repeat_based' => false,
|
||||
'calendardata' => self::CALENDAR_DATA,
|
||||
'calendardata' => self::CALENDAR_DATA,
|
||||
'displayname' => 'Displayname 123',
|
||||
'principaluri' => 'principals/users/user001',
|
||||
],
|
||||
|
|
|
@ -345,7 +345,7 @@ class BirthdayServiceTest extends TestCase {
|
|||
->with('principal001', 'contact_birthdays', [
|
||||
'{DAV:}displayname' => 'Contact birthdays',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => '#E9D859',
|
||||
'components' => 'VEVENT',
|
||||
'components' => 'VEVENT',
|
||||
]);
|
||||
$this->service->ensureCalendarExists('principal001');
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ class CardDavBackendTest extends TestCase {
|
|||
$this->assertArrayHasKey('lastmodified', $card);
|
||||
$this->assertArrayHasKey('etag', $card);
|
||||
$this->assertArrayHasKey('size', $card);
|
||||
$this->assertEquals($this->{ 'vcardTest'.($index+1) }, $card['carddata']);
|
||||
$this->assertEquals($this->{ 'vcardTest'.($index + 1) }, $card['carddata']);
|
||||
}
|
||||
|
||||
// delete the card
|
||||
|
@ -668,7 +668,7 @@ class CardDavBackendTest extends TestCase {
|
|||
|
||||
$vCardIds = [];
|
||||
$query = $this->db->getQueryBuilder();
|
||||
for ($i=0; $i < 3; $i++) {
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
$query->insert($this->dbCardsTable)
|
||||
->values(
|
||||
[
|
||||
|
@ -767,7 +767,7 @@ class CardDavBackendTest extends TestCase {
|
|||
'limit' => ['john', ['FN'], ['limit' => 1], [['uri0', 'John Doe']]],
|
||||
'limit and offset' => ['john', ['FN'], ['limit' => 1, 'offset' => 1], [['uri1', 'John M. Doe']]],
|
||||
'find "_" escaped' => ['_', ['CLOUD'], [], [['uri2', 'find without options']]],
|
||||
'find not empty CLOUD' => ['%_%', ['CLOUD'], ['escape_like_param'=>false], [['uri0', 'John Doe'], ['uri2', 'find without options']]],
|
||||
'find not empty CLOUD' => ['%_%', ['CLOUD'], ['escape_like_param' => false], [['uri0', 'John Doe'], ['uri2', 'find without options']]],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -800,7 +800,7 @@ class CardDavBackendTest extends TestCase {
|
|||
|
||||
public function testGetContact() {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
for ($i=0; $i<2; $i++) {
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$query->insert($this->dbCardsTable)
|
||||
->values(
|
||||
[
|
||||
|
|
|
@ -668,11 +668,11 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
|
||||
$parameters = [
|
||||
[
|
||||
'name' => '{http://owncloud.org/ns}limit',
|
||||
'name' => '{http://owncloud.org/ns}limit',
|
||||
'value' => 5,
|
||||
],
|
||||
[
|
||||
'name' => '{http://owncloud.org/ns}offset',
|
||||
'name' => '{http://owncloud.org/ns}offset',
|
||||
'value' => 10,
|
||||
],
|
||||
[
|
||||
|
@ -723,11 +723,11 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
|
||||
$parameters = [
|
||||
[
|
||||
'name' => '{http://owncloud.org/ns}limit',
|
||||
'name' => '{http://owncloud.org/ns}limit',
|
||||
'value' => 5,
|
||||
],
|
||||
[
|
||||
'name' => '{http://owncloud.org/ns}offset',
|
||||
'name' => '{http://owncloud.org/ns}offset',
|
||||
'value' => 10,
|
||||
],
|
||||
[
|
||||
|
|
|
@ -62,7 +62,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
|
|||
public function nodeProvider() {
|
||||
$mocks = [];
|
||||
foreach (['\OCA\DAV\Connector\Sabre\File', '\OCA\DAV\Connector\Sabre\Directory', '\Sabre\DAV\INode'] as $class) {
|
||||
$mocks[] = $this->getMockBuilder($class)
|
||||
$mocks[] = $this->getMockBuilder($class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
|
|
@ -1177,8 +1177,8 @@ class FileTest extends TestCase {
|
|||
$storage = new Temporary([]);
|
||||
$storage->file_put_contents('file.txt', 'old content');
|
||||
$noCreateStorage = new PermissionsMask([
|
||||
'storage'=> $storage,
|
||||
'mask' => Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE
|
||||
'storage' => $storage,
|
||||
'mask' => Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE
|
||||
]);
|
||||
|
||||
$this->registerMount($this->user, $noCreateStorage, '/' . $this->user . '/files/root');
|
||||
|
|
|
@ -199,14 +199,14 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
|
||||
$parameters = [
|
||||
[
|
||||
'name' => '{DAV:}prop',
|
||||
'name' => '{DAV:}prop',
|
||||
'value' => [
|
||||
['name' => '{DAV:}getcontentlength', 'value' => ''],
|
||||
['name' => '{http://owncloud.org/ns}size', 'value' => ''],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => '{http://owncloud.org/ns}filter-rules',
|
||||
'name' => '{http://owncloud.org/ns}filter-rules',
|
||||
'value' => [
|
||||
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '123'],
|
||||
['name' => '{http://owncloud.org/ns}systemtag', 'value' => '456'],
|
||||
|
|
|
@ -141,7 +141,7 @@ class DirectControllerTest extends TestCase {
|
|||
$this->assertSame('awesomeUser', $direct->getUserId());
|
||||
$this->assertSame(101, $direct->getFileId());
|
||||
$this->assertSame('superduperlongtoken', $direct->getToken());
|
||||
$this->assertSame(42 + 60*60*8, $direct->getExpiration());
|
||||
$this->assertSame(42 + 60 * 60 * 8, $direct->getExpiration());
|
||||
});
|
||||
|
||||
$this->urlGenerator->method('getAbsoluteURL')
|
||||
|
|
|
@ -80,7 +80,7 @@ class AssemblyStreamTest extends \Test\TestCase {
|
|||
$tonofnodes = [];
|
||||
$tonofdata = "";
|
||||
for ($i = 0; $i < 101; $i++) {
|
||||
$thisdata = rand(0,100); // variable length and content
|
||||
$thisdata = rand(0,100); // variable length and content
|
||||
$tonofdata .= $thisdata;
|
||||
array_push($tonofnodes, $this->buildNode($i,$thisdata));
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class DecryptAll {
|
|||
if ($this->util->isMasterKeyEnabled()) {
|
||||
$output->writeln('Use master key to decrypt all files');
|
||||
$user = $this->keyManager->getMasterKeyId();
|
||||
$password =$this->keyManager->getMasterKeyPassword();
|
||||
$password = $this->keyManager->getMasterKeyPassword();
|
||||
} else {
|
||||
$recoveryKeyId = $this->keyManager->getRecoveryKeyId();
|
||||
if (!empty($user)) {
|
||||
|
|
|
@ -264,7 +264,7 @@ class EncryptAll {
|
|||
protected function encryptUsersFiles($uid, ProgressBar $progress, $userCount) {
|
||||
$this->setupUserFS($uid);
|
||||
$directories = [];
|
||||
$directories[] = '/' . $uid . '/files';
|
||||
$directories[] = '/' . $uid . '/files';
|
||||
|
||||
while ($root = array_pop($directories)) {
|
||||
$content = $this->rootView->getDirectoryContent($root);
|
||||
|
|
|
@ -508,7 +508,7 @@ class KeyManager {
|
|||
* @param View $view
|
||||
*/
|
||||
public function setVersion($path, $version, View $view) {
|
||||
$fileInfo= $view->getFileInfo($path);
|
||||
$fileInfo = $view->getFileInfo($path);
|
||||
|
||||
if ($fileInfo !== false) {
|
||||
$cache = $fileInfo->getStorage()->getCache();
|
||||
|
|
|
@ -99,10 +99,10 @@ class Admin implements ISettings {
|
|||
$encryptHomeStorage = $util->shouldEncryptHomeStorage();
|
||||
|
||||
$parameters = [
|
||||
'recoveryEnabled' => $recoveryAdminEnabled,
|
||||
'initStatus' => $session->getStatus(),
|
||||
'recoveryEnabled' => $recoveryAdminEnabled,
|
||||
'initStatus' => $session->getStatus(),
|
||||
'encryptHomeStorage' => $encryptHomeStorage,
|
||||
'masterKeyEnabled' => $util->isMasterKeyEnabled(),
|
||||
'masterKeyEnabled' => $util->isMasterKeyEnabled(),
|
||||
];
|
||||
|
||||
return new TemplateResponse('encryption', 'settings-admin', $parameters, '');
|
||||
|
|
|
@ -42,7 +42,7 @@ script('encryption', 'settings-personal');
|
|||
<span class="msg"></span>
|
||||
</p>
|
||||
|
||||
<?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?>
|
||||
<?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?>
|
||||
<br />
|
||||
<p id="userEnableRecovery">
|
||||
<label for="userEnableRecovery"><?php p($l->t("Enable password recovery:")); ?></label>
|
||||
|
|
|
@ -306,7 +306,7 @@ class CryptTest extends TestCase {
|
|||
* test parseHeader()
|
||||
*/
|
||||
public function testParseHeader() {
|
||||
$header= 'HBEGIN:foo:bar:cipher:AES-256-CFB:HEND';
|
||||
$header = 'HBEGIN:foo:bar:cipher:AES-256-CFB:HEND';
|
||||
$result = self::invokePrivate($this->crypt, 'parseHeader', [$header]);
|
||||
|
||||
$this->assertTrue(is_array($result));
|
||||
|
|
|
@ -306,15 +306,15 @@ class EncryptAllTest extends TestCase {
|
|||
$this->view->expects($this->at(0))->method('getDirectoryContent')
|
||||
->with('/user1/files')->willReturn(
|
||||
[
|
||||
['name' => 'foo', 'type'=>'dir'],
|
||||
['name' => 'bar', 'type'=>'file'],
|
||||
['name' => 'foo', 'type' => 'dir'],
|
||||
['name' => 'bar', 'type' => 'file'],
|
||||
]
|
||||
);
|
||||
|
||||
$this->view->expects($this->at(3))->method('getDirectoryContent')
|
||||
->with('/user1/files/foo')->willReturn(
|
||||
[
|
||||
['name' => 'subfile', 'type'=>'file']
|
||||
['name' => 'subfile', 'type' => 'file']
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ class KeyManagerTest extends TestCase {
|
|||
$this->keyStorageMock->expects($this->exactly(2))
|
||||
->method('getUserKey')
|
||||
->willReturnCallback(function ($uid, $keyID, $encryptionModuleId) {
|
||||
if ($keyID=== 'privateKey') {
|
||||
if ($keyID === 'privateKey') {
|
||||
return '';
|
||||
}
|
||||
return 'key';
|
||||
|
|
|
@ -465,7 +465,7 @@ class FederatedShareProvider implements IShareProvider {
|
|||
$query->insert('federated_reshares')
|
||||
->values(
|
||||
[
|
||||
'share_id' => $query->createNamedParameter($shareId),
|
||||
'share_id' => $query->createNamedParameter($shareId),
|
||||
'remote_id' => $query->createNamedParameter($remoteId),
|
||||
]
|
||||
);
|
||||
|
|
|
@ -118,7 +118,7 @@ class Notifications {
|
|||
$ocsStatus = isset($status['ocs']);
|
||||
$ocsSuccess = $ocsStatus && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200);
|
||||
|
||||
if ($result['success'] && (!$ocsStatus ||$ocsSuccess)) {
|
||||
if ($result['success'] && (!$ocsStatus || $ocsSuccess)) {
|
||||
$event = new FederatedShareAddedEvent($remote);
|
||||
$this->eventDispatcher->dispatchTyped($event);
|
||||
return true;
|
||||
|
@ -305,7 +305,7 @@ class Notifications {
|
|||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action="share") {
|
||||
protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action = "share") {
|
||||
if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) {
|
||||
$remoteDomain = 'https://' . $remoteDomain;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class DbHandler {
|
|||
$query->insert($this->dbTable)
|
||||
->values(
|
||||
[
|
||||
'url' => $query->createParameter('url'),
|
||||
'url' => $query->createParameter('url'),
|
||||
'url_hash' => $query->createParameter('url_hash'),
|
||||
]
|
||||
)
|
||||
|
|
|
@ -181,7 +181,7 @@ class OCSAuthAPIControllerTest extends TestCase {
|
|||
try {
|
||||
$result = $ocsAuthApi->getSharedSecret($url, $token);
|
||||
$this->assertTrue($ok);
|
||||
$data = $result->getData();
|
||||
$data = $result->getData();
|
||||
$this->assertSame('secret', $data['sharedSecret']);
|
||||
} catch (OCSForbiddenException $e) {
|
||||
$this->assertFalse($ok);
|
||||
|
|
|
@ -69,7 +69,7 @@ use Psr\Container\ContainerInterface;
|
|||
class Application extends App implements IBootstrap {
|
||||
public const APP_ID = 'files';
|
||||
|
||||
public function __construct(array $urlParams=[]) {
|
||||
public function __construct(array $urlParams = []) {
|
||||
parent::__construct(self::APP_ID, $urlParams);
|
||||
}
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ class Scan extends Base {
|
|||
protected function formatExecTime() {
|
||||
$secs = round($this->execTime);
|
||||
# convert seconds into HH:MM:SS form
|
||||
return sprintf('%02d:%02d:%02d', ($secs/3600), ($secs/60%60), $secs%60);
|
||||
return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -246,7 +246,7 @@ class ScanAppData extends Base {
|
|||
protected function formatExecTime() {
|
||||
$secs = round($this->execTime);
|
||||
# convert seconds into HH:MM:SS form
|
||||
return sprintf('%02d:%02d:%02d', ($secs/3600), ($secs/60%60), $secs%60);
|
||||
return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,16 +95,16 @@ class ViewController extends Controller {
|
|||
Helper $activityHelper
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->appName = $appName;
|
||||
$this->request = $request;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->appName = $appName;
|
||||
$this->request = $request;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->activityHelper = $activityHelper;
|
||||
$this->userSession = $userSession;
|
||||
$this->appManager = $appManager;
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->activityHelper = $activityHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,8 +113,8 @@ class ViewController extends Controller {
|
|||
* @return string
|
||||
*/
|
||||
protected function renderScript($appName, $scriptName) {
|
||||
$content = '';
|
||||
$appPath = \OC_App::getAppPath($appName);
|
||||
$content = '';
|
||||
$appPath = \OC_App::getAppPath($appName);
|
||||
$scriptPath = $appPath . '/' . $scriptName;
|
||||
if (file_exists($scriptPath)) {
|
||||
// TODO: sanitize path / script name ?
|
||||
|
@ -203,19 +203,19 @@ class ViewController extends Controller {
|
|||
$favoritesSublistArray = [];
|
||||
|
||||
$navBarPositionPosition = 6;
|
||||
$currentCount = 0;
|
||||
$currentCount = 0;
|
||||
foreach ($favElements['folders'] as $dir) {
|
||||
$link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
|
||||
$link = $this->urlGenerator->linkToRoute('files.view.index', ['dir' => $dir, 'view' => 'files']);
|
||||
$sortingValue = ++$currentCount;
|
||||
$element = [
|
||||
'id' => str_replace('/', '-', $dir),
|
||||
'view' => 'files',
|
||||
'href' => $link,
|
||||
'dir' => $dir,
|
||||
'order' => $navBarPositionPosition,
|
||||
'folderPosition' => $sortingValue,
|
||||
'name' => basename($dir),
|
||||
'icon' => 'files',
|
||||
$element = [
|
||||
'id' => str_replace('/', '-', $dir),
|
||||
'view' => 'files',
|
||||
'href' => $link,
|
||||
'dir' => $dir,
|
||||
'order' => $navBarPositionPosition,
|
||||
'folderPosition' => $sortingValue,
|
||||
'name' => basename($dir),
|
||||
'icon' => 'files',
|
||||
'quickaccesselement' => 'true'
|
||||
];
|
||||
|
||||
|
@ -266,13 +266,13 @@ class ViewController extends Controller {
|
|||
$subcontent = $this->renderScript($subitem['appname'], $subitem['script']);
|
||||
}
|
||||
$contentItems[$subitem['id']] = [
|
||||
'id' => $subitem['id'],
|
||||
'id' => $subitem['id'],
|
||||
'content' => $subcontent
|
||||
];
|
||||
}
|
||||
}
|
||||
$contentItems[$item['id']] = [
|
||||
'id' => $item['id'],
|
||||
'id' => $item['id'],
|
||||
'content' => $content
|
||||
];
|
||||
}
|
||||
|
@ -285,22 +285,22 @@ class ViewController extends Controller {
|
|||
$this->eventDispatcher->dispatchTyped(new LoadViewer());
|
||||
}
|
||||
|
||||
$params = [];
|
||||
$params['usedSpacePercent'] = (int) $storageInfo['relative'];
|
||||
$params['owner'] = $storageInfo['owner'] ?? '';
|
||||
$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? '';
|
||||
$params['isPublic'] = false;
|
||||
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
|
||||
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
|
||||
$params = [];
|
||||
$params['usedSpacePercent'] = (int) $storageInfo['relative'];
|
||||
$params['owner'] = $storageInfo['owner'] ?? '';
|
||||
$params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? '';
|
||||
$params['isPublic'] = false;
|
||||
$params['allowShareWithLink'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes');
|
||||
$params['defaultFileSorting'] = $this->config->getUserValue($user, 'files', 'file_sorting', 'name');
|
||||
$params['defaultFileSortingDirection'] = $this->config->getUserValue($user, 'files', 'file_sorting_direction', 'asc');
|
||||
$params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', false);
|
||||
$params['isIE'] = \OCP\Util::isIE();
|
||||
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
|
||||
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
|
||||
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
|
||||
$params['appNavigation'] = $nav;
|
||||
$params['appContents'] = $contentItems;
|
||||
$params['hiddenFields'] = $event->getHiddenFields();
|
||||
$params['showgridview'] = $this->config->getUserValue($user, 'files', 'show_grid', false);
|
||||
$params['isIE'] = \OCP\Util::isIE();
|
||||
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
|
||||
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
|
||||
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
|
||||
$params['appNavigation'] = $nav;
|
||||
$params['appContents'] = $contentItems;
|
||||
$params['hiddenFields'] = $event->getHiddenFields();
|
||||
|
||||
$response = new TemplateResponse(
|
||||
$this->appName,
|
||||
|
@ -322,14 +322,14 @@ class ViewController extends Controller {
|
|||
* @throws \OCP\Files\NotFoundException
|
||||
*/
|
||||
private function redirectToFile($fileId) {
|
||||
$uid = $this->userSession->getUser()->getUID();
|
||||
$uid = $this->userSession->getUser()->getUID();
|
||||
$baseFolder = $this->rootFolder->getUserFolder($uid);
|
||||
$files = $baseFolder->getById($fileId);
|
||||
$params = [];
|
||||
$files = $baseFolder->getById($fileId);
|
||||
$params = [];
|
||||
|
||||
if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
|
||||
$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
|
||||
$files = $baseFolder->getById($fileId);
|
||||
$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
|
||||
$files = $baseFolder->getById($fileId);
|
||||
$params['view'] = 'trashbin';
|
||||
}
|
||||
|
||||
|
|
|
@ -56,11 +56,11 @@ class Helper {
|
|||
|
||||
return [
|
||||
'uploadMaxFilesize' => $maxUploadFileSize,
|
||||
'maxHumanFilesize' => $maxHumanFileSize,
|
||||
'maxHumanFilesize' => $maxHumanFileSize,
|
||||
'freeSpace' => $storageInfo['free'],
|
||||
'quota' => $storageInfo['quota'],
|
||||
'used' => $storageInfo['used'],
|
||||
'usedSpacePercent' => (int)$storageInfo['relative'],
|
||||
'usedSpacePercent' => (int)$storageInfo['relative'],
|
||||
'owner' => $storageInfo['owner'],
|
||||
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
|
||||
'mountType' => $storageInfo['mountType'],
|
||||
|
|
|
@ -47,17 +47,17 @@ class FTP extends StreamWrapper {
|
|||
|
||||
public function __construct($params) {
|
||||
if (isset($params['host']) && isset($params['user']) && isset($params['password'])) {
|
||||
$this->host=$params['host'];
|
||||
$this->user=$params['user'];
|
||||
$this->password=$params['password'];
|
||||
$this->host = $params['host'];
|
||||
$this->user = $params['user'];
|
||||
$this->password = $params['password'];
|
||||
if (isset($params['secure'])) {
|
||||
$this->secure = $params['secure'];
|
||||
} else {
|
||||
$this->secure = false;
|
||||
}
|
||||
$this->root=isset($params['root'])?$params['root']:'/';
|
||||
if (! $this->root || $this->root[0]!=='/') {
|
||||
$this->root='/'.$this->root;
|
||||
$this->root = isset($params['root'])?$params['root']:'/';
|
||||
if (! $this->root || $this->root[0] !== '/') {
|
||||
$this->root = '/'.$this->root;
|
||||
}
|
||||
if (substr($this->root, -1) !== '/') {
|
||||
$this->root .= '/';
|
||||
|
@ -77,11 +77,11 @@ class FTP extends StreamWrapper {
|
|||
* @return string
|
||||
*/
|
||||
public function constructUrl($path) {
|
||||
$url='ftp';
|
||||
$url = 'ftp';
|
||||
if ($this->secure) {
|
||||
$url.='s';
|
||||
$url .= 's';
|
||||
}
|
||||
$url.='://'.urlencode($this->user).':'.urlencode($this->password).'@'.$this->host.$this->root.$path;
|
||||
$url .= '://'.urlencode($this->user).':'.urlencode($this->password).'@'.$this->host.$this->root.$path;
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
@ -120,10 +120,10 @@ class FTP extends StreamWrapper {
|
|||
case 'c':
|
||||
case 'c+':
|
||||
//emulate these
|
||||
if (strrpos($path, '.')!==false) {
|
||||
$ext=substr($path, strrpos($path, '.'));
|
||||
if (strrpos($path, '.') !== false) {
|
||||
$ext = substr($path, strrpos($path, '.'));
|
||||
} else {
|
||||
$ext='';
|
||||
$ext = '';
|
||||
}
|
||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
|
||||
if ($this->file_exists($path)) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
// Register sftp://
|
||||
Stream::register();
|
||||
|
||||
$parsedHost = $this->splitHost($params['host']);
|
||||
$parsedHost = $this->splitHost($params['host']);
|
||||
|
||||
$this->host = $parsedHost[0];
|
||||
$this->port = $parsedHost[1];
|
||||
|
@ -404,7 +404,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function touch($path, $mtime=null) {
|
||||
public function touch($path, $mtime = null) {
|
||||
try {
|
||||
if (!is_null($mtime)) {
|
||||
return false;
|
||||
|
|
|
@ -184,7 +184,7 @@ class StorageConfig implements \JsonSerializable {
|
|||
* @param Backend $backend
|
||||
*/
|
||||
public function setBackend(Backend $backend) {
|
||||
$this->backend= $backend;
|
||||
$this->backend = $backend;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,14 +62,14 @@ class Admin implements ISettings {
|
|||
*/
|
||||
public function getForm() {
|
||||
$parameters = [
|
||||
'encryptionEnabled' => $this->encryptionManager->isEnabled(),
|
||||
'visibilityType' => BackendService::VISIBILITY_ADMIN,
|
||||
'storages' => $this->globalStoragesService->getStorages(),
|
||||
'backends' => $this->backendService->getAvailableBackends(),
|
||||
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
||||
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
||||
'globalCredentials' => $this->globalAuth->getAuth(''),
|
||||
'encryptionEnabled' => $this->encryptionManager->isEnabled(),
|
||||
'visibilityType' => BackendService::VISIBILITY_ADMIN,
|
||||
'storages' => $this->globalStoragesService->getStorages(),
|
||||
'backends' => $this->backendService->getAvailableBackends(),
|
||||
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
||||
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
||||
'globalCredentials' => $this->globalAuth->getAuth(''),
|
||||
'globalCredentialsUid' => '',
|
||||
];
|
||||
|
||||
|
|
|
@ -70,14 +70,14 @@ class Personal implements ISettings {
|
|||
$uid = $this->userSession->getUser()->getUID();
|
||||
|
||||
$parameters = [
|
||||
'encryptionEnabled' => $this->encryptionManager->isEnabled(),
|
||||
'visibilityType' => BackendService::VISIBILITY_PERSONAL,
|
||||
'storages' => $this->userGlobalStoragesService->getStorages(),
|
||||
'backends' => $this->backendService->getAvailableBackends(),
|
||||
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
||||
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
||||
'globalCredentials' => $this->globalAuth->getAuth($uid),
|
||||
'encryptionEnabled' => $this->encryptionManager->isEnabled(),
|
||||
'visibilityType' => BackendService::VISIBILITY_PERSONAL,
|
||||
'storages' => $this->userGlobalStoragesService->getStorages(),
|
||||
'backends' => $this->backendService->getAvailableBackends(),
|
||||
'authMechanisms' => $this->backendService->getAuthMechanisms(),
|
||||
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||
'allowUserMounting' => $this->backendService->isUserMountingAllowed(),
|
||||
'globalCredentials' => $this->globalAuth->getAuth($uid),
|
||||
'globalCredentialsUid' => $uid,
|
||||
];
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class AjaxControllerTest extends TestCase {
|
|||
'publickey' => 'MyPublicKey',
|
||||
]);
|
||||
|
||||
$expected = new JSONResponse(
|
||||
$expected = new JSONResponse(
|
||||
[
|
||||
'data' => [
|
||||
'private_key' => 'MyPrivateKey',
|
||||
|
|
|
@ -91,14 +91,14 @@ class AdminTest extends TestCase {
|
|||
->with('')
|
||||
->willReturn('asdf:asdf');
|
||||
$params = [
|
||||
'encryptionEnabled' => false,
|
||||
'visibilityType' => BackendService::VISIBILITY_ADMIN,
|
||||
'storages' => ['a', 'b', 'c'],
|
||||
'backends' => ['d', 'e', 'f'],
|
||||
'authMechanisms' => ['g', 'h', 'i'],
|
||||
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||
'allowUserMounting' => true,
|
||||
'globalCredentials' => 'asdf:asdf',
|
||||
'encryptionEnabled' => false,
|
||||
'visibilityType' => BackendService::VISIBILITY_ADMIN,
|
||||
'storages' => ['a', 'b', 'c'],
|
||||
'backends' => ['d', 'e', 'f'],
|
||||
'authMechanisms' => ['g', 'h', 'i'],
|
||||
'dependencies' => \OCA\Files_External\MountConfig::dependencyMessage($this->backendService->getBackends()),
|
||||
'allowUserMounting' => true,
|
||||
'globalCredentials' => 'asdf:asdf',
|
||||
'globalCredentialsUid' => '',
|
||||
];
|
||||
$expected = new TemplateResponse('files_external', 'settings', $params, '');
|
||||
|
|
|
@ -63,7 +63,7 @@ class FtpTest extends \Test\Files\Storage\Storage {
|
|||
}
|
||||
|
||||
public function testConstructUrl() {
|
||||
$config = [ 'host' => 'localhost',
|
||||
$config = [ 'host' => 'localhost',
|
||||
'user' => 'ftp',
|
||||
'password' => 'ftp',
|
||||
'root' => '/',
|
||||
|
|
|
@ -35,30 +35,30 @@ if (file_exists($privateConfigFile)) {
|
|||
|
||||
// this is now more a template now for your private configurations
|
||||
return [
|
||||
'ftp'=>[
|
||||
'run'=>false,
|
||||
'host'=>'localhost',
|
||||
'user'=>'test',
|
||||
'password'=>'test',
|
||||
'root'=>'/test',
|
||||
'ftp' => [
|
||||
'run' => false,
|
||||
'host' => 'localhost',
|
||||
'user' => 'test',
|
||||
'password' => 'test',
|
||||
'root' => '/test',
|
||||
],
|
||||
'webdav'=>[
|
||||
'run'=>false,
|
||||
'host'=>'localhost',
|
||||
'user'=>'test',
|
||||
'password'=>'test',
|
||||
'root'=>'',
|
||||
'webdav' => [
|
||||
'run' => false,
|
||||
'host' => 'localhost',
|
||||
'user' => 'test',
|
||||
'password' => 'test',
|
||||
'root' => '',
|
||||
// wait delay in seconds after write operations
|
||||
// (only in tests)
|
||||
// set to higher value for lighttpd webdav
|
||||
'wait'=> 0
|
||||
'wait' => 0
|
||||
],
|
||||
'owncloud'=>[
|
||||
'run'=>false,
|
||||
'host'=>'localhost/owncloud',
|
||||
'user'=>'test',
|
||||
'password'=>'test',
|
||||
'root'=>'',
|
||||
'owncloud' => [
|
||||
'run' => false,
|
||||
'host' => 'localhost/owncloud',
|
||||
'user' => 'test',
|
||||
'password' => 'test',
|
||||
'root' => '',
|
||||
],
|
||||
'swift' => [
|
||||
'run' => false,
|
||||
|
@ -72,19 +72,19 @@ return [
|
|||
//'url' => 'https://identity.api.rackspacecloud.com/v2.0/', //to be used with Rackspace Cloud Files and OpenStack Object Storage
|
||||
//'timeout' => 5 // timeout of HTTP requests in seconds
|
||||
],
|
||||
'smb'=>[
|
||||
'run'=>false,
|
||||
'user'=>'test',
|
||||
'password'=>'test',
|
||||
'host'=>'localhost',
|
||||
'share'=>'/test',
|
||||
'root'=>'/test/',
|
||||
'smb' => [
|
||||
'run' => false,
|
||||
'user' => 'test',
|
||||
'password' => 'test',
|
||||
'host' => 'localhost',
|
||||
'share' => '/test',
|
||||
'root' => '/test/',
|
||||
],
|
||||
'amazons3'=>[
|
||||
'run'=>false,
|
||||
'key'=>'test',
|
||||
'secret'=>'test',
|
||||
'bucket'=>'bucket'
|
||||
'amazons3' => [
|
||||
'run' => false,
|
||||
'key' => 'test',
|
||||
'secret' => 'test',
|
||||
'bucket' => 'bucket'
|
||||
//'hostname' => 'your.host.name',
|
||||
//'port' => '443',
|
||||
//'use_ssl' => 'true',
|
||||
|
@ -92,19 +92,19 @@ return [
|
|||
//'test'=>'true',
|
||||
//'timeout'=>20
|
||||
],
|
||||
'sftp' => [
|
||||
'run'=>false,
|
||||
'host'=>'localhost',
|
||||
'user'=>'test',
|
||||
'password'=>'test',
|
||||
'root'=>'/test'
|
||||
'sftp' => [
|
||||
'run' => false,
|
||||
'host' => 'localhost',
|
||||
'user' => 'test',
|
||||
'password' => 'test',
|
||||
'root' => '/test'
|
||||
],
|
||||
'sftp_key' => [
|
||||
'run'=>false,
|
||||
'host'=>'localhost',
|
||||
'user'=>'test',
|
||||
'public_key'=>'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key',
|
||||
'private_key'=>'test',
|
||||
'root'=>'/test'
|
||||
'sftp_key' => [
|
||||
'run' => false,
|
||||
'host' => 'localhost',
|
||||
'user' => 'test',
|
||||
'public_key' => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key',
|
||||
'private_key' => 'test',
|
||||
'root' => '/test'
|
||||
],
|
||||
];
|
||||
|
|
|
@ -94,42 +94,42 @@ return [
|
|||
*/
|
||||
[
|
||||
'name' => 'ShareAPI#getShares',
|
||||
'url' => '/api/v1/shares',
|
||||
'url' => '/api/v1/shares',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#getInheritedShares',
|
||||
'url' => '/api/v1/shares/inherited',
|
||||
'url' => '/api/v1/shares/inherited',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#createShare',
|
||||
'url' => '/api/v1/shares',
|
||||
'url' => '/api/v1/shares',
|
||||
'verb' => 'POST',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#pendingShares',
|
||||
'url' => '/api/v1/shares/pending',
|
||||
'url' => '/api/v1/shares/pending',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#getShare',
|
||||
'url' => '/api/v1/shares/{id}',
|
||||
'url' => '/api/v1/shares/{id}',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#updateShare',
|
||||
'url' => '/api/v1/shares/{id}',
|
||||
'url' => '/api/v1/shares/{id}',
|
||||
'verb' => 'PUT',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#deleteShare',
|
||||
'url' => '/api/v1/shares/{id}',
|
||||
'url' => '/api/v1/shares/{id}',
|
||||
'verb' => 'DELETE',
|
||||
],
|
||||
[
|
||||
'name' => 'ShareAPI#acceptShare',
|
||||
'url' => '/api/v1/shares/pending/{id}',
|
||||
'url' => '/api/v1/shares/pending/{id}',
|
||||
'verb' => 'POST',
|
||||
],
|
||||
/*
|
||||
|
@ -137,12 +137,12 @@ return [
|
|||
*/
|
||||
[
|
||||
'name' => 'DeletedShareAPI#index',
|
||||
'url' => '/api/v1/deletedshares',
|
||||
'url' => '/api/v1/deletedshares',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
[
|
||||
'name' => 'DeletedShareAPI#undelete',
|
||||
'url' => '/api/v1/deletedshares/{id}',
|
||||
'url' => '/api/v1/deletedshares/{id}',
|
||||
'verb' => 'POST',
|
||||
],
|
||||
/*
|
||||
|
|
|
@ -108,7 +108,7 @@ class Capabilities implements ICapability {
|
|||
|
||||
//Federated sharing
|
||||
$res['federation'] = [
|
||||
'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
|
||||
'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
|
||||
'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
|
||||
'expire_date' => ['enabled' => true]
|
||||
];
|
||||
|
|
|
@ -131,7 +131,7 @@ class Manager {
|
|||
* @return Mount|null
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) {
|
||||
public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) {
|
||||
$user = $user ? $user : $this->uid;
|
||||
$accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING;
|
||||
$name = Filesystem::normalizePath('/' . $name);
|
||||
|
@ -145,17 +145,17 @@ class Manager {
|
|||
$mountPoint = $tmpMountPointName;
|
||||
$hash = md5($tmpMountPointName);
|
||||
$data = [
|
||||
'remote' => $remote,
|
||||
'share_token' => $token,
|
||||
'password' => $password,
|
||||
'name' => $name,
|
||||
'owner' => $owner,
|
||||
'user' => $user,
|
||||
'mountpoint' => $mountPoint,
|
||||
'mountpoint_hash' => $hash,
|
||||
'accepted' => $accepted,
|
||||
'remote_id' => $remoteId,
|
||||
'share_type' => $shareType,
|
||||
'remote' => $remote,
|
||||
'share_token' => $token,
|
||||
'password' => $password,
|
||||
'name' => $name,
|
||||
'owner' => $owner,
|
||||
'user' => $user,
|
||||
'mountpoint' => $mountPoint,
|
||||
'mountpoint_hash' => $hash,
|
||||
'accepted' => $accepted,
|
||||
'remote_id' => $remoteId,
|
||||
'share_type' => $shareType,
|
||||
];
|
||||
|
||||
$i = 1;
|
||||
|
@ -175,11 +175,11 @@ class Manager {
|
|||
$this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType);
|
||||
|
||||
$options = [
|
||||
'remote' => $remote,
|
||||
'token' => $token,
|
||||
'password' => $password,
|
||||
'mountpoint' => $mountPoint,
|
||||
'owner' => $owner
|
||||
'remote' => $remote,
|
||||
'token' => $token,
|
||||
'password' => $password,
|
||||
'mountpoint' => $mountPoint,
|
||||
'owner' => $owner
|
||||
];
|
||||
return $this->mountShare($options);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage {
|
|||
$returnValue = false;
|
||||
}
|
||||
|
||||
$cache->set($url, $returnValue, 60*60*24);
|
||||
$cache->set($url, $returnValue, 60 * 60 * 24);
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ class Notifier implements INotifier {
|
|||
'id' => $notification->getObjectId(),
|
||||
'name' => $share->getTarget(),
|
||||
],
|
||||
'user' => [
|
||||
'user' => [
|
||||
'type' => 'user',
|
||||
'id' => $sharer->getUID(),
|
||||
'name' => $sharer->getDisplayName(),
|
||||
|
@ -219,7 +219,7 @@ class Notifier implements INotifier {
|
|||
'id' => $group->getGID(),
|
||||
'name' => $group->getDisplayName(),
|
||||
],
|
||||
'user' => [
|
||||
'user' => [
|
||||
'type' => 'user',
|
||||
'id' => $sharer->getUID(),
|
||||
'name' => $sharer->getDisplayName(),
|
||||
|
|
|
@ -94,8 +94,8 @@ class Updater {
|
|||
* @param string $newPath new path relative to data/user/files
|
||||
*/
|
||||
private static function renameChildren($oldPath, $newPath) {
|
||||
$absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath);
|
||||
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath);
|
||||
$absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath);
|
||||
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath);
|
||||
|
||||
$mountManager = \OC\Files\Filesystem::getMountManager();
|
||||
$mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath);
|
||||
|
|
|
@ -74,7 +74,7 @@ class ApiTest extends TestCase {
|
|||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_expire_after_n_days', '7');
|
||||
|
||||
$this->folder = self::TEST_FOLDER_NAME;
|
||||
$this->subfolder = '/subfolder_share_api_test';
|
||||
$this->subfolder = '/subfolder_share_api_test';
|
||||
$this->subsubfolder = '/subsubfolder_share_api_test';
|
||||
|
||||
$this->filename = '/share-api-test.txt';
|
||||
|
@ -650,7 +650,7 @@ class ApiTest extends TestCase {
|
|||
$share3->setStatus(IShare::STATUS_ACCEPTED);
|
||||
$this->shareManager->updateShare($share3);
|
||||
|
||||
$testValues=[
|
||||
$testValues = [
|
||||
['query' => $this->folder,
|
||||
'expectedResult' => $this->folder . $this->filename],
|
||||
['query' => $this->folder . $this->subfolder,
|
||||
|
|
|
@ -490,8 +490,8 @@ class ShareAPIControllerTest extends TestCase {
|
|||
*/
|
||||
|
||||
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
|
||||
$shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token=null,
|
||||
$password=null, $label = '') {
|
||||
$shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token = null,
|
||||
$password = null, $label = '') {
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getId')->willReturn($id);
|
||||
$share->method('getShareType')->willReturn($shareType);
|
||||
|
@ -511,7 +511,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
$share->method('getToken')->willReturn($token);
|
||||
$share->method('getPassword')->willReturn($password);
|
||||
|
||||
if ($shareType === IShare::TYPE_USER ||
|
||||
if ($shareType === IShare::TYPE_USER ||
|
||||
$shareType === IShare::TYPE_GROUP ||
|
||||
$shareType === IShare::TYPE_LINK) {
|
||||
$share->method('getFullId')->willReturn('ocinternal:'.$id);
|
||||
|
|
|
@ -276,7 +276,7 @@ class ShareesAPIControllerTest extends TestCase {
|
|||
|
||||
$this->collaboratorSearch->expects($this->once())
|
||||
->method('search')
|
||||
->with($search, $expectedShareTypes, $this->anything(), $perPage, $perPage * ($page -1))
|
||||
->with($search, $expectedShareTypes, $this->anything(), $perPage, $perPage * ($page - 1))
|
||||
->willReturn([[], false]);
|
||||
|
||||
$sharees->expects($this->any())
|
||||
|
|
|
@ -44,7 +44,7 @@ class ShareTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
$this->folder = self::TEST_FOLDER_NAME;
|
||||
$this->subfolder = '/subfolder_share_api_test';
|
||||
$this->subfolder = '/subfolder_share_api_test';
|
||||
$this->subsubfolder = '/subsubfolder_share_api_test';
|
||||
|
||||
$this->filename = '/share-api-test.txt';
|
||||
|
|
|
@ -107,7 +107,7 @@ class SharedStorageTest extends TestCase {
|
|||
|
||||
// delete the local folder
|
||||
/** @var \OC\Files\Storage\Storage $storage */
|
||||
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
|
||||
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/localfolder');
|
||||
$storage->rmdir($internalPath);
|
||||
|
||||
//enforce reload of the mount points
|
||||
|
|
|
@ -113,7 +113,7 @@ class SizePropagationTest extends TestCase {
|
|||
|
||||
// but the size including mountpoints increases
|
||||
$newRecipientRootInfo = $recipientView->getFileInfo('', true);
|
||||
$this->assertEquals($oldRecipientSize +3, $newRecipientRootInfo->getSize());
|
||||
$this->assertEquals($oldRecipientSize + 3, $newRecipientRootInfo->getSize());
|
||||
|
||||
// size of owner's root increases
|
||||
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
|
||||
|
|
|
@ -92,7 +92,7 @@ class Expiration {
|
|||
$time = $this->timeFactory->getTime();
|
||||
// Never expire dates in future e.g. misconfiguration or negative time
|
||||
// adjustment
|
||||
if ($time<$timestamp) {
|
||||
if ($time < $timestamp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class Helper {
|
|||
$timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1);
|
||||
}
|
||||
$originalPath = '';
|
||||
$originalName = substr($entryName, 0, -strlen($timestamp)-2);
|
||||
$originalName = substr($entryName, 0, -strlen($timestamp) - 2);
|
||||
if (isset($originalLocations[$originalName][$timestamp])) {
|
||||
$originalPath = $originalLocations[$originalName][$timestamp];
|
||||
if (substr($originalPath, -1) === '/') {
|
||||
|
|
|
@ -86,7 +86,7 @@ class CleanUpTest extends TestCase {
|
|||
'id' => $query->expr()->literal('file'.$i),
|
||||
'timestamp' => $query->expr()->literal($i),
|
||||
'location' => $query->expr()->literal('.'),
|
||||
'user' => $query->expr()->literal('user'.$i%2)
|
||||
'user' => $query->expr()->literal('user'.$i % 2)
|
||||
])->execute();
|
||||
}
|
||||
$getAllQuery = $this->dbConnection->getQueryBuilder();
|
||||
|
|
|
@ -34,14 +34,14 @@ class ExpirationTest extends \Test\TestCase {
|
|||
public const FAKE_TIME_NOW = 1000000;
|
||||
|
||||
public function expirationData() {
|
||||
$today = 100*self::SECONDS_PER_DAY;
|
||||
$back10Days = (100-10)*self::SECONDS_PER_DAY;
|
||||
$back20Days = (100-20)*self::SECONDS_PER_DAY;
|
||||
$back30Days = (100-30)*self::SECONDS_PER_DAY;
|
||||
$back35Days = (100-35)*self::SECONDS_PER_DAY;
|
||||
$today = 100 * self::SECONDS_PER_DAY;
|
||||
$back10Days = (100 - 10) * self::SECONDS_PER_DAY;
|
||||
$back20Days = (100 - 20) * self::SECONDS_PER_DAY;
|
||||
$back30Days = (100 - 30) * self::SECONDS_PER_DAY;
|
||||
$back35Days = (100 - 35) * self::SECONDS_PER_DAY;
|
||||
|
||||
// it should never happen, but who knows :/
|
||||
$ahead100Days = (100+100)*self::SECONDS_PER_DAY;
|
||||
$ahead100Days = (100 + 100) * self::SECONDS_PER_DAY;
|
||||
|
||||
return [
|
||||
// Expiration is disabled - always should return false
|
||||
|
@ -158,10 +158,10 @@ class ExpirationTest extends \Test\TestCase {
|
|||
[ 'auto', false ],
|
||||
[ 'auto,auto', false ],
|
||||
[ 'auto, auto', false ],
|
||||
[ 'auto, 3', self::FAKE_TIME_NOW - (3*self::SECONDS_PER_DAY) ],
|
||||
[ 'auto, 3', self::FAKE_TIME_NOW - (3 * self::SECONDS_PER_DAY) ],
|
||||
[ '5, auto', false ],
|
||||
[ '3, 5', self::FAKE_TIME_NOW - (5*self::SECONDS_PER_DAY) ],
|
||||
[ '10, 3', self::FAKE_TIME_NOW - (10*self::SECONDS_PER_DAY) ],
|
||||
[ '3, 5', self::FAKE_TIME_NOW - (5 * self::SECONDS_PER_DAY) ],
|
||||
[ '10, 3', self::FAKE_TIME_NOW - (10 * self::SECONDS_PER_DAY) ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class Expiration {
|
|||
$time = $this->timeFactory->getTime();
|
||||
// Never expire dates in future e.g. misconfiguration or negative time
|
||||
// adjustment
|
||||
if ($time<$timestamp) {
|
||||
if ($time < $timestamp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class Expiration {
|
|||
$isValid = false;
|
||||
\OC::$server->getLogger()->warning(
|
||||
$minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
|
||||
['app'=>'files_versions']
|
||||
['app' => 'files_versions']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ class Expiration {
|
|||
$isValid = false;
|
||||
\OC::$server->getLogger()->warning(
|
||||
$maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
|
||||
['app'=>'files_versions']
|
||||
['app' => 'files_versions']
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ use OCP\Lock\ILockingProvider;
|
|||
use OCP\User;
|
||||
|
||||
class Storage {
|
||||
public const DEFAULTENABLED=true;
|
||||
public const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
|
||||
public const DEFAULTENABLED = true;
|
||||
public const DEFAULTMAXSIZE = 50; // unit: percentage; 50% of available disk space/quota
|
||||
public const VERSIONS_ROOT = 'files_versions/';
|
||||
|
||||
public const DELETE_TRIGGER_MASTER_REMOVED = 0;
|
||||
|
@ -351,7 +351,7 @@ class Storage {
|
|||
$versionCreated = true;
|
||||
}
|
||||
|
||||
$fileToRestore = 'files_versions' . $filename . '.v' . $revision;
|
||||
$fileToRestore = 'files_versions' . $filename . '.v' . $revision;
|
||||
|
||||
// Restore encrypted version of the old file for the newly restored file
|
||||
// This has to happen manually here since the file is manually copied below
|
||||
|
@ -502,7 +502,7 @@ class Storage {
|
|||
|
||||
$toDelete = [];
|
||||
foreach (array_reverse($versions['all']) as $key => $version) {
|
||||
if ((int)$version['version'] <$threshold) {
|
||||
if ((int)$version['version'] < $threshold) {
|
||||
$toDelete[$key] = $version;
|
||||
} else {
|
||||
//Versions are sorted by time - nothing mo to iterate.
|
||||
|
@ -799,7 +799,7 @@ class Storage {
|
|||
// Check if enough space is available after versions are rearranged.
|
||||
// If not we delete the oldest versions until we meet the size limit for versions,
|
||||
// but always keep the two latest versions
|
||||
$numOfVersions = count($allVersions) -2 ;
|
||||
$numOfVersions = count($allVersions) - 2 ;
|
||||
$i = 0;
|
||||
// sort oldest first and make sure that we start at the first element
|
||||
ksort($allVersions);
|
||||
|
|
|
@ -35,14 +35,14 @@ class ExpirationTest extends \Test\TestCase {
|
|||
public const SECONDS_PER_DAY = 86400; //60*60*24
|
||||
|
||||
public function expirationData() {
|
||||
$today = 100*self::SECONDS_PER_DAY;
|
||||
$back10Days = (100-10)*self::SECONDS_PER_DAY;
|
||||
$back20Days = (100-20)*self::SECONDS_PER_DAY;
|
||||
$back30Days = (100-30)*self::SECONDS_PER_DAY;
|
||||
$back35Days = (100-35)*self::SECONDS_PER_DAY;
|
||||
$today = 100 * self::SECONDS_PER_DAY;
|
||||
$back10Days = (100 - 10) * self::SECONDS_PER_DAY;
|
||||
$back20Days = (100 - 20) * self::SECONDS_PER_DAY;
|
||||
$back30Days = (100 - 30) * self::SECONDS_PER_DAY;
|
||||
$back35Days = (100 - 35) * self::SECONDS_PER_DAY;
|
||||
|
||||
// it should never happen, but who knows :/
|
||||
$ahead100Days = (100+100)*self::SECONDS_PER_DAY;
|
||||
$ahead100Days = (100 + 100) * self::SECONDS_PER_DAY;
|
||||
|
||||
return [
|
||||
// Expiration is disabled - always should return false
|
||||
|
|
|
@ -944,7 +944,7 @@ class VersioningTest extends \Test\TestCase {
|
|||
*/
|
||||
public static function loginHelper($user, $create = false) {
|
||||
if ($create) {
|
||||
$backend = new \Test\Util\User\Dummy();
|
||||
$backend = new \Test\Util\User\Dummy();
|
||||
$backend->createUser($user, $user);
|
||||
\OC::$server->getUserManager()->registerBackend($backend);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue