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