update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
77
pfosten/vendor/symfony/console/Command/Command.php
vendored
Executable file → Normal file
77
pfosten/vendor/symfony/console/Command/Command.php
vendored
Executable file → Normal file
|
|
@ -11,16 +11,16 @@
|
|||
|
||||
namespace Symfony\Component\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Base class for all commands.
|
||||
|
|
@ -29,6 +29,11 @@ use Symfony\Component\Console\Exception\LogicException;
|
|||
*/
|
||||
class Command
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name
|
||||
*/
|
||||
protected static $defaultName;
|
||||
|
||||
private $application;
|
||||
private $name;
|
||||
private $processTitle;
|
||||
|
|
@ -46,8 +51,17 @@ class Command
|
|||
private $helperSet;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @return string|null The default command name or null when no default name is set
|
||||
*/
|
||||
public static function getDefaultName()
|
||||
{
|
||||
$class = \get_called_class();
|
||||
$r = new \ReflectionProperty($class, 'defaultName');
|
||||
|
||||
return $class === $r->class ? static::$defaultName : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $name The name of the command; passing null means it must be set in configure()
|
||||
*
|
||||
* @throws LogicException When the command name is empty
|
||||
|
|
@ -56,15 +70,11 @@ class Command
|
|||
{
|
||||
$this->definition = new InputDefinition();
|
||||
|
||||
if (null !== $name) {
|
||||
if (null !== $name || null !== $name = static::getDefaultName()) {
|
||||
$this->setName($name);
|
||||
}
|
||||
|
||||
$this->configure();
|
||||
|
||||
if (!$this->name) {
|
||||
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -77,11 +87,6 @@ class Command
|
|||
$this->ignoreValidationErrors = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the application instance for this command.
|
||||
*
|
||||
* @param Application $application An Application instance
|
||||
*/
|
||||
public function setApplication(Application $application = null)
|
||||
{
|
||||
$this->application = $application;
|
||||
|
|
@ -92,11 +97,6 @@ class Command
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the helper set.
|
||||
*
|
||||
* @param HelperSet $helperSet A HelperSet instance
|
||||
*/
|
||||
public function setHelperSet(HelperSet $helperSet)
|
||||
{
|
||||
$this->helperSet = $helperSet;
|
||||
|
|
@ -150,9 +150,6 @@ class Command
|
|||
* execute() method, you set the code to execute by passing
|
||||
* a Closure to the setCode() method.
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return null|int null or 0 if everything went fine, or an error code
|
||||
*
|
||||
* @throws LogicException When this abstract method is not implemented
|
||||
|
|
@ -170,9 +167,6 @@ class Command
|
|||
* This method is executed before the InputDefinition is validated.
|
||||
* This means that this is the only place where the command can
|
||||
* interactively ask for values of missing required arguments.
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
|
@ -183,9 +177,6 @@ class Command
|
|||
*
|
||||
* This is mainly useful when a lot of commands extends one main command
|
||||
* where some things need to be initialized based on the input arguments and options.
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
|
@ -198,9 +189,6 @@ class Command
|
|||
* setCode() method or by overriding the execute() method
|
||||
* in a sub-class.
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return int The command exit code
|
||||
*
|
||||
* @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
|
||||
|
|
@ -229,16 +217,15 @@ class Command
|
|||
$this->initialize($input, $output);
|
||||
|
||||
if (null !== $this->processTitle) {
|
||||
if (function_exists('cli_set_process_title')) {
|
||||
if (false === @cli_set_process_title($this->processTitle)) {
|
||||
if (\function_exists('cli_set_process_title')) {
|
||||
if (!@cli_set_process_title($this->processTitle)) {
|
||||
if ('Darwin' === PHP_OS) {
|
||||
$output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
|
||||
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
} else {
|
||||
$error = error_get_last();
|
||||
trigger_error($error['message'], E_USER_WARNING);
|
||||
cli_set_process_title($this->processTitle);
|
||||
}
|
||||
}
|
||||
} elseif (function_exists('setproctitle')) {
|
||||
} elseif (\function_exists('setproctitle')) {
|
||||
setproctitle($this->processTitle);
|
||||
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
|
||||
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
|
||||
|
|
@ -259,7 +246,7 @@ class Command
|
|||
$input->validate();
|
||||
|
||||
if ($this->code) {
|
||||
$statusCode = call_user_func($this->code, $input, $output);
|
||||
$statusCode = \call_user_func($this->code, $input, $output);
|
||||
} else {
|
||||
$statusCode = $this->execute($input, $output);
|
||||
}
|
||||
|
|
@ -475,7 +462,7 @@ class Command
|
|||
}
|
||||
|
||||
/**
|
||||
* @return bool Whether the command should be publicly shown or not.
|
||||
* @return bool whether the command should be publicly shown or not
|
||||
*/
|
||||
public function isHidden()
|
||||
{
|
||||
|
|
@ -563,7 +550,7 @@ class Command
|
|||
*/
|
||||
public function setAliases($aliases)
|
||||
{
|
||||
if (!is_array($aliases) && !$aliases instanceof \Traversable) {
|
||||
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
|
||||
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
|
||||
}
|
||||
|
||||
|
|
|
|||
7
pfosten/vendor/symfony/console/Command/HelpCommand.php
vendored
Executable file → Normal file
7
pfosten/vendor/symfony/console/Command/HelpCommand.php
vendored
Executable file → Normal file
|
|
@ -13,8 +13,8 @@ namespace Symfony\Component\Console\Command;
|
|||
|
||||
use Symfony\Component\Console\Helper\DescriptorHelper;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -56,11 +56,6 @@ EOF
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the command.
|
||||
*
|
||||
* @param Command $command The command to set
|
||||
*/
|
||||
public function setCommand(Command $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
|
|
|
|||
6
pfosten/vendor/symfony/console/Command/ListCommand.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/console/Command/ListCommand.php
vendored
Executable file → Normal file
|
|
@ -13,10 +13,10 @@ namespace Symfony\Component\Console\Command;
|
|||
|
||||
use Symfony\Component\Console\Helper\DescriptorHelper;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* ListCommand displays the list of all available commands for the application.
|
||||
|
|
|
|||
31
pfosten/vendor/symfony/console/Command/LockableTrait.php
vendored
Executable file → Normal file
31
pfosten/vendor/symfony/console/Command/LockableTrait.php
vendored
Executable file → Normal file
|
|
@ -13,7 +13,10 @@ namespace Symfony\Component\Console\Command;
|
|||
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Filesystem\LockHandler;
|
||||
use Symfony\Component\Lock\Factory;
|
||||
use Symfony\Component\Lock\Lock;
|
||||
use Symfony\Component\Lock\Store\FlockStore;
|
||||
use Symfony\Component\Lock\Store\SemaphoreStore;
|
||||
|
||||
/**
|
||||
* Basic lock feature for commands.
|
||||
|
|
@ -22,7 +25,8 @@ use Symfony\Component\Filesystem\LockHandler;
|
|||
*/
|
||||
trait LockableTrait
|
||||
{
|
||||
private $lockHandler;
|
||||
/** @var Lock */
|
||||
private $lock;
|
||||
|
||||
/**
|
||||
* Locks a command.
|
||||
|
|
@ -31,18 +35,23 @@ trait LockableTrait
|
|||
*/
|
||||
private function lock($name = null, $blocking = false)
|
||||
{
|
||||
if (!class_exists(LockHandler::class)) {
|
||||
throw new RuntimeException('To enable the locking feature you must install the symfony/filesystem component.');
|
||||
if (!class_exists(SemaphoreStore::class)) {
|
||||
throw new RuntimeException('To enable the locking feature you must install the symfony/lock component.');
|
||||
}
|
||||
|
||||
if (null !== $this->lockHandler) {
|
||||
if (null !== $this->lock) {
|
||||
throw new LogicException('A lock is already in place.');
|
||||
}
|
||||
|
||||
$this->lockHandler = new LockHandler($name ?: $this->getName());
|
||||
if (SemaphoreStore::isSupported($blocking)) {
|
||||
$store = new SemaphoreStore();
|
||||
} else {
|
||||
$store = new FlockStore();
|
||||
}
|
||||
|
||||
if (!$this->lockHandler->lock($blocking)) {
|
||||
$this->lockHandler = null;
|
||||
$this->lock = (new Factory($store))->createLock($name ?: $this->getName());
|
||||
if (!$this->lock->acquire($blocking)) {
|
||||
$this->lock = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -55,9 +64,9 @@ trait LockableTrait
|
|||
*/
|
||||
private function release()
|
||||
{
|
||||
if ($this->lockHandler) {
|
||||
$this->lockHandler->release();
|
||||
$this->lockHandler = null;
|
||||
if ($this->lock) {
|
||||
$this->lock->release();
|
||||
$this->lock = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue