summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
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/user_ldap/lib
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/user_ldap/lib')
-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
10 files changed, 22 insertions, 22 deletions
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;
}