update v 1.0.7.5

This commit is contained in:
Sujit Prasad
2016-06-13 20:41:55 +05:30
parent aa9786d829
commit 283d97e3ea
5078 changed files with 339851 additions and 175995 deletions

View File

@@ -1,29 +1,18 @@
<?php namespace Illuminate\Console;
<?php
use RuntimeException;
namespace Illuminate\Console;
trait AppNamespaceDetectorTrait {
/**
* Get the application namespace from the Composer file.
*
* @return string
*
* @throws \RuntimeException
*/
protected function getAppNamespace()
{
$composer = json_decode(file_get_contents(base_path().'/composer.json'), true);
foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path)
{
foreach ((array) $path as $pathChoice)
{
if (realpath(app_path()) == realpath(base_path().'/'.$pathChoice)) return $namespace;
}
}
throw new RuntimeException("Unable to detect application namespace.");
}
use Illuminate\Container\Container;
trait AppNamespaceDetectorTrait
{
/**
* Get the application namespace.
*
* @return string
*/
protected function getAppNamespace()
{
return Container::getInstance()->getNamespace();
}
}

View File

@@ -1,4 +1,6 @@
<?php namespace Illuminate\Console;
<?php
namespace Illuminate\Console;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Container\Container;
@@ -9,159 +11,162 @@ use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Illuminate\Contracts\Console\Application as ApplicationContract;
class Application extends SymfonyApplication implements ApplicationContract {
class Application extends SymfonyApplication implements ApplicationContract
{
/**
* The Laravel application instance.
*
* @var \Illuminate\Contracts\Container\Container
*/
protected $laravel;
/**
* The Laravel application instance.
*
* @var \Illuminate\Contracts\Container\Container
*/
protected $laravel;
/**
* The output from the previous command.
*
* @var \Symfony\Component\Console\Output\BufferedOutput
*/
protected $lastOutput;
/**
* The output from the previous command.
*
* @var \Symfony\Component\Console\Output\BufferedOutput
*/
protected $lastOutput;
/**
* Create a new Artisan console application.
*
* @param \Illuminate\Contracts\Container\Container $laravel
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @param string $version
* @return void
*/
public function __construct(Container $laravel, Dispatcher $events, $version)
{
parent::__construct('Laravel Framework', $version);
/**
* Create a new Artisan console application.
*
* @param \Illuminate\Contracts\Container\Container $laravel
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @param string $version
* @return void
*/
public function __construct(Container $laravel, Dispatcher $events, $version)
{
parent::__construct('Laravel Framework', $version);
$this->laravel = $laravel;
$this->setAutoExit(false);
$this->setCatchExceptions(false);
$this->laravel = $laravel;
$this->setAutoExit(false);
$this->setCatchExceptions(false);
$events->fire(new Events\ArtisanStarting($this));
}
$events->fire('artisan.start', [$this]);
}
/**
* Run an Artisan console command by name.
*
* @param string $command
* @param array $parameters
* @return int
*/
public function call($command, array $parameters = [])
{
$parameters = collect($parameters)->prepend($command);
/**
* Run an Artisan console command by name.
*
* @param string $command
* @param array $parameters
* @return int
*/
public function call($command, array $parameters = array())
{
$parameters['command'] = $command;
$this->lastOutput = new BufferedOutput;
$this->lastOutput = new BufferedOutput;
$this->setCatchExceptions(false);
return $this->find($command)->run(new ArrayInput($parameters), $this->lastOutput);
}
$result = $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput);
/**
* Get the output for the last run command.
*
* @return string
*/
public function output()
{
return $this->lastOutput ? $this->lastOutput->fetch() : '';
}
$this->setCatchExceptions(true);
/**
* Add a command to the console.
*
* @param \Symfony\Component\Console\Command\Command $command
* @return \Symfony\Component\Console\Command\Command
*/
public function add(SymfonyCommand $command)
{
if ($command instanceof Command)
{
$command->setLaravel($this->laravel);
}
return $result;
}
return $this->addToParent($command);
}
/**
* Get the output for the last run command.
*
* @return string
*/
public function output()
{
return $this->lastOutput ? $this->lastOutput->fetch() : '';
}
/**
* Add the command to the parent instance.
*
* @param \Symfony\Component\Console\Command\Command $command
* @return \Symfony\Component\Console\Command\Command
*/
protected function addToParent(SymfonyCommand $command)
{
return parent::add($command);
}
/**
* Add a command to the console.
*
* @param \Symfony\Component\Console\Command\Command $command
* @return \Symfony\Component\Console\Command\Command
*/
public function add(SymfonyCommand $command)
{
if ($command instanceof Command) {
$command->setLaravel($this->laravel);
}
/**
* Add a command, resolving through the application.
*
* @param string $command
* @return \Symfony\Component\Console\Command\Command
*/
public function resolve($command)
{
return $this->add($this->laravel->make($command));
}
return $this->addToParent($command);
}
/**
* Resolve an array of commands through the application.
*
* @param array|mixed $commands
* @return $this
*/
public function resolveCommands($commands)
{
$commands = is_array($commands) ? $commands : func_get_args();
/**
* Add the command to the parent instance.
*
* @param \Symfony\Component\Console\Command\Command $command
* @return \Symfony\Component\Console\Command\Command
*/
protected function addToParent(SymfonyCommand $command)
{
return parent::add($command);
}
foreach ($commands as $command)
{
$this->resolve($command);
}
/**
* Add a command, resolving through the application.
*
* @param string $command
* @return \Symfony\Component\Console\Command\Command
*/
public function resolve($command)
{
return $this->add($this->laravel->make($command));
}
return $this;
}
/**
* Resolve an array of commands through the application.
*
* @param array|mixed $commands
* @return $this
*/
public function resolveCommands($commands)
{
$commands = is_array($commands) ? $commands : func_get_args();
/**
* Get the default input definitions for the applications.
*
* This is used to add the --env option to every available command.
*
* @return \Symfony\Component\Console\Input\InputDefinition
*/
protected function getDefaultInputDefinition()
{
$definition = parent::getDefaultInputDefinition();
foreach ($commands as $command) {
$this->resolve($command);
}
$definition->addOption($this->getEnvironmentOption());
return $this;
}
return $definition;
}
/**
* Get the default input definitions for the applications.
*
* This is used to add the --env option to every available command.
*
* @return \Symfony\Component\Console\Input\InputDefinition
*/
protected function getDefaultInputDefinition()
{
$definition = parent::getDefaultInputDefinition();
/**
* Get the global environment option for the definition.
*
* @return \Symfony\Component\Console\Input\InputOption
*/
protected function getEnvironmentOption()
{
$message = 'The environment the command should run under.';
$definition->addOption($this->getEnvironmentOption());
return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message);
}
return $definition;
}
/**
* Get the Laravel application instance.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getLaravel()
{
return $this->laravel;
}
/**
* Get the global environment option for the definition.
*
* @return \Symfony\Component\Console\Input\InputOption
*/
protected function getEnvironmentOption()
{
$message = 'The environment the command should run under.';
return new InputOption('--env', null, InputOption::VALUE_OPTIONAL, $message);
}
/**
* Get the Laravel application instance.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getLaravel()
{
return $this->laravel;
}
}

View File

@@ -1,5 +1,8 @@
<?php namespace Illuminate\Console;
<?php
namespace Illuminate\Console;
use Illuminate\Contracts\Support\Arrayable;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
@@ -7,381 +10,514 @@ use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Illuminate\Contracts\Foundation\Application as LaravelApplication;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
class Command extends \Symfony\Component\Console\Command\Command {
class Command extends SymfonyCommand
{
/**
* The Laravel application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
*/
protected $laravel;
/**
* The Laravel application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
*/
protected $laravel;
/**
* The input interface implementation.
*
* @var \Symfony\Component\Console\Input\InputInterface
*/
protected $input;
/**
* The input interface implementation.
*
* @var \Symfony\Component\Console\Input\InputInterface
*/
protected $input;
/**
* The output interface implementation.
*
* @var \Illuminate\Console\OutputStyle
*/
protected $output;
/**
* The output interface implementation.
*
* @var \Symfony\Component\Console\Output\OutputInterface
*/
protected $output;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature;
/**
* The console command name.
*
* @var string
*/
protected $name;
/**
* The console command name.
*
* @var string
*/
protected $name;
/**
* The console command description.
*
* @var string
*/
protected $description;
/**
* The console command description.
*
* @var string
*/
protected $description;
/**
* Create a new console command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct($this->name);
/**
* The default verbosity of output commands.
*
* @var int
*/
protected $verbosity = OutputInterface::VERBOSITY_NORMAL;
// We will go ahead and set the name, description, and parameters on console
// commands just to make things a little easier on the developer. This is
// so they don't have to all be manually specified in the constructors.
$this->setDescription($this->description);
/**
* The mapping between human readable verbosity levels and Symfony's OutputInterface.
*
* @var array
*/
protected $verbosityMap = [
'v' => OutputInterface::VERBOSITY_VERBOSE,
'vv' => OutputInterface::VERBOSITY_VERY_VERBOSE,
'vvv' => OutputInterface::VERBOSITY_DEBUG,
'quiet' => OutputInterface::VERBOSITY_QUIET,
'normal' => OutputInterface::VERBOSITY_NORMAL,
];
$this->specifyParameters();
}
/**
* Create a new console command instance.
*
* @return void
*/
public function __construct()
{
// We will go ahead and set the name, description, and parameters on console
// commands just to make things a little easier on the developer. This is
// so they don't have to all be manually specified in the constructors.
if (isset($this->signature)) {
$this->configureUsingFluentDefinition();
} else {
parent::__construct($this->name);
}
/**
* Specify the arguments and options on the command.
*
* @return void
*/
protected function specifyParameters()
{
// We will loop through all of the arguments and options for the command and
// set them all on the base command instance. This specifies what can get
// passed into these commands as "parameters" to control the execution.
foreach ($this->getArguments() as $arguments)
{
call_user_func_array(array($this, 'addArgument'), $arguments);
}
$this->setDescription($this->description);
foreach ($this->getOptions() as $options)
{
call_user_func_array(array($this, 'addOption'), $options);
}
}
if (! isset($this->signature)) {
$this->specifyParameters();
}
}
/**
* Run the console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int
*/
public function run(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
/**
* Configure the console command using a fluent definition.
*
* @return void
*/
protected function configureUsingFluentDefinition()
{
list($name, $arguments, $options) = Parser::parse($this->signature);
$this->output = $output;
parent::__construct($name);
return parent::run($input, $output);
}
foreach ($arguments as $argument) {
$this->getDefinition()->addArgument($argument);
}
/**
* Execute the console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return mixed
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$method = method_exists($this, 'handle') ? 'handle' : 'fire';
foreach ($options as $option) {
$this->getDefinition()->addOption($option);
}
}
return $this->laravel->call([$this, $method]);
}
/**
* Specify the arguments and options on the command.
*
* @return void
*/
protected function specifyParameters()
{
// We will loop through all of the arguments and options for the command and
// set them all on the base command instance. This specifies what can get
// passed into these commands as "parameters" to control the execution.
foreach ($this->getArguments() as $arguments) {
call_user_func_array([$this, 'addArgument'], $arguments);
}
/**
* Call another console command.
*
* @param string $command
* @param array $arguments
* @return int
*/
public function call($command, array $arguments = array())
{
$instance = $this->getApplication()->find($command);
foreach ($this->getOptions() as $options) {
call_user_func_array([$this, 'addOption'], $options);
}
}
$arguments['command'] = $command;
/**
* Run the console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int
*/
public function run(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
return $instance->run(new ArrayInput($arguments), $this->output);
}
$this->output = new OutputStyle($input, $output);
/**
* Call another console command silently.
*
* @param string $command
* @param array $arguments
* @return int
*/
public function callSilent($command, array $arguments = array())
{
$instance = $this->getApplication()->find($command);
return parent::run($input, $output);
}
$arguments['command'] = $command;
/**
* Execute the console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return mixed
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$method = method_exists($this, 'handle') ? 'handle' : 'fire';
return $instance->run(new ArrayInput($arguments), new NullOutput);
}
return $this->laravel->call([$this, $method]);
}
/**
* Get the value of a command argument.
*
* @param string $key
* @return string|array
*/
public function argument($key = null)
{
if (is_null($key)) return $this->input->getArguments();
/**
* Call another console command.
*
* @param string $command
* @param array $arguments
* @return int
*/
public function call($command, array $arguments = [])
{
$instance = $this->getApplication()->find($command);
return $this->input->getArgument($key);
}
$arguments['command'] = $command;
/**
* Get the value of a command option.
*
* @param string $key
* @return string|array
*/
public function option($key = null)
{
if (is_null($key)) return $this->input->getOptions();
return $instance->run(new ArrayInput($arguments), $this->output);
}
return $this->input->getOption($key);
}
/**
* Call another console command silently.
*
* @param string $command
* @param array $arguments
* @return int
*/
public function callSilent($command, array $arguments = [])
{
$instance = $this->getApplication()->find($command);
/**
* Confirm a question with the user.
*
* @param string $question
* @param bool $default
* @return bool
*/
public function confirm($question, $default = false)
{
$helper = $this->getHelperSet()->get('question');
$arguments['command'] = $command;
$question = new ConfirmationQuestion("<question>{$question}</question> ", $default);
return $instance->run(new ArrayInput($arguments), new NullOutput);
}
return $helper->ask($this->input, $this->output, $question);
}
/**
* Determine if the given argument is present.
*
* @param string|int $name
* @return bool
*/
public function hasArgument($name)
{
return $this->input->hasArgument($name);
}
/**
* Prompt the user for input.
*
* @param string $question
* @param string $default
* @return string
*/
public function ask($question, $default = null)
{
$helper = $this->getHelperSet()->get('question');
/**
* Get the value of a command argument.
*
* @param string $key
* @return string|array
*/
public function argument($key = null)
{
if (is_null($key)) {
return $this->input->getArguments();
}
$question = new Question("<question>$question</question> ", $default);
return $this->input->getArgument($key);
}
return $helper->ask($this->input, $this->output, $question);
}
/**
* Determine if the given option is present.
*
* @param string $name
* @return bool
*/
public function hasOption($name)
{
return $this->input->hasOption($name);
}
/**
* Prompt the user for input with auto completion.
*
* @param string $question
* @param array $choices
* @param string $default
* @return string
*/
public function askWithCompletion($question, array $choices, $default = null)
{
$helper = $this->getHelperSet()->get('question');
/**
* Get the value of a command option.
*
* @param string $key
* @return string|array
*/
public function option($key = null)
{
if (is_null($key)) {
return $this->input->getOptions();
}
$question = new Question("<question>$question</question> ", $default);
return $this->input->getOption($key);
}
$question->setAutocompleterValues($choices);
/**
* Confirm a question with the user.
*
* @param string $question
* @param bool $default
* @return bool
*/
public function confirm($question, $default = false)
{
return $this->output->confirm($question, $default);
}
return $helper->ask($this->input, $this->output, $question);
}
/**
* Prompt the user for input.
*
* @param string $question
* @param string $default
* @return string
*/
public function ask($question, $default = null)
{
return $this->output->ask($question, $default);
}
/**
* Prompt the user for input but hide the answer from the console.
*
* @param string $question
* @param bool $fallback
* @return string
*/
public function secret($question, $fallback = true)
{
$helper = $this->getHelperSet()->get('question');
/**
* Prompt the user for input with auto completion.
*
* @param string $question
* @param array $choices
* @param string $default
* @return string
*/
public function anticipate($question, array $choices, $default = null)
{
return $this->askWithCompletion($question, $choices, $default);
}
$question = new Question("<question>$question</question> ");
/**
* Prompt the user for input with auto completion.
*
* @param string $question
* @param array $choices
* @param string $default
* @return string
*/
public function askWithCompletion($question, array $choices, $default = null)
{
$question = new Question($question, $default);
$question->setHidden(true)->setHiddenFallback($fallback);
$question->setAutocompleterValues($choices);
return $helper->ask($this->input, $this->output, $question);
}
return $this->output->askQuestion($question);
}
/**
* Give the user a single choice from an array of answers.
*
* @param string $question
* @param array $choices
* @param string $default
* @param mixed $attempts
* @param bool $multiple
* @return bool
*/
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
{
$helper = $this->getHelperSet()->get('question');
/**
* Prompt the user for input but hide the answer from the console.
*
* @param string $question
* @param bool $fallback
* @return string
*/
public function secret($question, $fallback = true)
{
$question = new Question($question);
$question = new ChoiceQuestion("<question>$question</question> ", $choices, $default);
$question->setHidden(true)->setHiddenFallback($fallback);
$question->setMaxAttempts($attempts)->setMultiselect($multiple);
return $this->output->askQuestion($question);
}
return $helper->ask($this->input, $this->output, $question);
}
/**
* Give the user a single choice from an array of answers.
*
* @param string $question
* @param array $choices
* @param string $default
* @param mixed $attempts
* @param bool $multiple
* @return string
*/
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
{
$question = new ChoiceQuestion($question, $choices, $default);
/**
* Format input to textual table.
*
* @param array $headers
* @param array $rows
* @param string $style
* @return void
*/
public function table(array $headers, array $rows, $style = 'default')
{
$table = new Table($this->output);
$question->setMaxAttempts($attempts)->setMultiselect($multiple);
$table->setHeaders($headers)->setRows($rows)->setStyle($style)->render();
}
return $this->output->askQuestion($question);
}
/**
* Write a string as information output.
*
* @param string $string
* @return void
*/
public function info($string)
{
$this->output->writeln("<info>$string</info>");
}
/**
* Format input to textual table.
*
* @param array $headers
* @param \Illuminate\Contracts\Support\Arrayable|array $rows
* @param string $style
* @return void
*/
public function table(array $headers, $rows, $style = 'default')
{
$table = new Table($this->output);
/**
* Write a string as standard output.
*
* @param string $string
* @return void
*/
public function line($string)
{
$this->output->writeln($string);
}
if ($rows instanceof Arrayable) {
$rows = $rows->toArray();
}
/**
* Write a string as comment output.
*
* @param string $string
* @return void
*/
public function comment($string)
{
$this->output->writeln("<comment>$string</comment>");
}
$table->setHeaders($headers)->setRows($rows)->setStyle($style)->render();
}
/**
* Write a string as question output.
*
* @param string $string
* @return void
*/
public function question($string)
{
$this->output->writeln("<question>$string</question>");
}
/**
* Write a string as information output.
*
* @param string $string
* @param null|int|string $verbosity
* @return void
*/
public function info($string, $verbosity = null)
{
$this->line($string, 'info', $verbosity);
}
/**
* Write a string as error output.
*
* @param string $string
* @return void
*/
public function error($string)
{
$this->output->writeln("<error>$string</error>");
}
/**
* Write a string as standard output.
*
* @param string $string
* @param string $style
* @param null|int|string $verbosity
* @return void
*/
public function line($string, $style = null, $verbosity = null)
{
$styled = $style ? "<$style>$string</$style>" : $string;
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array();
}
$this->output->writeln($styled, $this->parseVerbosity($verbosity));
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array();
}
/**
* Write a string as comment output.
*
* @param string $string
* @param null|int|string $verbosity
* @return void
*/
public function comment($string, $verbosity = null)
{
$this->line($string, 'comment', $verbosity);
}
/**
* Get the output implementation.
*
* @return \Symfony\Component\Console\Output\OutputInterface
*/
public function getOutput()
{
return $this->output;
}
/**
* Write a string as question output.
*
* @param string $string
* @param null|int|string $verbosity
* @return void
*/
public function question($string, $verbosity = null)
{
$this->line($string, 'question', $verbosity);
}
/**
* Get the Laravel application instance.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getLaravel()
{
return $this->laravel;
}
/**
* Write a string as error output.
*
* @param string $string
* @param null|int|string $verbosity
* @return void
*/
public function error($string, $verbosity = null)
{
$this->line($string, 'error', $verbosity);
}
/**
* Set the Laravel application instance.
*
* @param \Illuminate\Contracts\Foundation\Application $laravel
* @return void
*/
public function setLaravel(LaravelApplication $laravel)
{
$this->laravel = $laravel;
}
/**
* Write a string as warning output.
*
* @param string $string
* @param null|int|string $verbosity
* @return void
*/
public function warn($string, $verbosity = null)
{
if (! $this->output->getFormatter()->hasStyle('warning')) {
$style = new OutputFormatterStyle('yellow');
$this->output->getFormatter()->setStyle('warning', $style);
}
$this->line($string, 'warning', $verbosity);
}
/**
* Get the verbosity level in terms of Symfony's OutputInterface level.
*
* @param string|int $level
* @return int
*/
protected function parseVerbosity($level = null)
{
if (isset($this->verbosityMap[$level])) {
$level = $this->verbosityMap[$level];
} elseif (! is_int($level)) {
$level = $this->verbosity;
}
return $level;
}
/**
* Set the verbosity level.
*
* @param string|int $level
* @return void
*/
protected function setVerbosity($level)
{
$this->verbosity = $this->parseVerbosity($level);
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [];
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [];
}
/**
* Get the output implementation.
*
* @return \Symfony\Component\Console\Output\OutputInterface
*/
public function getOutput()
{
return $this->output;
}
/**
* Get the Laravel application instance.
*
* @return \Illuminate\Contracts\Foundation\Application
*/
public function getLaravel()
{
return $this->laravel;
}
/**
* Set the Laravel application instance.
*
* @param \Illuminate\Contracts\Container\Container $laravel
* @return void
*/
public function setLaravel($laravel)
{
$this->laravel = $laravel;
}
}

