From 900c62cb84689feef03bd4fe3d5f62f1c1cf12cb Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 2 Dec 2013 15:13:53 +0100 Subject: [PATCH 1/3] Fix #1598 #1599 : Fix support for portrait videos. --- composer.json | 3 ++- composer.lock | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 7891791d74..62e4127c57 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "jms/serializer" : "~0.10", "justinrainbow/json-schema" : "~1.3", "mediavorus/mediavorus" : "~0.4.0", - "media-alchemyst/media-alchemyst" : "~0.3.1", + "media-alchemyst/media-alchemyst" : "~0.4, >=0.4.3", "monolog/monolog" : "~1.3.0", "mrclay/minify" : "~2.1.6", "neutron/silex-imagine-provider" : "~0.1.0", @@ -29,6 +29,7 @@ "neutron/sphinxsearch-api" : "~2.0.6", "neutron/recaptcha" : "~0.1.0", "neutron/temporary-filesystem" : "~2.1", + "php-ffmpeg/php-ffmpeg" : "~0.4, >=0.4.3", "php-xpdf/php-xpdf" : "~0.2.1", "phpexiftool/phpexiftool" : "~0.3", "silex/silex" : "~1.0.0", diff --git a/composer.lock b/composer.lock index f3ec99fa71..5ea157f013 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "c86f3d5cef410e011d14c7ac9749c11e", + "hash": "329db4f5834432a8ebc2c25c3447381d", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -1434,26 +1434,26 @@ }, { "name": "media-alchemyst/media-alchemyst", - "version": "0.3.6", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/alchemy-fr/Media-Alchemyst.git", - "reference": "86a16aab82b6e31d2e70050f61fa815a98037253" + "reference": "319f55c2265a9056d68f1f0e6314dce977ef47ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/86a16aab82b6e31d2e70050f61fa815a98037253", - "reference": "86a16aab82b6e31d2e70050f61fa815a98037253", + "url": "https://api.github.com/repos/alchemy-fr/Media-Alchemyst/zipball/319f55c2265a9056d68f1f0e6314dce977ef47ef", + "reference": "319f55c2265a9056d68f1f0e6314dce977ef47ef", "shasum": "" }, "require": { "alchemy/ghostscript": "~0.4.0", "imagine/imagine": "0.6.x@dev", - "mediavorus/mediavorus": "~0.4.0", + "mediavorus/mediavorus": "~0.4.2", "monolog/monolog": "~1.0", "neutron/temporary-filesystem": "~2.1", "php": ">=5.3.3", - "php-ffmpeg/php-ffmpeg": "~0.3, >=0.3.4", + "php-ffmpeg/php-ffmpeg": "~0.4.2", "php-mp4box/php-mp4box": "~0.3.0", "php-unoconv/php-unoconv": "~0.3.0", "pimple/pimple": "~1.0", @@ -1503,20 +1503,20 @@ "video", "video processing" ], - "time": "2013-10-21 12:41:18" + "time": "2013-12-03 17:07:51" }, { "name": "mediavorus/mediavorus", - "version": "0.4.1", + "version": "0.4.2", "source": { "type": "git", "url": "https://github.com/romainneutron/MediaVorus.git", - "reference": "5d5c416353f48192f2202dd4be5c21d95f46b08d" + "reference": "b80ab6acd79f69b2040f7915e1393f08f68277fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/romainneutron/MediaVorus/zipball/5d5c416353f48192f2202dd4be5c21d95f46b08d", - "reference": "5d5c416353f48192f2202dd4be5c21d95f46b08d", + "url": "https://api.github.com/repos/romainneutron/MediaVorus/zipball/b80ab6acd79f69b2040f7915e1393f08f68277fc", + "reference": "b80ab6acd79f69b2040f7915e1393f08f68277fc", "shasum": "" }, "require": { @@ -1564,7 +1564,7 @@ "keywords": [ "metadata" ], - "time": "2013-10-21 12:36:49" + "time": "2013-11-28 16:41:54" }, { "name": "monolog/monolog", @@ -1887,16 +1887,16 @@ }, { "name": "php-ffmpeg/php-ffmpeg", - "version": "0.4.0", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/alchemy-fr/PHP-FFmpeg.git", - "reference": "0d82e5ad3cb50fd78882b5e15aaf57b39a274103" + "reference": "554cec2bc7b76e222aeef083205ed3bd57327975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alchemy-fr/PHP-FFmpeg/zipball/0d82e5ad3cb50fd78882b5e15aaf57b39a274103", - "reference": "0d82e5ad3cb50fd78882b5e15aaf57b39a274103", + "url": "https://api.github.com/repos/alchemy-fr/PHP-FFmpeg/zipball/554cec2bc7b76e222aeef083205ed3bd57327975", + "reference": "554cec2bc7b76e222aeef083205ed3bd57327975", "shasum": "" }, "require": { @@ -1952,7 +1952,7 @@ "video", "video processing" ], - "time": "2013-10-21 12:16:28" + "time": "2013-12-02 13:48:20" }, { "name": "php-mp4box/php-mp4box", From 7a8f77c569f79c321eea9749d084b56693e9fbe8 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 28 Nov 2013 10:47:02 +0100 Subject: [PATCH 2/3] Fix #1594 : Removed users are not disconnected --- .../Repositories/SessionRepository.php | 11 +++ lib/classes/User/Adapter.php | 6 ++ lib/classes/patch/383alpha1a.php | 76 +++++++++++++++++++ tests/classes/userTest.php | 23 ++++++ 4 files changed, 116 insertions(+) create mode 100644 lib/classes/patch/383alpha1a.php diff --git a/lib/Doctrine/Repositories/SessionRepository.php b/lib/Doctrine/Repositories/SessionRepository.php index 747d99d7f3..a801d1f51e 100644 --- a/lib/Doctrine/Repositories/SessionRepository.php +++ b/lib/Doctrine/Repositories/SessionRepository.php @@ -12,4 +12,15 @@ use Doctrine\ORM\EntityRepository; */ class SessionRepository extends EntityRepository { + public function findByUser(\User_Adapter $user) + { + $dql = 'SELECT s + FROM Entities\Session s + WHERE s.usr_id = :usr_id'; + + $query = $this->_em->createQuery($dql); + $query->setParameters(array('usr_id' => $user->get_id())); + + return $query->getResult(); + } } diff --git a/lib/classes/User/Adapter.php b/lib/classes/User/Adapter.php index 417282679b..d252a7dadd 100644 --- a/lib/classes/User/Adapter.php +++ b/lib/classes/User/Adapter.php @@ -974,6 +974,12 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $this->app['EM']->remove($provider); } + $repo = $this->app['EM']->getRepository('Entities\Session'); + + foreach ($repo->findByUser($this) as $session) { + $this->app['EM']->remove($session); + } + $this->app['EM']->flush(); $sql = 'UPDATE usr SET usr_login = :usr_login , usr_mail = null diff --git a/lib/classes/patch/383alpha1a.php b/lib/classes/patch/383alpha1a.php new file mode 100644 index 0000000000..0a3172ab95 --- /dev/null +++ b/lib/classes/patch/383alpha1a.php @@ -0,0 +1,76 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function apply(base $appbox, Application $app) + { + // Remove deleted users sessions + $sql = 'SELECT s.id FROM `Sessions` s, usr u WHERE u.usr_login LIKE "(#deleted%" AND u.usr_id = s.usr_id'; + $stmt = $appbox->get_connection()->prepare($sql); + $stmt->execute(); + $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); + + foreach ($rows as $row) { + if (null !== $session = $app['EM']->find('Entities\Session', $row['id'])) { + $app['EM']->remove($session); + } + } + + // Remove API sessions + $query = $app['EM']->createQuery('SELECT s FROM Entities\Session s WHERE s.user_agent LIKE :guzzle'); + $query->setParameter(':guzzle', 'Guzzle%'); + + foreach ($query->getResult() as $session) { + $app['EM']->remove($session); + } + + $app['EM']->flush(); + + return true; + } +} diff --git a/tests/classes/userTest.php b/tests/classes/userTest.php index eb747973c7..f831111205 100644 --- a/tests/classes/userTest.php +++ b/tests/classes/userTest.php @@ -49,6 +49,29 @@ class userTest extends PhraseanetPHPUnitAbstract $this->assertNull($repo->findWithProviderAndId('custom-one', 12345)); } + public function testDeleteSetMailToNullAndRemovesSessions() + { + try { + $usrId = \User_Adapter::get_usr_id_from_login(self::$DI['app'], 'test_phpunit_sessions'); + $user = \User_Adapter::getInstance($usrId, self::$DI['app']); + } catch (\Exception $e) { + $user = \User_Adapter::create(self::$DI['app'], 'test_phpunit_sessions', 'any', null, false); + } + + $session = new Entities\Session(); + $session + ->setUsrId($user->get_id()) + ->setUserAgent(''); + + self::$DI['app']['EM']->persist($session); + self::$DI['app']['EM']->flush(); + + $user->delete(); + + $repo = self::$DI['app']['EM']->getRepository('Entities\Session'); + $this->assertCount(0, $repo->findByUser($user)); + } + public function testGetPref() { $user = $this->get_user(); From 0a813a6440f7a92df3eea65762bb1d76c2fb869c Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 3 Dec 2013 18:22:00 +0100 Subject: [PATCH 3/3] Bump to version 3.8.3-alpha.1 --- lib/Alchemy/Phrasea/Core/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 3213aa14ff..1aa849b74b 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.8.3-alpha.0'; + protected static $number = '3.8.3-alpha.1'; protected static $name = 'Diplodocus'; public static function getNumber()