run_action()
Used to execute a scheduled event, not a mandatory method.
As shown as an example in the SSL module, a method according to "command" index that is in the $data variable is called.
public function run_action($data=[]){
if($data["command"] == "checking-ssl-enroll") return $this->checking_enroll($data);
return true;
}
You can create a newly scheduled event, as in the following example.
if(!class_exists("Events")) Helper::Load(["Events"]);
Events::add_scheduled_operation([
'owner' => "order",
'owner_id' => $this->order["id"],
'name' => "run-action-for-order-module",
'period' => 'minute',
'time' => 5,
'module' => __CLASS__,
'command' => "checking-ssl-enroll",
]);
"period", "time"is an optional index, allows it to be run at specific intervals, if removed it is continuously checked each time.