File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 10
10
11
11
class Sword
12
12
{
13
- const VERSION = '0.1.19 ' ;
13
+ const VERSION = '0.2.0 ' ;
14
14
}
Original file line number Diff line number Diff line change 11
11
use EasySwoole \Component \Di ;
12
12
use EasySwoole \EasySwoole \Command \CommandRunner ;
13
13
use EasySwoole \Command \Caller ;
14
- use EasySwoole \EasySwoole \ Crontab \Crontab ;
14
+ use EasySwoole \Crontab \Crontab ;
15
15
use EasySwoole \EasySwoole \ServerManager ;
16
16
use EasySwoole \EasySwoole \Swoole \EventRegister ;
17
17
use EasySwoole \EasySwoole \SysConst ;
@@ -127,17 +127,20 @@ public static function mainServerCreate(EventRegister $register)
127
127
*/
128
128
$ path = EASYSWOOLE_ROOT .'/App/Crontab ' ;
129
129
if (file_exists ($ path )){
130
+ $ crontab = new Crontab ();
131
+
130
132
//取出配置目录全部文件
131
133
foreach (scandir ($ path ) as $ file ){
132
134
//如果是php文件
133
135
if (preg_match ('/.php/ ' ,$ file )){
134
136
$ name = basename ($ file ,".php " );
135
137
$ class = "\\App \\Crontab \\{$ name }" ;
136
138
if (class_exists ($ class ) and $ class ::enable){
137
- Crontab:: getInstance ()-> addTask ( $ class );
139
+ $ crontab -> register ( new $ class() );
138
140
}
139
141
}
140
142
}
143
+ $ crontab ->attachToServer (ServerManager::getInstance ()->getSwooleServer ());
141
144
}
142
145
143
146
/**
You can’t perform that action at this time.
0 commit comments