mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge branch '3.8'
Conflicts: composer.json composer.lock lib/Alchemy/Phrasea/Core/Version.php lib/Doctrine/Repositories/SessionRepository.php lib/classes/User/Adapter.php
This commit is contained in:
@@ -22,7 +22,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",
|
||||
"mrclay/minify" : "~2.1.6",
|
||||
"neutron/process-manager" : "~1.0",
|
||||
@@ -31,6 +31,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.1.x-dev@dev",
|
||||
|
16
composer.lock
generated
16
composer.lock
generated
@@ -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": "daac732f5ff830bcaf81da6ecf16f9e2",
|
||||
"hash": "c8348e356ce79bc133510a11279d48c9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alchemy-fr/tcpdf-clone",
|
||||
@@ -1574,26 +1574,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",
|
||||
@@ -1643,7 +1643,7 @@
|
||||
"video",
|
||||
"video processing"
|
||||
],
|
||||
"time": "2013-10-21 12:41:18"
|
||||
"time": "2013-12-03 17:07:51"
|
||||
},
|
||||
{
|
||||
"name": "mediavorus/mediavorus",
|
||||
|
@@ -15,6 +15,8 @@ class Version
|
||||
{
|
||||
protected static $number = '3.9.0-alpha.9';
|
||||
protected static $name = 'Epanterias';
|
||||
protected static $number = '3.8.3-alpha.1';
|
||||
protected static $name = 'Diplodocus';
|
||||
|
||||
public static function getNumber()
|
||||
{
|
||||
|
26
lib/Doctrine/Repositories/SessionRepository.php
Normal file
26
lib/Doctrine/Repositories/SessionRepository.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Repositories;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
* SessionRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class SessionRepository extends EntityRepository
|
||||
{
|
||||
public function findByUser(\User_Adapter $user)
|
||||
{
|
||||
$dql = 'SELECT s
|
||||
FROM Alchemy\Phrasea\Model\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();
|
||||
}
|
||||
}
|
@@ -751,6 +751,12 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
||||
$this->app['EM']->remove($order);
|
||||
}
|
||||
|
||||
$repo = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\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
|
||||
|
84
lib/classes/patch/383alpha1a.php
Normal file
84
lib/classes/patch/383alpha1a.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class patch_383alpha1a implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '3.8.3-alpha.1';
|
||||
|
||||
/** @var array */
|
||||
private $concern = array(base::APPLICATION_BOX);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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('Alchemy\Phrasea\Model\Entities\Session', $row['id'])) {
|
||||
$app['EM']->remove($session);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove API sessions
|
||||
$query = $app['EM']->createQuery('SELECT s FROM Alchemy\Phrasea\Model\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;
|
||||
}
|
||||
}
|
@@ -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 \Alchemy\Phrasea\Model\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('Alchemy\Phrasea\Model\Entities\Session');
|
||||
$this->assertCount(0, $repo->findByUser($user));
|
||||
}
|
||||
|
||||
public function testGetPref()
|
||||
{
|
||||
$user = $this->get_user();
|
||||
|
Reference in New Issue
Block a user