diff --git a/VERSIONS b/VERSIONS index d5c8b4305e15895904d3b3ff604edb1812f149e0..6c894c5cf78367be463530dbdc6a0aa89490d812 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,9 @@ +14/05/2019 - v8.0.15 + + - ticket #88956 : Arte VOD : Amélioration du script de mise à jour des auteurs + + + 13/05/2019 - v8.0.14 - ticket #88526 : SIGB Nanook : possibilité d'accéder directement à une notice Bokeh depuis Nanook diff --git a/library/Class/Migration/ArteVODAuthorsOrder.php b/library/Class/Migration/ArteVODAuthorsOrder.php index d6ce62fc7b93129a0b17a478ff5044482775ec35..4b3a201519e83b62de9cec60b9f3e73c948ff24d 100644 --- a/library/Class/Migration/ArteVODAuthorsOrder.php +++ b/library/Class/Migration/ArteVODAuthorsOrder.php @@ -21,6 +21,33 @@ class Class_Migration_ArteVODAuthorsOrder { + use Trait_MemoryCleaner; + + public function updateAuthorsForAllAlbums($closure=null) { + try { + $page = 0; + while($albums = Class_Album::findAllBy(['type_doc_id' => Class_TypeDoc::ARTEVOD, + 'order' => 'id', + 'limitPage' => [$page, 500]])) { + $this->_runPage($albums, $closure); + $this->_cleanMemory(); + $page++; + } + } catch(Exception $e) { + return; + } + } + + + protected function _runPage($albums, $closure) { + foreach($albums as $album) { + $this->updateAuthors($album); + if ($closure) + $closure($album); + } + } + + public function updateAuthors($album) { $old_authors = new Storm_Collection($album->getAuthors()); $album->getMarc()->clearZone('701'); @@ -36,15 +63,6 @@ class Class_Migration_ArteVODAuthorsOrder { } - public function updateAuthorsForAllAlbums($closure=null) { - foreach(Class_Album::findAllBy(['type_doc_id' => Class_TypeDoc::ARTEVOD]) as $album) { - $this->updateAuthors($album); - if ($closure) - $closure($album); - } - } - - protected function addAuthorsTo($authors, $closure, $album) { $authors->select($closure) ->eachDo(function ($author) use ($album) diff --git a/library/startup.php b/library/startup.php index f0b046e1a6f74c09d1e90a5270838078ba5cd7d3..a65eb94e1c989541fd54e8dbef5183fc7a60a110 100644 --- a/library/startup.php +++ b/library/startup.php @@ -81,7 +81,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','8.0'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.14'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.15'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/tests/library/Class/Migration/ArteVODAuthorsOrderTest.php b/tests/library/Class/Migration/ArteVODAuthorsOrderTest.php index 17bbe703a4416452724f748102fc91dd7fbfcef7..1d326c665a7183ca75ba077738ffc9e1a2738482 100644 --- a/tests/library/Class/Migration/ArteVODAuthorsOrderTest.php +++ b/tests/library/Class/Migration/ArteVODAuthorsOrderTest.php @@ -54,7 +54,10 @@ class ArteVodLinkUpdateAuthorTest extends ModelTestCase { ->setExternalUri("http://artevod/comme-elle-respire") ->beValidated() ->save(); - (new Class_Migration_ArteVODAuthorsOrder())->updateAuthorsForAllAlbums(); + + (new Class_Migration_ArteVODAuthorsOrder()) + ->setMemoryCleaner(function() {}) + ->updateAuthorsForAllAlbums(); }