View File

@@ -1,50 +1,55 @@
<?php namespace Illuminate\Console;
<?php
namespace Illuminate\Console;
use Closure;
trait ConfirmableTrait {
trait ConfirmableTrait
{
/**
* Confirm before proceeding with the action.
*
* @param string $warning
* @param \Closure|bool|null $callback
* @return bool
*/
public function confirmToProceed($warning = 'Application In Production!', $callback = null)
{
$callback = is_null($callback) ? $this->getDefaultConfirmCallback() : $callback;
/**
* Confirm before proceeding with the action.
*
* @param string $warning
* @param \Closure|null $callback
* @return bool
*/
public function confirmToProceed($warning = 'Application In Production!', Closure $callback = null)
{
$shouldConfirm = $callback ?: $this->getDefaultConfirmCallback();
$shouldConfirm = $callback instanceof Closure ? call_user_func($callback) : $callback;
if (call_user_func($shouldConfirm))
{
if ($this->option('force')) return true;
if ($shouldConfirm) {
if ($this->option('force')) {
return true;
}
$this->comment(str_repeat('*', strlen($warning) + 12));
$this->comment('* '.$warning.' *');
$this->comment(str_repeat('*', strlen($warning) + 12));
$this->output->writeln('');
$this->comment(str_repeat('*', strlen($warning) + 12));
$this->comment('* '.$warning.' *');
$this->comment(str_repeat('*', strlen($warning) + 12));
$this->output->writeln('');
$confirmed = $this->confirm('Do you really wish to run this command? [y/N]');
$confirmed = $this->confirm('Do you really wish to run this command?');
if ( ! $confirmed)
{
$this->comment('Command Cancelled!');
if (! $confirmed) {
$this->comment('Command Cancelled!');
return false;
}
}
return false;
}
}
return true;
}
/**
* Get the default confirmation callback.
*
* @return \Closure
*/
protected function getDefaultConfirmCallback()
{
return function() { return $this->getLaravel()->environment() == 'production'; };
}
return true;
}
/**
* Get the default confirmation callback.
*
* @return \Closure
*/
protected function getDefaultConfirmCallback()
{
return function () {
return $this->getLaravel()->environment() == 'production';
};
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Illuminate\Console\Events;
class ArtisanStarting
{
/**
* The Artisan application instance.
*
* @var \Illuminate\Console\Application
*/
public $artisan;
/**
* Create a new event instance.
*
* @param \Illuminate\Console\Application $artisan
* @return void
*/
public function __construct($artisan)
{
$this->artisan = $artisan;
}
}

View File

@@ -1,208 +1,219 @@
<?php namespace Illuminate\Console;
<?php
namespace Illuminate\Console;
use Illuminate\Support\Str;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputArgument;
abstract class GeneratorCommand extends Command {
abstract class GeneratorCommand extends Command
{
/**
* The filesystem instance.
*
* @var \Illuminate\Filesystem\Filesystem
*/
protected $files;
use AppNamespaceDetectorTrait;
/**
* The type of class being generated.
*
* @var string
*/
protected $type;
/**
* The filesystem instance.
*
* @var \Illuminate\Filesystem\Filesystem
*/
protected $files;
/**
* Create a new controller creator command instance.
*
* @param \Illuminate\Filesystem\Filesystem $files
* @return void
*/
public function __construct(Filesystem $files)
{
parent::__construct();
/**
* The type of class being generated.
*
* @var string
*/
protected $type;
$this->files = $files;
}
/**
* Create a new controller creator command instance.
*
* @param \Illuminate\Filesystem\Filesystem $files
* @return void
*/
public function __construct(Filesystem $files)
{
parent::__construct();
/**
* Get the stub file for the generator.
*
* @return string
*/
abstract protected function getStub();
$this->files = $files;
}
/**
* Execute the console command.
*
* @return bool|null
*/
public function fire()
{
$name = $this->parseName($this->getNameInput());
/**
* Get the stub file for the generator.
*
* @return string
*/
abstract protected function getStub();
$path = $this->getPath($name);
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$name = $this->parseName($this->getNameInput());
if ($this->alreadyExists($this->getNameInput())) {
$this->error($this->type.' already exists!');
if ($this->files->exists($path = $this->getPath($name)))
{
$this->error($this->type.' already exists!');
return false;
}
return false;
}
$this->makeDirectory($path);
$this->makeDirectory($path);
$this->files->put($path, $this->buildClass($name));
$this->files->put($path, $this->buildClass($name));
$this->info($this->type.' created successfully.');
}
$this->info($this->type.' created successfully.');
}
/**
* Determine if the class already exists.
*
* @param string $rawName
* @return bool
*/
protected function alreadyExists($rawName)
{
$name = $this->parseName($rawName);
/**
* Get the destination class path.
*
* @param string $name
* @return string
*/
protected function getPath($name)
{
$name = str_replace($this->getAppNamespace(), '', $name);
return $this->files->exists($this->getPath($name));
}
return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php';
}
/**
* Get the destination class path.
*
* @param string $name
* @return string
*/
protected function getPath($name)
{
$name = str_replace($this->laravel->getNamespace(), '', $name);
/**
* Parse the name and format according to the root namespace.
*
* @param string $name
* @return string
*/
protected function parseName($name)
{
$rootNamespace = $this->getAppNamespace();
return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php';
}
if (starts_with($name, $rootNamespace))
{
return $name;
}
/**
* Parse the name and format according to the root namespace.
*
* @param string $name
* @return string
*/
protected function parseName($name)
{
$rootNamespace = $this->laravel->getNamespace();
if (str_contains($name, '/'))
{
$name = str_replace('/', '\\', $name);
}
if (Str::startsWith($name, $rootNamespace)) {
return $name;
}
return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name);
}
if (Str::contains($name, '/')) {
$name = str_replace('/', '\\', $name);
}
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace;
}
return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name);
}
/**
* Build the directory for the class if necessary.
*
* @param string $path
* @return string
*/
protected function makeDirectory($path)
{
if ( ! $this->files->isDirectory(dirname($path)))
{
$this->files->makeDirectory(dirname($path), 0777, true, true);
}
}
/**
* Get the default namespace for the class.
*
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace;
}
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = $this->files->get($this->getStub());
/**
* Build the directory for the class if necessary.
*
* @param string $path
* @return string
*/
protected function makeDirectory($path)
{
if (! $this->files->isDirectory(dirname($path))) {
$this->files->makeDirectory(dirname($path), 0777, true, true);
}
}
return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name);
}
/**
* Build the class with the given name.
*
* @param string $name
* @return string
*/
protected function buildClass($name)
{
$stub = $this->files->get($this->getStub());
/**
* Replace the namespace for the given stub.
*
* @param string $stub
* @param string $name
* @return $this
*/
protected function replaceNamespace(&$stub, $name)
{
$stub = str_replace(
'{{namespace}}', $this->getNamespace($name), $stub
);
return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name);
}
$stub = str_replace(
'{{rootNamespace}}', $this->getAppNamespace(), $stub
);
/**
* Replace the namespace for the given stub.
*
* @param string $stub
* @param string $name
* @return $this
*/
protected function replaceNamespace(&$stub, $name)
{
$stub = str_replace(
'DummyNamespace', $this->getNamespace($name), $stub
);
return $this;
}
$stub = str_replace(
'DummyRootNamespace', $this->laravel->getNamespace(), $stub
);
/**
* Get the full namespace name for a given class.
*
* @param string $name
* @return string
*/
protected function getNamespace($name)
{
return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
}
return $this;
}
/**
* Replace the class name for the given stub.
*
* @param string $stub
* @param string $name
* @return string
*/
protected function replaceClass($stub, $name)
{
$class = str_replace($this->getNamespace($name).'\\', '', $name);
/**
* Get the full namespace name for a given class.
*
* @param string $name
* @return string
*/
protected function getNamespace($name)
{
return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
}
return str_replace('{{class}}', $class, $stub);
}
/**
* Replace the class name for the given stub.
*
* @param string $stub
* @param string $name
* @return string
*/
protected function replaceClass($stub, $name)
{
$class = str_replace($this->getNamespace($name).'\\', '', $name);
/**
* Get the desired class name from the input.
*
* @return string
*/
protected function getNameInput()
{
return $this->argument('name');
}
return str_replace('DummyClass', $class, $stub);
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('name', InputArgument::REQUIRED, 'The name of the class'),
);
}
/**
* Get the desired class name from the input.
*
* @return string
*/
protected function getNameInput()
{
return trim($this->argument('name'));
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
['name', InputArgument::REQUIRED, 'The name of the class'],
];
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace Illuminate\Console;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class OutputStyle extends SymfonyStyle
{
/**
* The output instance.
*
* @var \Symfony\Component\Console\Output\OutputInterface
*/
private $output;
/**
* Create a new Console OutputStyle instance.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
public function __construct(InputInterface $input, OutputInterface $output)
{
$this->output = $output;
parent::__construct($input, $output);
}
/**
* Returns whether verbosity is quiet (-q).
*
* @return bool
*/
public function isQuiet()
{
return $this->output->isQuiet();
}
/**
* Returns whether verbosity is verbose (-v).
*
* @return bool
*/
public function isVerbose()
{
return $this->output->isVerbose();
}
/**
* Returns whether verbosity is very verbose (-vv).
*
* @return bool
*/
public function isVeryVerbose()
{
return $this->output->isVeryVerbose();
}
/**
* Returns whether verbosity is debug (-vvv).
*
* @return bool
*/
public function isDebug()
{
return $this->output->isDebug();
}
}

