Ignore:
Timestamp:
05/26/10 10:12:22 (14 years ago)
Author:
viani
Message:

Ticket #950 - Merged 2589:2838 /trunk/workflow/ em /sandbox/workflow/trunk/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/workflow/trunk/inc/class.run_activity.inc.php

    r2466 r2858  
    2424     */ 
    2525        class run_activity extends WorkflowUtils 
    26         {        
     26        { 
    2727                /** 
    2828                 * @var array  $public_functions func 
     
    5050                 * @access public 
    5151                 */ 
    52                 var $process;    
     52                var $process; 
    5353                /** 
    5454                 * @var object $GUI  GUI engine object. Act carefully with it. 
     
    6262                var $message = Array(); 
    6363                /** 
    64                  * @var object $categories categorie object for categories  
     64                 * @var object $categories categorie object for categories 
    6565                 * @access public 
    6666                 */ 
    6767                var $categories; 
    6868                /** 
    69                  * @var array $conf  
    70                  * @access public 
    71                  */ 
    72                 var $conf = array();     
     69                 * @var array $conf 
     70                 * @access public 
     71                 */ 
     72                var $conf = array(); 
    7373                /** 
    7474                 * @var $wf_template local activity template 
     
    7676                 */ 
    7777                var $wf_template; 
    78                 /**  
     78                /** 
    7979                 * @var object $instance 
    8080                 * @access public 
    8181                 */ 
    8282                var $instance; 
    83                 /**  
     83                /** 
    8484                 * @var object $activity_type The type of activity 
    8585                 * @access public 
     
    8888                // then we retain all usefull vars as members, to make them avaible in user's source code 
    8989                // theses are data which can be set before the user code and which are not likely to change because of the user code 
    90                 /**  
    91                  * @var int $process_id The process id  
     90                /** 
     91                 * @var int $process_id The process id 
    9292                 * @access public 
    9393                 */ 
    9494                var $process_id; 
    95                 /**  
    96                  * @var int $activity_id The activity id  
     95                /** 
     96                 * @var int $activity_id The activity id 
    9797                 * @access public 
    9898                 */ 
    9999                var $activity_id; 
    100                 /**  
     100                /** 
    101101                 * @var int $process_name The process name 
    102102                 * @access public 
    103103                 */ 
    104104                var $process_name; 
    105                 /**  
    106                  * @var int $process_version The process_version  
     105                /** 
     106                 * @var int $process_version The process_version 
    107107                 * @access public 
    108108                 */ 
    109109                var $process_version; 
    110                 /**  
    111                  * @var int $activity_name The process id  
     110                /** 
     111                 * @var int $activity_name The process id 
    112112                 * @access public 
    113113                 */ 
    114114                var $activity_name; 
    115                 /**  
    116                  * @var int $user_name The user name  
     115                /** 
     116                 * @var int $user_name The user name 
    117117                 * @access public 
    118118                 */ 
    119119                var $user_name; 
    120                 /**  
    121                  * @var int $view_activity activity id of the view activity avaible for this process  
     120                /** 
     121                 * @var int $view_activity activity id of the view activity avaible for this process 
    122122                 * @access public 
    123123                 */ 
    124124                var $view_activity; 
    125                 // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed            
    126                 /**  
    127                  * @var int $instance_id Instance id  
     125                // theses 4 vars aren't avaible for the user code, they're set only after this user code was executed 
     126                /** 
     127                 * @var int $instance_id Instance id 
    128128                 * @access public 
    129129                 */ 
    130130                var $instance_id=0; 
    131                 /**  
    132                  * @var string $instance_name Instance name  
     131                /** 
     132                 * @var string $instance_name Instance name 
    133133                 * @access public 
    134134                 */ 
    135135                var $instance_name=''; 
    136                 /**  
    137                  * @var int $instance_owner Instance owner id  
     136                /** 
     137                 * @var int $instance_owner Instance owner id 
    138138                 * @access public 
    139139                 */ 
    140140                var $instance_owner=0; 
    141                 /**  
    142                  * @var string $owner_name Owner name  
     141                /** 
     142                 * @var string $owner_name Owner name 
    143143                 * @access public 
    144144                 */ 
    145145                var $owner_name=''; 
    146                  
     146 
    147147                /** 
    148148                 * @var bool $print_mode print mode 
     
    155155                 */ 
    156156                var $enable_print_mode = false; 
    157                  
     157 
    158158                /** 
    159159                 * @var array $act_role_names of roles associated with the activity, usefull for lists of users associated with theses roles 
    160                  * @access public        
     160                 * @access public 
    161161                 */ 
    162162                var $act_role_names= Array(); 
    163                  
     163 
    164164                /** 
    165165                 * @var array $agents Array of ui_agent objects 
     
    172172                 * @access public 
    173173                 */ 
    174                 var $smarty;                 
     174                var $smarty; 
    175175                /** 
    176176                 * @var array $wf holds a global environment vector 
    177177                 * @access public 
    178178                 */ 
    179                 var $wf;                     
     179                var $wf; 
    180180                /** 
    181181                 * @var $download_mode activates download mode 
    182182                 * @access public 
    183183                 */ 
    184                 var $download_mode;         
     184                var $download_mode; 
    185185                /** 
    186186                 * @var string $_template_name holds the template's file name 
    187187                 * @access public 
    188188                 */ 
    189                 var $_template_name = null;  
     189                var $_template_name = null; 
    190190                /** 
    191191                 * @var bool Indicates wether the current instance is a child instance or not 
     
    193193         */ 
    194194                var $isChildInstance = false; 
     195 
    195196                /** 
    196197                 * @var object Stores a 'workflow_smarty' object 
     
    200201 
    201202                /** 
     203                 * @var object Log Object 
     204         * @access private 
     205         */ 
     206                private $logger = null; 
     207 
     208                /** 
    202209                 * Constructor 
    203                  *  
    204                  * @access public  
     210                 * 
     211                 * @access public 
    205212                 */ 
    206213                function run_activity() 
     
    218225 
    219226                        $this->workflowSmarty   = &Factory::getInstance('workflow_smarty', false); 
     227 
     228                        // never configure a log of type "firebug" here. This will make goAjax stop running well =( 
     229                        $this->logger                   = &Factory::getInstance('Logger', array('file')); 
    220230 
    221231                        // TODO: open a new connection to the database under a different username to allow privilege handling on tables 
     
    236246                function go($activity_id=0, $iid=0, $auto=0) 
    237247                { 
     248                        $totalTime = microtime(true); 
     249 
    238250                        $result=Array(); 
    239251 
     
    431443 
    432444                        /* BEGIN WORKFLOW MVC SETTINGS */ 
    433                         $env = array( );                                           //create settings vector 
     445                        $env = array();                                            //create settings vector 
    434446                        $env['view']          =& $smarty;                          //view layer instance 
    435447                        $env['template_file'] =& $_template_name;                  //template file to be shown 
    436                         $env['dao']           =& wf_create_object('wf_db');        //data access object instance 
     448                        $env['dao']                       =& Factory::newInstance('wf_db');    //data access object instance 
    437449                        $env['workflow']      =& $GLOBALS['workflow'];             //workflow environment information 
    438450                        $env['instance']      =& $instance;                        //process manager instance 
     
    441453                        $env['request']       =& $security->process($_REQUEST);    //sanitizes input data from client 
    442454                        $env['factory']       =& Factory::getInstance('ProcessWrapperFactory');  //instantiation controller class 
    443                         $env['natural']           =& wf_create_object('wf_natural');   //data access object instance for mainframe 
     455                        $env['natural']           =& Factory::newInstance('wf_natural');   //data access object instance for mainframe 
    444456                        /* END WORKFLOW MVC SETTINGS */ 
    445457 
     
    485497 
    486498                        /* include the files */ 
     499                        $processTime = microtime(true); 
     500 
    487501                        foreach ($_engineFiles as $_engineFile) 
    488502                                require $_engineFile; 
     503 
     504                        $processTime = (microtime(true) - $processTime); 
    489505 
    490506                        unset($GLOBALS['workflow_env']); 
     
    528544                        } 
    529545 
     546                        $totalTime = (microtime(true) - $totalTime); 
     547 
     548                        $logTime = sprintf("GO [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", 
     549                                                                $this->process_id, 
     550                                                                $this->instance_id, 
     551                                                                $GLOBALS['user'], 
     552                                                                $this->activity_id, 
     553                                                                number_format(($totalTime - $processTime),3), 
     554                                                                number_format($processTime,3) ); 
     555 
     556                        $this->logger->debug($logTime); 
     557 
    530558                        // TODO: process instance comments 
    531  
    532559                        $instructions = $this->runtime->handle_postUserCode(_DEBUG); 
    533560                        switch($instructions['action']) 
     
    593620                function goAjax($activity_id=0, $iid=0, $auto=0) 
    594621                { 
     622                        $totalTime = microtime(true); 
     623 
    595624                        $result=Array(); 
    596625 
     
    702731 
    703732                        /* BEGIN WORKFLOW MVC SETTINGS */ 
    704                         $env = array( );                                           //create settings vector 
    705                         $env['dao']           =& wf_create_object('wf_db');        //data access object instance 
     733                        $env = array();                                            //create settings vector 
     734                        $env['dao']                       =& Factory::newInstance('wf_db');    //data access object instance 
    706735                        $env['workflow']      =& $GLOBALS['workflow'];             //workflow environment information 
    707736                        $env['instance']      =& $instance;                        //process manager instance 
     
    710739                        $env['request']       =& $security->process($_REQUEST); //sanitizes input data from client 
    711740                        $env['factory']       =& Factory::newInstance('ProcessWrapperFactory');  //instantiation controller class 
    712                         $env['natural']           =& wf_create_object('wf_natural');   //data access object instance for mainframe 
     741                        $env['natural']           =& Factory::newInstance('wf_natural');   //data access object instance for mainframe 
    713742                        /* END WORKFLOW MVC SETTINGS */ 
    714743 
     
    727756                         * the messages for the process factory instead of Workflow 
    728757                         * factory. Note that this is the same comment as the previous 
    729                          * function... boooring.. =} 
     758                         * function... boooring.. 
    730759                         */ 
    731760                        Security::enable(); 
     
    734763                        $nc = &Factory::newInstance('NanoController'); 
    735764                        $nc->setClassPath(GALAXIA_PROCESSES . SEP . $this->process->getNormalizedName(). SEP . 'code'); 
     765 
     766                        $processTime = microtime(true); 
    736767                        $nc->iterateOverVirtualRequests(); 
     768                        $processTime = microtime(true) - $processTime; 
     769 
    737770                        $nc->outputResultData(); 
    738771                        unset($GLOBALS['workflow_env']); 
     
    740773                        if (!is_null($iid)) 
    741774                                $instance->instance->sync(); 
     775 
     776                        $totalTime = microtime(true) - $totalTime; 
     777 
     778                        $logTime = sprintf("GOAJAX [pid=%s,iid=%s,uid=%s,aid=%s] [eng=%ss,proc=%ss]", 
     779                                                                $this->process_id, 
     780                                                                $this->instance_id, 
     781                                                                $GLOBALS['user'], 
     782                                                                $this->activity_id, 
     783                                                                number_format(($totalTime - $processTime),3), 
     784                                                                number_format($processTime,3) ); 
     785 
     786                        $this->logger->debug($logTime); 
    742787                } 
    743788 
Note: See TracChangeset for help on using the changeset viewer.