Merge branch 'master' into loops

Conflicts:
	core/lib/Thelia/Core/Template/Loop/Category.php
	core/lib/Thelia/Core/Template/Loop/FeatureValue.php
	core/lib/Thelia/Core/Template/Loop/Folder.php
	core/lib/Thelia/Core/Template/Loop/Product.php
	core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
	install/faker.php
This commit is contained in:
Etienne Roudeix
2013-08-21 09:19:56 +02:00
3275 changed files with 929970 additions and 274940 deletions

11
core/lib/Thelia/Command/BaseModuleGenerate.php Normal file → Executable file
View File

@@ -22,12 +22,8 @@
/*************************************************************************************/
namespace Thelia\Command;
use Propel\Runtime\Propel;
use Symfony\Component\Console\Application;
abstract class BaseModuleGenerate extends ContainerAwareCommand {
abstract class BaseModuleGenerate extends ContainerAwareCommand
{
protected $module;
protected $moduleDirectory;
@@ -53,6 +49,7 @@ abstract class BaseModuleGenerate extends ContainerAwareCommand {
if (in_array(strtolower($name), $this->reservedKeyWords)) {
throw new \RuntimeException(sprintf("%s module name is a reserved keyword", $name));
}
return ucfirst($name);
}
}
}

View File

@@ -23,7 +23,6 @@
namespace Thelia\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
@@ -56,9 +55,9 @@ class CacheClear extends ContainerAwareCommand
$fs->remove($cacheDir);
$output->writeln("<info>cache cleared successfully</info>");
} catch(IOException $e) {
} catch (IOException $e) {
$output->writeln(sprintf("error during clearing cache : %s", $e->getMessage()));
}
}
}
}

View File

@@ -0,0 +1,70 @@
<?php
use Thelia\Core\Event\TheliaEvents;
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Command;
use Thelia\Command\ContainerAwareCommand;
use Thelia\Core\Event\TheliaEvents;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Thelia\Core\Event\ImageEvent;
use Thelia\Core\HttpFoundation\Request;
use Symfony\Component\Console\Input\InputArgument;
class ClearImageCache extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName("image-cache:clear")
->setDescription("Empty part or whole web space image cache")
->addArgument("subdir", InputArgument::OPTIONAL, "Clear only the specified subdirectory")
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$dispatcher = $this->getContainer()->get('event_dispatcher');
$request = new Request();
try {
$event = new ImageEvent($request);
$subdir = $input->getArgument('subdir');
if (! is_null($subdir)) $event->setCacheSubdirectory($subdir);
$dispatcher->dispatch(TheliaEvents::IMAGE_CLEAR_CACHE, $event);
$output->writeln(sprintf('%s image cache successfully cleared.', is_null($subdir) ? 'Entire' : ucfirst($subdir)));
}
catch(\Exception $ex) {
$output->writeln(sprintf("Failed to clear image cache: %s", $ex->getMessage()));
}
}
}

View File

@@ -32,7 +32,8 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ContainerAwareCommand extends Command implements ContainerAwareInterface {
class ContainerAwareCommand extends Command implements ContainerAwareInterface
{
/**
* @var ContainerInterface
*/
@@ -57,4 +58,4 @@ class ContainerAwareCommand extends Command implements ContainerAwareInterface {
{
$this->container = $container;
}
}
}

View File

@@ -29,7 +29,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Thelia\Command\ContainerAwareCommand;
class Install extends ContainerAwareCommand
{
/**
@@ -80,7 +79,6 @@ class Install extends ContainerAwareCommand
$this->checkPermission($output);
$connectionInfo = array(
"host" => $input->getOption("db_host"),
"dbName" => $input->getOption("db_name"),
@@ -88,9 +86,7 @@ class Install extends ContainerAwareCommand
"password" => $input->getOption("db_password")
);
while(false === $connection = $this->tryConnection($connectionInfo, $output)) {
while (false === $connection = $this->tryConnection($connectionInfo, $output)) {
$connectionInfo = $this->getConnectionInfo($input, $output);
}
@@ -164,8 +160,6 @@ class Install extends ContainerAwareCommand
exit;
}
}
/**
@@ -180,7 +174,6 @@ class Install extends ContainerAwareCommand
$sampleConfigFile = THELIA_ROOT . "/local/config/database.yml.sample";
$configFile = THELIA_ROOT . "/local/config/database.yml";
$fs->copy($sampleConfigFile, $configFile, true);
$configContent = file_get_contents($configFile);
@@ -196,11 +189,11 @@ class Install extends ContainerAwareCommand
file_put_contents($configFile, $configContent);
$fs->remove($sampleConfigFile);
// FA - no, as no further install will be possible
// $fs->remove($sampleConfigFile);
$fs->remove($this->getContainer()->getParameter("kernel.cache_dir"));
}
/**
@@ -237,7 +230,7 @@ class Install extends ContainerAwareCommand
$tab = explode(";", $sql);
for($i=0; $i<count($tab); $i++){
for ($i=0; $i<count($tab); $i++) {
$queryTemp = str_replace("-CODE-", ";',", $tab[$i]);
$queryTemp = str_replace("|", ";", $queryTemp);
$query[] = $queryTemp;
@@ -266,7 +259,7 @@ class Install extends ContainerAwareCommand
* test database access
*
* @param $connectionInfo
* @param OutputInterface $output
* @param OutputInterface $output
* @return bool|\PDO
*/
protected function tryConnection($connectionInfo, OutputInterface $output)
@@ -288,19 +281,18 @@ class Install extends ContainerAwareCommand
$output->writeln(array(
"<error>Wrong connection information</error>"
));
return false;
}
return $connection;
}
/**
* Ask to user all needed information
*
* @param InputInterface $input
* @param OutputInterface $output
* @param InputInterface $input
* @param OutputInterface $output
* @return array
*/
protected function getConnectionInfo(InputInterface $input, OutputInterface $output)
@@ -363,4 +355,4 @@ class Install extends ContainerAwareCommand
return sprintf("<info>%s</info>", $text);
}
}
}

