Skip to content
Snippets Groups Projects
Commit 8fae188f authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #71738 : guard memory comsuption of patch 337

parent afe8b4d6
2 merge requests!2511dev #71738 : guard memory comsuption of patch 337,!2509Dev#71738 check sql patch
Pipeline #3506 passed with stage
in 28 minutes and 45 seconds
- ticket #71738 : Système : Amélioration des performances du patch SQL 337
\ No newline at end of file
......@@ -20,26 +20,35 @@
*/
class Class_Migration_AlbumEditorToNotes {
use Trait_MemoryCleaner;
public function run() {
try {
$albums = Class_Album::findAllBy(['where' => 'editeur is not null and editeur != ""']);
while($albums = Class_Album::findAllBy(['where' => 'editeur is not null and editeur != ""',
'limit' => 1000]))
$this->_migratePage($albums);
} catch (Exception $e) {
return;
}
}
foreach($albums as $album) {
protected function _migratePage($albums) {
foreach($albums as $album)
$this->_migrateEditor($album);
}
$this->_cleanMemory();
}
protected function _migrateEditor($album) {
$editors = $album->getEditors();
if (in_array($album->getEditeur(), $editors))
return;
if (!in_array($album->getEditeur(), $editors))
$album->addEditor($album->getEditeur());
$album
->addEditor($album->getEditeur())
->setEditeur(null)
->save();
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment