From 2fb720dab77c2cc1a3559d418723cf892e0f284a Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@afi-sa.fr> Date: Wed, 22 Oct 2014 10:58:45 +0200 Subject: [PATCH] hotline #17208 memory leak clear album cache after each import --- .../Cyberlibris/LivresNumeriquesReader.php | 4 ++-- .../BibNumerique/RessourceNumerique.php | 22 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php b/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php index 91db13fc46b..5705533f17f 100644 --- a/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php +++ b/library/Class/WebService/BibNumerique/Cyberlibris/LivresNumeriquesReader.php @@ -16,11 +16,11 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_WebService_BibNumerique_Cyberlibris_LivresNumeriquesReader extends Class_WebService_DublinCoreParser { +class Class_WebService_BibNumerique_Cyberlibris_LivresNumeriquesReader extends Class_WebService_DublinCoreParser { protected $_total_count; protected $_page_number; protected $_page_size; diff --git a/library/Class/WebService/BibNumerique/RessourceNumerique.php b/library/Class/WebService/BibNumerique/RessourceNumerique.php index e211706d78a..4b2d7581e90 100644 --- a/library/Class/WebService/BibNumerique/RessourceNumerique.php +++ b/library/Class/WebService/BibNumerique/RessourceNumerique.php @@ -16,11 +16,11 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_WebService_BibNumerique_RessourceNumerique { - + protected $_id; protected $_title; protected $_description; @@ -180,7 +180,7 @@ public function getPhotos() { return $this->_photos; } - + public function getMatieres() { return implode($this->_matieres,'::'); @@ -209,7 +209,7 @@ public function importMatieres($album) { $ids=[]; $indexation = new Class_Indexation(); - foreach ($this->_matieres as $matiere_libelle) { + foreach ($this->_matieres as $matiere_libelle) { if ( $matiere=Class_CodifMatiere::findFirstBy(['libelle' => $matiere_libelle])) { $ids[]=$matiere->getId(); continue; @@ -220,7 +220,7 @@ $matiere->setCodeAlpha($indexation->alphaMaj($matiere_libelle)); $matiere->save(); $ids[]=$matiere->getId(); - + } if ($ids) $album->setMatiere(implode(';',$ids)); @@ -240,7 +240,7 @@ ->setUrlOrigine($this->getBaseUrl()) ->setCategorie($categorie) ->setRessources($this->getRessources()); - + $this->importMatieres($album); @@ -252,6 +252,8 @@ if ($album->save()) Class_WebService_BibNumerique_Vignette::getInstance()->updateAlbum($album); + Class_Album::clearCache(); + Class_AlbumRessource::clearCache(); return $album; } @@ -263,7 +265,7 @@ ->findFirstBy(array('libelle' => $libelle, 'parent_id' => 0)); - if (null != $category) + if (null != $category) return $category; $category = Class_AlbumCategorie::newInstance(['libelle' => $libelle]); @@ -291,10 +293,10 @@ foreach ($this->_trailers as $url) $album->addTrailerUri($url); - + foreach ($this->_photos as $url) $album->addPhotoUri($url); - + $album->setExternalUri($this->getExternalUri()); return $this; } @@ -314,7 +316,7 @@ public function getRessourceCategorieLibelle(){} public function getBaseUrl() {} - + public function setOaiId($id) { if (!$id) -- GitLab