13
core/lib/Thelia/Command/ModuleGenerateCommand.php Normal file → Executable file
View File

@@ -22,16 +22,13 @@
/*************************************************************************************/
namespace Thelia\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
class ModuleGenerateCommand extends BaseModuleGenerate {
class ModuleGenerateCommand extends BaseModuleGenerate
{
protected function configure()
{
$this
@@ -53,7 +50,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate {
$this->createDirectories();
$this->createFiles();
if(method_exists($this, "renderBlock")) {
if (method_exists($this, "renderBlock")) {
//impossible to change output class in CommandTester...
$output->renderBlock(array(
'',
@@ -99,6 +96,4 @@ class ModuleGenerateCommand extends BaseModuleGenerate {
file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
}
}
}

9
core/lib/Thelia/Command/ModuleGenerateModelCommand.php Normal file → Executable file
View File

@@ -23,18 +23,16 @@
namespace Thelia\Command;
use Propel\Generator\Command\ModelBuildCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Filesystem\Filesystem;
class ModuleGenerateModelCommand extends BaseModuleGenerate {
class ModuleGenerateModelCommand extends BaseModuleGenerate
{
protected function configure()
{
$this
@@ -124,7 +122,6 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate {
}
}
}
}
}

8
core/lib/Thelia/Command/ModuleGenerateSqlCommand.php Normal file → Executable file
View File

@@ -23,17 +23,15 @@
namespace Thelia\Command;
use Propel\Generator\Command\SqlBuildCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Filesystem\Filesystem;
class ModuleGenerateSqlCommand extends BaseModuleGenerate {
class ModuleGenerateSqlCommand extends BaseModuleGenerate
{
public function configure()
{
$this
@@ -82,4 +80,4 @@ class ModuleGenerateSqlCommand extends BaseModuleGenerate {
), 'bg=green;fg=black');
}
}
}

7
core/lib/Thelia/Command/Output/TheliaConsoleOutput.php Normal file → Executable file
View File

@@ -23,11 +23,10 @@
namespace Thelia\Command\Output;
use Symfony\Component\Console\Output\ConsoleOutput;
class TheliaConsoleOutput extends ConsoleOutput{
class TheliaConsoleOutput extends ConsoleOutput
{
public function renderBlock(array $messages, $style = "info")
{
$strlen = function ($string) {
@@ -53,4 +52,4 @@ class TheliaConsoleOutput extends ConsoleOutput{
$this->writeln($output);
}
}
}

3
core/lib/Thelia/Command/Skeleton/Module/Class.php Normal file → Executable file
View File

@@ -21,12 +21,11 @@
/* */
/*************************************************************************************/
namespace %%NAMESPACE%%;
use Thelia\Module\BaseModule;
class %%CLASSNAME%% extends BaseModule
class Class extends BaseModule
{
/**
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class

0
core/lib/Thelia/Command/Skeleton/Module/config.xml Normal file → Executable file
View File

0
core/lib/Thelia/Command/Skeleton/Module/plugin.xml Normal file → Executable file
View File

0
core/lib/Thelia/Command/Skeleton/Module/schema.xml Normal file → Executable file
View File