Fixed issue #13670: Performance optimization: change while(list() to foreach() (thank...
authorErnesto Baschny <ernst@cron-it.de>
Thu, 13 May 2010 17:13:26 +0000 (17:13 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Thu, 13 May 2010 17:13:26 +0000 (17:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7608 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/sys_action/class.tx_sysaction.php

index ccedf54..84832fd 100755 (executable)
@@ -126,9 +126,8 @@ class tx_sysaction extends mod_user_task {
                                                        $opt=array();
 
                                                        $grList = t3lib_div::trimExplode(",",$actionRow["t1_allowed_groups"],1);
-                                                       reset($grList);
                                                        $opt[]='<option value=""></option>';
-                                                       while(list(,$gu)=each($grList)) {
+                                                       foreach ($grlist as $gu) {
                                                                $checkGr = t3lib_BEfunc::getRecord("be_groups",$gu);
                                                                if (is_array($checkGr)) $opt[]='<option value="'.$checkGr["uid"].'"'.(t3lib_div::inList($userRecord["usergroup"],$checkGr["uid"])?" selected":"").'>'.htmlspecialchars($checkGr["title"]).'</option>';
                                                        }
@@ -220,8 +219,7 @@ class tx_sysaction extends mod_user_task {
                                                $dbAnalysis->getFromDB();
 
                                                $lines=array();
-                                               reset($dbAnalysis->itemArray);
-                                               while(list(,$el)=each($dbAnalysis->itemArray))  {
+                                               foreach ($dbAnalysis->itemArray as $el) {
                                                        $path = t3lib_BEfunc::getRecordPath ($el["id"],$this->perms_clause,$this->BE_USER->uc["titleLen"]);
                                                        $lines[]='<tr>
                                                                <td nowrap class="bgColor4">'.
@@ -373,15 +371,13 @@ class tx_sysaction extends mod_user_task {
                        // All current groups:
                $cGroups = array_flip(t3lib_div::trimExplode(",",$curUserGroup,1));
                $grList = t3lib_div::intExplode(",",$allowedGroups);
-               reset($grList);
-               while(list(,$gu)=each($grList)) {
+               foreach ($grList as $gu) {
                        unset($cGroups[$gu]);   // Remove the group if it's in the array for some reason...
                }
                        // reverse array again and set incoming groups:
                $cGroups=array_keys($cGroups);
                if (is_array($inGroups))        {
-                       reset($inGroups);
-                       while(list(,$gu)=each($inGroups))       {
+                       foreach ($inGroups as $gu) {
                                $checkGr = t3lib_BEfunc::getRecord("be_groups",$gu);
                                if (is_array($checkGr) && in_array($gu,$grList))        {
                                        $cGroups[]=$gu;