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,7 +31,7 @@ class Rotate extends TimedJob {
|
||||||
use RotationTrait;
|
use RotationTrait;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->setInterval(60*60*3);
|
$this->setInterval(60 * 60 * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function run($argument) {
|
protected function run($argument) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ class CommentersSorterTest extends TestCase {
|
||||||
$commentMocks = [];
|
$commentMocks = [];
|
||||||
foreach ($data['actors'] as $actorType => $actors) {
|
foreach ($data['actors'] as $actorType => $actors) {
|
||||||
foreach ($actors as $actorId => $noOfComments) {
|
foreach ($actors as $actorId => $noOfComments) {
|
||||||
for ($i=0;$i<$noOfComments;$i++) {
|
for ($i = 0;$i < $noOfComments;$i++) {
|
||||||
$mock = $this->createMock(IComment::class);
|
$mock = $this->createMock(IComment::class);
|
||||||
$mock->expects($this->atLeastOnce())
|
$mock->expects($this->atLeastOnce())
|
||||||
->method('getActorType')
|
->method('getActorType')
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CleanupDirectLinksJob extends TimedJob {
|
||||||
private $mapper;
|
private $mapper;
|
||||||
|
|
||||||
public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) {
|
public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) {
|
||||||
$this->setInterval(60*60*24);
|
$this->setInterval(60 * 60 * 24);
|
||||||
|
|
||||||
$this->timeFactory = $timeFactory;
|
$this->timeFactory = $timeFactory;
|
||||||
$this->mapper = $mapper;
|
$this->mapper = $mapper;
|
||||||
|
@ -46,6 +46,6 @@ class CleanupDirectLinksJob extends TimedJob {
|
||||||
|
|
||||||
protected function run($argument) {
|
protected function run($argument) {
|
||||||
// Delete all shares expired 24 hours ago
|
// 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;
|
$this->jobList = $jobList;
|
||||||
|
|
||||||
// Run once a day
|
// Run once a day
|
||||||
$this->setInterval(60*60*24);
|
$this->setInterval(60 * 60 * 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function run($argument) {
|
protected function run($argument) {
|
||||||
|
@ -65,7 +65,7 @@ class UploadCleanup extends TimedJob {
|
||||||
$uploads = $userRoot->get('uploads');
|
$uploads = $userRoot->get('uploads');
|
||||||
/** @var Folder $uploadFolder */
|
/** @var Folder $uploadFolder */
|
||||||
$uploadFolder = $uploads->get($folder);
|
$uploadFolder = $uploads->get($folder);
|
||||||
} catch (NotFoundException|NoUserException $e) {
|
} catch (NotFoundException | NoUserException $e) {
|
||||||
$this->jobList->remove(self::class, $argument);
|
$this->jobList->remove(self::class, $argument);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,8 +427,8 @@ class BirthdayService {
|
||||||
*/
|
*/
|
||||||
private function formatTitle(string $field,
|
private function formatTitle(string $field,
|
||||||
string $name,
|
string $name,
|
||||||
int $year=null,
|
int $year = null,
|
||||||
bool $supports4Byte=true):string {
|
bool $supports4Byte = true):string {
|
||||||
if ($supports4Byte) {
|
if ($supports4Byte) {
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'BDAY':
|
case 'BDAY':
|
||||||
|
|
|
@ -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),
|
'{' . \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];
|
$calendar[$xmlName] = $row[$dbName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$principals = array_map(function ($principal) {
|
$principals = array_map(function ($principal) {
|
||||||
return urldecode($principal);
|
return urldecode($principal);
|
||||||
}, $principals);
|
}, $principals);
|
||||||
$principals[]= $principalUri;
|
$principals[] = $principalUri;
|
||||||
|
|
||||||
$fields = array_values($this->propertyMap);
|
$fields = array_values($this->propertyMap);
|
||||||
$fields[] = 'a.id';
|
$fields[] = 'a.id';
|
||||||
|
@ -389,7 +389,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$readOnlyPropertyName => $readOnly,
|
$readOnlyPropertyName => $readOnly,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||||
$calendar[$xmlName] = $row[$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 . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
|
||||||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
'{' . 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];
|
$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,
|
'{' . \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];
|
$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,
|
'{' . \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];
|
$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'),
|
'{' . 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];
|
$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'),
|
'{' . 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];
|
$calendar[$xmlName] = $row[$dbName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
->from('calendarsubscriptions')
|
->from('calendarsubscriptions')
|
||||||
->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
||||||
->orderBy('calendarorder', 'asc');
|
->orderBy('calendarorder', 'asc');
|
||||||
$stmt =$query->execute();
|
$stmt = $query->execute();
|
||||||
|
|
||||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
@ -723,7 +723,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
'{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])) {
|
if (!is_null($row[$dbName])) {
|
||||||
$subscription[$xmlName] = $row[$dbName];
|
$subscription[$xmlName] = $row[$dbName];
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
|
$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
foreach ($this->propertyMap as $xmlName => $dbName) {
|
||||||
if (isset($properties[$xmlName])) {
|
if (isset($properties[$xmlName])) {
|
||||||
$values[$dbName] = $properties[$xmlName];
|
$values[$dbName] = $properties[$xmlName];
|
||||||
}
|
}
|
||||||
|
@ -939,7 +939,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array
|
* @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 = $this->db->getQueryBuilder();
|
||||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
|
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification'])
|
||||||
->from('calendarobjects')
|
->from('calendarobjects')
|
||||||
|
@ -957,7 +957,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
'calendarid' => $row['calendarid'],
|
'calendarid' => $row['calendarid'],
|
||||||
'size' => (int)$row['size'],
|
'size' => (int)$row['size'],
|
||||||
'component' => strtolower($row['componenttype']),
|
'component' => strtolower($row['componenttype']),
|
||||||
'classification'=> (int)$row['classification']
|
'classification' => (int)$row['classification']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array|null
|
* @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 = $this->db->getQueryBuilder();
|
||||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
|
$query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification'])
|
||||||
->from('calendarobjects')
|
->from('calendarobjects')
|
||||||
|
@ -1004,7 +1004,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
'size' => (int)$row['size'],
|
'size' => (int)$row['size'],
|
||||||
'calendardata' => $this->readBlob($row['calendardata']),
|
'calendardata' => $this->readBlob($row['calendardata']),
|
||||||
'component' => strtolower($row['componenttype']),
|
'component' => strtolower($row['componenttype']),
|
||||||
'classification'=> (int)$row['classification']
|
'classification' => (int)$row['classification']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array
|
* @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)) {
|
if (empty($uris)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -1078,7 +1078,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return string
|
* @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);
|
$extraData = $this->getDenormalizedData($calendarData);
|
||||||
|
|
||||||
$q = $this->db->getQueryBuilder();
|
$q = $this->db->getQueryBuilder();
|
||||||
|
@ -1169,7 +1169,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return string
|
* @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);
|
$extraData = $this->getDenormalizedData($calendarData);
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->update('calendarobjects')
|
$query->update('calendarobjects')
|
||||||
|
@ -1252,7 +1252,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return void
|
* @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);
|
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
|
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
|
||||||
|
@ -1345,7 +1345,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array
|
* @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;
|
$componentType = null;
|
||||||
$requirePostFilter = true;
|
$requirePostFilter = true;
|
||||||
$timeRange = null;
|
$timeRange = null;
|
||||||
|
@ -1439,7 +1439,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param integer|null $offset
|
* @param integer|null $offset
|
||||||
* @return array
|
* @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);
|
$calendars = $this->getCalendarsForUser($principalUri);
|
||||||
$ownCalendars = [];
|
$ownCalendars = [];
|
||||||
$sharedCalendars = [];
|
$sharedCalendars = [];
|
||||||
|
@ -1932,7 +1932,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array
|
* @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
|
// Current synctoken
|
||||||
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
|
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
|
||||||
$stmt->execute([ $calendarId ]);
|
$stmt->execute([ $calendarId ]);
|
||||||
|
@ -1951,8 +1951,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
|
|
||||||
if ($syncToken) {
|
if ($syncToken) {
|
||||||
$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
|
$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
|
||||||
if ($limit>0) {
|
if ($limit > 0) {
|
||||||
$query.= " LIMIT " . (int)$limit;
|
$query .= " LIMIT " . (int)$limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetching all changes
|
// Fetching all changes
|
||||||
|
@ -2037,7 +2037,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
->from('calendarsubscriptions')
|
->from('calendarsubscriptions')
|
||||||
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
|
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
|
||||||
->orderBy('calendarorder', 'asc');
|
->orderBy('calendarorder', 'asc');
|
||||||
$stmt =$query->execute();
|
$stmt = $query->execute();
|
||||||
|
|
||||||
$subscriptions = [];
|
$subscriptions = [];
|
||||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||||
|
@ -2052,7 +2052,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
'{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])) {
|
if (!is_null($row[$dbName])) {
|
||||||
$subscription[$xmlName] = $row[$dbName];
|
$subscription[$xmlName] = $row[$dbName];
|
||||||
}
|
}
|
||||||
|
@ -2089,7 +2089,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
|
|
||||||
$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
|
$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
|
||||||
|
|
||||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
|
||||||
if (array_key_exists($xmlName, $properties)) {
|
if (array_key_exists($xmlName, $properties)) {
|
||||||
$values[$dbName] = $properties[$xmlName];
|
$values[$dbName] = $properties[$xmlName];
|
||||||
if (in_array($dbName, $propertiesBoolean)) {
|
if (in_array($dbName, $propertiesBoolean)) {
|
||||||
|
@ -2147,7 +2147,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
|
$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
|
||||||
$newValues = [];
|
$newValues = [];
|
||||||
|
|
||||||
foreach ($mutations as $propertyName=>$propertyValue) {
|
foreach ($mutations as $propertyName => $propertyValue) {
|
||||||
if ($propertyName === '{http://calendarserver.org/ns/}source') {
|
if ($propertyName === '{http://calendarserver.org/ns/}source') {
|
||||||
$newValues['source'] = $propertyValue->getHref();
|
$newValues['source'] = $propertyValue->getHref();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2159,7 +2159,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->update('calendarsubscriptions')
|
$query->update('calendarsubscriptions')
|
||||||
->set('lastmodified', $query->createNamedParameter(time()));
|
->set('lastmodified', $query->createNamedParameter(time()));
|
||||||
foreach ($newValues as $fieldName=>$value) {
|
foreach ($newValues as $fieldName => $value) {
|
||||||
$query->set($fieldName, $query->createNamedParameter($value));
|
$query->set($fieldName, $query->createNamedParameter($value));
|
||||||
}
|
}
|
||||||
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
||||||
|
@ -2338,7 +2338,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return void
|
* @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';
|
$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
|
||||||
|
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
@ -2388,7 +2388,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$uid = null;
|
$uid = null;
|
||||||
$classification = self::CLASSIFICATION_PUBLIC;
|
$classification = self::CLASSIFICATION_PUBLIC;
|
||||||
foreach ($vObject->getComponents() as $component) {
|
foreach ($vObject->getComponents() as $component) {
|
||||||
if ($component->name!=='VTIMEZONE') {
|
if ($component->name !== 'VTIMEZONE') {
|
||||||
$componentType = $component->name;
|
$componentType = $component->name;
|
||||||
$uid = (string)$component->UID;
|
$uid = (string)$component->UID;
|
||||||
break;
|
break;
|
||||||
|
@ -2493,7 +2493,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array
|
* @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);
|
return $this->calendarSharingBackend->getShares($resourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2574,7 +2574,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $calendarData
|
* @param string $calendarData
|
||||||
* @param int $calendarType
|
* @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);
|
$objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -52,7 +52,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||||
private $pluginManager;
|
private $pluginManager;
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $returnCachedSubscriptions=false;
|
private $returnCachedSubscriptions = false;
|
||||||
|
|
||||||
public function __construct(BackendInterface $caldavBackend, $principalInfo) {
|
public function __construct(BackendInterface $caldavBackend, $principalInfo) {
|
||||||
parent::__construct($caldavBackend, $principalInfo);
|
parent::__construct($caldavBackend, $principalInfo);
|
||||||
|
@ -183,7 +183,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||||
* @param integer|null $limit
|
* @param integer|null $limit
|
||||||
* @param integer|null $offset
|
* @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'];
|
$principalUri = $this->principalInfo['uri'];
|
||||||
return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset);
|
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
|
* @return array an array of events/journals/todos which are arrays of key-value-pairs
|
||||||
* @since 13.0.0
|
* @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,
|
return $this->backend->search($this->calendarInfo, $pattern,
|
||||||
$searchProperties, $options, $limit, $offset);
|
$searchProperties, $options, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,5 +47,5 @@ interface INotificationProvider {
|
||||||
*/
|
*/
|
||||||
public function send(VEvent $vevent,
|
public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName,
|
string $calendarDisplayName,
|
||||||
array $users=[]): void;
|
array $users = []): void;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ abstract class AbstractProvider implements INotificationProvider {
|
||||||
*/
|
*/
|
||||||
abstract public function send(VEvent $vevent,
|
abstract public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName,
|
string $calendarDisplayName,
|
||||||
array $users=[]): void;
|
array $users = []): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -83,7 +83,7 @@ class EmailProvider extends AbstractProvider {
|
||||||
*/
|
*/
|
||||||
public function send(VEvent $vevent,
|
public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName,
|
string $calendarDisplayName,
|
||||||
array $users=[]):void {
|
array $users = []):void {
|
||||||
$fallbackLanguage = $this->getFallbackLanguage();
|
$fallbackLanguage = $this->getFallbackLanguage();
|
||||||
|
|
||||||
$emailAddressesOfSharees = $this->getEMailAddressesOfAllUsersWithWriteAccessToCalendar($users);
|
$emailAddressesOfSharees = $this->getEMailAddressesOfAllUsersWithWriteAccessToCalendar($users);
|
||||||
|
|
|
@ -86,8 +86,8 @@ class PushProvider extends AbstractProvider {
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function send(VEvent $vevent,
|
public function send(VEvent $vevent,
|
||||||
string $calendarDisplayName=null,
|
string $calendarDisplayName = null,
|
||||||
array $users=[]):void {
|
array $users = []):void {
|
||||||
if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') {
|
if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'no') !== 'yes') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,10 +330,10 @@ class ReminderService {
|
||||||
*/
|
*/
|
||||||
private function getRemindersForVAlarm(VAlarm $valarm,
|
private function getRemindersForVAlarm(VAlarm $valarm,
|
||||||
array $objectData,
|
array $objectData,
|
||||||
string $eventHash=null,
|
string $eventHash = null,
|
||||||
string $alarmHash=null,
|
string $alarmHash = null,
|
||||||
bool $isRecurring=false,
|
bool $isRecurring = false,
|
||||||
bool $isRecurrenceException=false):array {
|
bool $isRecurrenceException = false):array {
|
||||||
if ($eventHash === null) {
|
if ($eventHash === null) {
|
||||||
$eventHash = $this->getEventHash($valarm->parent);
|
$eventHash = $this->getEventHash($valarm->parent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,7 +435,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
||||||
* @param String[] $metadata
|
* @param String[] $metadata
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
private function rowToPrincipal(array $row, array $metadata=[]):array {
|
private function rowToPrincipal(array $row, array $metadata = []):array {
|
||||||
return array_merge([
|
return array_merge([
|
||||||
'uri' => $this->principalPrefix . '/' . $row['backend_id'] . '-' . $row['resource_id'],
|
'uri' => $this->principalPrefix . '/' . $row['backend_id'] . '-' . $row['resource_id'],
|
||||||
'{DAV:}displayname' => $row['displayname'],
|
'{DAV:}displayname' => $row['displayname'],
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Plugin extends ServerPlugin {
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $enabled=false;
|
private $enabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Server
|
* @var Server
|
||||||
|
|
|
@ -124,9 +124,9 @@ class Converter {
|
||||||
$elements = explode(' ', $fullName);
|
$elements = explode(' ', $fullName);
|
||||||
$result = ['', '', '', '', ''];
|
$result = ['', '', '', '', ''];
|
||||||
if (count($elements) > 2) {
|
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[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) {
|
} elseif (count($elements) === 2) {
|
||||||
$result[0] = $elements[1];
|
$result[0] = $elements[1];
|
||||||
$result[1] = $elements[0];
|
$result[1] = $elements[0];
|
||||||
|
|
|
@ -192,8 +192,8 @@ class InvitationResponseController extends Controller {
|
||||||
* @param string|null $comment
|
* @param string|null $comment
|
||||||
* @return Message
|
* @return Message
|
||||||
*/
|
*/
|
||||||
private function buildITipResponse(array $row, string $partStat, int $guests=null,
|
private function buildITipResponse(array $row, string $partStat, int $guests = null,
|
||||||
string $comment=null):Message {
|
string $comment = null):Message {
|
||||||
$iTipMessage = new Message();
|
$iTipMessage = new Message();
|
||||||
$iTipMessage->uid = $row['uid'];
|
$iTipMessage->uid = $row['uid'];
|
||||||
$iTipMessage->component = 'VEVENT';
|
$iTipMessage->component = 'VEVENT';
|
||||||
|
|
|
@ -198,7 +198,7 @@ class Backend {
|
||||||
$shares = [];
|
$shares = [];
|
||||||
while ($row = $result->fetch()) {
|
while ($row = $result->fetch()) {
|
||||||
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
|
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
|
||||||
$shares[]= [
|
$shares[] = [
|
||||||
'href' => "principal:${row['principaluri']}",
|
'href' => "principal:${row['principaluri']}",
|
||||||
'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
|
'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
|
|
|
@ -563,7 +563,7 @@ EOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providesSchedulingData() {
|
public function providesSchedulingData() {
|
||||||
$data =<<<EOS
|
$data = <<<EOS
|
||||||
BEGIN:VCALENDAR
|
BEGIN:VCALENDAR
|
||||||
VERSION:2.0
|
VERSION:2.0
|
||||||
PRODID:-//Sabre//Sabre VObject 3.5.0//EN
|
PRODID:-//Sabre//Sabre VObject 3.5.0//EN
|
||||||
|
@ -888,7 +888,7 @@ END:VCALENDAR
|
||||||
EOD;
|
EOD;
|
||||||
|
|
||||||
$uriCount = count($uris);
|
$uriCount = count($uris);
|
||||||
for ($i=0; $i < $uriCount; $i++) {
|
for ($i = 0; $i < $uriCount; $i++) {
|
||||||
$this->backend->createCalendarObject($calendarId,
|
$this->backend->createCalendarObject($calendarId,
|
||||||
$uris[$i], $calData[$i]);
|
$uris[$i], $calData[$i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
|
||||||
* @param array $replyTo
|
* @param array $replyTo
|
||||||
* @return IMessage
|
* @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);
|
$message = $this->createMock(IMessage::class);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
|
||||||
return $vcalendar;
|
return $vcalendar;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setupURLGeneratorMock(int $times=1):void {
|
private function setupURLGeneratorMock(int $times = 1):void {
|
||||||
for ($i = 0; $i < $times; $i++) {
|
for ($i = 0; $i < $times; $i++) {
|
||||||
$this->urlGenerator
|
$this->urlGenerator
|
||||||
->expects($this->at(8 * $i))
|
->expects($this->at(8 * $i))
|
||||||
|
|
|
@ -358,7 +358,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
$this->assertArrayHasKey('lastmodified', $card);
|
$this->assertArrayHasKey('lastmodified', $card);
|
||||||
$this->assertArrayHasKey('etag', $card);
|
$this->assertArrayHasKey('etag', $card);
|
||||||
$this->assertArrayHasKey('size', $card);
|
$this->assertArrayHasKey('size', $card);
|
||||||
$this->assertEquals($this->{ 'vcardTest'.($index+1) }, $card['carddata']);
|
$this->assertEquals($this->{ 'vcardTest'.($index + 1) }, $card['carddata']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the card
|
// delete the card
|
||||||
|
@ -668,7 +668,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
|
|
||||||
$vCardIds = [];
|
$vCardIds = [];
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
for ($i=0; $i < 3; $i++) {
|
for ($i = 0; $i < 3; $i++) {
|
||||||
$query->insert($this->dbCardsTable)
|
$query->insert($this->dbCardsTable)
|
||||||
->values(
|
->values(
|
||||||
[
|
[
|
||||||
|
@ -767,7 +767,7 @@ class CardDavBackendTest extends TestCase {
|
||||||
'limit' => ['john', ['FN'], ['limit' => 1], [['uri0', 'John Doe']]],
|
'limit' => ['john', ['FN'], ['limit' => 1], [['uri0', 'John Doe']]],
|
||||||
'limit and offset' => ['john', ['FN'], ['limit' => 1, 'offset' => 1], [['uri1', 'John M. Doe']]],
|
'limit and offset' => ['john', ['FN'], ['limit' => 1, 'offset' => 1], [['uri1', 'John M. Doe']]],
|
||||||
'find "_" escaped' => ['_', ['CLOUD'], [], [['uri2', 'find without options']]],
|
'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() {
|
public function testGetContact() {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
for ($i=0; $i<2; $i++) {
|
for ($i = 0; $i < 2; $i++) {
|
||||||
$query->insert($this->dbCardsTable)
|
$query->insert($this->dbCardsTable)
|
||||||
->values(
|
->values(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ class FileTest extends TestCase {
|
||||||
$storage = new Temporary([]);
|
$storage = new Temporary([]);
|
||||||
$storage->file_put_contents('file.txt', 'old content');
|
$storage->file_put_contents('file.txt', 'old content');
|
||||||
$noCreateStorage = new PermissionsMask([
|
$noCreateStorage = new PermissionsMask([
|
||||||
'storage'=> $storage,
|
'storage' => $storage,
|
||||||
'mask' => Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE
|
'mask' => Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ class DirectControllerTest extends TestCase {
|
||||||
$this->assertSame('awesomeUser', $direct->getUserId());
|
$this->assertSame('awesomeUser', $direct->getUserId());
|
||||||
$this->assertSame(101, $direct->getFileId());
|
$this->assertSame(101, $direct->getFileId());
|
||||||
$this->assertSame('superduperlongtoken', $direct->getToken());
|
$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')
|
$this->urlGenerator->method('getAbsoluteURL')
|
||||||
|
|
|
@ -84,7 +84,7 @@ class DecryptAll {
|
||||||
if ($this->util->isMasterKeyEnabled()) {
|
if ($this->util->isMasterKeyEnabled()) {
|
||||||
$output->writeln('Use master key to decrypt all files');
|
$output->writeln('Use master key to decrypt all files');
|
||||||
$user = $this->keyManager->getMasterKeyId();
|
$user = $this->keyManager->getMasterKeyId();
|
||||||
$password =$this->keyManager->getMasterKeyPassword();
|
$password = $this->keyManager->getMasterKeyPassword();
|
||||||
} else {
|
} else {
|
||||||
$recoveryKeyId = $this->keyManager->getRecoveryKeyId();
|
$recoveryKeyId = $this->keyManager->getRecoveryKeyId();
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
|
|
|
@ -508,7 +508,7 @@ class KeyManager {
|
||||||
* @param View $view
|
* @param View $view
|
||||||
*/
|
*/
|
||||||
public function setVersion($path, $version, View $view) {
|
public function setVersion($path, $version, View $view) {
|
||||||
$fileInfo= $view->getFileInfo($path);
|
$fileInfo = $view->getFileInfo($path);
|
||||||
|
|
||||||
if ($fileInfo !== false) {
|
if ($fileInfo !== false) {
|
||||||
$cache = $fileInfo->getStorage()->getCache();
|
$cache = $fileInfo->getStorage()->getCache();
|
||||||
|
|
|
@ -306,7 +306,7 @@ class CryptTest extends TestCase {
|
||||||
* test parseHeader()
|
* test parseHeader()
|
||||||
*/
|
*/
|
||||||
public function testParseHeader() {
|
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]);
|
$result = self::invokePrivate($this->crypt, 'parseHeader', [$header]);
|
||||||
|
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
|
|
|
@ -306,15 +306,15 @@ class EncryptAllTest extends TestCase {
|
||||||
$this->view->expects($this->at(0))->method('getDirectoryContent')
|
$this->view->expects($this->at(0))->method('getDirectoryContent')
|
||||||
->with('/user1/files')->willReturn(
|
->with('/user1/files')->willReturn(
|
||||||
[
|
[
|
||||||
['name' => 'foo', 'type'=>'dir'],
|
['name' => 'foo', 'type' => 'dir'],
|
||||||
['name' => 'bar', 'type'=>'file'],
|
['name' => 'bar', 'type' => 'file'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->view->expects($this->at(3))->method('getDirectoryContent')
|
$this->view->expects($this->at(3))->method('getDirectoryContent')
|
||||||
->with('/user1/files/foo')->willReturn(
|
->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))
|
$this->keyStorageMock->expects($this->exactly(2))
|
||||||
->method('getUserKey')
|
->method('getUserKey')
|
||||||
->willReturnCallback(function ($uid, $keyID, $encryptionModuleId) {
|
->willReturnCallback(function ($uid, $keyID, $encryptionModuleId) {
|
||||||
if ($keyID=== 'privateKey') {
|
if ($keyID === 'privateKey') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return 'key';
|
return 'key';
|
||||||
|
|
|
@ -118,7 +118,7 @@ class Notifications {
|
||||||
$ocsStatus = isset($status['ocs']);
|
$ocsStatus = isset($status['ocs']);
|
||||||
$ocsSuccess = $ocsStatus && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200);
|
$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);
|
$event = new FederatedShareAddedEvent($remote);
|
||||||
$this->eventDispatcher->dispatchTyped($event);
|
$this->eventDispatcher->dispatchTyped($event);
|
||||||
return true;
|
return true;
|
||||||
|
@ -305,7 +305,7 @@ class Notifications {
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @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) {
|
if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) {
|
||||||
$remoteDomain = 'https://' . $remoteDomain;
|
$remoteDomain = 'https://' . $remoteDomain;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ use Psr\Container\ContainerInterface;
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
public const APP_ID = 'files';
|
public const APP_ID = 'files';
|
||||||
|
|
||||||
public function __construct(array $urlParams=[]) {
|
public function __construct(array $urlParams = []) {
|
||||||
parent::__construct(self::APP_ID, $urlParams);
|
parent::__construct(self::APP_ID, $urlParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ class Scan extends Base {
|
||||||
protected function formatExecTime() {
|
protected function formatExecTime() {
|
||||||
$secs = round($this->execTime);
|
$secs = round($this->execTime);
|
||||||
# convert seconds into HH:MM:SS form
|
# 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() {
|
protected function formatExecTime() {
|
||||||
$secs = round($this->execTime);
|
$secs = round($this->execTime);
|
||||||
# convert seconds into HH:MM:SS form
|
# 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,17 +47,17 @@ class FTP extends StreamWrapper {
|
||||||
|
|
||||||
public function __construct($params) {
|
public function __construct($params) {
|
||||||
if (isset($params['host']) && isset($params['user']) && isset($params['password'])) {
|
if (isset($params['host']) && isset($params['user']) && isset($params['password'])) {
|
||||||
$this->host=$params['host'];
|
$this->host = $params['host'];
|
||||||
$this->user=$params['user'];
|
$this->user = $params['user'];
|
||||||
$this->password=$params['password'];
|
$this->password = $params['password'];
|
||||||
if (isset($params['secure'])) {
|
if (isset($params['secure'])) {
|
||||||
$this->secure = $params['secure'];
|
$this->secure = $params['secure'];
|
||||||
} else {
|
} else {
|
||||||
$this->secure = false;
|
$this->secure = false;
|
||||||
}
|
}
|
||||||
$this->root=isset($params['root'])?$params['root']:'/';
|
$this->root = isset($params['root'])?$params['root']:'/';
|
||||||
if (! $this->root || $this->root[0]!=='/') {
|
if (! $this->root || $this->root[0] !== '/') {
|
||||||
$this->root='/'.$this->root;
|
$this->root = '/'.$this->root;
|
||||||
}
|
}
|
||||||
if (substr($this->root, -1) !== '/') {
|
if (substr($this->root, -1) !== '/') {
|
||||||
$this->root .= '/';
|
$this->root .= '/';
|
||||||
|
@ -77,11 +77,11 @@ class FTP extends StreamWrapper {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function constructUrl($path) {
|
public function constructUrl($path) {
|
||||||
$url='ftp';
|
$url = 'ftp';
|
||||||
if ($this->secure) {
|
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;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,10 +120,10 @@ class FTP extends StreamWrapper {
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'c+':
|
case 'c+':
|
||||||
//emulate these
|
//emulate these
|
||||||
if (strrpos($path, '.')!==false) {
|
if (strrpos($path, '.') !== false) {
|
||||||
$ext=substr($path, strrpos($path, '.'));
|
$ext = substr($path, strrpos($path, '.'));
|
||||||
} else {
|
} else {
|
||||||
$ext='';
|
$ext = '';
|
||||||
}
|
}
|
||||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
|
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
|
||||||
if ($this->file_exists($path)) {
|
if ($this->file_exists($path)) {
|
||||||
|
|
|
@ -404,7 +404,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function touch($path, $mtime=null) {
|
public function touch($path, $mtime = null) {
|
||||||
try {
|
try {
|
||||||
if (!is_null($mtime)) {
|
if (!is_null($mtime)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -184,7 +184,7 @@ class StorageConfig implements \JsonSerializable {
|
||||||
* @param Backend $backend
|
* @param Backend $backend
|
||||||
*/
|
*/
|
||||||
public function setBackend(Backend $backend) {
|
public function setBackend(Backend $backend) {
|
||||||
$this->backend= $backend;
|
$this->backend = $backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,30 +35,30 @@ if (file_exists($privateConfigFile)) {
|
||||||
|
|
||||||
// this is now more a template now for your private configurations
|
// this is now more a template now for your private configurations
|
||||||
return [
|
return [
|
||||||
'ftp'=>[
|
'ftp' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'user'=>'test',
|
'user' => 'test',
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
'root'=>'/test',
|
'root' => '/test',
|
||||||
],
|
],
|
||||||
'webdav'=>[
|
'webdav' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'user'=>'test',
|
'user' => 'test',
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
'root'=>'',
|
'root' => '',
|
||||||
// wait delay in seconds after write operations
|
// wait delay in seconds after write operations
|
||||||
// (only in tests)
|
// (only in tests)
|
||||||
// set to higher value for lighttpd webdav
|
// set to higher value for lighttpd webdav
|
||||||
'wait'=> 0
|
'wait' => 0
|
||||||
],
|
],
|
||||||
'owncloud'=>[
|
'owncloud' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost/owncloud',
|
'host' => 'localhost/owncloud',
|
||||||
'user'=>'test',
|
'user' => 'test',
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
'root'=>'',
|
'root' => '',
|
||||||
],
|
],
|
||||||
'swift' => [
|
'swift' => [
|
||||||
'run' => false,
|
'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
|
//'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
|
//'timeout' => 5 // timeout of HTTP requests in seconds
|
||||||
],
|
],
|
||||||
'smb'=>[
|
'smb' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'user'=>'test',
|
'user' => 'test',
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'share'=>'/test',
|
'share' => '/test',
|
||||||
'root'=>'/test/',
|
'root' => '/test/',
|
||||||
],
|
],
|
||||||
'amazons3'=>[
|
'amazons3' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'key'=>'test',
|
'key' => 'test',
|
||||||
'secret'=>'test',
|
'secret' => 'test',
|
||||||
'bucket'=>'bucket'
|
'bucket' => 'bucket'
|
||||||
//'hostname' => 'your.host.name',
|
//'hostname' => 'your.host.name',
|
||||||
//'port' => '443',
|
//'port' => '443',
|
||||||
//'use_ssl' => 'true',
|
//'use_ssl' => 'true',
|
||||||
|
@ -93,18 +93,18 @@ return [
|
||||||
//'timeout'=>20
|
//'timeout'=>20
|
||||||
],
|
],
|
||||||
'sftp' => [
|
'sftp' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'user'=>'test',
|
'user' => 'test',
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
'root'=>'/test'
|
'root' => '/test'
|
||||||
],
|
],
|
||||||
'sftp_key' => [
|
'sftp_key' => [
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'user'=>'test',
|
'user' => 'test',
|
||||||
'public_key'=>'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key',
|
'public_key' => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key',
|
||||||
'private_key'=>'test',
|
'private_key' => 'test',
|
||||||
'root'=>'/test'
|
'root' => '/test'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Manager {
|
||||||
* @return Mount|null
|
* @return Mount|null
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
* @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;
|
$user = $user ? $user : $this->uid;
|
||||||
$accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING;
|
$accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING;
|
||||||
$name = Filesystem::normalizePath('/' . $name);
|
$name = Filesystem::normalizePath('/' . $name);
|
||||||
|
|
|
@ -287,7 +287,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage {
|
||||||
$returnValue = false;
|
$returnValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->set($url, $returnValue, 60*60*24);
|
$cache->set($url, $returnValue, 60 * 60 * 24);
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,7 +650,7 @@ class ApiTest extends TestCase {
|
||||||
$share3->setStatus(IShare::STATUS_ACCEPTED);
|
$share3->setStatus(IShare::STATUS_ACCEPTED);
|
||||||
$this->shareManager->updateShare($share3);
|
$this->shareManager->updateShare($share3);
|
||||||
|
|
||||||
$testValues=[
|
$testValues = [
|
||||||
['query' => $this->folder,
|
['query' => $this->folder,
|
||||||
'expectedResult' => $this->folder . $this->filename],
|
'expectedResult' => $this->folder . $this->filename],
|
||||||
['query' => $this->folder . $this->subfolder,
|
['query' => $this->folder . $this->subfolder,
|
||||||
|
|
|
@ -490,8 +490,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
|
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
|
||||||
$shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token=null,
|
$shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token = null,
|
||||||
$password=null, $label = '') {
|
$password = null, $label = '') {
|
||||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||||
$share->method('getId')->willReturn($id);
|
$share->method('getId')->willReturn($id);
|
||||||
$share->method('getShareType')->willReturn($shareType);
|
$share->method('getShareType')->willReturn($shareType);
|
||||||
|
|
|
@ -276,7 +276,7 @@ class ShareesAPIControllerTest extends TestCase {
|
||||||
|
|
||||||
$this->collaboratorSearch->expects($this->once())
|
$this->collaboratorSearch->expects($this->once())
|
||||||
->method('search')
|
->method('search')
|
||||||
->with($search, $expectedShareTypes, $this->anything(), $perPage, $perPage * ($page -1))
|
->with($search, $expectedShareTypes, $this->anything(), $perPage, $perPage * ($page - 1))
|
||||||
->willReturn([[], false]);
|
->willReturn([[], false]);
|
||||||
|
|
||||||
$sharees->expects($this->any())
|
$sharees->expects($this->any())
|
||||||
|
|
|
@ -113,7 +113,7 @@ class SizePropagationTest extends TestCase {
|
||||||
|
|
||||||
// but the size including mountpoints increases
|
// but the size including mountpoints increases
|
||||||
$newRecipientRootInfo = $recipientView->getFileInfo('', true);
|
$newRecipientRootInfo = $recipientView->getFileInfo('', true);
|
||||||
$this->assertEquals($oldRecipientSize +3, $newRecipientRootInfo->getSize());
|
$this->assertEquals($oldRecipientSize + 3, $newRecipientRootInfo->getSize());
|
||||||
|
|
||||||
// size of owner's root increases
|
// size of owner's root increases
|
||||||
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
|
$this->loginAsUser(self::TEST_FILES_SHARING_API_USER2);
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Expiration {
|
||||||
$time = $this->timeFactory->getTime();
|
$time = $this->timeFactory->getTime();
|
||||||
// Never expire dates in future e.g. misconfiguration or negative time
|
// Never expire dates in future e.g. misconfiguration or negative time
|
||||||
// adjustment
|
// adjustment
|
||||||
if ($time<$timestamp) {
|
if ($time < $timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ class Helper {
|
||||||
$timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1);
|
$timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1);
|
||||||
}
|
}
|
||||||
$originalPath = '';
|
$originalPath = '';
|
||||||
$originalName = substr($entryName, 0, -strlen($timestamp)-2);
|
$originalName = substr($entryName, 0, -strlen($timestamp) - 2);
|
||||||
if (isset($originalLocations[$originalName][$timestamp])) {
|
if (isset($originalLocations[$originalName][$timestamp])) {
|
||||||
$originalPath = $originalLocations[$originalName][$timestamp];
|
$originalPath = $originalLocations[$originalName][$timestamp];
|
||||||
if (substr($originalPath, -1) === '/') {
|
if (substr($originalPath, -1) === '/') {
|
||||||
|
|
|
@ -86,7 +86,7 @@ class CleanUpTest extends TestCase {
|
||||||
'id' => $query->expr()->literal('file'.$i),
|
'id' => $query->expr()->literal('file'.$i),
|
||||||
'timestamp' => $query->expr()->literal($i),
|
'timestamp' => $query->expr()->literal($i),
|
||||||
'location' => $query->expr()->literal('.'),
|
'location' => $query->expr()->literal('.'),
|
||||||
'user' => $query->expr()->literal('user'.$i%2)
|
'user' => $query->expr()->literal('user'.$i % 2)
|
||||||
])->execute();
|
])->execute();
|
||||||
}
|
}
|
||||||
$getAllQuery = $this->dbConnection->getQueryBuilder();
|
$getAllQuery = $this->dbConnection->getQueryBuilder();
|
||||||
|
|
|
@ -34,14 +34,14 @@ class ExpirationTest extends \Test\TestCase {
|
||||||
public const FAKE_TIME_NOW = 1000000;
|
public const FAKE_TIME_NOW = 1000000;
|
||||||
|
|
||||||
public function expirationData() {
|
public function expirationData() {
|
||||||
$today = 100*self::SECONDS_PER_DAY;
|
$today = 100 * self::SECONDS_PER_DAY;
|
||||||
$back10Days = (100-10)*self::SECONDS_PER_DAY;
|
$back10Days = (100 - 10) * self::SECONDS_PER_DAY;
|
||||||
$back20Days = (100-20)*self::SECONDS_PER_DAY;
|
$back20Days = (100 - 20) * self::SECONDS_PER_DAY;
|
||||||
$back30Days = (100-30)*self::SECONDS_PER_DAY;
|
$back30Days = (100 - 30) * self::SECONDS_PER_DAY;
|
||||||
$back35Days = (100-35)*self::SECONDS_PER_DAY;
|
$back35Days = (100 - 35) * self::SECONDS_PER_DAY;
|
||||||
|
|
||||||
// it should never happen, but who knows :/
|
// it should never happen, but who knows :/
|
||||||
$ahead100Days = (100+100)*self::SECONDS_PER_DAY;
|
$ahead100Days = (100 + 100) * self::SECONDS_PER_DAY;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Expiration is disabled - always should return false
|
// Expiration is disabled - always should return false
|
||||||
|
@ -158,10 +158,10 @@ class ExpirationTest extends \Test\TestCase {
|
||||||
[ 'auto', false ],
|
[ 'auto', false ],
|
||||||
[ 'auto,auto', false ],
|
[ 'auto,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 ],
|
[ '5, auto', false ],
|
||||||
[ '3, 5', self::FAKE_TIME_NOW - (5*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) ],
|
[ '10, 3', self::FAKE_TIME_NOW - (10 * self::SECONDS_PER_DAY) ],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class Expiration {
|
||||||
$time = $this->timeFactory->getTime();
|
$time = $this->timeFactory->getTime();
|
||||||
// Never expire dates in future e.g. misconfiguration or negative time
|
// Never expire dates in future e.g. misconfiguration or negative time
|
||||||
// adjustment
|
// adjustment
|
||||||
if ($time<$timestamp) {
|
if ($time < $timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class Expiration {
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
\OC::$server->getLogger()->warning(
|
\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.',
|
$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;
|
$isValid = false;
|
||||||
\OC::$server->getLogger()->warning(
|
\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.',
|
$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;
|
use OCP\User;
|
||||||
|
|
||||||
class Storage {
|
class Storage {
|
||||||
public const DEFAULTENABLED=true;
|
public const DEFAULTENABLED = true;
|
||||||
public const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
|
public const DEFAULTMAXSIZE = 50; // unit: percentage; 50% of available disk space/quota
|
||||||
public const VERSIONS_ROOT = 'files_versions/';
|
public const VERSIONS_ROOT = 'files_versions/';
|
||||||
|
|
||||||
public const DELETE_TRIGGER_MASTER_REMOVED = 0;
|
public const DELETE_TRIGGER_MASTER_REMOVED = 0;
|
||||||
|
@ -502,7 +502,7 @@ class Storage {
|
||||||
|
|
||||||
$toDelete = [];
|
$toDelete = [];
|
||||||
foreach (array_reverse($versions['all']) as $key => $version) {
|
foreach (array_reverse($versions['all']) as $key => $version) {
|
||||||
if ((int)$version['version'] <$threshold) {
|
if ((int)$version['version'] < $threshold) {
|
||||||
$toDelete[$key] = $version;
|
$toDelete[$key] = $version;
|
||||||
} else {
|
} else {
|
||||||
//Versions are sorted by time - nothing mo to iterate.
|
//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.
|
// 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,
|
// If not we delete the oldest versions until we meet the size limit for versions,
|
||||||
// but always keep the two latest versions
|
// but always keep the two latest versions
|
||||||
$numOfVersions = count($allVersions) -2 ;
|
$numOfVersions = count($allVersions) - 2 ;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
// sort oldest first and make sure that we start at the first element
|
// sort oldest first and make sure that we start at the first element
|
||||||
ksort($allVersions);
|
ksort($allVersions);
|
||||||
|
|
|
@ -35,14 +35,14 @@ class ExpirationTest extends \Test\TestCase {
|
||||||
public const SECONDS_PER_DAY = 86400; //60*60*24
|
public const SECONDS_PER_DAY = 86400; //60*60*24
|
||||||
|
|
||||||
public function expirationData() {
|
public function expirationData() {
|
||||||
$today = 100*self::SECONDS_PER_DAY;
|
$today = 100 * self::SECONDS_PER_DAY;
|
||||||
$back10Days = (100-10)*self::SECONDS_PER_DAY;
|
$back10Days = (100 - 10) * self::SECONDS_PER_DAY;
|
||||||
$back20Days = (100-20)*self::SECONDS_PER_DAY;
|
$back20Days = (100 - 20) * self::SECONDS_PER_DAY;
|
||||||
$back30Days = (100-30)*self::SECONDS_PER_DAY;
|
$back30Days = (100 - 30) * self::SECONDS_PER_DAY;
|
||||||
$back35Days = (100-35)*self::SECONDS_PER_DAY;
|
$back35Days = (100 - 35) * self::SECONDS_PER_DAY;
|
||||||
|
|
||||||
// it should never happen, but who knows :/
|
// it should never happen, but who knows :/
|
||||||
$ahead100Days = (100+100)*self::SECONDS_PER_DAY;
|
$ahead100Days = (100 + 100) * self::SECONDS_PER_DAY;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Expiration is disabled - always should return false
|
// Expiration is disabled - always should return false
|
||||||
|
|
|
@ -154,7 +154,7 @@ class GroupsController extends AUserData {
|
||||||
// Check the group exists
|
// Check the group exists
|
||||||
$group = $this->groupManager->get($groupId);
|
$group = $this->groupManager->get($groupId);
|
||||||
if ($group !== null) {
|
if ($group !== null) {
|
||||||
$isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
|
$isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group);
|
||||||
} else {
|
} else {
|
||||||
throw new OCSNotFoundException('The requested group could not be found');
|
throw new OCSNotFoundException('The requested group could not be found');
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Application extends App implements IBootstrap {
|
||||||
/**
|
/**
|
||||||
* @param array $urlParams
|
* @param array $urlParams
|
||||||
*/
|
*/
|
||||||
public function __construct(array $urlParams=[]) {
|
public function __construct(array $urlParams = []) {
|
||||||
parent::__construct(self::APP_ID, $urlParams);
|
parent::__construct(self::APP_ID, $urlParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ class UsersController extends Controller {
|
||||||
protected function canAdminChangeUserPasswords() {
|
protected function canAdminChangeUserPasswords() {
|
||||||
$isEncryptionEnabled = $this->encryptionManager->isEnabled();
|
$isEncryptionEnabled = $this->encryptionManager->isEnabled();
|
||||||
try {
|
try {
|
||||||
$noUserSpecificEncryptionKeys =!$this->encryptionManager->getEncryptionModule()->needDetailedAccessList();
|
$noUserSpecificEncryptionKeys = !$this->encryptionManager->getEncryptionModule()->needDetailedAccessList();
|
||||||
$isEncryptionModuleLoaded = true;
|
$isEncryptionModuleLoaded = true;
|
||||||
} catch (ModuleDoesNotExistsException $e) {
|
} catch (ModuleDoesNotExistsException $e) {
|
||||||
$noUserSpecificEncryptionKeys = true;
|
$noUserSpecificEncryptionKeys = true;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<span class="crondate" title="<?php p($absolute_time);?>">
|
<span class="crondate" title="<?php p($absolute_time);?>">
|
||||||
<?php p($l->t("Last job execution ran %s. Something seems wrong.", [$relative_time]));?>
|
<?php p($l->t("Last job execution ran %s. Something seems wrong.", [$relative_time]));?>
|
||||||
</span>
|
</span>
|
||||||
<?php } elseif (time() - $_['cronMaxAge'] > 12*3600) {
|
<?php } elseif (time() - $_['cronMaxAge'] > 12 * 3600) {
|
||||||
if ($_['backgroundjobs_mode'] === 'cron') { ?>
|
if ($_['backgroundjobs_mode'] === 'cron') { ?>
|
||||||
<span class="status warning"></span>
|
<span class="status warning"></span>
|
||||||
<span class="crondate" title="<?php p($maxAgeAbsoluteTime);?>">
|
<span class="crondate" title="<?php p($maxAgeAbsoluteTime);?>">
|
||||||
|
|
|
@ -723,7 +723,7 @@ class ShareByMailProviderTest extends TestCase {
|
||||||
|
|
||||||
$id = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token);
|
$id = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token);
|
||||||
|
|
||||||
$instance->getShareById($id+1);
|
$instance->getShareById($id + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetShareByPath() {
|
public function testGetShareByPath() {
|
||||||
|
@ -921,10 +921,10 @@ class ShareByMailProviderTest extends TestCase {
|
||||||
|
|
||||||
$id = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token);
|
$id = $this->createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token);
|
||||||
|
|
||||||
$this->invokePrivate($instance, 'getRawShare', [$id+1]);
|
$this->invokePrivate($instance, 'getRawShare', [$id + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $note='', $shareType = IShare::TYPE_EMAIL) {
|
private function createDummyShare($itemType, $itemSource, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $note = '', $shareType = IShare::TYPE_EMAIL) {
|
||||||
$qb = $this->connection->getQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$qb->insert('share')
|
$qb->insert('share')
|
||||||
->setValue('share_type', $qb->createNamedParameter($shareType))
|
->setValue('share_type', $qb->createNamedParameter($shareType))
|
||||||
|
|
|
@ -152,7 +152,7 @@ class Listener {
|
||||||
*/
|
*/
|
||||||
public function mapperEvent(MapperEvent $event) {
|
public function mapperEvent(MapperEvent $event) {
|
||||||
$tagIds = $event->getTags();
|
$tagIds = $event->getTags();
|
||||||
if ($event->getObjectType() !== 'files' ||empty($tagIds)
|
if ($event->getObjectType() !== 'files' || empty($tagIds)
|
||||||
|| !in_array($event->getEvent(), [MapperEvent::EVENT_ASSIGN, MapperEvent::EVENT_UNASSIGN])
|
|| !in_array($event->getEvent(), [MapperEvent::EVENT_ASSIGN, MapperEvent::EVENT_UNASSIGN])
|
||||||
|| !$this->appManager->isInstalled('activity')) {
|
|| !$this->appManager->isInstalled('activity')) {
|
||||||
// System tags not for files, no tags, not (un-)assigning or no activity-app enabled (save the energy)
|
// System tags not for files, no tags, not (un-)assigning or no activity-app enabled (save the energy)
|
||||||
|
|
|
@ -382,8 +382,8 @@ class ThemingController extends Controller {
|
||||||
[
|
[
|
||||||
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon',
|
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon',
|
||||||
['app' => $app]) . '?v=' . $cacheBusterValue,
|
['app' => $app]) . '?v=' . $cacheBusterValue,
|
||||||
'type'=> 'image/png',
|
'type' => 'image/png',
|
||||||
'sizes'=> '128x128'
|
'sizes' => '128x128'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon',
|
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon',
|
||||||
|
|
|
@ -164,7 +164,7 @@ class IconBuilder {
|
||||||
$res = $tmp->getImageResolution();
|
$res = $tmp->getImageResolution();
|
||||||
$tmp->destroy();
|
$tmp->destroy();
|
||||||
|
|
||||||
if ($x>$y) {
|
if ($x > $y) {
|
||||||
$max = $x;
|
$max = $x;
|
||||||
} else {
|
} else {
|
||||||
$max = $y;
|
$max = $y;
|
||||||
|
|
|
@ -372,7 +372,7 @@ class ThemingDefaults extends \OC_Defaults {
|
||||||
*/
|
*/
|
||||||
private function increaseCacheBuster() {
|
private function increaseCacheBuster() {
|
||||||
$cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
|
$cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
|
||||||
$this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1);
|
$this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey + 1);
|
||||||
$this->cacheFactory->createDistributed('theming-')->clear();
|
$this->cacheFactory->createDistributed('theming-')->clear();
|
||||||
$this->cacheFactory->createDistributed('imagePath')->clear();
|
$this->cacheFactory->createDistributed('imagePath')->clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Util {
|
||||||
*/
|
*/
|
||||||
public function invertTextColor($color) {
|
public function invertTextColor($color) {
|
||||||
$l = $this->calculateLuma($color);
|
$l = $this->calculateLuma($color);
|
||||||
if ($l>0.6) {
|
if ($l > 0.6) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -104,7 +104,7 @@ class Util {
|
||||||
list($red, $green, $blue) = $this->hexToRGB($color);
|
list($red, $green, $blue) = $this->hexToRGB($color);
|
||||||
$compiler = new Compiler();
|
$compiler = new Compiler();
|
||||||
$hsl = $compiler->toHSL($red, $green, $blue);
|
$hsl = $compiler->toHSL($red, $green, $blue);
|
||||||
return $hsl[3]/100;
|
return $hsl[3] / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -356,7 +356,7 @@ class ThemingControllerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @dataProvider dataUpdateImages */
|
/** @dataProvider dataUpdateImages */
|
||||||
public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists=true) {
|
public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists = true) {
|
||||||
$tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg';
|
$tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg';
|
||||||
$destination = \OC::$server->getTempManager()->getTemporaryFolder();
|
$destination = \OC::$server->getTempManager()->getTemporaryFolder();
|
||||||
|
|
||||||
|
@ -816,8 +816,8 @@ class ThemingControllerTest extends TestCase {
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'src' => 'touchicon?v=0',
|
'src' => 'touchicon?v=0',
|
||||||
'type'=> 'image/png',
|
'type' => 'image/png',
|
||||||
'sizes'=> '128x128'
|
'sizes' => '128x128'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'src' => 'favicon?v=0',
|
'src' => 'favicon?v=0',
|
||||||
|
|
|
@ -312,7 +312,7 @@ class ImageManagerTest extends TestCase {
|
||||||
$this->createMock(ISimpleFolder::class),
|
$this->createMock(ISimpleFolder::class),
|
||||||
$this->createMock(ISimpleFolder::class)
|
$this->createMock(ISimpleFolder::class)
|
||||||
];
|
];
|
||||||
foreach ($folders as $index=>$folder) {
|
foreach ($folders as $index => $folder) {
|
||||||
$folder->expects($this->any())
|
$folder->expects($this->any())
|
||||||
->method('getName')
|
->method('getName')
|
||||||
->willReturn($index);
|
->willReturn($index);
|
||||||
|
|
|
@ -644,8 +644,8 @@ class ThemingDefaultsTest extends TestCase {
|
||||||
->method('createDistributed')
|
->method('createDistributed')
|
||||||
->with('theming-')
|
->with('theming-')
|
||||||
->willReturn($this->cache);
|
->willReturn($this->cache);
|
||||||
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(['foo'=>'bar']);
|
$this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(['foo' => 'bar']);
|
||||||
$this->assertEquals(['foo'=>'bar'], $this->template->getScssVariables());
|
$this->assertEquals(['foo' => 'bar'], $this->template->getScssVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetScssVariables() {
|
public function testGetScssVariables() {
|
||||||
|
|
|
@ -60,7 +60,7 @@ class RememberBackupCodesJob extends TimedJob {
|
||||||
$this->notificationManager = $notificationManager;
|
$this->notificationManager = $notificationManager;
|
||||||
$this->jobList = $jobList;
|
$this->jobList = $jobList;
|
||||||
|
|
||||||
$this->setInterval(60*60*24*14);
|
$this->setInterval(60 * 60 * 24 * 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function run($argument) {
|
protected function run($argument) {
|
||||||
|
|
|
@ -57,11 +57,11 @@ class UpdateCheckerTest extends TestCase {
|
||||||
->willReturn([
|
->willReturn([
|
||||||
'version' => '1.2.3',
|
'version' => '1.2.3',
|
||||||
'versionstring' => 'Nextcloud 1.2.3',
|
'versionstring' => 'Nextcloud 1.2.3',
|
||||||
'web'=> 'javascript:alert(1)',
|
'web' => 'javascript:alert(1)',
|
||||||
'url'=> 'javascript:alert(2)',
|
'url' => 'javascript:alert(2)',
|
||||||
'changes' => 'javascript:alert(3)',
|
'changes' => 'javascript:alert(3)',
|
||||||
'autoupdater'=> '0',
|
'autoupdater' => '0',
|
||||||
'eol'=> '1',
|
'eol' => '1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
|
@ -98,11 +98,11 @@ class UpdateCheckerTest extends TestCase {
|
||||||
->willReturn([
|
->willReturn([
|
||||||
'version' => '1.2.3',
|
'version' => '1.2.3',
|
||||||
'versionstring' => 'Nextcloud 1.2.3',
|
'versionstring' => 'Nextcloud 1.2.3',
|
||||||
'web'=> 'https://docs.nextcloud.com/myUrl',
|
'web' => 'https://docs.nextcloud.com/myUrl',
|
||||||
'url'=> 'https://downloads.nextcloud.org/server',
|
'url' => 'https://downloads.nextcloud.org/server',
|
||||||
'changes' => 'https://updates.nextcloud.com/changelog_server/?version=123.0.0',
|
'changes' => 'https://updates.nextcloud.com/changelog_server/?version=123.0.0',
|
||||||
'autoupdater'=> '1',
|
'autoupdater' => '1',
|
||||||
'eol'=> '0',
|
'eol' => '0',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->changesChecker->expects($this->once())
|
$this->changesChecker->expects($this->once())
|
||||||
|
|
|
@ -34,7 +34,7 @@ $serverConnections = $helper->getServerConfigurationPrefixes();
|
||||||
sort($serverConnections);
|
sort($serverConnections);
|
||||||
$lk = array_pop($serverConnections);
|
$lk = array_pop($serverConnections);
|
||||||
$ln = (int)str_replace('s', '', $lk);
|
$ln = (int)str_replace('s', '', $lk);
|
||||||
$nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
|
$nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
$resultData = ['configPrefix' => $nk];
|
$resultData = ['configPrefix' => $nk];
|
||||||
|
|
||||||
|
|
|
@ -1146,8 +1146,8 @@ class Wizard extends LDAPUtility {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$lastFilter = null;
|
$lastFilter = null;
|
||||||
if (isset($filters[count($filters)-1])) {
|
if (isset($filters[count($filters) - 1])) {
|
||||||
$lastFilter = $filters[count($filters)-1];
|
$lastFilter = $filters[count($filters) - 1];
|
||||||
}
|
}
|
||||||
foreach ($filters as $filter) {
|
foreach ($filters as $filter) {
|
||||||
if ($lastFilter === $filter && count($foundItems) > 0) {
|
if ($lastFilter === $filter && count($foundItems) > 0) {
|
||||||
|
@ -1348,7 +1348,7 @@ class Wizard extends LDAPUtility {
|
||||||
&& stripos($hostInfo['scheme'], 'ldaps') !== false)) {
|
&& stripos($hostInfo['scheme'], 'ldaps') !== false)) {
|
||||||
$portSettings[] = ['port' => $port, 'tls' => true];
|
$portSettings[] = ['port' => $port, 'tls' => true];
|
||||||
}
|
}
|
||||||
$portSettings[] =['port' => $port, 'tls' => false];
|
$portSettings[] = ['port' => $port, 'tls' => false];
|
||||||
}
|
}
|
||||||
|
|
||||||
//default ports
|
//default ports
|
||||||
|
|
|
@ -258,7 +258,7 @@ class SyncTest extends TestCase {
|
||||||
|
|
||||||
$this->config->expects($this->exactly(2))
|
$this->config->expects($this->exactly(2))
|
||||||
->method('getAppValue')
|
->method('getAppValue')
|
||||||
->willReturnOnConsecutiveCalls(time() - 60*40, time() - 60*20);
|
->willReturnOnConsecutiveCalls(time() - 60 * 40, time() - 60 * 20);
|
||||||
|
|
||||||
$this->sync->setArgument($this->arguments);
|
$this->sync->setArgument($this->arguments);
|
||||||
$this->assertTrue($this->sync->qualifiesToRun($cycleData));
|
$this->assertTrue($this->sync->qualifiesToRun($cycleData));
|
||||||
|
@ -317,7 +317,7 @@ class SyncTest extends TestCase {
|
||||||
}
|
}
|
||||||
// for qualifiesToRun()
|
// for qualifiesToRun()
|
||||||
if ($key === $runData['scheduledCycle']['prefix'] . '_lastChange') {
|
if ($key === $runData['scheduledCycle']['prefix'] . '_lastChange') {
|
||||||
return time() - 60*40;
|
return time() - 60 * 40;
|
||||||
}
|
}
|
||||||
// for getMinPagingSize
|
// for getMinPagingSize
|
||||||
if ($key === $runData['scheduledCycle']['prefix'] . 'ldap_paging_size') {
|
if ($key === $runData['scheduledCycle']['prefix'] . 'ldap_paging_size') {
|
||||||
|
|
|
@ -600,7 +600,7 @@ class LDAPProviderTest extends \Test\TestCase {
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
$userBackend->expects($this->at(3))
|
$userBackend->expects($this->at(3))
|
||||||
->method('getConfiguration')
|
->method('getConfiguration')
|
||||||
->willReturn(['ldap_display_name'=>'displayName']);
|
->willReturn(['ldap_display_name' => 'displayName']);
|
||||||
$userBackend->expects($this->any())
|
$userBackend->expects($this->any())
|
||||||
->method($this->anything())
|
->method($this->anything())
|
||||||
->willReturnSelf();
|
->willReturnSelf();
|
||||||
|
@ -638,7 +638,7 @@ class LDAPProviderTest extends \Test\TestCase {
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
$userBackend->expects($this->at(3))
|
$userBackend->expects($this->at(3))
|
||||||
->method('getConfiguration')
|
->method('getConfiguration')
|
||||||
->willReturn(['ldap_email_attr'=>'mail']);
|
->willReturn(['ldap_email_attr' => 'mail']);
|
||||||
$userBackend->expects($this->any())
|
$userBackend->expects($this->any())
|
||||||
->method($this->anything())
|
->method($this->anything())
|
||||||
->willReturnSelf();
|
->willReturnSelf();
|
||||||
|
@ -686,7 +686,7 @@ class LDAPProviderTest extends \Test\TestCase {
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
$groupBackend->expects($this->any())
|
$groupBackend->expects($this->any())
|
||||||
->method('getConfiguration')
|
->method('getConfiguration')
|
||||||
->willReturn(['ldap_group_member_assoc_attribute'=>'assoc_type']);
|
->willReturn(['ldap_group_member_assoc_attribute' => 'assoc_type']);
|
||||||
$groupBackend->expects($this->any())
|
$groupBackend->expects($this->any())
|
||||||
->method($this->anything())
|
->method($this->anything())
|
||||||
->willReturnSelf();
|
->willReturnSelf();
|
||||||
|
|
|
@ -60,7 +60,7 @@ class StatusesController extends OCSController {
|
||||||
* @param int|null $offset
|
* @param int|null $offset
|
||||||
* @return DataResponse
|
* @return DataResponse
|
||||||
*/
|
*/
|
||||||
public function findAll(?int $limit=null, ?int $offset=null): DataResponse {
|
public function findAll(?int $limit = null, ?int $offset = null): DataResponse {
|
||||||
$allStatuses = $this->service->findAll($limit, $offset);
|
$allStatuses = $this->service->findAll($limit, $offset);
|
||||||
|
|
||||||
return new DataResponse(array_map(function ($userStatus) {
|
return new DataResponse(array_map(function ($userStatus) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Rotate extends TimedJob {
|
||||||
use RotationTrait;
|
use RotationTrait;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->setInterval(60*60*3);
|
$this->setInterval(60 * 60 * 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function run($argument) {
|
protected function run($argument) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext {
|
||||||
}
|
}
|
||||||
$answeredValue = (string)$answeredValue;
|
$answeredValue = (string)$answeredValue;
|
||||||
Assert::assertEquals(
|
Assert::assertEquals(
|
||||||
$row['value']==="EMPTY" ? '' : $row['value'],
|
$row['value'] === "EMPTY" ? '' : $row['value'],
|
||||||
$answeredValue,
|
$answeredValue,
|
||||||
"Failed field " . $row['capability'] . " " . $row['path_to_element']
|
"Failed field " . $row['capability'] . " " . $row['path_to_element']
|
||||||
);
|
);
|
||||||
|
|
|
@ -113,7 +113,7 @@ class fakeSMTP {
|
||||||
$this->mail['emailBody'] = $splitmail[1];
|
$this->mail['emailBody'] = $splitmail[1];
|
||||||
$headers = preg_replace("/ \s+/", ' ', preg_replace("/\n\s/", ' ', $this->mail['emailHeaders']));
|
$headers = preg_replace("/ \s+/", ' ', preg_replace("/\n\s/", ' ', $this->mail['emailHeaders']));
|
||||||
$headerlines = explode("\n", $headers);
|
$headerlines = explode("\n", $headers);
|
||||||
for ($i=0; $i<count($headerlines); $i++) {
|
for ($i = 0; $i < count($headerlines); $i++) {
|
||||||
if (preg_match('/^Subject: (.*)/i', $headerlines[$i], $matches)) {
|
if (preg_match('/^Subject: (.*)/i', $headerlines[$i], $matches)) {
|
||||||
$this->mail['emailSubject'] = trim($matches[1]);
|
$this->mail['emailSubject'] = trim($matches[1]);
|
||||||
}
|
}
|
||||||
|
@ -152,13 +152,13 @@ class fakeSMTP {
|
||||||
return preg_match('/^[_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', strtolower($email));
|
return preg_match('/^[_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/', strtolower($email));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRandom($length=8) {
|
private function generateRandom($length = 8) {
|
||||||
$password = '';
|
$password = '';
|
||||||
$possible = '2346789BCDFGHJKLMNPQRTVWXYZ';
|
$possible = '2346789BCDFGHJKLMNPQRTVWXYZ';
|
||||||
$maxlength = strlen($possible);
|
$maxlength = strlen($possible);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
for ($i=0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$char = substr($possible, mt_rand(0, $maxlength-1), 1);
|
$char = substr($possible, mt_rand(0, $maxlength - 1), 1);
|
||||||
if (!strstr($password, $char)) {
|
if (!strstr($password, $char)) {
|
||||||
$password .= $char;
|
$password .= $char;
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,7 +422,7 @@ trait Provisioning {
|
||||||
'groupid' => $group,
|
'groupid' => $group,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->response =$client->post($fullUrl, $options);
|
$this->response = $client->post($fullUrl, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ With help from many libraries and frameworks including:
|
||||||
chdir($buildDir);
|
chdir($buildDir);
|
||||||
}
|
}
|
||||||
$timestampChanges = explode(PHP_EOL, $out);
|
$timestampChanges = explode(PHP_EOL, $out);
|
||||||
$timestampChanges = array_slice($timestampChanges, 0, count($timestampChanges)-1);
|
$timestampChanges = array_slice($timestampChanges, 0, count($timestampChanges) - 1);
|
||||||
foreach ($timestampChanges as $timestamp) {
|
foreach ($timestampChanges as $timestamp) {
|
||||||
if ((int)$timestamp < $deadlineTimestamp) {
|
if ((int)$timestamp < $deadlineTimestamp) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -112,7 +112,7 @@ class CheckCode extends Command implements CompletionAwareInterface {
|
||||||
$output->writeln(" {$count} errors");
|
$output->writeln(" {$count} errors");
|
||||||
}
|
}
|
||||||
usort($errors, function ($a, $b) {
|
usort($errors, function ($a, $b) {
|
||||||
return $a['line'] >$b['line'];
|
return $a['line'] > $b['line'];
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach ($errors as $p) {
|
foreach ($errors as $p) {
|
||||||
|
|
|
@ -312,7 +312,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
|
||||||
$count = $result->fetchColumn();
|
$count = $result->fetchColumn();
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
|
|
||||||
$numChunks = ceil($count/$chunkSize);
|
$numChunks = ceil($count / $chunkSize);
|
||||||
if ($numChunks > 1) {
|
if ($numChunks > 1) {
|
||||||
$output->writeln('chunked query, ' . $numChunks . ' chunks');
|
$output->writeln('chunked query, ' . $numChunks . ' chunks');
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class CheckApp extends Base {
|
||||||
$path = (string)$input->getOption('path');
|
$path = (string)$input->getOption('path');
|
||||||
$result = $this->checker->verifyAppSignature($appid, $path);
|
$result = $this->checker->verifyAppSignature($appid, $path);
|
||||||
$this->writeArrayInOutputFormat($input, $output, $result);
|
$this->writeArrayInOutputFormat($input, $output, $result);
|
||||||
if (count($result)>0) {
|
if (count($result) > 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -63,7 +63,7 @@ class CheckCore extends Base {
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$result = $this->checker->verifyCoreSignature();
|
$result = $this->checker->verifyCoreSignature();
|
||||||
$this->writeArrayInOutputFormat($input, $output, $result);
|
$this->writeArrayInOutputFormat($input, $output, $result);
|
||||||
if (count($result)>0) {
|
if (count($result) > 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -63,7 +63,7 @@ class CreateJs extends Command implements CompletionAwareInterface {
|
||||||
}
|
}
|
||||||
$languages = $lang;
|
$languages = $lang;
|
||||||
if (empty($lang)) {
|
if (empty($lang)) {
|
||||||
$languages= $this->getAllLanguages($path);
|
$languages = $this->getAllLanguages($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($languages as $lang) {
|
foreach ($languages as $lang) {
|
||||||
|
@ -84,7 +84,7 @@ class CreateJs extends Command implements CompletionAwareInterface {
|
||||||
if ($fileInfo->getExtension() !== 'php') {
|
if ($fileInfo->getExtension() !== 'php') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$result[]= substr($fileInfo->getBasename(), 0, -4);
|
$result[] = substr($fileInfo->getBasename(), 0, -4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -108,7 +108,7 @@ class File extends Command implements Completion\CompletionAwareInterface {
|
||||||
$defaultLogFile = rtrim($dataDir, '/').'/nextcloud.log';
|
$defaultLogFile = rtrim($dataDir, '/').'/nextcloud.log';
|
||||||
$output->writeln('Log file: '.$this->config->getSystemValue('logfile', $defaultLogFile));
|
$output->writeln('Log file: '.$this->config->getSystemValue('logfile', $defaultLogFile));
|
||||||
|
|
||||||
$rotateSize = $this->config->getSystemValue('log_rotate_size', 100*1024*1024);
|
$rotateSize = $this->config->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
|
||||||
if ($rotateSize) {
|
if ($rotateSize) {
|
||||||
$rotateString = \OCP\Util::humanFileSize($rotateSize);
|
$rotateString = \OCP\Util::humanFileSize($rotateSize);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,8 +81,8 @@ class Repair extends Command {
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
if ($this->memoryLimit !== -1) {
|
if ($this->memoryLimit !== -1) {
|
||||||
$limitInMiB = round($this->memoryLimit / 1024 /1024, 1);
|
$limitInMiB = round($this->memoryLimit / 1024 / 1024, 1);
|
||||||
$thresholdInMiB = round($this->memoryTreshold / 1024 /1024, 1);
|
$thresholdInMiB = round($this->memoryTreshold / 1024 / 1024, 1);
|
||||||
$output->writeln("Memory limit is $limitInMiB MiB");
|
$output->writeln("Memory limit is $limitInMiB MiB");
|
||||||
$output->writeln("Memory threshold is $thresholdInMiB MiB");
|
$output->writeln("Memory threshold is $thresholdInMiB MiB");
|
||||||
$output->writeln("");
|
$output->writeln("");
|
||||||
|
|
|
@ -134,7 +134,7 @@ class AvatarController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache for 1 day
|
// Cache for 1 day
|
||||||
$response->cacheFor(60*60*24);
|
$response->cacheFor(60 * 60 * 24);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class AvatarController extends Controller {
|
||||||
if (!($node instanceof File)) {
|
if (!($node instanceof File)) {
|
||||||
return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]);
|
return new JSONResponse(['data' => ['message' => $this->l->t('Please select a file.')]]);
|
||||||
}
|
}
|
||||||
if ($node->getSize() > 20*1024*1024) {
|
if ($node->getSize() > 20 * 1024 * 1024) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['data' => ['message' => $this->l->t('File is too big')]],
|
['data' => ['message' => $this->l->t('File is too big')]],
|
||||||
Http::STATUS_BAD_REQUEST
|
Http::STATUS_BAD_REQUEST
|
||||||
|
@ -183,7 +183,7 @@ class AvatarController extends Controller {
|
||||||
is_uploaded_file($files['tmp_name'][0]) &&
|
is_uploaded_file($files['tmp_name'][0]) &&
|
||||||
!\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0])
|
!\OC\Files\Filesystem::isFileBlacklisted($files['tmp_name'][0])
|
||||||
) {
|
) {
|
||||||
if ($files['size'][0] > 20*1024*1024) {
|
if ($files['size'][0] > 20 * 1024 * 1024) {
|
||||||
return new JSONResponse(
|
return new JSONResponse(
|
||||||
['data' => ['message' => $this->l->t('File is too big')]],
|
['data' => ['message' => $this->l->t('File is too big')]],
|
||||||
Http::STATUS_BAD_REQUEST
|
Http::STATUS_BAD_REQUEST
|
||||||
|
|
|
@ -216,7 +216,7 @@ class LostController extends Controller {
|
||||||
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
|
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*24*7) ||
|
if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 24 * 7) ||
|
||||||
$user->getLastLogin() > $splittedToken[0]) {
|
$user->getLastLogin() > $splittedToken[0]) {
|
||||||
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
|
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ class LostController extends Controller {
|
||||||
* @param array $additional
|
* @param array $additional
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function error($message, array $additional=[]) {
|
private function error($message, array $additional = []) {
|
||||||
return array_merge(['status' => 'error', 'msg' => $message], $additional);
|
return array_merge(['status' => 'error', 'msg' => $message], $additional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ class LostController extends Controller {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function success($data = []) {
|
private function success($data = []) {
|
||||||
return array_merge($data, ['status'=>'success']);
|
return array_merge($data, ['status' => 'success']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,7 +70,7 @@ class SetupController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['install']) and $post['install']=='true') {
|
if (isset($post['install']) and $post['install'] == 'true') {
|
||||||
// We have to launch the installation process :
|
// We have to launch the installation process :
|
||||||
$e = $this->setupHelper->install($post);
|
$e = $this->setupHelper->install($post);
|
||||||
$errors = ['errors' => $e];
|
$errors = ['errors' => $e];
|
||||||
|
|
|
@ -190,7 +190,7 @@ if (\OCP\Util::needUpgrade()) {
|
||||||
$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
|
$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
|
||||||
});
|
});
|
||||||
$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
|
$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
|
||||||
$incompatibleApps[]= $app;
|
$incompatibleApps[] = $app;
|
||||||
});
|
});
|
||||||
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
|
$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
|
||||||
$eventSource->send('failure', $message);
|
$eventSource->send('failure', $message);
|
||||||
|
|
|
@ -77,7 +77,7 @@ script('core', [
|
||||||
<?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) {
|
<?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) {
|
||||||
$hasOtherDB = true;
|
$hasOtherDB = true;
|
||||||
} else {
|
} else {
|
||||||
$hasOtherDB =false;
|
$hasOtherDB = false;
|
||||||
} //other than SQLite?>
|
} //other than SQLite?>
|
||||||
<legend><?php p($l->t('Configure the database')); ?></legend>
|
<legend><?php p($l->t('Configure the database')); ?></legend>
|
||||||
<div id="selectDbType">
|
<div id="selectDbType">
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!=='files')? $_['application']:$theme->getTitle()); ?>">
|
<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] !== 'files')? $_['application']:$theme->getTitle()); ?>">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
|
<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
|
||||||
<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
|
<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>">
|
<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files')? $_['application']:$theme->getTitle()); ?>">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
|
<meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
|
||||||
<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
|
<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
|
||||||
|
|
|
@ -530,7 +530,7 @@ class OC {
|
||||||
if (count($_COOKIE) > 0) {
|
if (count($_COOKIE) > 0) {
|
||||||
$requestUri = $request->getScriptName();
|
$requestUri = $request->getScriptName();
|
||||||
$processingScript = explode('/', $requestUri);
|
$processingScript = explode('/', $requestUri);
|
||||||
$processingScript = $processingScript[count($processingScript)-1];
|
$processingScript = $processingScript[count($processingScript) - 1];
|
||||||
|
|
||||||
// index.php routes are handled in the middleware
|
// index.php routes are handled in the middleware
|
||||||
if ($processingScript === 'index.php') {
|
if ($processingScript === 'index.php') {
|
||||||
|
|
|
@ -408,7 +408,7 @@ class AllConfig implements \OCP\IConfig {
|
||||||
return $this->userCache[$userId];
|
return $this->userCache[$userId];
|
||||||
}
|
}
|
||||||
if ($userId === null || $userId === '') {
|
if ($userId === null || $userId === '') {
|
||||||
$this->userCache[$userId]=[];
|
$this->userCache[$userId] = [];
|
||||||
return $this->userCache[$userId];
|
return $this->userCache[$userId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ class NodeVisitor extends NodeVisitorAbstract {
|
||||||
|
|
||||||
public function enterNode(Node $node) {
|
public function enterNode(Node $node) {
|
||||||
if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) {
|
if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) {
|
||||||
$this->errors[]= [
|
$this->errors[] = [
|
||||||
'disallowedToken' => '==',
|
'disallowedToken' => '==',
|
||||||
'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
|
'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
|
||||||
'line' => $node->getLine(),
|
'line' => $node->getLine(),
|
||||||
|
@ -111,7 +111,7 @@ class NodeVisitor extends NodeVisitorAbstract {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\NotEqual) {
|
if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\NotEqual) {
|
||||||
$this->errors[]= [
|
$this->errors[] = [
|
||||||
'disallowedToken' => '!=',
|
'disallowedToken' => '!=',
|
||||||
'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
|
'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
|
||||||
'line' => $node->getLine(),
|
'line' => $node->getLine(),
|
||||||
|
@ -247,7 +247,7 @@ class NodeVisitor extends NodeVisitorAbstract {
|
||||||
$lowerName = strtolower($name);
|
$lowerName = strtolower($name);
|
||||||
|
|
||||||
if (isset($this->blackListedClassNames[$lowerName])) {
|
if (isset($this->blackListedClassNames[$lowerName])) {
|
||||||
$this->errors[]= [
|
$this->errors[] = [
|
||||||
'disallowedToken' => $name,
|
'disallowedToken' => $name,
|
||||||
'errorCode' => $errorCode,
|
'errorCode' => $errorCode,
|
||||||
'line' => $node->getLine(),
|
'line' => $node->getLine(),
|
||||||
|
@ -261,7 +261,7 @@ class NodeVisitor extends NodeVisitorAbstract {
|
||||||
$lowerName = strtolower($name);
|
$lowerName = strtolower($name);
|
||||||
|
|
||||||
if (isset($this->blackListedConstants[$lowerName])) {
|
if (isset($this->blackListedConstants[$lowerName])) {
|
||||||
$this->errors[]= [
|
$this->errors[] = [
|
||||||
'disallowedToken' => $name,
|
'disallowedToken' => $name,
|
||||||
'errorCode' => CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED,
|
'errorCode' => CodeChecker::CLASS_CONST_FETCH_NOT_ALLOWED,
|
||||||
'line' => $node->getLine(),
|
'line' => $node->getLine(),
|
||||||
|
@ -275,7 +275,7 @@ class NodeVisitor extends NodeVisitorAbstract {
|
||||||
$lowerName = strtolower($name);
|
$lowerName = strtolower($name);
|
||||||
|
|
||||||
if (isset($this->blackListedFunctions[$lowerName])) {
|
if (isset($this->blackListedFunctions[$lowerName])) {
|
||||||
$this->errors[]= [
|
$this->errors[] = [
|
||||||
'disallowedToken' => $name,
|
'disallowedToken' => $name,
|
||||||
'errorCode' => CodeChecker::STATIC_CALL_NOT_ALLOWED,
|
'errorCode' => CodeChecker::STATIC_CALL_NOT_ALLOWED,
|
||||||
'line' => $node->getLine(),
|
'line' => $node->getLine(),
|
||||||
|
@ -289,7 +289,7 @@ class NodeVisitor extends NodeVisitorAbstract {
|
||||||
$lowerName = strtolower($name);
|
$lowerName = strtolower($name);
|
||||||
|
|
||||||
if (isset($this->blackListedMethods[$lowerName])) {
|
if (isset($this->blackListedMethods[$lowerName])) {
|
||||||
$this->errors[]= [
|
$this->errors[] = [
|
||||||
'disallowedToken' => $name,
|
'disallowedToken' => $name,
|
||||||
'errorCode' => CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED,
|
'errorCode' => CodeChecker::CLASS_METHOD_CALL_NOT_ALLOWED,
|
||||||
'line' => $node->getLine(),
|
'line' => $node->getLine(),
|
||||||
|
|
|
@ -168,7 +168,7 @@ class DependencyAnalyzer {
|
||||||
}
|
}
|
||||||
if (isset($dependencies['php']['@attributes']['min-int-size'])) {
|
if (isset($dependencies['php']['@attributes']['min-int-size'])) {
|
||||||
$intSize = $dependencies['php']['@attributes']['min-int-size'];
|
$intSize = $dependencies['php']['@attributes']['min-int-size'];
|
||||||
if ($intSize > $this->platform->getIntSize()*8) {
|
if ($intSize > $this->platform->getIntSize() * 8) {
|
||||||
$missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]);
|
$missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class App {
|
||||||
* the transformed app id, defaults to OCA\
|
* the transformed app id, defaults to OCA\
|
||||||
* @return string the starting namespace for the app
|
* @return string the starting namespace for the app
|
||||||
*/
|
*/
|
||||||
public static function buildAppNamespace(string $appId, string $topNamespace='OCA\\'): string {
|
public static function buildAppNamespace(string $appId, string $topNamespace = 'OCA\\'): string {
|
||||||
// Hit the cache!
|
// Hit the cache!
|
||||||
if (isset(self::$nameSpaceCache[$appId])) {
|
if (isset(self::$nameSpaceCache[$appId])) {
|
||||||
return $topNamespace . self::$nameSpaceCache[$appId];
|
return $topNamespace . self::$nameSpaceCache[$appId];
|
||||||
|
@ -88,7 +88,7 @@ class App {
|
||||||
return $topNamespace . self::$nameSpaceCache[$appId];
|
return $topNamespace . self::$nameSpaceCache[$appId];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAppIdForClass(string $className, string $topNamespace='OCA\\'): ?string {
|
public static function getAppIdForClass(string $className, string $topNamespace = 'OCA\\'): ?string {
|
||||||
if (strpos($className, $topNamespace) !== 0) {
|
if (strpos($className, $topNamespace) !== 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Http extends BaseHttp {
|
||||||
* @param array $server $_SERVER
|
* @param array $server $_SERVER
|
||||||
* @param string $protocolVersion the http version to use defaults to HTTP/1.1
|
* @param string $protocolVersion the http version to use defaults to HTTP/1.1
|
||||||
*/
|
*/
|
||||||
public function __construct($server, $protocolVersion='HTTP/1.1') {
|
public function __construct($server, $protocolVersion = 'HTTP/1.1') {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->protocolVersion = $protocolVersion;
|
$this->protocolVersion = $protocolVersion;
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
||||||
* @param string $stream
|
* @param string $stream
|
||||||
* @see http://www.php.net/manual/en/reserved.variables.php
|
* @see http://www.php.net/manual/en/reserved.variables.php
|
||||||
*/
|
*/
|
||||||
public function __construct(array $vars= [],
|
public function __construct(array $vars = [],
|
||||||
ISecureRandom $secureRandom = null,
|
ISecureRandom $secureRandom = null,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
CsrfTokenManager $csrfTokenManager = null,
|
CsrfTokenManager $csrfTokenManager = null,
|
||||||
|
|
|
@ -116,7 +116,7 @@ class MiddlewareDispatcher {
|
||||||
* @throws \Exception the passed in exception if it can't handle it
|
* @throws \Exception the passed in exception if it can't handle it
|
||||||
*/
|
*/
|
||||||
public function afterException(Controller $controller, string $methodName, \Exception $exception): Response {
|
public function afterException(Controller $controller, string $methodName, \Exception $exception): Response {
|
||||||
for ($i=$this->middlewareCounter-1; $i>=0; $i--) {
|
for ($i = $this->middlewareCounter - 1; $i >= 0; $i--) {
|
||||||
$middleware = $this->middlewares[$i];
|
$middleware = $this->middlewares[$i];
|
||||||
try {
|
try {
|
||||||
return $middleware->afterException($controller, $methodName, $exception);
|
return $middleware->afterException($controller, $methodName, $exception);
|
||||||
|
@ -139,7 +139,7 @@ class MiddlewareDispatcher {
|
||||||
* @return Response a Response object
|
* @return Response a Response object
|
||||||
*/
|
*/
|
||||||
public function afterController(Controller $controller, string $methodName, Response $response): Response {
|
public function afterController(Controller $controller, string $methodName, Response $response): Response {
|
||||||
for ($i= \count($this->middlewares)-1; $i>=0; $i--) {
|
for ($i = \count($this->middlewares) - 1; $i >= 0; $i--) {
|
||||||
$middleware = $this->middlewares[$i];
|
$middleware = $this->middlewares[$i];
|
||||||
$response = $middleware->afterController($controller, $methodName, $response);
|
$response = $middleware->afterController($controller, $methodName, $response);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ class MiddlewareDispatcher {
|
||||||
* @return string the output that should be printed
|
* @return string the output that should be printed
|
||||||
*/
|
*/
|
||||||
public function beforeOutput(Controller $controller, string $methodName, string $output): string {
|
public function beforeOutput(Controller $controller, string $methodName, string $output): string {
|
||||||
for ($i= \count($this->middlewares)-1; $i>=0; $i--) {
|
for ($i = \count($this->middlewares) - 1; $i >= 0; $i--) {
|
||||||
$middleware = $this->middlewares[$i];
|
$middleware = $this->middlewares[$i];
|
||||||
$output = $middleware->beforeOutput($controller, $methodName, $output);
|
$output = $middleware->beforeOutput($controller, $methodName, $output);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class SameSiteCookieMiddleware extends Middleware {
|
||||||
public function beforeController($controller, $methodName) {
|
public function beforeController($controller, $methodName) {
|
||||||
$requestUri = $this->request->getScriptName();
|
$requestUri = $this->request->getScriptName();
|
||||||
$processingScript = explode('/', $requestUri);
|
$processingScript = explode('/', $requestUri);
|
||||||
$processingScript = $processingScript[count($processingScript)-1];
|
$processingScript = $processingScript[count($processingScript) - 1];
|
||||||
|
|
||||||
if ($processingScript !== 'index.php') {
|
if ($processingScript !== 'index.php') {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -47,7 +47,7 @@ abstract class Archive {
|
||||||
* @param string $source either a local file or string data
|
* @param string $source either a local file or string data
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
abstract public function addFile($path, $source='');
|
abstract public function addFile($path, $source = '');
|
||||||
/**
|
/**
|
||||||
* rename a file or folder in the archive
|
* rename a file or folder in the archive
|
||||||
* @param string $source
|
* @param string $source
|
||||||
|
|
|
@ -39,15 +39,15 @@ class ZIP extends Archive {
|
||||||
/**
|
/**
|
||||||
* @var \ZipArchive zip
|
* @var \ZipArchive zip
|
||||||
*/
|
*/
|
||||||
private $zip=null;
|
private $zip = null;
|
||||||
private $path;
|
private $path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $source
|
* @param string $source
|
||||||
*/
|
*/
|
||||||
public function __construct($source) {
|
public function __construct($source) {
|
||||||
$this->path=$source;
|
$this->path = $source;
|
||||||
$this->zip=new \ZipArchive();
|
$this->zip = new \ZipArchive();
|
||||||
if ($this->zip->open($source, \ZipArchive::CREATE)) {
|
if ($this->zip->open($source, \ZipArchive::CREATE)) {
|
||||||
} else {
|
} else {
|
||||||
\OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN);
|
\OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN);
|
||||||
|
@ -67,11 +67,11 @@ class ZIP extends Archive {
|
||||||
* @param string $source either a local file or string data
|
* @param string $source either a local file or string data
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function addFile($path, $source='') {
|
public function addFile($path, $source = '') {
|
||||||
if ($source and $source[0]=='/' and file_exists($source)) {
|
if ($source and $source[0] == '/' and file_exists($source)) {
|
||||||
$result=$this->zip->addFile($source, $path);
|
$result = $this->zip->addFile($source, $path);
|
||||||
} else {
|
} else {
|
||||||
$result=$this->zip->addFromString($path, $source);
|
$result = $this->zip->addFromString($path, $source);
|
||||||
}
|
}
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->zip->close();//close and reopen to save the zip
|
$this->zip->close();//close and reopen to save the zip
|
||||||
|
@ -86,8 +86,8 @@ class ZIP extends Archive {
|
||||||
* @return boolean|null
|
* @return boolean|null
|
||||||
*/
|
*/
|
||||||
public function rename($source, $dest) {
|
public function rename($source, $dest) {
|
||||||
$source=$this->stripPath($source);
|
$source = $this->stripPath($source);
|
||||||
$dest=$this->stripPath($dest);
|
$dest = $this->stripPath($dest);
|
||||||
$this->zip->renameName($source, $dest);
|
$this->zip->renameName($source, $dest);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,7 @@ class ZIP extends Archive {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function filesize($path) {
|
public function filesize($path) {
|
||||||
$stat=$this->zip->statName($path);
|
$stat = $this->zip->statName($path);
|
||||||
return $stat['size'];
|
return $stat['size'];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -113,13 +113,13 @@ class ZIP extends Archive {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getFolder($path) {
|
public function getFolder($path) {
|
||||||
$files=$this->getFiles();
|
$files = $this->getFiles();
|
||||||
$folderContent=[];
|
$folderContent = [];
|
||||||
$pathLength=strlen($path);
|
$pathLength = strlen($path);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (substr($file, 0, $pathLength)==$path and $file!=$path) {
|
if (substr($file, 0, $pathLength) == $path and $file != $path) {
|
||||||
if (strrpos(substr($file, 0, -1), '/')<=$pathLength) {
|
if (strrpos(substr($file, 0, -1), '/') <= $pathLength) {
|
||||||
$folderContent[]=substr($file, $pathLength);
|
$folderContent[] = substr($file, $pathLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,10 +130,10 @@ class ZIP extends Archive {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getFiles() {
|
public function getFiles() {
|
||||||
$fileCount=$this->zip->numFiles;
|
$fileCount = $this->zip->numFiles;
|
||||||
$files=[];
|
$files = [];
|
||||||
for ($i=0;$i<$fileCount;$i++) {
|
for ($i = 0;$i < $fileCount;$i++) {
|
||||||
$files[]=$this->zip->getNameIndex($i);
|
$files[] = $this->zip->getNameIndex($i);
|
||||||
}
|
}
|
||||||
return $files;
|
return $files;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ class ZIP extends Archive {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function fileExists($path) {
|
public function fileExists($path) {
|
||||||
return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
|
return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* remove a file or folder from the archive
|
* remove a file or folder from the archive
|
||||||
|
@ -190,16 +190,16 @@ class ZIP extends Archive {
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
public function getStream($path, $mode) {
|
public function getStream($path, $mode) {
|
||||||
if ($mode=='r' or $mode=='rb') {
|
if ($mode == 'r' or $mode == 'rb') {
|
||||||
return $this->zip->getStream($path);
|
return $this->zip->getStream($path);
|
||||||
} else {
|
} else {
|
||||||
//since we can't directly get a writable stream,
|
//since we can't directly get a writable stream,
|
||||||
//make a temp copy of the file and put it back
|
//make a temp copy of the file and put it back
|
||||||
//in the archive when the stream is closed
|
//in the archive when the stream is closed
|
||||||
if (strrpos($path, '.')!==false) {
|
if (strrpos($path, '.') !== false) {
|
||||||
$ext=substr($path, strrpos($path, '.'));
|
$ext = substr($path, strrpos($path, '.'));
|
||||||
} else {
|
} else {
|
||||||
$ext='';
|
$ext = '';
|
||||||
}
|
}
|
||||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
|
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
|
||||||
if ($this->fileExists($path)) {
|
if ($this->fileExists($path)) {
|
||||||
|
@ -225,7 +225,7 @@ class ZIP extends Archive {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function stripPath($path) {
|
private function stripPath($path) {
|
||||||
if (!$path || $path[0]=='/') {
|
if (!$path || $path[0] == '/') {
|
||||||
return substr($path, 1);
|
return substr($path, 1);
|
||||||
} else {
|
} else {
|
||||||
return $path;
|
return $path;
|
||||||
|
|
|
@ -163,7 +163,7 @@ class DefaultToken extends Entity implements INamedToken {
|
||||||
$scope = json_decode($this->getScope(), true);
|
$scope = json_decode($this->getScope(), true);
|
||||||
if (!$scope) {
|
if (!$scope) {
|
||||||
return [
|
return [
|
||||||
'filesystem'=> true
|
'filesystem' => true
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return $scope;
|
return $scope;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue