From 1472f96e933ff4e0b2fe7e80e377682852641445 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 28 Nov 2013 13:24:51 +0100 Subject: [PATCH 1/4] Fix #736 : Re-inject phraseanet rights after collection creation in case of PhraseaEngine --- .../Phrasea/Command/CreateCollection.php | 4 ++ .../Phrasea/Controller/Admin/Databox.php | 4 ++ lib/Alchemy/Phrasea/Controller/Root/Login.php | 2 - .../Core/Event/CollectionCreateEvent.php | 32 +++++++++ lib/Alchemy/Phrasea/Core/PhraseaEvents.php | 2 + .../Provider/SearchEngineServiceProvider.php | 30 +++++--- .../SearchEngine/Phrasea/PhraseaEngine.php | 10 +++ .../Phrasea/PhraseaEngineSubscriber.php | 72 +++++++++++++++++++ .../SearchEngine/SearchEngineInterface.php | 8 +++ .../SphinxSearch/SphinxSearchEngine.php | 11 +++ .../SphinxSearchEngineSubscriber.php | 22 ++++++ .../SearchEngine/PhraseaEngineTest.php | 1 + .../SearchEngine/SearchEngineAbstractTest.php | 7 ++ .../SearchEngine/SphinxSearchEngineTest.php | 1 + 14 files changed, 196 insertions(+), 10 deletions(-) create mode 100644 lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php create mode 100644 lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php create mode 100644 lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngineSubscriber.php diff --git a/lib/Alchemy/Phrasea/Command/CreateCollection.php b/lib/Alchemy/Phrasea/Command/CreateCollection.php index 89d6f7ce22..45eac86624 100644 --- a/lib/Alchemy/Phrasea/Command/CreateCollection.php +++ b/lib/Alchemy/Phrasea/Command/CreateCollection.php @@ -12,6 +12,8 @@ namespace Alchemy\Phrasea\Command; use Alchemy\Phrasea\Command\Command; +use Alchemy\Phrasea\Core\Event\CollectionCreateEvent; +use Alchemy\Phrasea\Core\PhraseaEvents; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; @@ -65,5 +67,7 @@ class CreateCollection extends Command } \User_Adapter::reset_sys_admins_rights($this->container); + + $this->container['dispatcher']->dispatch(PhraseaEvents::COLLECTION_CREATE, new CollectionCreateEvent($new_collection)); } } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php index 501ea5a4bb..791570cb9a 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php @@ -11,6 +11,8 @@ namespace Alchemy\Phrasea\Controller\Admin; +use Alchemy\Phrasea\Core\Event\CollectionCreateEvent; +use Alchemy\Phrasea\Core\PhraseaEvents; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; @@ -1058,6 +1060,8 @@ class Databox implements ControllerProviderInterface } } + $app['dispatcher']->dispatch(PhraseaEvents::COLLECTION_CREATE, new CollectionCreateEvent($collection)); + return $app->redirectPath('admin_display_collection', array('bas_id' => $collection->get_base_id(), 'success' => 1, 'reload-tree' => 1)); } catch (\Exception $e) { return $app->redirectPath('admin_database_submit_collection', array('databox_id' => $databox_id, 'error' => 'error')); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index 9b255c5e3e..bf4ec4b613 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -1034,8 +1034,6 @@ class Login implements ControllerProviderInterface $response = $this->generateAuthResponse($app, $app['browser'], $request->request->get('redirect')); $response->headers->clearCookie('invite-usr-id'); - $user->ACL()->inject_rights(); - if ($request->cookies->has('postlog') && $request->cookies->get('postlog') == '1') { if (!$user->is_guest() && $request->cookies->has('invite-usr_id')) { if ($user->get_id() != $inviteUsrId = $request->cookies->get('invite-usr_id')) { diff --git a/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php b/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php new file mode 100644 index 0000000000..29918de41d --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php @@ -0,0 +1,32 @@ +collection = $collection; + } + + public function getCollection() + { + return $this->collection; + } +} diff --git a/lib/Alchemy/Phrasea/Core/PhraseaEvents.php b/lib/Alchemy/Phrasea/Core/PhraseaEvents.php index 46e2b8ac48..32390cadad 100644 --- a/lib/Alchemy/Phrasea/Core/PhraseaEvents.php +++ b/lib/Alchemy/Phrasea/Core/PhraseaEvents.php @@ -23,4 +23,6 @@ final class PhraseaEvents const API_LOAD_START = 'api.load.start'; const API_LOAD_END = 'api.load.end'; const API_RESULT = 'api.result'; + + const COLLECTION_CREATE = 'collection.create'; } diff --git a/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php index f33aa3df0c..e2dc672a4d 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/SearchEngineServiceProvider.php @@ -23,24 +23,38 @@ class SearchEngineServiceProvider implements ServiceProviderInterface public function register(Application $app) { $app['phraseanet.SE'] = $app->share(function ($app) { - - $engineClass = $app['phraseanet.configuration']['main']['search-engine']['type']; $engineOptions = $app['phraseanet.configuration']['main']['search-engine']['options']; - if (!class_exists($engineClass) || $engineClass instanceof SearchEngineInterface) { - throw new InvalidArgumentException(sprintf('%s is not valid SearchEngineInterface', $engineClass)); - } - - return $engineClass::create($app, $engineOptions); + return $app['phraseanet.SE.engine-class']::create($app, $engineOptions); }); $app['phraseanet.SE.logger'] = $app->share(function (Application $app) { return new SearchEngineLogger($app); }); + + $app['phraseanet.SE.engine-class'] = $app->share(function ($app) { + $engineClass = $app['phraseanet.configuration']['main']['search-engine']['type']; + + if (!class_exists($engineClass) || $engineClass instanceof SearchEngineInterface) { + throw new InvalidArgumentException(sprintf('%s is not valid SearchEngineInterface', $engineClass)); + } + + return $engineClass; + }); + + $app['phraseanet.SE.subscriber'] = $app->share(function ($app) { + return $app['phraseanet.SE.engine-class']::createSubscriber($app); + }); } public function boot(Application $app) { - } + $app['dispatcher'] = $app->share( + $app->extend('dispatcher', function ($dispatcher, Application $app) { + $dispatcher->addSubscriber($app['phraseanet.SE.subscriber']); + return $dispatcher; + }) + ); + } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index aed8517cc3..c846f67c35 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -506,6 +506,16 @@ class PhraseaEngine implements SearchEngineInterface return $html ; } + /** + * {@inheritdoc} + * + * @return PhraseaEngineSubscriber + */ + public static function createSubscriber(Application $app) + { + return new PhraseaEngineSubscriber($app); + } + /** * {@inheritdoc} * diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php new file mode 100644 index 0000000000..a1a1c79b5b --- /dev/null +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php @@ -0,0 +1,72 @@ +app = $app; + } + + public function onAuthenticate(PostAuthenticate $event) + { + $event->getUser()->ACL()->inject_rights(); + } + + public function onCollectionCreate(CollectionCreateEvent $event) + { + $sql = 'SELECT u.usr_id, c.session_id + FROM (usr u, Sessions s, basusr b) + LEFT JOIN cache c ON (c.usr_id = u.usr_id) + WHERE u.model_of = 0 AND u.usr_login NOT LIKE "(#deleted%" + AND b.base_id = :base_id AND b.usr_id = u.usr_id AND b.actif=1 + AND s.usr_id = u.usr_id'; + + $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); + $stmt->execute(array(':base_id' => $event->getCollection()->get_base_id())); + $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + $initialized = false; + + foreach ($rows as $row) { + $user = \User_Adapter::getInstance($row['usr_id'], $this->app); + $user->ACL()->inject_rights(); + if (null !== $row['session_id']) { + if (!$initialized) { + $this->app['phraseanet.SE']->initialize(); + $initialized = true; + } + phrasea_clear_cache($row['session_id']); + phrasea_close_session($row['session_id']); + } + } + } + + public static function getSubscribedEvents() + { + return array( + PhraseaEvents::POST_AUTHENTICATE => array('onAuthenticate', 0), + PhraseaEvents::COLLECTION_CREATE => array('onCollectionCreate', 0), + ); + } +} diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php index e1d9171ae3..684fcaa630 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php @@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Alchemy\Phrasea\SearchEngine\SearchEngineResult; use Alchemy\Phrasea\Exception\RuntimeException; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Doctrine\Common\Collections\ArrayCollection; interface SearchEngineInterface @@ -231,6 +232,13 @@ interface SearchEngineInterface */ public function clearAllCache(\DateTime $date = null); + /** + * Returns a subscriber + * + * @return EventSubscriberInterface + */ + public static function createSubscriber(Application $app); + /** * Creates the adapter. * diff --git a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php index d10be055d9..5bbaa21f23 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php @@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\SearchEngine\SphinxSearch; use Alchemy\Phrasea\Application; +use Alchemy\Phrasea\SearchEngine\Phrasea\SphinxSearchEngineSubscriber; use Alchemy\Phrasea\SearchEngine\SearchEngineInterface; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Alchemy\Phrasea\SearchEngine\SearchEngineResult; @@ -572,6 +573,16 @@ class SphinxSearchEngine implements SearchEngineInterface return $this; } + /** + * {@inheritdoc} + * + * @return SphinxSearchEngineSubscriber + */ + public static function createSubscriber(Application $app) + { + return new SphinxSearchEngineSubscriber(); + } + /** * {@inheritdoc} * diff --git a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngineSubscriber.php b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngineSubscriber.php new file mode 100644 index 0000000000..3c0ebcb921 --- /dev/null +++ b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngineSubscriber.php @@ -0,0 +1,22 @@ +assertInstanceOf('Symfony\Component\EventDispatcher\EventSubscriberInterface', $classname::createSubscriber(self::$DI['app'])); + } + abstract public function initialize(); abstract public function testAutocomplete(); diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php index fa4f196b72..19fb9595cd 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php @@ -74,6 +74,7 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest self::$searchd->run(); self::$searchEngine = SphinxSearchEngine::create($app, $app['phraseanet.configuration']['main']['search-engine']['options']); + self::$searchEngineClass = 'Alchemy\Phrasea\SearchEngine\SphinxSearch\SphinxSearchEngine'; } public function setUp() From fd83ba07cb51c1b6ecdbddcf4454d5c03173a0b5 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 2 Dec 2013 17:47:50 +0100 Subject: [PATCH 2/4] Fix #1591 : Fix subdef group/name parameter extraction --- lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php index bbc8aa7a40..b02b4989fa 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Subdefs.php @@ -61,7 +61,7 @@ class Subdefs implements ControllerProviderInterface if ($delete_subdef) { - $delete_subef = explode('_', $delete_subdef); + $delete_subef = explode('_', $delete_subdef, 2); $group = $delete_subef[0]; $name = $delete_subef[1]; $subdefs = $databox->get_subdef_structure(); @@ -83,10 +83,10 @@ class Subdefs implements ControllerProviderInterface $options = array(); - $post_sub_ex = explode('_', $post_sub); + $post_sub_ex = explode('_', $post_sub, 2); - $group = array_shift($post_sub_ex); - $name = implode('_', $post_sub_ex); + $group = $post_sub_ex[0]; + $name = $post_sub_ex[1]; $class = $request->request->get($post_sub . '_class'); $downloadable = $request->request->get($post_sub . '_downloadable'); From 8729bb094f127163432cedece1abdbc5a9c6bc72 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 2 Dec 2013 18:07:48 +0100 Subject: [PATCH 3/4] Fix #1602 : Use localisation for datepicker placeholder --- templates/web/prod/index.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig index fdd7f139b4..3ec6c17538 100644 --- a/templates/web/prod/index.html.twig +++ b/templates/web/prod/index.html.twig @@ -423,14 +423,14 @@
- +
{% trans 'phraseanet::time:: a' %}
- +
From 7904a33e076a8b331fa86cc07b1aaeeec0e77ee6 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 3 Dec 2013 21:01:43 +0100 Subject: [PATCH 4/4] Fix CS --- .../Phrasea/Core/Event/CollectionCreateEvent.php | 3 --- .../Phrasea/PhraseaEngineSubscriber.php | 1 - lib/Doctrine/Entities/AuthFailure.php | 2 -- lib/Doctrine/Entities/LazaretAttribute.php | 2 -- lib/Doctrine/Entities/LazaretCheck.php | 2 -- lib/Doctrine/Entities/SessionModule.php | 2 -- lib/Doctrine/Entities/UsrList.php | 2 +- lib/Doctrine/Entities/ValidationData.php | 2 -- lib/Doctrine/Repositories/BasketRepository.php | 4 ++-- .../Repositories/LazaretFileRepository.php | 2 +- lib/Doctrine/Repositories/StoryWZRepository.php | 2 +- lib/classes/module/console/checkExtension.php | 16 ++++------------ lib/conf.d/Doctrine/Entities.Session.dcm.yml | 2 +- lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml | 5 ----- lib/conf.d/Doctrine/Entities.UsrList.dcm.yml | 2 -- .../Doctrine/Entities.UsrListEntry.dcm.yml | 2 -- .../Doctrine/Entities.UsrListOwner.dcm.yml | 3 --- .../Doctrine/Entities.ValidationSession.dcm.yml | 4 ---- .../PhraseaFixture/Basket/LoadFiveBaskets.php | 2 +- lib/conf.d/plugins/commands.php | 1 - lib/conf.d/plugins/services.php | 1 - 21 files changed, 11 insertions(+), 51 deletions(-) diff --git a/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php b/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php index 29918de41d..9a5d44a1c8 100644 --- a/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/CollectionCreateEvent.php @@ -11,9 +11,6 @@ namespace Alchemy\Phrasea\Core\Event; -use Alchemy\Phrasea\Authentication\Context; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\EventDispatcher\Event as SfEvent; class CollectionCreateEvent extends SfEvent diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php index a1a1c79b5b..bbdd71deb5 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineSubscriber.php @@ -15,7 +15,6 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Event\CollectionCreateEvent; use Alchemy\Phrasea\Core\Event\PostAuthenticate; use Alchemy\Phrasea\Core\PhraseaEvents; -use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class PhraseaEngineSubscriber implements EventSubscriberInterface diff --git a/lib/Doctrine/Entities/AuthFailure.php b/lib/Doctrine/Entities/AuthFailure.php index b2121eee59..669d7a7d50 100644 --- a/lib/Doctrine/Entities/AuthFailure.php +++ b/lib/Doctrine/Entities/AuthFailure.php @@ -11,8 +11,6 @@ namespace Entities; -use Doctrine\ORM\Mapping as ORM; - /** * AuthFailure */ diff --git a/lib/Doctrine/Entities/LazaretAttribute.php b/lib/Doctrine/Entities/LazaretAttribute.php index 0484aa0df1..441e17ede9 100644 --- a/lib/Doctrine/Entities/LazaretAttribute.php +++ b/lib/Doctrine/Entities/LazaretAttribute.php @@ -11,8 +11,6 @@ namespace Entities; -use Alchemy\Phrasea\Application; - /** * LazaretAttribute */ diff --git a/lib/Doctrine/Entities/LazaretCheck.php b/lib/Doctrine/Entities/LazaretCheck.php index 4de1fd2c2e..3d1518f4c7 100644 --- a/lib/Doctrine/Entities/LazaretCheck.php +++ b/lib/Doctrine/Entities/LazaretCheck.php @@ -11,8 +11,6 @@ namespace Entities; -use Alchemy\Phrasea\Application; - /** * LazaretCheck */ diff --git a/lib/Doctrine/Entities/SessionModule.php b/lib/Doctrine/Entities/SessionModule.php index 4422fa6ede..b5e26b5820 100644 --- a/lib/Doctrine/Entities/SessionModule.php +++ b/lib/Doctrine/Entities/SessionModule.php @@ -11,8 +11,6 @@ namespace Entities; -use Alchemy\Phrasea\Application; - /** * SessionModule */ diff --git a/lib/Doctrine/Entities/UsrList.php b/lib/Doctrine/Entities/UsrList.php index 06dd1e7d98..8af2208937 100644 --- a/lib/Doctrine/Entities/UsrList.php +++ b/lib/Doctrine/Entities/UsrList.php @@ -238,7 +238,7 @@ class UsrList public function has(\User_Adapter $user, Application $app) { return $this->entries->exists( - function($key, $entry) use ($user, $app) { + function ($key, $entry) use ($user, $app) { return $entry->getUser($app)->get_id() === $user->get_id(); } ); diff --git a/lib/Doctrine/Entities/ValidationData.php b/lib/Doctrine/Entities/ValidationData.php index 64474e687c..6f503a1e3e 100644 --- a/lib/Doctrine/Entities/ValidationData.php +++ b/lib/Doctrine/Entities/ValidationData.php @@ -11,8 +11,6 @@ namespace Entities; -use Alchemy\Phrasea\Application; - /** * ValidationData */ diff --git a/lib/Doctrine/Repositories/BasketRepository.php b/lib/Doctrine/Repositories/BasketRepository.php index 395314a79e..4e89ab620e 100644 --- a/lib/Doctrine/Repositories/BasketRepository.php +++ b/lib/Doctrine/Repositories/BasketRepository.php @@ -124,8 +124,8 @@ class BasketRepository extends EntityRepository * * @throws NotFoundHttpException * @throws AccessDeniedHttpException - * @param type $basket_id - * @param \User_Adapter $user + * @param type $basket_id + * @param \User_Adapter $user * @return \Entities\Basket */ public function findUserBasket(Application $app, $basket_id, \User_Adapter $user, $requireOwner) diff --git a/lib/Doctrine/Repositories/LazaretFileRepository.php b/lib/Doctrine/Repositories/LazaretFileRepository.php index 237c4b98fa..7651642dfa 100644 --- a/lib/Doctrine/Repositories/LazaretFileRepository.php +++ b/lib/Doctrine/Repositories/LazaretFileRepository.php @@ -15,7 +15,7 @@ class LazaretFileRepository extends EntityRepository public function findPerPage(array $base_ids, $offset = 0, $perPage = 10) { - $base_ids = implode(', ', array_map(function($int) { + $base_ids = implode(', ', array_map(function ($int) { return (int) $int; }, $base_ids)); diff --git a/lib/Doctrine/Repositories/StoryWZRepository.php b/lib/Doctrine/Repositories/StoryWZRepository.php index a0f5ddd1d0..d104c8f73e 100644 --- a/lib/Doctrine/Repositories/StoryWZRepository.php +++ b/lib/Doctrine/Repositories/StoryWZRepository.php @@ -46,7 +46,7 @@ class StoryWZRepository extends EntityRepository $sortedStories[] = $story->getRecord($app)->get_title(); } - uasort($sortedStories, function($a, $b) { + uasort($sortedStories, function ($a, $b) { if ($a == $b) { return 0; } diff --git a/lib/classes/module/console/checkExtension.php b/lib/classes/module/console/checkExtension.php index 326aa16434..13c6c306d3 100644 --- a/lib/classes/module/console/checkExtension.php +++ b/lib/classes/module/console/checkExtension.php @@ -202,11 +202,9 @@ class module_console_checkExtension extends Command return 1; } - // test disconnected mode if available // prepare the test before closing session - if(function_exists("phrasea_public_query")) - { + if (function_exists("phrasea_public_query")) { // fill an array for each sbas to query $tbases = array(); foreach ($phSession["bases"] as $phbase) { @@ -231,7 +229,6 @@ class module_console_checkExtension extends Command } } - $output->writeln("\n-- phrasea_close_session --"); $rs = phrasea_close_session($sessid); @@ -244,11 +241,8 @@ class module_console_checkExtension extends Command return 1; } - - // session is closed, test disconnected mode if available - if(function_exists("phrasea_public_query")) - { + if (function_exists("phrasea_public_query")) { $output->writeln("\n-- phrasea_public_query(...0, 5,...) --"); $ret = phrasea_public_query( @@ -262,7 +256,7 @@ class module_console_checkExtension extends Command , true // verbose output (chrono, sql...) ); - if(is_array($ret) && array_key_exists("results", $ret) && is_array($ret["results"])) { + if (is_array($ret) && array_key_exists("results", $ret) && is_array($ret["results"])) { $output->writeln( sprintf("Succes ! returned %d answers", count($ret["results"])) ); } else { $output->writeln("Failed ! "); @@ -270,9 +264,7 @@ class module_console_checkExtension extends Command return 1; } - - foreach($ret['results'] as $result) - { + foreach ($ret['results'] as $result) { $sbid = $result["sbid"]; $rid = $result["rid"]; $q = $tbases["S".$sbid]["arrayq"]; // query tree diff --git a/lib/conf.d/Doctrine/Entities.Session.dcm.yml b/lib/conf.d/Doctrine/Entities.Session.dcm.yml index cd93bcb07d..3e6b7cec81 100644 --- a/lib/conf.d/Doctrine/Entities.Session.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.Session.dcm.yml @@ -63,4 +63,4 @@ Entities\Session: mappedBy: session cascade: ["ALL"] orderBy: - module_id: ASC \ No newline at end of file + module_id: ASC diff --git a/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml b/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml index fd82c27ebc..0623697180 100644 --- a/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.StoryWZ.dcm.yml @@ -22,8 +22,3 @@ Entities\StoryWZ: gedmo: timestampable: on: create - - - - - diff --git a/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml b/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml index 6eb3597d9e..07c28376a1 100644 --- a/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.UsrList.dcm.yml @@ -29,5 +29,3 @@ Entities\UsrList: targetEntity: UsrListEntry mappedBy: list cascade: ["ALL"] - - diff --git a/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml b/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml index a9bab397a9..1ce3439cb0 100644 --- a/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.UsrListEntry.dcm.yml @@ -31,5 +31,3 @@ Entities\UsrListEntry: name: list_id referencedColumnName: id cascade: ["persist"] - - diff --git a/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml b/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml index 9fb72bc084..6a94728351 100644 --- a/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.UsrListOwner.dcm.yml @@ -33,6 +33,3 @@ Entities\UsrListOwner: name: list_id referencedColumnName: id cascade: ["persist"] - - - diff --git a/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml b/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml index 1c3c901c27..bb30a30a52 100644 --- a/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml +++ b/lib/conf.d/Doctrine/Entities.ValidationSession.dcm.yml @@ -35,7 +35,3 @@ Entities\ValidationSession: targetEntity: ValidationParticipant mappedBy: session cascade: ["ALL"] - - - - diff --git a/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php b/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php index 882a051118..5431aeb40f 100644 --- a/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php +++ b/lib/conf.d/PhraseaFixture/Basket/LoadFiveBaskets.php @@ -29,7 +29,7 @@ class LoadFiveBaskets extends \PhraseaFixture\AbstractWZ implements FixtureInter public function load(ObjectManager $manager) { - for ($i = 0; $i < 5; $i ++ ) { + for ($i = 0; $i < 5; $i ++) { $basket = new \Entities\Basket(); $basket->setName('test ' . $i); diff --git a/lib/conf.d/plugins/commands.php b/lib/conf.d/plugins/commands.php index 1e38b339db..2b98740306 100644 --- a/lib/conf.d/plugins/commands.php +++ b/lib/conf.d/plugins/commands.php @@ -6,6 +6,5 @@ use Alchemy\Phrasea\CLI; return call_user_func(function (CLI $cli) { - return $cli; }, $cli); diff --git a/lib/conf.d/plugins/services.php b/lib/conf.d/plugins/services.php index e1edd7ca84..f0cb0b4f90 100644 --- a/lib/conf.d/plugins/services.php +++ b/lib/conf.d/plugins/services.php @@ -6,6 +6,5 @@ use Alchemy\Phrasea\Application; return call_user_func(function (Application $app) { - return $app; }, $app);