View File

@@ -0,0 +1,136 @@
<?php
namespace Illuminate\Console;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class Parser
{
/**
* Parse the given console command definition into an array.
*
* @param string $expression
* @return array
*
* @throws \InvalidArgumentException
*/
public static function parse($expression)
{
if (trim($expression) === '') {
throw new InvalidArgumentException('Console command definition is empty.');
}
preg_match('/[^\s]+/', $expression, $matches);
if (isset($matches[0])) {
$name = $matches[0];
} else {
throw new InvalidArgumentException('Unable to determine command name from signature.');
}
preg_match_all('/\{\s*(.*?)\s*\}/', $expression, $matches);
$tokens = isset($matches[1]) ? $matches[1] : [];
if (count($tokens)) {
return array_merge([$name], static::parameters($tokens));
}
return [$name, [], []];
}
/**
* Extract all of the parameters from the tokens.
*
* @param array $tokens
* @return array
*/
protected static function parameters(array $tokens)
{
$arguments = [];
$options = [];
foreach ($tokens as $token) {
if (! Str::startsWith($token, '--')) {
$arguments[] = static::parseArgument($token);
} else {
$options[] = static::parseOption(ltrim($token, '-'));
}
}
return [$arguments, $options];
}
/**
* Parse an argument expression.
*
* @param string $token
* @return \Symfony\Component\Console\Input\InputArgument
*/
protected static function parseArgument($token)
{
$description = null;
if (Str::contains($token, ' : ')) {
list($token, $description) = explode(' : ', $token, 2);
$token = trim($token);
$description = trim($description);
}
switch (true) {
case Str::endsWith($token, '?*'):
return new InputArgument(trim($token, '?*'), InputArgument::IS_ARRAY, $description);
case Str::endsWith($token, '*'):
return new InputArgument(trim($token, '*'), InputArgument::IS_ARRAY | InputArgument::REQUIRED, $description);
case Str::endsWith($token, '?'):
return new InputArgument(trim($token, '?'), InputArgument::OPTIONAL, $description);
case preg_match('/(.+)\=(.+)/', $token, $matches):
return new InputArgument($matches[1], InputArgument::OPTIONAL, $description, $matches[2]);
default:
return new InputArgument($token, InputArgument::REQUIRED, $description);
}
}
/**
* Parse an option expression.
*
* @param string $token
* @return \Symfony\Component\Console\Input\InputOption
*/
protected static function parseOption($token)
{
$description = null;
if (Str::contains($token, ' : ')) {
list($token, $description) = explode(' : ', $token);
$token = trim($token);
$description = trim($description);
}
$shortcut = null;
$matches = preg_split('/\s*\|\s*/', $token, 2);
if (isset($matches[1])) {
$shortcut = $matches[0];
$token = $matches[1];
}
switch (true) {
case Str::endsWith($token, '='):
return new InputOption(trim($token, '='), $shortcut, InputOption::VALUE_OPTIONAL, $description);
case Str::endsWith($token, '=*'):
return new InputOption(trim($token, '=*'), $shortcut, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $description);
case preg_match('/(.+)\=(.+)/', $token, $matches):
return new InputOption($matches[1], $shortcut, InputOption::VALUE_OPTIONAL, $description, $matches[2]);
default:
return new InputOption($token, $shortcut, InputOption::VALUE_NONE, $description);
}
}
}

