Added image processing actgion and loop
This commit is contained in:
@@ -30,7 +30,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
|
|
||||||
class BaseAction
|
class BaseAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var The container
|
* @var The container
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -134,4 +134,10 @@ final class TheliaEvents
|
|||||||
const CART_CHANGEITEM = "action.changeArticle";
|
const CART_CHANGEITEM = "action.changeArticle";
|
||||||
|
|
||||||
const CART_DELETEITEM = "action.deleteArticle";
|
const CART_DELETEITEM = "action.deleteArticle";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sent on image processing
|
||||||
|
*/
|
||||||
|
const IMAGE_PROCESS = "action.processImage";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ abstract class BaseLoop
|
|||||||
* @throws \InvalidArgumentException if argument is not found in loop argument list
|
* @throws \InvalidArgumentException if argument is not found in loop argument list
|
||||||
* @return Argument the loop argument.
|
* @return Argument the loop argument.
|
||||||
*/
|
*/
|
||||||
public function getArg($argumentName)
|
protected function getArg($argumentName)
|
||||||
{
|
{
|
||||||
$arg = $this->args->get($argumentName);
|
$arg = $this->args->get($argumentName);
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ abstract class BaseLoop
|
|||||||
* @throws \InvalidArgumentException if argument is not found in loop argument list
|
* @throws \InvalidArgumentException if argument is not found in loop argument list
|
||||||
* @return Argument the loop argument.
|
* @return Argument the loop argument.
|
||||||
*/
|
*/
|
||||||
public function getArgValue($argumentName)
|
protected function getArgValue($argumentName)
|
||||||
{
|
{
|
||||||
return $this->getArg($argumentName)->getValue();
|
return $this->getArg($argumentName)->getValue();
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* @return array|mixed|\PropelModelPager|\PropelObjectCollection
|
* @return array|mixed|\PropelModelPager|\PropelObjectCollection
|
||||||
*/
|
*/
|
||||||
public function search(ModelCriteria $search, &$pagination = null)
|
protected function search(ModelCriteria $search, &$pagination = null)
|
||||||
{
|
{
|
||||||
if ($this->getArgValue('page') !== null) {
|
if ($this->getArgValue('page') !== null) {
|
||||||
return $this->searchWithPagination($search, $pagination);
|
return $this->searchWithPagination($search, $pagination);
|
||||||
@@ -206,7 +206,7 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* @return array|mixed|\PropelObjectCollection
|
* @return array|mixed|\PropelObjectCollection
|
||||||
*/
|
*/
|
||||||
public function searchWithOffset(ModelCriteria $search)
|
protected function searchWithOffset(ModelCriteria $search)
|
||||||
{
|
{
|
||||||
if ($this->getArgValue('limit') >= 0) {
|
if ($this->getArgValue('limit') >= 0) {
|
||||||
$search->limit($this->getArgValue('limit'));
|
$search->limit($this->getArgValue('limit'));
|
||||||
@@ -222,7 +222,7 @@ abstract class BaseLoop
|
|||||||
*
|
*
|
||||||
* @return array|\PropelModelPager
|
* @return array|\PropelModelPager
|
||||||
*/
|
*/
|
||||||
public function searchWithPagination(ModelCriteria $search, &$pagination)
|
protected function searchWithPagination(ModelCriteria $search, &$pagination)
|
||||||
{
|
{
|
||||||
$pagination = $search->paginate($this->getArgValue('page'), $this->getArgValue('limit'));
|
$pagination = $search->paginate($this->getArgValue('page'), $this->getArgValue('limit'));
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ use Thelia\Type\BooleanOrBothType;
|
|||||||
* - current : current id is used if you are on a category page
|
* - current : current id is used if you are on a category page
|
||||||
* - not_empty : if value is 1, category and subcategories must have at least 1 product
|
* - not_empty : if value is 1, category and subcategories must have at least 1 product
|
||||||
* - visible : default 1, if you want category not visible put 0
|
* - visible : default 1, if you want category not visible put 0
|
||||||
* - order : all value available : 'alpha', 'alpha_reverse', 'manual' (default), 'manual-reverse', 'random'
|
* - order : all value available : 'alpha', 'alpha-reverse', 'manual' (default), 'manual-reverse', 'random'
|
||||||
* - exclude : all category id you want to exclude (as for id, an integer or a "string list" can be used)
|
* - exclude : all category id you want to exclude (as for id, an integer or a "string list" can be used)
|
||||||
*
|
*
|
||||||
* example :
|
* example :
|
||||||
@@ -77,7 +77,7 @@ class Category extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual-reverse', 'random'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random'))
|
||||||
),
|
),
|
||||||
'manual'
|
'manual'
|
||||||
),
|
),
|
||||||
@@ -130,7 +130,7 @@ class Category extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\CategoryI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "manual-reverse":
|
case "manual-reverse":
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class Content extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'random', 'given_id'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse', 'random', 'given_id'))
|
||||||
),
|
),
|
||||||
'alpha'
|
'alpha'
|
||||||
),
|
),
|
||||||
@@ -155,7 +155,7 @@ class Content extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "manual":
|
case "manual":
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Feature extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse'))
|
||||||
),
|
),
|
||||||
'manual'
|
'manual'
|
||||||
)
|
)
|
||||||
@@ -124,7 +124,7 @@ class Feature extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "manual":
|
case "manual":
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class FeatureAvailable extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse'))
|
||||||
),
|
),
|
||||||
'manual'
|
'manual'
|
||||||
)
|
)
|
||||||
@@ -100,7 +100,7 @@ class FeatureAvailable extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureAvI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "manual":
|
case "manual":
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class FeatureValue extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual_reverse'))
|
||||||
),
|
),
|
||||||
'manual'
|
'manual'
|
||||||
)
|
)
|
||||||
@@ -108,7 +108,7 @@ class FeatureValue extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FeatureI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "manual":
|
case "manual":
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class Folder extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual-reverse', 'random'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', 'manual', 'manual-reverse', 'random'))
|
||||||
),
|
),
|
||||||
'manual'
|
'manual'
|
||||||
),
|
),
|
||||||
@@ -113,7 +113,7 @@ class Folder extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "manual-reverse":
|
case "manual-reverse":
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class Product extends BaseLoop
|
|||||||
new Argument(
|
new Argument(
|
||||||
'order',
|
'order',
|
||||||
new TypeCollection(
|
new TypeCollection(
|
||||||
new Type\EnumListType(array('alpha', 'alpha_reverse', /*'min_price', 'max_price',*/ 'manual', 'manual_reverse', 'ref', /*'promo', 'new',*/ 'random', 'given_id'))
|
new Type\EnumListType(array('alpha', 'alpha-reverse', /*'min_price', 'max_price',*/ 'manual', 'manual_reverse', 'ref', /*'promo', 'new',*/ 'random', 'given_id'))
|
||||||
),
|
),
|
||||||
'alpha'
|
'alpha'
|
||||||
),
|
),
|
||||||
@@ -256,7 +256,7 @@ class Product extends BaseLoop
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
$search->addAscendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE);
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
case "alpha_reverse":
|
case "alpha-reverse":
|
||||||
$search->addDescendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE);
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\ProductI18nTableMap::TITLE);
|
||||||
break;
|
break;
|
||||||
/*case "min_price":
|
/*case "min_price":
|
||||||
|
|||||||
@@ -44,24 +44,26 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testCacheClear()
|
public function testCacheClear()
|
||||||
{
|
{
|
||||||
$application = new Application($this->getKernel());
|
// Fails on windows - do not execute this test on windows
|
||||||
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
|
$application = new Application($this->getKernel());
|
||||||
|
|
||||||
$cacheClear = new CacheClear();
|
$cacheClear = new CacheClear();
|
||||||
$cacheClear->setContainer($this->getContainer());
|
$cacheClear->setContainer($this->getContainer());
|
||||||
|
|
||||||
$application->add($cacheClear);
|
$application->add($cacheClear);
|
||||||
|
|
||||||
$command = $application->find("cache:clear");
|
$command = $application->find("cache:clear");
|
||||||
$commandTester = new CommandTester($command);
|
$commandTester = new CommandTester($command);
|
||||||
$commandTester->execute(array(
|
$commandTester->execute(array(
|
||||||
"command" => $command->getName(),
|
"command" => $command->getName(),
|
||||||
"--env" => "test"
|
"--env" => "test"
|
||||||
));
|
));
|
||||||
|
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
|
|
||||||
$this->assertFalse($fs->exists($this->cache_dir));
|
|
||||||
|
|
||||||
|
$this->assertFalse($fs->exists($this->cache_dir));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -69,22 +71,28 @@ class CacheClearTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testCacheClearWithoutWritePermission()
|
public function testCacheClearWithoutWritePermission()
|
||||||
{
|
{
|
||||||
$fs = new Filesystem();
|
// Fails on windows - mock this test on windows
|
||||||
$fs->chmod($this->cache_dir,0100);
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
|
$fs = new Filesystem();
|
||||||
|
$fs->chmod($this->cache_dir,0100);
|
||||||
|
|
||||||
$application = new Application($this->getKernel());
|
$application = new Application($this->getKernel());
|
||||||
|
|
||||||
$cacheClear = new CacheClear();
|
$cacheClear = new CacheClear();
|
||||||
$cacheClear->setContainer($this->getContainer());
|
$cacheClear->setContainer($this->getContainer());
|
||||||
|
|
||||||
$application->add($cacheClear);
|
$application->add($cacheClear);
|
||||||
|
|
||||||
$command = $application->find("cache:clear");
|
$command = $application->find("cache:clear");
|
||||||
$commandTester = new CommandTester($command);
|
$commandTester = new CommandTester($command);
|
||||||
$commandTester->execute(array(
|
$commandTester->execute(array(
|
||||||
"command" => $command->getName(),
|
"command" => $command->getName(),
|
||||||
"--env" => "test"
|
"--env" => "test"
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new \RuntimeException("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getKernel()
|
public function getKernel()
|
||||||
|
|||||||
@@ -19,3 +19,5 @@ Variables Config à initialiser:
|
|||||||
- password.length : longueur du mot de passe, défaut 4
|
- password.length : longueur du mot de passe, défaut 4
|
||||||
- form.secret : token csrf
|
- form.secret : token csrf
|
||||||
- verifyStock : vérification du stock lors du paiement/ajout au panier. Defaut 1
|
- verifyStock : vérification du stock lors du paiement/ajout au panier. Defaut 1
|
||||||
|
- default_images_quality_percent : qualité par défaut des images générées (0 à 100, défaut: 75).
|
||||||
|
- original_image_delivery_mode : mode de mise à disposition des images originales (full resolution) dans le cache. 'symlink' pour un lien symbolique, 'copy' pour une copie
|
||||||
@@ -7,6 +7,11 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`position`,`c
|
|||||||
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
|
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
|
||||||
('session_config.default', '1', 1, 1, NOW(), NOW()),
|
('session_config.default', '1', 1, 1, NOW(), NOW()),
|
||||||
('verifyStock', '1', 1, 0, NOW(), NOW());
|
('verifyStock', '1', 1, 0, NOW(), NOW());
|
||||||
|
('imagine_driver', 'gd', 1, 0, NOW(), NOW());
|
||||||
|
('default_images_quality_percent', '75', 1, 0, NOW(), NOW());
|
||||||
|
('original_image_delivery_mode', 'symlink', 1, 0, NOW(), NOW());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
|
INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
database:
|
|
||||||
connection:
|
|
||||||
driver: %DRIVER%
|
|
||||||
user: %USERNAME%
|
|
||||||
password: %PASSWORD%
|
|
||||||
dsn: %DSN%
|
|
||||||
Reference in New Issue
Block a user