mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 21:43:18 +00:00
Fix latest merge
This commit is contained in:
@@ -207,7 +207,7 @@ class IniReset extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln('Upgrading from v3.1 to v'.Version::getNumber());
|
$output->writeln('Upgrading from v3.1 to v'.Version::getNumber());
|
||||||
$cmd = 'php ' . __DIR__ . '/../../../../../bin/setup system:upgrade -y -f';
|
$cmd = 'php ' . __DIR__ . '/../../../../../bin/setup system:upgrade -y -f -v';
|
||||||
$process = new Process($cmd);
|
$process = new Process($cmd);
|
||||||
$process->run(function ($type, $buffer) {
|
$process->run(function ($type, $buffer) {
|
||||||
if ('err' === $type) {
|
if ('err' === $type) {
|
||||||
|
@@ -50,6 +50,16 @@ class UserRepository extends EntityRepository
|
|||||||
return $this->findOneBy(['login' => $login]);
|
return $this->findOneBy(['login' => $login]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds deleted users.
|
||||||
|
*
|
||||||
|
* @return User[]
|
||||||
|
*/
|
||||||
|
public function findDeleted()
|
||||||
|
{
|
||||||
|
return $this->findBy(['deleted' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a user by email.
|
* Finds a user by email.
|
||||||
*
|
*
|
||||||
|
@@ -58,23 +58,14 @@ class patch_386alpha4a implements patchInterface
|
|||||||
*/
|
*/
|
||||||
public function apply(base $appbox, Application $app)
|
public function apply(base $appbox, Application $app)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT usr_id FROM usr WHERE usr_login LIKE "(#deleted_%"';
|
$repo = $app['EM']->getRepository('Phraseanet:UsrList');
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
foreach ($app['EM']->getRepository('Phraseanet:User')->findDeleted() as $user) {
|
||||||
$stmt->execute();
|
foreach ($repo->findUserLists($user) as $list) {
|
||||||
|
|
||||||
$repo = $app['EM']->getRepository('Entities\UsrList');
|
|
||||||
|
|
||||||
$users = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
foreach ($users as $user) {
|
|
||||||
foreach ($repo->findUserLists(new \User_Adapter($user['usr_id'], $app)) as $list) {
|
|
||||||
$app['EM']->remove($list);
|
$app['EM']->remove($list);
|
||||||
}
|
}
|
||||||
$app['EM']->flush();
|
$app['EM']->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user