summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-10-23 23:27:15 +0200
committerLukas Reschke <lukas@owncloud.com>2014-10-24 12:27:53 +0200
commitd060180140923ac054b252f0cbd821063a53f5b7 (patch)
tree59d53bb16be35960f493709d8409a75bc79be47e /apps
parent9739a25547e5f8f7500b0a962780cb9267b47cd1 (diff)
downloadnextcloud-server-d060180140923ac054b252f0cbd821063a53f5b7.tar.gz
nextcloud-server-d060180140923ac054b252f0cbd821063a53f5b7.zip
Use function outside of loop
Otherwise the function is executed n times which is a lot of overhead
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/config.php7
-rw-r--r--apps/user_ldap/lib/wizard.php3
-rw-r--r--apps/user_ldap/settings.php4
3 files changed, 8 insertions, 6 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 92bb891ca21..5378137e1d3 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -716,10 +716,11 @@ class OC_Mount_Config {
}
}
- if (count($dependencyGroup) > 0) {
+ $dependencyGroupCount = count($dependencyGroup);
+ if ($dependencyGroupCount > 0) {
$backends = '';
- for ($i = 0; $i < count($dependencyGroup); $i++) {
- if ($i > 0 && $i === count($dependencyGroup) - 1) {
+ for ($i = 0; $i < $dependencyGroupCount; $i++) {
+ if ($i > 0 && $i === $dependencyGroupCount - 1) {
$backends .= $l->t(' and ');
} elseif ($i > 0) {
$backends .= ', ';
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index e2a85ea5eb9..1d7701440e9 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -685,7 +685,8 @@ class Wizard extends LDAPUtility {
$this->ldap->getDN($cr, $er);
$attrs = $this->ldap->getAttributes($cr, $er);
$result = array();
- for($i = 0; $i < count($possibleAttrs); $i++) {
+ $possibleAttrsCount = count($possibleAttrs);
+ for($i = 0; $i < $possibleAttrsCount; $i++) {
if(isset($attrs[$possibleAttrs[$i]])) {
$result[$possibleAttrs[$i]] = $attrs[$possibleAttrs[$i]]['count'];
}
diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php
index 1e588b1cd85..ca61a53b196 100644
--- a/apps/user_ldap/settings.php
+++ b/apps/user_ldap/settings.php
@@ -54,8 +54,8 @@ $wizTabs[] = array('tpl' => 'part.wizard-server', 'cap' => $l->t('Server'))
$wizTabs[] = array('tpl' => 'part.wizard-userfilter', 'cap' => $l->t('User Filter'));
$wizTabs[] = array('tpl' => 'part.wizard-loginfilter', 'cap' => $l->t('Login Filter'));
$wizTabs[] = array('tpl' => 'part.wizard-groupfilter', 'cap' => $l->t('Group Filter'));
-
-for($i = 0; $i < count($wizTabs); $i++) {
+$wizTabsCount = count($wizTabs);
+for($i = 0; $i < $wizTabsCount; $i++) {
$tab = new OCP\Template('user_ldap', $wizTabs[$i]['tpl']);
if($i === 0) {
$tab->assign('serverConfigurationPrefixes', $prefixes);