Ignore:
Timestamp:
12/14/12 14:30:35 (11 years ago)
Author:
douglasz
Message:

Ticket #3236 - Melhorias de performance no codigo do Expresso.

File:
1 edited

Legend:

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

    r3167 r7655  
    390390                        $transitions=Array(); 
    391391                        $jobs = array(); 
    392                         for($i=0;$i<count($this->tree[1]['children']);$i++) { 
     392            $tree_count = count($this->tree[1]['children']); 
     393                        for($i=0;$i<$tree_count;++$i) { 
    393394                          // Process attributes 
    394395                          $z=$this->tree[1]['children'][$i]; 
     
    397398                          //config values 
    398399                          if ($name=='configs') { 
    399                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     400                $tree_z_count = count($this->tree[$z]['children']); 
     401                                for($j=0;$j<$tree_z_count;++$j) { 
    400402                                  $z2 = $this->tree[$z]['children'][$j]; 
    401403                                  // this is a config $name = $this->tree[$z2]['name']; 
    402404                                  $aux = Array(); 
    403405                                  if($this->tree[$z2]['name']=='config') { 
    404                                         for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     406                    $tree_z_count = count($this->tree[$z2]['children']); 
     407                                        for($k=0;$k<$tree_z_count;++$k) { 
    405408                                          $z3 = $this->tree[$z2]['children'][$k]; 
    406409                                          $name = trim($this->tree[$z3]['name']); 
     
    414417                          //activities 
    415418                          elseif($name=='activities') { 
    416                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     419                $tree_z_count = count($this->tree[$z]['children']); 
     420                                for($j=0;$j<$tree_z_count;++$j) { 
    417421                                  $z2 = $this->tree[$z]['children'][$j]; 
    418422                                  // this is an activity $name = $this->tree[$z2]['name']; 
    419423                                  $aux = Array(); 
    420424                                  if($this->tree[$z2]['name']=='activity') { 
    421                                         for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     425                    $tree_z2_count = count($this->tree[$z2]['children']); 
     426                                        for($k=0;$k<$tree_z2_count;++$k) { 
    422427                                          $z3 = $this->tree[$z2]['children'][$k]; 
    423428                                          $name = trim($this->tree[$z3]['name']); 
     
    425430                                          if($name=='roles') { 
    426431                                                $roles=Array(); 
    427                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++) { 
     432                        $tree_z3_count = count($this->tree[$z3]['children']); 
     433                                                for($l=0;$l<$tree_z3_count;++$l) { 
    428434                                                  $z4 = $this->tree[$z3]['children'][$l]; 
    429435                                                  $name = trim($this->tree[$z4]['name']); 
     
    445451                                          { 
    446452                                                $agents=Array(); 
    447                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++)  
     453                        $tree_z3_count = count($this->tree[$z3]['children']); 
     454                                                for($l=0;$l<$tree_z3_count;++$l) 
    448455                                                { 
    449456                                                  $z4 = $this->tree[$z3]['children'][$l]; 
     
    453460                                                  { 
    454461                                                        $agent = array(); 
    455                                                         for($m=0;$m<count($this->tree[$z4]['children']);$m++) 
     462                            $tree_z4_count = count($this->tree[$z4]['children']); 
     463                                                        for($m=0;$m<$tree_z4_count;++$m) 
    456464                                                        { 
    457465                                                          $z5 = $this->tree[$z4]['children'][$m]; 
     
    466474                                                          elseif ($name=='agent_datas')  
    467475                                                          { 
    468                                                                 for($n=0;$n<count($this->tree[$z5]['children']);$n++) 
     476                                $tree_z5_count = count($this->tree[$z5]['children']); 
     477                                                                for($n=0;$n<$tree_z5_count;++$n) 
    469478                                                                { 
    470479                                                                  $z6 = $this->tree[$z5]['children'][$n]; 
     
    474483                                                                  if ($name=='agent_data') 
    475484                                                                  { 
    476                                                                         for($o=0;$o<count($this->tree[$z6]['children']);$o++) 
     485                                    $tree_z6_count = count($this->tree[$z6]['children']); 
     486                                                                        for($o=0;$o<$tree_z6_count;++$o) 
    477487                                                                        { 
    478488                                                                          $z7 = $this->tree[$z6]['children'][$o]; 
     
    510520                                } 
    511521                          } elseif($name=='transitions') { 
    512                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     522                $tree_z_count = count($this->tree[$z]['children']); 
     523                                for($j=0;$j<$tree_z_count;++$j) { 
    513524                                  $z2 = $this->tree[$z]['children'][$j]; 
    514525                                  // this is an activity $name = $this->tree[$z2]['name']; 
    515526                                  $aux=Array(); 
    516527                                  if($this->tree[$z2]['name']=='transition') { 
    517                                         for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     528                    $tree_z2_count = count($this->tree[$z2]['children']); 
     529                                        for($k=0;$k<$tree_z2_count;++$k) { 
    518530                                          $z3 = $this->tree[$z2]['children'][$k]; 
    519531                                          $name = trim($this->tree[$z3]['name']); 
     
    527539                                } 
    528540                          } elseif($name=='includes') { 
    529                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     541                $tree_z_count = count($this->tree[$z]['children']); 
     542                                for($j=0;$j<$tree_z_count;++$j) { 
    530543                                  $z2 = $this->tree[$z]['children'][$j]; 
    531544                                  // this is an activity $name = $this->tree[$z2]['name']; 
    532545                                  $aux=Array(); 
    533546                                  if($this->tree[$z2]['name']=='include') { 
    534                                         for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     547                    $tree_z2_count = count($this->tree[$z2]['children']); 
     548                                        for($k=0;$k<$tree_z2_count;++$k) { 
    535549                                          $z3 = $this->tree[$z2]['children'][$k]; 
    536550                                          $name = trim($this->tree[$z3]['name']); 
     
    542556                                } 
    543557                          } elseif($name=='templates') { 
    544                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     558                $tree_z_count = count($this->tree[$z]['children']); 
     559                                for($j=0;$j<$tree_z_count;++$j) { 
    545560                                  $z2 = $this->tree[$z]['children'][$j]; 
    546561                                  // this is an activity $name = $this->tree[$z2]['name']; 
    547562                                  $aux=Array(); 
    548563                                  if($this->tree[$z2]['name']=='template') { 
    549                                         for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     564                    $tree_z2_count = count($this->tree[$z2]['children']); 
     565                                        for($k=0;$k<$tree_z2_count;++$k) { 
    550566                                          $z3 = $this->tree[$z2]['children'][$k]; 
    551567                                          $name = trim($this->tree[$z3]['name']); 
     
    557573                                } 
    558574                          } elseif($name=='resources') { 
    559                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     575                $tree_z_count = count($this->tree[$z]['children']); 
     576                                for($j=0;$j<$tree_z_count;++$j) { 
    560577                                  $z2 = $this->tree[$z]['children'][$j]; 
    561578                                  // this is an activity $name = $this->tree[$z2]['name']; 
    562579                                  $aux=Array(); 
    563580                                  if($this->tree[$z2]['name']=='resource') { 
    564                                         for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     581                    $tree_z2_count = count($this->tree[$z2]['children']); 
     582                                        for($k=0;$k<$tree_z2_count;++$k) { 
    565583                                          $z3 = $this->tree[$z2]['children'][$k]; 
    566584                                          $name = trim($this->tree[$z3]['name']); 
     
    572590                                } 
    573591                          } 
    574                           elseif ($name == 'jobs') 
    575                           { 
    576           for ($j = 0; $j < count($this->tree[$z]['children']); $j++) 
    577           { 
    578             $job = array(); 
    579                                     $jobIndex = $this->tree[$z]['children'][$j]; 
    580             if($this->tree[$jobIndex]['name'] == 'job') 
    581             { 
    582               for ($k = 0; $k < count($this->tree[$jobIndex]['children']); $k++) 
    583               { 
    584                 $propertyIndex = $this->tree[$jobIndex]['children'][$k]; 
    585                 $job[trim($this->tree[$propertyIndex]['name'])] = trim($this->tree[$propertyIndex]['data']); 
    586               } 
    587             } 
    588             $jobs[] = $job; 
    589           } 
     592                          elseif ($name == 'jobs'){ 
     593                  $tree_z_count = count($this->tree[$z]['children']); 
     594                  for ($j = 0; $j < $tree_z_count; ++$j) 
     595                  { 
     596                    $job = array(); 
     597                            $jobIndex = $this->tree[$z]['children'][$j]; 
     598                    if($this->tree[$jobIndex]['name'] == 'job') 
     599                    { 
     600                      $tree_jobIndex_count = count($this->tree[$jobIndex]['children']); 
     601                      for ($k = 0; $k < $tree_jobIndex_count; ++$k) 
     602                      { 
     603                        $propertyIndex = $this->tree[$jobIndex]['children'][$k]; 
     604                        $job[trim($this->tree[$propertyIndex]['name'])] = trim($this->tree[$propertyIndex]['data']); 
     605                      } 
     606                    } 
     607                    $jobs[] = $job; 
     608                  } 
    590609                          } 
    591610                          else { 
Note: See TracChangeset for help on using the changeset viewer.