Merge branch '3.8'

This commit is contained in:
Romain Neutron
2013-10-29 10:32:10 +01:00

View File

@@ -81,10 +81,8 @@ class patch_370a7 implements patchInterface
$this->truncateTable($app['EM'], 'Entities\\LazaretFile'); $this->truncateTable($app['EM'], 'Entities\\LazaretFile');
$this->truncateTable($app['EM'], 'Entities\\LazaretSession'); $this->truncateTable($app['EM'], 'Entities\\LazaretSession');
// suspend auto-commit $i = 0;
$app['EM']->getConnection()->beginTransaction();
try {
foreach ($rs as $row) { foreach ($rs as $row) {
$filePath = $app['root.path'] . '/tmp/lazaret/' . $row['filepath']; $filePath = $app['root.path'] . '/tmp/lazaret/' . $row['filepath'];
@@ -137,14 +135,16 @@ class patch_370a7 implements patchInterface
$lazaretFile->setSession($lazaretSession); $lazaretFile->setSession($lazaretSession);
$app['EM']->persist($lazaretFile); $app['EM']->persist($lazaretFile);
if (0 === ++$i % 100) {
$app['EM']->flush();
$app['EM']->clear();
}
} }
} }
$app['EM']->flush(); $app['EM']->flush();
} catch (\Exception $e) { $app['EM']->clear();
$app['EM']->getConnection()->rollback();
$app['EM']->close();
}
$stmt->closeCursor(); $stmt->closeCursor();