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

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

Location:
trunk/workflow/inc/engine/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/engine/src/API/Instance.php

    r3167 r7655  
    906906    if(empty($theuser)) $theuser='*'; 
    907907    $found = false; 
    908     for($i=0;$i<count($this->activities);$i++) { 
     908    $activities_count = count($this->activities); 
     909    for($i=0;$i<$activities_count;++$i) { 
    909910      if($this->activities[$i]['wf_activity_id']==$activityId) { 
    910911        // here we are in the good activity 
     
    944945   */ 
    945946  function getActivityUser($activityId) { 
    946     for($i=0;$i<count($this->activities);$i++) { 
     947    $activities_count = count($this->activities); 
     948    for($i=0;$i<$activities_count;++$i) { 
    947949      if($this->activities[$i]['wf_activity_id']==$activityId) { 
    948950        return $this->activities[$i]['wf_user']; 
     
    967969      return false; 
    968970    } 
    969     for($i=0;$i<count($this->activities);$i++)  
     971    $activities_count = count($this->activities); 
     972    for($i=0;$i<$activities_count;++$i) 
    970973    { 
    971974      if($this->activities[$i]['wf_activity_id']==$activityId)  
     
    990993   */ 
    991994  function getActivityStatus($activityId) { 
    992     for($i=0;$i<count($this->activities);$i++) { 
     995    $activities_count = count($this->activities); 
     996    for($i=0;$i<$activities_count;++$i) { 
    993997      if($this->activities[$i]['wf_activity_id']==$activityId) { 
    994998        return $this->activities[$i]['wf_status']; 
     
    10081012  function setActivityStarted($activityId) { 
    10091013    $now = date("U"); 
    1010     for($i=0;$i<count($this->activities);$i++) { 
     1014    $activities_count = count($this->activities); 
     1015    for($i=0;$i<$activities_count;++$i) { 
    10111016      if($this->activities[$i]['wf_activity_id']==$activityId) { 
    10121017        $this->activities[$i]['wf_started']=$now; 
     
    10281033   */ 
    10291034  function getActivityStarted($activityId) { 
    1030     for($i=0;$i<count($this->activities);$i++) { 
     1035    $activities_count = count($this->activities); 
     1036    for($i=0;$i<$activities_count;++$i) { 
    10311037      if($this->activities[$i]['wf_activity_id']==$activityId) { 
    10321038        return $this->activities[$i]['wf_started']; 
     
    10471053  function _get_instance_activity($activityId)  
    10481054  { 
    1049     for($i=0;$i<count($this->activities);$i++) { 
     1055    $activities_count = count($this->activities); 
     1056    for($i=0;$i<$activities_count;$i++) { 
    10501057      if($this->activities[$i]['wf_activity_id']==$activityId) { 
    10511058        return $this->activities[$i]; 
     
    12951302    else  
    12961303    { 
    1297         $max++; 
     1304        ++$max; 
    12981305    } 
    12991306    if($activity_type=='start') 
     
    13781385        $this->unsetNextUser($cand); 
    13791386        $this->sync(); 
    1380         $i++; 
     1387        ++$i; 
    13811388      } 
    13821389      $this->unsetNextUser('*' . $activityId); 
  • trunk/workflow/inc/engine/src/GUI/GUI.php

    r3167 r7655  
    645645    { 
    646646      $result->Move($offset); 
    647       for ($i = 0; $i < $realMaxRecords; $i++) 
     647      for ($i = 0; $i < $realMaxRecords; ++$i) 
    648648      { 
    649649        $res = $result->fetchRow(); 
  • trunk/workflow/inc/engine/src/ProcessManager/ActivityManager.php

    r3167 r7655  
    539539     
    540540    while($this->_list_has_unvisited_nodes($nodes) && !$this->_node_in_list($start_node,$nodes)) { 
    541       for($i=0;$i<count($nodes);$i++) { 
     541      $nodes_count = count($nodes); 
     542      for($i=0;$i<$nodes_count;++$i) { 
    542543        $node=&$nodes[$i]; 
    543544        if(!$node['visited']) { 
  • trunk/workflow/inc/engine/src/ProcessManager/ProcessManager.php

    r5921 r7655  
    299299                $activities=Array(); 
    300300                $transitions=Array(); 
    301                 for($i=0;$i<count($this->tree[1]['children']);$i++) { 
     301        $tree_count = count($this->tree[1]['children']); 
     302                for($i=0;$i<$tree_count;++$i) { 
    302303                        // Process attributes 
    303304                        $z=$this->tree[1]['children'][$i]; 
     
    306307                        //config values 
    307308                        if ($name=='configs') { 
    308                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     309                $tree_z_count = count($this->tree[$z]['children']); 
     310                                for($j=0;$j<$tree_z_count;++$j) { 
    309311                                        $z2 = $this->tree[$z]['children'][$j]; 
    310312                                        // this is a config $name = $this->tree[$z2]['name']; 
    311313                                        $aux = Array(); 
    312314                                        if($this->tree[$z2]['name']=='config') { 
    313                                                 for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     315                        $tree_z2_count = count($this->tree[$z2]['children']); 
     316                                                for($k=0;$k<$tree_z2_count;++$k) { 
    314317                                                        $z3 = $this->tree[$z2]['children'][$k]; 
    315318                                                        $name = trim($this->tree[$z3]['name']); 
     
    323326                        //activities 
    324327                        elseif($name=='activities') { 
    325                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     328                $tree_z_count = count($this->tree[$z]['children']); 
     329                                for($j=0;$j<$tree_z_count;++$j) { 
    326330                                        $z2 = $this->tree[$z]['children'][$j]; 
    327331                                        // this is an activity $name = $this->tree[$z2]['name']; 
    328332                                        $aux = Array(); 
    329333                                        if($this->tree[$z2]['name']=='activity') { 
    330                                                 for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     334                        $tree_z2_count = count($this->tree[$z2]['children']); 
     335                                                for($k=0;$k<$tree_z2_count;++$k) { 
    331336                                                        $z3 = $this->curre[$z2]['children'][$k]; 
    332337                                                        $name = trim($this->tree[$z3]['name']); 
     
    334339                                                        if($name=='roles') { 
    335340                                                                $roles=Array(); 
    336                                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++) { 
     341                                $tree_z3_count = count($this->tree[$z3]['children']); 
     342                                                                for($l=0;$l<$tree_z3_count;++$l) { 
    337343                                                                        $z4 = $this->tree[$z3]['children'][$l]; 
    338344                                                                        $name = trim($this->tree[$z4]['name']); 
     
    354360                                                        { 
    355361                                                                $agents=Array(); 
    356                                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++) 
     362                                $tree_z3_count = count($this->tree[$z3]['children']); 
     363                                                                for($l=0;$l<$tree_z3_count;$l++) 
    357364                                                                { 
    358365                                                                        $z4 = $this->tree[$z3]['children'][$l]; 
     
    362369                                                                        { 
    363370                                                                                $agent = array(); 
    364                                                                                 for($m=0;$m<count($this->tree[$z4]['children']);$m++) 
     371                                        $tree_z4_count = count($this->tree[$z4]['children']); 
     372                                                                                for($m=0;$m<$tree_z4_count;++$m) 
    365373                                                                                { 
    366374                                                                                        $z5 = $this->tree[$z4]['children'][$m]; 
     
    375383                                                                                        elseif ($name=='agent_datas') 
    376384                                                                                        { 
    377                                                                                                 for($n=0;$n<count($this->tree[$z5]['children']);$n++) 
     385                                                $tree_z5_count = count($this->tree[$z5]['children']); 
     386                                                                                                for($n=0;$n<$tree_z5_count;++$n) 
    378387                                                                                                { 
    379388                                                                                                        $z6 = $this->tree[$z5]['children'][$n]; 
     
    383392                                                                                                        if ($name=='agent_data') 
    384393                                                                                                        { 
    385                                                                                                                 for($o=0;$o<count($this->tree[$z6]['children']);$o++) 
     394                                                        $tree_z6_count = count($this->tree[$z6]['children']); 
     395                                                                                                                for($o=0;$o<$tree_z6_count;++$o) 
    386396                                                                                                                { 
    387397                                                                                                                        $z7 = $this->tree[$z6]['children'][$o]; 
     
    419429                                } 
    420430                        } elseif($name=='transitions') { 
    421                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     431                $tree_z_count = count($this->tree[$z]['children']); 
     432                                for($j=0;$j<$tree_z_count;++$j) { 
    422433                                        $z2 = $this->tree[$z]['children'][$j]; 
    423434                                        // this is an activity $name = $this->tree[$z2]['name']; 
    424435                                        $aux=Array(); 
    425436                                        if($this->tree[$z2]['name']=='transition') { 
    426                                                 for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     437                        $tree_z2_count = count($this->tree[$z2]['children']); 
     438                                                for($k=0;$k<$tree_z2_count;++$k) { 
    427439                                                        $z3 = $this->tree[$z2]['children'][$k]; 
    428440                                                        $name = trim($this->tree[$z3]['name']); 
     
    573585                                                        if ($key) 
    574586                                                        { 
    575                                                                 $countfields++; 
     587                                                                ++$countfields; 
    576588                                                                $query .= "$key = ? ,"; 
    577589                                                                $bindvars[] = $value; 
     
    729741                                        if ($key) 
    730742                                        { 
    731                                                 $countfields++; 
     743                                                ++$countfields; 
    732744                                                $query .= "$key = ? ,"; 
    733745                                                $bindvars[] = $value; 
     
    10841096                } else { 
    10851097                        $parts[0]++; 
    1086                         for ($i = 1; $i < count($parts); $i++) { 
     1098            $parts_count = count($parts); 
     1099                        for ($i = 1; $i < $parts_count; ++$i) { 
    10871100                                $parts[$i] = 0; 
    10881101                        } 
  • trunk/workflow/inc/engine/src/common/Base.php

    r3167 r7655  
    331331                        $qe = explode("?", $query); 
    332332                        $query = ''; 
    333                         for ($i = 0; $i < sizeof($qe) - 1; $i++) { 
     333                        for ($i = 0; $i < sizeof($qe) - 1; ++$i) { 
    334334                                $query .= $qe[$i] . ":" . $i; 
    335335                        } 
Note: See TracChangeset for help on using the changeset viewer.