summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-01-25 23:06:53 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-01-26 11:35:42 +0100
commitc1e4f9f30563d5eda1718d716d631d6092cd4e28 (patch)
tree3bb7b6ef891cd80895d4c2c92252a4ccbc0c0cee /apps
parentfe7e726ab228e6ddde7cf1442de9d0db193334a1 (diff)
downloadnextcloud-server-c1e4f9f30563d5eda1718d716d631d6092cd4e28.tar.gz
nextcloud-server-c1e4f9f30563d5eda1718d716d631d6092cd4e28.zip
Use type casting instead of *val() method
It should be up to 6x faster Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/comments/appinfo/app.php2
-rw-r--r--apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php2
-rw-r--r--apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php2
-rw-r--r--apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php6
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php2
-rw-r--r--apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php2
-rw-r--r--apps/files_external/3rdparty/icewind/smb/src/Parser.php2
-rw-r--r--apps/files_trashbin/lib/Expiration.php8
-rw-r--r--apps/files_versions/lib/Expiration.php8
-rw-r--r--apps/files_versions/lib/Storage.php2
-rw-r--r--apps/user_ldap/ajax/getNewServerConfigPrefix.php2
-rw-r--r--apps/user_ldap/lib/Command/Search.php4
-rw-r--r--apps/user_ldap/lib/Connection.php6
-rw-r--r--apps/user_ldap/lib/Controller/ConfigAPIController.php2
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php6
-rw-r--r--apps/user_ldap/lib/Helper.php2
-rw-r--r--apps/user_ldap/lib/Jobs/CleanUp.php8
-rw-r--r--apps/user_ldap/lib/Migration/UUIDFixInsert.php2
-rw-r--r--apps/user_ldap/lib/User/Manager.php2
-rw-r--r--apps/user_ldap/lib/User/OfflineUser.php6
-rw-r--r--apps/user_ldap/lib/Wizard.php6
21 files changed, 41 insertions, 41 deletions
diff --git a/apps/comments/appinfo/app.php b/apps/comments/appinfo/app.php
index 15c545ae1e4..109063cd22e 100644
--- a/apps/comments/appinfo/app.php
+++ b/apps/comments/appinfo/app.php
@@ -36,7 +36,7 @@ $eventDispatcher->addListener(
$eventDispatcher->addListener(\OCP\Comments\CommentsEntityEvent::EVENT_ENTITY, function(\OCP\Comments\CommentsEntityEvent $event) {
$event->addEntityCollection('files', function($name) {
- $nodes = \OC::$server->getUserFolder()->getById(intval($name));
+ $nodes = \OC::$server->getUserFolder()->getById((int)$name);
return !empty($nodes);
});
});
diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php
index 5fc38315438..bac661b6722 100644
--- a/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php
+++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php
@@ -40,6 +40,6 @@ class LimitFilter implements XmlDeserializable {
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
}
- return intval($value);
+ return (int)$value;
}
} \ No newline at end of file
diff --git a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php
index 7aac59809a2..8ced850bbc0 100644
--- a/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php
+++ b/apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php
@@ -40,6 +40,6 @@ class OffsetFilter implements XmlDeserializable {
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
}
- return intval($value);
+ return (int)$value;
}
} \ No newline at end of file
diff --git a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
index ac625c3a9a4..58469d27205 100644
--- a/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php
@@ -97,7 +97,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
}
$propFind->handle(self::PROPERTY_NAME_COUNT, function() use ($node) {
- return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId()));
+ return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId());
});
$propFind->handle(self::PROPERTY_NAME_HREF, function() use ($node) {
@@ -153,9 +153,9 @@ class CommentPropertiesPlugin extends ServerPlugin {
return null;
}
- $lastRead = $this->commentsManager->getReadMark('files', strval($node->getId()), $user);
+ $lastRead = $this->commentsManager->getReadMark('files', (string)$node->getId(), $user);
- return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId()), $lastRead);
+ return $this->commentsManager->getNumberOfCommentsForObject('files', (string)$node->getId(), $lastRead);
}
}
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index b8a8209129c..fd237b604a9 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -369,7 +369,7 @@ abstract class Node implements \Sabre\DAV\INode {
throw new \InvalidArgumentException('X-OC-MTime header must be an integer (unix timestamp).');
}
- return intval($mtimeFromRequest);
+ return (int)$mtimeFromRequest;
}
}
diff --git a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php
index c76ab832b14..eb4b3a7c9e6 100644
--- a/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php
+++ b/apps/dav/lib/SystemTag/SystemTagsRelationsCollection.php
@@ -60,7 +60,7 @@ class SystemTagsRelationsCollection extends SimpleCollection {
$userSession,
$groupManager,
function($name) {
- $nodes = \OC::$server->getUserFolder()->getById(intval($name));
+ $nodes = \OC::$server->getUserFolder()->getById((int)$name);
return !empty($nodes);
}
),
diff --git a/apps/files_external/3rdparty/icewind/smb/src/Parser.php b/apps/files_external/3rdparty/icewind/smb/src/Parser.php
index 3142f9c29e0..c6515002657 100644
--- a/apps/files_external/3rdparty/icewind/smb/src/Parser.php
+++ b/apps/files_external/3rdparty/icewind/smb/src/Parser.php
@@ -133,7 +133,7 @@ class Parser {
return [
'mtime' => strtotime($data['write_time']),
'mode' => hexdec(substr($data['attributes'], strpos($data['attributes'], '('), -1)),
- 'size' => isset($data['stream']) ? intval(explode(' ', $data['stream'])[1]) : 0
+ 'size' => isset($data['stream']) ? (int)explode(' ', $data['stream'])[1] : 0
];
}
diff --git a/apps/files_trashbin/lib/Expiration.php b/apps/files_trashbin/lib/Expiration.php
index 03f126fc415..c7ad4e29f18 100644
--- a/apps/files_trashbin/lib/Expiration.php
+++ b/apps/files_trashbin/lib/Expiration.php
@@ -142,13 +142,13 @@ class Expiration {
$this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
// Keep for X days but delete anytime if space needed
- $this->minAge = intval($minValue);
+ $this->minAge = (int)$minValue;
$this->maxAge = self::NO_OBLIGATION;
$this->canPurgeToSaveSpace = true;
} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
// Delete anytime if space needed, Delete all older than max automatically
$this->minAge = self::NO_OBLIGATION;
- $this->maxAge = intval($maxValue);
+ $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
// Delete all older than max OR older than min if space needed
@@ -158,8 +158,8 @@ class Expiration {
$maxValue = $minValue;
}
- $this->minAge = intval($minValue);
- $this->maxAge = intval($maxValue);
+ $this->minAge = (int)$minValue;
+ $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = false;
}
}
diff --git a/apps/files_versions/lib/Expiration.php b/apps/files_versions/lib/Expiration.php
index 1dad8801230..83195d10a30 100644
--- a/apps/files_versions/lib/Expiration.php
+++ b/apps/files_versions/lib/Expiration.php
@@ -175,13 +175,13 @@ class Expiration {
$this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue === 'auto') {
// Keep for X days but delete anytime if space needed
- $this->minAge = intval($minValue);
+ $this->minAge = (int)$minValue;
$this->maxAge = self::NO_OBLIGATION;
$this->canPurgeToSaveSpace = true;
} elseif ($minValue === 'auto' && $maxValue !== 'auto') {
// Delete anytime if space needed, Delete all older than max automatically
$this->minAge = self::NO_OBLIGATION;
- $this->maxAge = intval($maxValue);
+ $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = true;
} elseif ($minValue !== 'auto' && $maxValue !== 'auto') {
// Delete all older than max OR older than min if space needed
@@ -191,8 +191,8 @@ class Expiration {
$maxValue = $minValue;
}
- $this->minAge = intval($minValue);
- $this->maxAge = intval($maxValue);
+ $this->minAge = (int)$minValue;
+ $this->maxAge = (int)$maxValue;
$this->canPurgeToSaveSpace = false;
}
}
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index d798312fda3..f8a6636839a 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -503,7 +503,7 @@ class Storage {
$toDelete = [];
foreach (array_reverse($versions['all']) as $key => $version) {
- if (intval($version['version'])<$threshold) {
+ if ((int)$version['version'] <$threshold) {
$toDelete[$key] = $version;
} else {
//Versions are sorted by time - nothing mo to iterate.
diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php
index d65e9add563..c0c81be14d7 100644
--- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php
+++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php
@@ -32,7 +32,7 @@ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$serverConnections = $helper->getServerConfigurationPrefixes();
sort($serverConnections);
$lk = array_pop($serverConnections);
-$ln = intval(str_replace('s', '', $lk));
+$ln = (int)str_replace('s', '', $lk);
$nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
$resultData = array('configPrefix' => $nk);
diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php
index ae61bfcd41c..c81b8d54696 100644
--- a/apps/user_ldap/lib/Command/Search.php
+++ b/apps/user_ldap/lib/Command/Search.php
@@ -109,8 +109,8 @@ class Search extends Command {
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new LDAP();
- $offset = intval($input->getOption('offset'));
- $limit = intval($input->getOption('limit'));
+ $offset = (int)$input->getOption('offset');
+ $limit = (int)$input->getOption('limit');
$this->validateOffsetAndLimit($offset, $limit);
if($input->getOption('group')) {
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index c73a35e6bf1..25d3f66c52d 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -106,7 +106,7 @@ class Connection extends LDAPUtility {
$this->doNotValidate = !in_array($this->configPrefix,
$helper->getServerConfigurationPrefixes());
$this->hasPagedResultSupport =
- intval($this->configuration->ldapPagingSize) !== 0
+ (int)$this->configuration->ldapPagingSize !== 0
|| $this->ldap->hasPagedResultSupport();
}
@@ -368,7 +368,7 @@ class Connection extends LDAPUtility {
}
}
- $backupPort = intval($this->configuration->ldapBackupPort);
+ $backupPort = (int)$this->configuration->ldapBackupPort;
if ($backupPort <= 0) {
$this->configuration->backupPort = $this->configuration->ldapPort;
}
@@ -399,7 +399,7 @@ class Connection extends LDAPUtility {
private function doCriticalValidation() {
$configurationOK = true;
$errorStr = 'Configuration Error (prefix '.
- strval($this->configPrefix).'): ';
+ (string)$this->configPrefix .'): ';
//options that shall not be empty
$options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName',
diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php
index 54800ef24eb..e000bd4e709 100644
--- a/apps/user_ldap/lib/Controller/ConfigAPIController.php
+++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php
@@ -285,7 +285,7 @@ class ConfigAPIController extends OCSController {
$config = new Configuration($configID);
$data = $config->getConfiguration();
- if(!boolval(intval($showPassword))) {
+ if(!(int)$showPassword) {
$data['ldapAgentPassword'] = '***';
}
foreach ($data as $key => $value) {
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index 3faa96bc2b8..6a2be770104 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -266,7 +266,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
$groups = $this->access->groupsMatchFilter($groups);
$allGroups = $groups;
$nestedGroups = $this->access->connection->ldapNestedGroups;
- if (intval($nestedGroups) === 1) {
+ if ((int)$nestedGroups === 1) {
foreach ($groups as $group) {
$subGroups = $this->_getGroupDNsFromMemberOf($group, $seen);
$allGroups = array_merge($allGroups, $subGroups);
@@ -667,8 +667,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
// if possible, read out membership via memberOf. It's far faster than
// performing a search, which still is a fallback later.
// memberof doesn't support memberuid, so skip it here.
- if(intval($this->access->connection->hasMemberOfFilterSupport) === 1
- && intval($this->access->connection->useMemberOfToDetectMembership) === 1
+ if((int)$this->access->connection->hasMemberOfFilterSupport === 1
+ && (int)$this->access->connection->useMemberOfToDetectMembership === 1
&& strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid'
) {
$groupDNs = $this->_getGroupDNsFromMemberOf($userDN);
diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php
index 3d1ae31cfef..f7794168760 100644
--- a/apps/user_ldap/lib/Helper.php
+++ b/apps/user_ldap/lib/Helper.php
@@ -122,7 +122,7 @@ class Helper {
sort($serverConnections);
$lastKey = array_pop($serverConnections);
- $lastNumber = intval(str_replace('s', '', $lastKey));
+ $lastNumber = (int)str_replace('s', '', $lastKey);
return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
}
diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php
index 849c30ecd65..14682c65ce1 100644
--- a/apps/user_ldap/lib/Jobs/CleanUp.php
+++ b/apps/user_ldap/lib/Jobs/CleanUp.php
@@ -69,8 +69,8 @@ class CleanUp extends TimedJob {
public function __construct() {
$minutes = \OC::$server->getConfig()->getSystemValue(
- 'ldapUserCleanupInterval', strval($this->defaultIntervalMin));
- $this->setInterval(intval($minutes) * 60);
+ 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
+ $this->setInterval((int)$minutes * 60);
}
/**
@@ -183,7 +183,7 @@ class CleanUp extends TimedJob {
*/
private function isCleanUpEnabled() {
return (bool)$this->ocConfig->getSystemValue(
- 'ldapUserCleanupInterval', strval($this->defaultIntervalMin));
+ 'ldapUserCleanupInterval', (string)$this->defaultIntervalMin);
}
/**
@@ -215,7 +215,7 @@ class CleanUp extends TimedJob {
* @return int
*/
private function getOffset() {
- return intval($this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0));
+ return (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobOffset', 0);
}
/**
diff --git a/apps/user_ldap/lib/Migration/UUIDFixInsert.php b/apps/user_ldap/lib/Migration/UUIDFixInsert.php
index 4a1104f2c6f..a99e13f74ce 100644
--- a/apps/user_ldap/lib/Migration/UUIDFixInsert.php
+++ b/apps/user_ldap/lib/Migration/UUIDFixInsert.php
@@ -90,7 +90,7 @@ class UUIDFixInsert implements IRepairStep {
$offset += $batchSize;
} catch (\InvalidArgumentException $e) {
if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) {
- $batchSize = intval(floor(count($records) * 0.8));
+ $batchSize = (int)floor(count($records) * 0.8);
$retry = true;
}
}
diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php
index b04a321652c..55fc7499beb 100644
--- a/apps/user_ldap/lib/User/Manager.php
+++ b/apps/user_ldap/lib/User/Manager.php
@@ -207,7 +207,7 @@ class Manager {
public function isDeletedUser($id) {
$isDeleted = $this->ocConfig->getUserValue(
$id, 'user_ldap', 'isDeleted', 0);
- return intval($isDeleted) === 1;
+ return (int)$isDeleted === 1;
}
/**
diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php
index 942eee84cb7..9576b49d5a2 100644
--- a/apps/user_ldap/lib/User/OfflineUser.php
+++ b/apps/user_ldap/lib/User/OfflineUser.php
@@ -166,7 +166,7 @@ class OfflineUser {
* @return int
*/
public function getLastLogin() {
- return intval($this->lastLogin);
+ return (int)$this->lastLogin;
}
/**
@@ -211,7 +211,7 @@ class OfflineUser {
', 1);
$query->execute(array($this->ocName));
$sResult = $query->fetchColumn(0);
- if(intval($sResult) === 1) {
+ if((int)$sResult === 1) {
$this->hasActiveShares = true;
return;
}
@@ -223,7 +223,7 @@ class OfflineUser {
', 1);
$query->execute(array($this->ocName));
$sResult = $query->fetchColumn(0);
- if(intval($sResult) === 1) {
+ if((int)$sResult === 1) {
$this->hasActiveShares = true;
return;
}
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index bf7c6bbeb93..433bd2fb73a 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -227,7 +227,7 @@ class Wizard extends LDAPUtility {
if ($attr !== '' && $attr !== 'displayName') {
// most likely not the default value with upper case N,
// verify it still produces a result
- $count = intval($this->countUsersWithAttribute($attr, true));
+ $count = (int)$this->countUsersWithAttribute($attr, true);
if($count > 0) {
//no change, but we sent it back to make sure the user interface
//is still correct, even if the ajax call was cancelled meanwhile
@@ -239,7 +239,7 @@ class Wizard extends LDAPUtility {
// first attribute that has at least one result wins
$displayNameAttrs = array('displayname', 'cn');
foreach ($displayNameAttrs as $attr) {
- $count = intval($this->countUsersWithAttribute($attr, true));
+ $count = (int)$this->countUsersWithAttribute($attr, true);
if($count > 0) {
$this->applyFind('ldap_display_name', $attr);
@@ -267,7 +267,7 @@ class Wizard extends LDAPUtility {
$attr = $this->configuration->ldapEmailAttribute;
if ($attr !== '') {
- $count = intval($this->countUsersWithAttribute($attr, true));
+ $count = (int)$this->countUsersWithAttribute($attr, true);
if($count > 0) {
return false;
}