complete phpdoc for install command
This commit is contained in:
@@ -26,14 +26,15 @@ namespace Thelia\Command;
|
|||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\DependencyInjection\Tests\Compiler\CheckExceptionOnInvalidReferenceBehaviorPassTest;
|
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Thelia\Command\ContainerAwareCommand;
|
use Thelia\Command\ContainerAwareCommand;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
|
|
||||||
|
|
||||||
class Install extends ContainerAwareCommand
|
class Install extends ContainerAwareCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Configure the command
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
@@ -84,6 +85,11 @@ class Install extends ContainerAwareCommand
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if needed directories have write permission
|
||||||
|
*
|
||||||
|
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||||
|
*/
|
||||||
protected function checkPermission(OutputInterface $output)
|
protected function checkPermission(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$output->writeln(array(
|
$output->writeln(array(
|
||||||
@@ -128,6 +134,11 @@ class Install extends ContainerAwareCommand
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rename database config file and complete it
|
||||||
|
*
|
||||||
|
* @param array $connectionInfo
|
||||||
|
*/
|
||||||
protected function createConfigFile($connectionInfo)
|
protected function createConfigFile($connectionInfo)
|
||||||
{
|
{
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
@@ -158,6 +169,12 @@ class Install extends ContainerAwareCommand
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert all sql needed in database
|
||||||
|
*
|
||||||
|
* @param \PDO $connection
|
||||||
|
* @param $dbName
|
||||||
|
*/
|
||||||
protected function insertSql(\PDO $connection, $dbName)
|
protected function insertSql(\PDO $connection, $dbName)
|
||||||
{
|
{
|
||||||
$connection->query(sprintf("use %s", $dbName));
|
$connection->query(sprintf("use %s", $dbName));
|
||||||
@@ -173,6 +190,12 @@ class Install extends ContainerAwareCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separate each sql instruction in an array
|
||||||
|
*
|
||||||
|
* @param $sql
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function prepareSql($sql)
|
protected function prepareSql($sql)
|
||||||
{
|
{
|
||||||
$sql = str_replace(";',", "-CODE-", $sql);
|
$sql = str_replace(";',", "-CODE-", $sql);
|
||||||
@@ -189,6 +212,12 @@ class Install extends ContainerAwareCommand
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create database if not exists
|
||||||
|
*
|
||||||
|
* @param \PDO $connection
|
||||||
|
* @param $dbName
|
||||||
|
*/
|
||||||
protected function createDatabase(\PDO $connection, $dbName)
|
protected function createDatabase(\PDO $connection, $dbName)
|
||||||
{
|
{
|
||||||
$connection->query(
|
$connection->query(
|
||||||
@@ -199,6 +228,13 @@ class Install extends ContainerAwareCommand
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test database access
|
||||||
|
*
|
||||||
|
* @param $connectionInfo
|
||||||
|
* @param OutputInterface $output
|
||||||
|
* @return bool|\PDO
|
||||||
|
*/
|
||||||
protected function tryConnection($connectionInfo, OutputInterface $output)
|
protected function tryConnection($connectionInfo, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -222,6 +258,13 @@ class Install extends ContainerAwareCommand
|
|||||||
return $connection;
|
return $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ask to user all needed information
|
||||||
|
*
|
||||||
|
* @param InputInterface $input
|
||||||
|
* @param OutputInterface $output
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getConnectionInfo(InputInterface $input, OutputInterface $output)
|
protected function getConnectionInfo(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$dialog = $this->getHelperSet()->get('dialog');
|
$dialog = $this->getHelperSet()->get('dialog');
|
||||||
|
|||||||
Reference in New Issue
Block a user