Ignore:
Timestamp:
12/18/12 16:15:29 (12 years ago)
Author:
douglasz
Message:

Ticket #3236 - Correcoes para Performance: Function Within Loop Declaration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/class.so_userinterface.inc.php

    r7655 r7673  
    123123 
    124124                        /* keep only associative elments and check if the user can access an intranet application */ 
    125                         for ($i = 0; $i < count($preOutput); ++$i) 
     125            $preOutput_count = count($preOutput); 
     126                        for ($i = 0; $i < $preOutput_count; ++$i) 
    126127                        { 
    127128                                if (($preOutput[$i]['intranet_only'] == '1') && (!$showIntranetApplications)) 
     
    169170 
    170171                $output = $result->GetArray(-1); 
    171                 for ($i = 0; $i < count($output); ++$i) 
     172        $output_count = count($output); 
     173                for ($i = 0; $i < $output_count; ++$i) 
    172174                        for ($j = 0; $j < $result->_numOfFields; ++$j) 
    173175                                unset($output[$i][$j]); 
     
    196198 
    197199                $output = $result->GetArray(-1); 
    198                 for ($i = 0; $i < count($output); ++$i) 
     200        $output_count = count($output); 
     201                for ($i = 0; $i < $output_count; ++$i) 
    199202                { 
    200203                        for ($j = 0; $j < $result->_numOfFields; ++$j) 
     
    218221 
    219222                $output = $result->GetArray(-1); 
    220                 for ($i = 0; $i < count($output); ++$i) 
     223        $output_count = count($output); 
     224                for ($i = 0; $i < $output_count; ++$i) 
    221225                        for ($j = 0; $j < $result->_numOfFields; ++$j) 
    222226                                unset($output[$i][$j]); 
     
    296300                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_NORMAL); 
    297301                $categoriesCount = array(); 
    298                 for ($i = 0; $i < count($employees); ++$i) 
     302        $employees_count = count($employees); 
     303                for ($i = 0; $i < $employees_count; ++$i) 
    299304                { 
    300305                        /* remove numeric fields */ 
     
    396401                $cachedLDAP = Factory::newInstance('CachedLDAP'); 
    397402                $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_NORMAL); 
    398                 for ($i = 0; $i < count($employees); ++$i) 
     403        $employees_count = count($employees); 
     404                for ($i = 0; $i < $employees_count; ++$i) 
    399405                { 
    400406                        /* remove numeric fields */ 
     
    434440 
    435441                if (count($searchTermExploded) > 0){ 
    436                         for ($i=1; $i<count($searchTermExploded); ++$i) { 
     442            $searchTermExploded_count = count($searchTermExploded); 
     443                        for ($i=1; $i<$searchTermExploded_count; ++$i) { 
    437444                                if (strlen($searchTermExploded[$i]) > 2) { 
    438445                                        $fullSearch = true; 
     
    481488 
    482489                /* filling return array with employee's information */ 
    483                 for ($i = 0; $i < count($result); ++$i) { 
     490        $result_count = count($result); 
     491                for ($i = 0; $i < $result_count; ++$i) { 
    484492                        $employees []= array( 
    485493                                        'area'                          => $result[$i]['area'], 
     
    536544                /* creating the ldap query */ 
    537545                $ldap_query = '(&(|'; 
    538                 for ($i = 0; $i < count($result); ++$i) { 
     546        $result_count = count($result); 
     547                for ($i = 0; $i < $result_count; ++$i) { 
    539548                        $ldap_query .= '(uidNumber=' . $result[$i]['funcionario_id'] . ')'; 
    540549                } 
     
    556565                /* filling return array with employee's information */ 
    557566                $employees = array(); 
    558                 for ($i = 0; $i < count($result); ++$i) { 
     567        $result_count = count($result); 
     568                for ($i = 0; $i < $result_count; ++$i) { 
    559569 
    560570                        $employee = array(); 
     
    642652 
    643653                /* filling return array with employee's information */ 
    644                 for ($i = 0; $i < count($result); ++$i) { 
     654        $result_count = count($result); 
     655                for ($i = 0; $i < $result_count; ++$i) { 
    645656                        $employees []= array( 
    646657                                        'area'                          => $result[$i]['area'], 
     
    707718 
    708719                $output = $result->GetArray(-1); 
    709                 for ($i = 0; $i < count($output); ++$i) 
     720        $output_count = count($output); 
     721                for ($i = 0; $i < $output_count; ++$i) 
    710722                        for ($j = 0; $j < $result->_numOfFields; ++$j) 
    711723                                unset($output[$i][$j]); 
     
    728740 
    729741                $output = $result->GetArray(-1); 
    730                 for ( $i = 0; $i < count($output); ++$i ) 
     742        $output_count = count($output); 
     743                for ( $i = 0; $i < $output_count; ++$i ) 
    731744                { 
    732745                        for ($j = 0; $j < $result->_numOfFields; ++$j) 
     
    759772 
    760773                $output = $result->GetArray( -1 ); 
    761                 for ( $i = 0; $i < count($output); ++$i ) 
     774        $output_count = count($output); 
     775                for ( $i = 0; $i < $output_count; ++$i ) 
    762776                        for ($j = 0; $j < $result->_numOfFields; ++$j) 
    763777                                unset($output[$i][$j]); 
     
    795809 
    796810                $categoriesCount = array( ); 
    797                 for ( $i = 0; $i < count( $employees ); ++$i ) 
     811        $employees_count = count( $employees ); 
     812                for ( $i = 0; $i < $employees_count; ++$i ) 
    798813                { 
    799814                        // remove numeric fields 
     
    867882 
    868883                $categoriesCount = array( ); 
    869                 for ( $i = 0; $i < count( $employees ); ++$i ) 
     884        $employees_count = count( $employees ); 
     885                for ( $i = 0; $i < $employees_count; ++$i ) 
    870886                { 
    871887                        // remove numeric fields 
     
    893909 
    894910                // count the number of employees in each category 
    895                 for ( $i = 0; $i < count( $employees ); ++$i ) 
     911        $employees_count = count( $employees ); 
     912                for ( $i = 0; $i < $employees_count; ++$i ) 
    896913                { 
    897914                        $categoryID = $employees[ $i ][ 'funcionario_categoria_id' ]; 
Note: See TracChangeset for help on using the changeset viewer.