View File

@@ -1,36 +1,37 @@
<?php namespace Illuminate\Console;
<?php
namespace Illuminate\Console;
use Illuminate\Support\ServiceProvider;
class ScheduleServiceProvider extends ServiceProvider {
class ScheduleServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->commands('Illuminate\Console\Scheduling\ScheduleRunCommand');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [
'Illuminate\Console\Scheduling\ScheduleRunCommand',
];
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->commands('Illuminate\Console\Scheduling\ScheduleRunCommand');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [
'Illuminate\Console\Scheduling\ScheduleRunCommand',
];
}
}

View File

@@ -1,126 +1,126 @@
<?php namespace Illuminate\Console\Scheduling;
<?php
namespace Illuminate\Console\Scheduling;
use LogicException;
use InvalidArgumentException;
use Illuminate\Contracts\Container\Container;
class CallbackEvent extends Event {
class CallbackEvent extends Event
{
/**
* The callback to call.
*
* @var string
*/
protected $callback;
/**
* The callback to call.
*
* @var string
*/
protected $callback;
/**
* The parameters to pass to the method.
*
* @var array
*/
protected $parameters;
/**
* The parameters to pass to the method.
*
* @var array
*/
protected $parameters;
/**
* Create a new event instance.
*
* @param string $callback
* @param array $parameters
* @return void
*
* @throws \InvalidArgumentException
*/
public function __construct($callback, array $parameters = [])
{
$this->callback = $callback;
$this->parameters = $parameters;
/**
* Create a new event instance.
*
* @param string $callback
* @param array $parameters
* @return void
*/
public function __construct($callback, array $parameters = array())
{
$this->callback = $callback;
$this->parameters = $parameters;
if (! is_string($this->callback) && ! is_callable($this->callback)) {
throw new InvalidArgumentException(
'Invalid scheduled callback event. Must be string or callable.'
);
}
}
if ( ! is_string($this->callback) && ! is_callable($this->callback))
{
throw new InvalidArgumentException(
"Invalid scheduled callback event. Must be string or callable."
);
}
}
/**
* Run the given event.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return mixed
*
* @throws \Exception
*/
public function run(Container $container)
{
if ($this->description) {
touch($this->mutexPath());
}
/**
* Run the given event.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return mixed
*/
public function run(Container $container)
{
if ($this->description)
{
touch($this->mutexPath());
}
try {
$response = $container->call($this->callback, $this->parameters);
} finally {
$this->removeMutex();
}
try {
$response = $container->call($this->callback, $this->parameters);
} catch (\Exception $e) {
$this->removeMutex();
parent::callAfterCallbacks($container);
throw $e;
}
return $response;
}
$this->removeMutex();
/**
* Remove the mutex file from disk.
*
* @return void
*/
protected function removeMutex()
{
if ($this->description) {
@unlink($this->mutexPath());
}
}
parent::callAfterCallbacks($container);
/**
* Do not allow the event to overlap each other.
*
* @return $this
*
* @throws \LogicException
*/
public function withoutOverlapping()
{
if (! isset($this->description)) {
throw new LogicException(
"A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'."
);
}
return $response;
}
return $this->skip(function () {
return file_exists($this->mutexPath());
});
}
/**
* Remove the mutex file from disk.
*
* @return void
*/
protected function removeMutex()
{
if ($this->description)
{
@unlink($this->mutexPath());
}
}
/**
* Get the mutex path for the scheduled command.
*
* @return string
*/
protected function mutexPath()
{
return storage_path('framework/schedule-'.sha1($this->description));
}
/**
* Do not allow the event to overlap each other.
*
* @return $this
*/
public function withoutOverlapping()
{
if ( ! isset($this->description))
{
throw new LogicException(
"A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'."
);
}
return $this->skip(function()
{
return file_exists($this->mutexPath());
});
}
/**
* Get the mutex path for the scheduled command.
*
* @return string
*/
protected function mutexPath()
{
return storage_path().'/framework/schedule-'.md5($this->description);
}
/**
* Get the summary of the event for display.
*
* @return string
*/
public function getSummaryForDisplay()
{
if (is_string($this->description)) return $this->description;
return is_string($this->callback) ? $this->callback : 'Closure';
}
/**
* Get the summary of the event for display.
*
* @return string
*/
public function getSummaryForDisplay()
{
if (is_string($this->description)) {
return $this->description;
}
return is_string($this->callback) ? $this->callback : 'Closure';
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,76 +1,108 @@
<?php namespace Illuminate\Console\Scheduling;
<?php
use Illuminate\Contracts\Foundation\Application;
namespace Illuminate\Console\Scheduling;
class Schedule {
use Symfony\Component\Process\ProcessUtils;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* All of the events on the schedule.
*
* @var array
*/
protected $events = [];
class Schedule
{
/**
* All of the events on the schedule.
*
* @var array
*/
protected $events = [];
/**
* 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 = array())
{
$this->events[] = $event = new CallbackEvent($callback, $parameters);
/**
* 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;
}
return $event;
}
/**
* Add a new Artisan command event to the schedule.
*
* @param string $command
* @return \Illuminate\Console\Scheduling\Event
*/
public function command($command)
{
return $this->exec(PHP_BINARY.' artisan '.$command);
}
/**
* 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));
/**
* Add a new command event to the schedule.
*
* @param string $command
* @return \Illuminate\Console\Scheduling\Event
*/
public function exec($command)
{
$this->events[] = $event = new Event($command);
if (defined('HHVM_VERSION')) {
$binary .= ' --php';
}
return $event;
}
if (defined('ARTISAN_BINARY')) {
$artisan = ProcessUtils::escapeArgument(ARTISAN_BINARY);
} else {
$artisan = 'artisan';
}
/**
* Get all of the events on the schedule.
*
* @return array
*/
public function events()
{
return $this->events;
}
return $this->exec("{$binary} {$artisan} {$command}", $parameters);
}
/**
* Get all of the events on the schedule that are due.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return array
*/
public function dueEvents(Application $app)
{
return array_filter($this->events, function($event) use ($app)
{
return $event->isDue($app);
});
}
/**
* 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);
}
$this->events[] = $event = new Event($command);
return $event;
}
/**
* 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(' ');
}
/**
* Get all of the events on the schedule.
*
* @return array
*/
public function events()
{
return $this->events;
}
/**
* 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);
});
}
}

View File

@@ -1,63 +1,70 @@
<?php namespace Illuminate\Console\Scheduling;
<?php
namespace Illuminate\Console\Scheduling;
use Illuminate\Console\Command;
class ScheduleRunCommand extends Command {
class ScheduleRunCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'schedule:run';
/**
* The console command name.
*
* @var string
*/
protected $name = 'schedule:run';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Run the scheduled commands';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Run the scheduled commands';
/**
* The schedule instance.
*
* @var \Illuminate\Console\Scheduling\Schedule
*/
protected $schedule;
/**
* The schedule instance.
*
* @var \Illuminate\Console\Scheduling\Schedule
*/
protected $schedule;
/**
* Create a new command instance.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
public function __construct(Schedule $schedule)
{
$this->schedule = $schedule;
/**
* Create a new command instance.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
public function __construct(Schedule $schedule)
{
$this->schedule = $schedule;
parent::__construct();
}
parent::__construct();
}
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$events = $this->schedule->dueEvents($this->laravel);
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$events = $this->schedule->dueEvents($this->laravel);
$eventsRan = 0;
foreach ($events as $event)
{
$this->line('<info>Running scheduled command:</info> '.$event->getSummaryForDisplay());
foreach ($events as $event) {
if (! $event->filtersPass($this->laravel)) {
continue;
}
$event->run($this->laravel);
}
$this->line('<info>Running scheduled command:</info> '.$event->getSummaryForDisplay());
if (count($events) === 0)
{
$this->info('No scheduled commands are ready to run.');
}
}
$event->run($this->laravel);
++$eventsRan;
}
if (count($events) === 0 || $eventsRan === 0) {
$this->info('No scheduled commands are ready to run.');
}
}
}

View File

@@ -14,10 +14,11 @@
}
],
"require": {
"php": ">=5.4.0",
"illuminate/contracts": "5.0.*",
"symfony/console": "2.6.*",
"nesbot/carbon": "~1.0"
"php": ">=5.5.9",
"illuminate/contracts": "5.2.*",
"illuminate/support": "5.2.*",
"nesbot/carbon": "~1.20",
"symfony/console": "2.8.*|3.0.*"
},
"autoload": {
"psr-4": {
@@ -26,14 +27,13 @@
},
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
"dev-master": "5.2-dev"
}
},
"suggest": {
"guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~5.0).",
"guzzlehttp/guzzle": "Required to use the ping methods on schedules (~5.3|~6.0).",
"mtdowling/cron-expression": "Required to use scheduling component (~1.0).",
"symfony/process": "Required to use scheduling component (2.6.*).",
"nesbot/carbon": "Required to use scheduling component (~1.0)."
"symfony/process": "Required to use scheduling component (2.8.*|3.0.*)."
},
"minimum-stability": "dev"
}