composer update

This commit is contained in:
Manish Verma
2018-12-05 10:50:52 +05:30
parent 9eabcacfa7
commit 4addd1e9c6
3328 changed files with 156676 additions and 138988 deletions

View File

@@ -1,25 +1,12 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Tools\Console\Command;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOStatement;
use InvalidArgumentException;
use PDOException;
use RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -36,12 +23,7 @@ use function sprintf;
* Task for executing arbitrary SQL that can come from a file or directly from
* the command line.
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
* @deprecated Use a database client application instead
*/
class ImportCommand extends Command
{
@@ -53,10 +35,11 @@ class ImportCommand extends Command
$this
->setName('dbal:import')
->setDescription('Import SQL file(s) directly to Database.')
->setDefinition([
new InputArgument(
'file', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'File path(s) of SQL to be executed.'
)
->setDefinition([new InputArgument(
'file',
InputArgument::REQUIRED | InputArgument::IS_ARRAY,
'File path(s) of SQL to be executed.'
),
])
->setHelp(<<<EOT
Import SQL file(s) directly to Database.
@@ -71,70 +54,76 @@ EOT
{
$conn = $this->getHelper('db')->getConnection();
if (($fileNames = $input->getArgument('file')) !== null) {
foreach ((array) $fileNames as $fileName) {
$filePath = realpath($fileName);
$fileNames = $input->getArgument('file');
// Phar compatibility.
if (false === $filePath) {
$filePath = $fileName;
}
if ($fileNames === null) {
return null;
}
if ( ! file_exists($filePath)) {
throw new \InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not exist.", $filePath)
);
} elseif ( ! is_readable($filePath)) {
throw new \InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not have read permissions.", $filePath)
);
}
foreach ((array) $fileNames as $fileName) {
$filePath = realpath($fileName);
$output->write(sprintf("Processing file '<info>%s</info>'... ", $filePath));
$sql = file_get_contents($filePath);
// Phar compatibility.
if ($filePath === false) {
$filePath = $fileName;
}
if ($conn instanceof \Doctrine\DBAL\Driver\PDOConnection) {
// PDO Drivers
try {
$lines = 0;
if (! file_exists($filePath)) {
throw new InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not exist.", $filePath)
);
} elseif (! is_readable($filePath)) {
throw new InvalidArgumentException(
sprintf("SQL file '<info>%s</info>' does not have read permissions.", $filePath)
);
}
$stmt = $conn->prepare($sql);
assert($stmt instanceof PDOStatement);
$output->write(sprintf("Processing file '<info>%s</info>'... ", $filePath));
$sql = file_get_contents($filePath);
$stmt->execute();
if ($conn instanceof PDOConnection) {
// PDO Drivers
try {
$lines = 0;
do {
// Required due to "MySQL has gone away!" issue
$stmt->fetch();
$stmt->closeCursor();
$lines++;
} while ($stmt->nextRowset());
$output->write(sprintf('%d statements executed!', $lines) . PHP_EOL);
} catch (\PDOException $e) {
$output->write('error!' . PHP_EOL);
throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
}
} else {
// Non-PDO Drivers (ie. OCI8 driver)
$stmt = $conn->prepare($sql);
$rs = $stmt->execute();
assert($stmt instanceof PDOStatement);
if ($rs) {
$output->writeln('OK!' . PHP_EOL);
} else {
$error = $stmt->errorInfo();
$stmt->execute();
$output->write('error!' . PHP_EOL);
do {
// Required due to "MySQL has gone away!" issue
$stmt->fetch();
$stmt->closeCursor();
throw new \RuntimeException($error[2], $error[0]);
}
$lines++;
} while ($stmt->nextRowset());
$stmt->closeCursor();
$output->write(sprintf('%d statements executed!', $lines) . PHP_EOL);
} catch (PDOException $e) {
$output->write('error!' . PHP_EOL);
throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
}
} else {
// Non-PDO Drivers (ie. OCI8 driver)
$stmt = $conn->prepare($sql);
$rs = $stmt->execute();
if (! $rs) {
$error = $stmt->errorInfo();
$output->write('error!' . PHP_EOL);
throw new RuntimeException($error[2], $error[0]);
}
$output->writeln('OK!' . PHP_EOL);
$stmt->closeCursor();
}
}
return null;
}
}

View File

@@ -1,25 +1,27 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Tools\Console\Command;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\Keywords\DB2Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords;
use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords;
use Doctrine\DBAL\Platforms\Keywords\OracleKeywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords;
use Doctrine\DBAL\Platforms\Keywords\ReservedKeywordsValidator;
use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords;
use Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords;
use InvalidArgumentException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -30,27 +32,25 @@ use function implode;
class ReservedWordsCommand extends Command
{
/**
* @var array
*/
/** @var string[] */
private $keywordListClasses = [
'mysql' => 'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords',
'mysql57' => 'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords',
'mysql80' => 'Doctrine\DBAL\Platforms\Keywords\MySQL80Keywords',
'sqlserver' => 'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords',
'sqlserver2005' => 'Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords',
'sqlserver2008' => 'Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords',
'sqlserver2012' => 'Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords',
'sqlite' => 'Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords',
'pgsql' => 'Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords',
'pgsql91' => 'Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords',
'pgsql92' => 'Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords',
'oracle' => 'Doctrine\DBAL\Platforms\Keywords\OracleKeywords',
'db2' => 'Doctrine\DBAL\Platforms\Keywords\DB2Keywords',
'sqlanywhere' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords',
'sqlanywhere11' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords',
'sqlanywhere12' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords',
'sqlanywhere16' => 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords',
'mysql' => MySQLKeywords::class,
'mysql57' => MySQL57Keywords::class,
'mysql80' => MySQL80Keywords::class,
'sqlserver' => SQLServerKeywords::class,
'sqlserver2005' => SQLServer2005Keywords::class,
'sqlserver2008' => SQLServer2008Keywords::class,
'sqlserver2012' => SQLServer2012Keywords::class,
'sqlite' => SQLiteKeywords::class,
'pgsql' => PostgreSQLKeywords::class,
'pgsql91' => PostgreSQL91Keywords::class,
'pgsql92' => PostgreSQL92Keywords::class,
'oracle' => OracleKeywords::class,
'db2' => DB2Keywords::class,
'sqlanywhere' => SQLAnywhereKeywords::class,
'sqlanywhere11' => SQLAnywhere11Keywords::class,
'sqlanywhere12' => SQLAnywhere12Keywords::class,
'sqlanywhere16' => SQLAnywhere16Keywords::class,
];
/**
@@ -74,10 +74,12 @@ class ReservedWordsCommand extends Command
$this
->setName('dbal:reserved-words')
->setDescription('Checks if the current database contains identifiers that are reserved.')
->setDefinition([
new InputOption(
'list', 'l', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Keyword-List name.'
)
->setDefinition([new InputOption(
'list',
'l',
InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
'Keyword-List name.'
),
])
->setHelp(<<<EOT
Checks if the current database contains tables and columns
@@ -120,11 +122,11 @@ EOT
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
/* @var $conn \Doctrine\DBAL\Connection */
/** @var Connection $conn */
$conn = $this->getHelper('db')->getConnection();
$keywordLists = (array) $input->getOption('list');
if ( ! $keywordLists) {
if (! $keywordLists) {
$keywordLists = [
'mysql',
'mysql57',
@@ -146,27 +148,24 @@ EOT
$keywords = [];
foreach ($keywordLists as $keywordList) {
if (!isset($this->keywordListClasses[$keywordList])) {
throw new \InvalidArgumentException(
"There exists no keyword list with name '" . $keywordList . "'. ".
"Known lists: " . implode(", ", array_keys($this->keywordListClasses))
if (! isset($this->keywordListClasses[$keywordList])) {
throw new InvalidArgumentException(
"There exists no keyword list with name '" . $keywordList . "'. " .
'Known lists: ' . implode(', ', array_keys($this->keywordListClasses))
);
}
$class = $this->keywordListClasses[$keywordList];
$keywords[] = new $class;
$class = $this->keywordListClasses[$keywordList];
$keywords[] = new $class();
}
$output->write('Checking keyword violations for <comment>' . implode(", ", $keywordLists) . "</comment>...", true);
$output->write('Checking keyword violations for <comment>' . implode(', ', $keywordLists) . '</comment>...', true);
/* @var $schema \Doctrine\DBAL\Schema\Schema */
$schema = $conn->getSchemaManager()->createSchema();
$schema = $conn->getSchemaManager()->createSchema();
$visitor = new ReservedKeywordsValidator($keywords);
$schema->visit($visitor);
$violations = $visitor->getViolations();
if (count($violations) == 0) {
$output->write("No reserved keywords violations have been found!", true);
} else {
if (count($violations) !== 0) {
$output->write('There are <error>' . count($violations) . '</error> reserved keyword violations in your database schema:', true);
foreach ($violations as $violation) {
$output->write(' - ' . $violation, true);
@@ -175,6 +174,8 @@ EOT
return 1;
}
$output->write('No reserved keywords violations have been found!', true);
return 0;
}
}

View File

@@ -1,43 +1,21 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Tools\Console\Command;
use Doctrine\DBAL\Tools\Dumper;
use LogicException;
use RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use function is_numeric;
use function stripos;
/**
* Task for executing arbitrary SQL that can come from a file or directly from
* the command line.
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class RunSqlCommand extends Command
{
@@ -67,14 +45,16 @@ EOT
{
$conn = $this->getHelper('db')->getConnection();
if (($sql = $input->getArgument('sql')) === null) {
throw new \RuntimeException("Argument 'SQL' is required in order to execute this command correctly.");
$sql = $input->getArgument('sql');
if ($sql === null) {
throw new RuntimeException("Argument 'SQL' is required in order to execute this command correctly.");
}
$depth = $input->getOption('depth');
if ( ! is_numeric($depth)) {
throw new \LogicException("Option 'depth' must contains an integer value");
if (! is_numeric($depth)) {
throw new LogicException("Option 'depth' must contains an integer value");
}
if (stripos($sql, 'select') === 0 || $input->getOption('force-fetch')) {

View File

@@ -1,21 +1,4 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Tools\Console;
@@ -26,6 +9,7 @@ use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\DBAL\Version;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
/**
@@ -36,22 +20,19 @@ class ConsoleRunner
/**
* Create a Symfony Console HelperSet
*
* @param Connection $connection
*
* @return HelperSet
*/
public static function createHelperSet(Connection $connection)
{
return new HelperSet([
'db' => new ConnectionHelper($connection)
'db' => new ConnectionHelper($connection),
]);
}
/**
* Runs console with the given helperset.
*
* @param \Symfony\Component\Console\Helper\HelperSet $helperSet
* @param \Symfony\Component\Console\Command\Command[] $commands
* @param Command[] $commands
*
* @return void
*/
@@ -69,8 +50,6 @@ class ConsoleRunner
}
/**
* @param Application $cli
*
* @return void
*/
public static function addCommands(Application $cli)

View File

@@ -1,50 +1,24 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Tools\Console\Helper;
use Symfony\Component\Console\Helper\Helper;
use Doctrine\DBAL\Connection;
use Symfony\Component\Console\Helper\Helper;
/**
* Doctrine CLI Connection Helper.
*
* @link www.doctrine-project.org
* @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class ConnectionHelper extends Helper
{
/**
* The Doctrine database Connection.
*
* @var \Doctrine\DBAL\Connection
* @var Connection
*/
protected $_connection;
/**
* Constructor.
*
* @param \Doctrine\DBAL\Connection $connection The Doctrine database Connection.
* @param Connection $connection The Doctrine database Connection.
*/
public function __construct(Connection $connection)
{
@@ -54,7 +28,7 @@ class ConnectionHelper extends Helper
/**
* Retrieves the Doctrine database Connection.
*
* @return \Doctrine\DBAL\Connection
* @return Connection
*/
public function getConnection()
{