每天laravel-20160712|Schedule
来源:互联网 发布:产品网络推广怎么做 编辑:程序博客网 时间:2024/06/06 05:29
<?phpnamespace Illuminate\Console\Scheduling;use Symfony\Component\Process\ProcessUtils;use Symfony\Component\Process\PhpExecutableFinder;// use namespace.class Schedule{ /** * All of the events on the schedule. * * @var array */ protected $events = [];// events schedule array set to store the events // by the way, all of this is function or instance of class /** * Add a new callback event to the schedule. * * @param string $callback * @param array $parameters * @return \Illuminate\Console\Scheduling\Event */ public function call($callback, array $parameters = []) { $this->events[] = $event = new CallbackEvent($callback, $parameters); return $event; }// get a instance about the event function ,and add it to the events array. /** * Add a new Artisan command event to the schedule. * * @param string $command * @param array $parameters * @return \Illuminate\Console\Scheduling\Event */ public function command($command, array $parameters = []) { $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)); // change argument if (defined('HHVM_VERSION')) { $binary .= ' --php'; } if (defined('ARTISAN_BINARY')) { $artisan = ProcessUtils::escapeArgument(ARTISAN_BINARY); } else { $artisan = 'artisan'; } return $this->exec("{$binary} {$artisan} {$command}", $parameters); }// the author said this is a new artisan command // suport the HHVM ,good /** * Add a new command event to the schedule. * * @param string $command * @param array $parameters * @return \Illuminate\Console\Scheduling\Event */ public function exec($command, array $parameters = []) { if (count($parameters)) { $command .= ' '.$this->compileParameters($parameters); }// prepare the command. $this->events[] = $event = new Event($command);// add the instance to the compileParameters return $event; }// Add a new command event to the schedule /** * Compile parameters for a command. * * @param array $parameters * @return string */ protected function compileParameters(array $parameters) { return collect($parameters)->map(function ($value, $key) { return is_numeric($key) ? $value : $key.'='.(is_numeric($value) ? $value : ProcessUtils::escapeArgument($value)); })->implode(' '); }// compile or change the parameters for you want. /** * Get all of the events on the schedule. * * @return array */ public function events() { return $this->events; }// big _get /** * Get all of the events on the schedule that are due. * * @param \Illuminate\Contracts\Foundation\Application $app * @return array */ public function dueEvents($app) { return array_filter($this->events, function ($event) use ($app) { return $event->isDue($app); }); }// a super big _get function // this can get all the events on the schedule that are due.}// at last ,this is a events schedule, that be set bigset get bigget and change the params
0 0
- 每天laravel-20160712|Schedule
- 每天laravel
- laravel schedule小记
- PHP Laravel定时任务Schedule
- 每天laravel-20160620|MemcachedConnector
- 每天laravel-20160622|MeacachedStore
- 每天laravel-20160623|NullStore
- 每天laravel-20160624|RateLimiter
- 每天laravel-20160625|RedisStore
- 每天laravel-20160626|RetrievesMultipleKeys
- 每天laravel-20160627|TaggableStore
- 每天laravel-20160628|TaggedCache
- 每天laravel-20160629|RedisTaggedCache
- 每天laravel-20160701|Repository
- 每天laravel-20160702|CacheTableCommand
- 每天laravel-20160703|ClearCommand
- 每天laravel-20160704|CahceHit
- 每天laravel-20160705|CahceMissed
- TCP/IP(十一)TCP滑动窗口和拥塞控制
- RedHat下安装Python3步骤
- 使用数组实现堆栈和队列
- Appium自动化1-环境搭建
- 推荐!手把手教你使用Git
- 每天laravel-20160712|Schedule
- Oracle之BBED之(二)-----BBED更改数据块
- 【转】移除ios自带button样式
- js获取鼠标焦点位置并选中一部分文字
- 为什么学习Java三大框架SSH与MVC的设计模式
- 活期理财每日计算利率
- ==与===的区别
- NullPointException-TabWidget.focusCurrentTab(TabWidget.java:401)
- C++ string类:find()和find_first_of()