Пример #1
0
 private static function _add_failed_mail_hook()
 {
     Module_ControlCentre_FlowManager::current_flow()->register_after_run_flow_hook('fmail', ['Module_ModuleManager_CommonHooks', 'failed_send_mail_hook']);
 }
Пример #2
0
 /**
  * @param string $method_name
  * @param array $args
  */
 private static function _run_all_modules_static_methods($method_name, $args = [])
 {
     $flow = Module_ControlCentre_FlowManager::current_flow();
     $ordered_mids = $flow->get_in_order_modules();
     // register hooks
     foreach ($ordered_mids as $_mid) {
         $_class = Module_ModuleManager_Register::functional_module_class_name($_mid);
         if ($_class['errno'] != Const_Err_Base::ERR_OK) {
             continue;
         }
         $_class = $_class['data'];
         if (method_exists($_class, $method_name)) {
             call_user_func_array([$_class, $method_name], $args);
         }
     }
 }
Пример #3
0
 /**
  * @param string $key
  * @return string
  */
 static function current_flow_info($key = null)
 {
     $flow = Module_ControlCentre_FlowManager::get_instance()->current_flow();
     $flow_info = $flow->options;
     return self::_get_data_info($flow_info, $key);
 }
Пример #4
0
 /**
  * @param array $data
  * @param array $control_options
  * @return array
  */
 public function run($data = [], $control_options = [])
 {
     $begin_time = microtime(true);
     Lib_Log::monitor("TIMER task [%d] begin at [%.4f]", [Module_ControlCentre_Main::current_task_id(), $begin_time]);
     $this->options = $control_options;
     $flow = Module_ControlCentre_FlowManager::get_instance()->get_current_flow();
     // run before hooks
     $this->run_hooks(self::HOOK_TYPE_BEFORE_RUN, [$data]);
     // run
     $result = $flow->run($this->id, $data);
     // run after hook
     $this->run_hooks(self::HOOK_TYPE_AFTER_RUN, [$result]);
     $end_time = microtime(true);
     Lib_Log::monitor("TIMER task [%d] end at [%.4f], use [%.4f]", [Module_ControlCentre_Main::current_task_id(), $end_time, $end_time - $begin_time]);
     return $result;
 }