mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00
Fix latest merge
This commit is contained in:
@@ -15,8 +15,6 @@ class Version
|
|||||||
{
|
{
|
||||||
protected static $number = '3.9.0-alpha.9';
|
protected static $number = '3.9.0-alpha.9';
|
||||||
protected static $name = 'Epanterias';
|
protected static $name = 'Epanterias';
|
||||||
protected static $number = '3.8.3-alpha.1';
|
|
||||||
protected static $name = 'Diplodocus';
|
|
||||||
|
|
||||||
public static function getNumber()
|
public static function getNumber()
|
||||||
{
|
{
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Doctrine\ORM\Query\ResultSetMapping;
|
||||||
|
|
||||||
class patch_383alpha1a implements patchInterface
|
class patch_383alpha1a implements patchInterface
|
||||||
{
|
{
|
||||||
@@ -56,6 +57,10 @@ class patch_383alpha1a implements patchInterface
|
|||||||
*/
|
*/
|
||||||
public function apply(base $appbox, Application $app)
|
public function apply(base $appbox, Application $app)
|
||||||
{
|
{
|
||||||
|
if (!$this->hasSessionTable($app)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove deleted users sessions
|
// 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';
|
$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 = $appbox->get_connection()->prepare($sql);
|
||||||
@@ -81,4 +86,19 @@ class patch_383alpha1a implements patchInterface
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function hasSessionTable(Application $app)
|
||||||
|
{
|
||||||
|
$rsm = (new ResultSetMapping())->addScalarResult('Name', 'Name');
|
||||||
|
$ret = false;
|
||||||
|
|
||||||
|
foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) {
|
||||||
|
if ('Session' === $row['Name']) {
|
||||||
|
$ret = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user