From b35bea771f261aef12f7af764f1124726ebb0d20 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 22 Mar 2012 15:22:41 +0100 Subject: [PATCH 1/2] Baskets cleanup --- lib/classes/patch/361.class.php | 100 ++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 lib/classes/patch/361.class.php diff --git a/lib/classes/patch/361.class.php b/lib/classes/patch/361.class.php new file mode 100644 index 0000000000..c8436161ad --- /dev/null +++ b/lib/classes/patch/361.class.php @@ -0,0 +1,100 @@ +release; + } + + public function require_all_upgrades() + { + return false; + } + + /** + * + * @return Array + */ + function concern() + { + return $this->concern; + } + + function apply(base &$appbox) + { + $Core = \bootstrap::getCore(); + + $em = $Core->getEntityManager(); + + $repository = $em->getRepository('\Entities\BasketElement'); + + foreach($repository->findAll() as $basketElement) + { + try + { + $basketElement->getRecord(); + } + catch(\Exception $e) + { + $em->remove($basketElement); + } + } + + + $em = $Core->getEntityManager(); + + $repository = $em->getRepository('\Entities\Basket'); + + foreach($repository->findAll() as $basket) + { + $htmlDesc = $basket->getDescription(); + + $description = trim(strip_tags(str_replace("
", "\n", $htmlDesc))); + + if($htmlDesc == $description) + { + continue; + } + + $basket->setDescription($description); + } + + $em->flush(); + + return true; + } + +} From 9a6d475f3b562426dc0dd3d99d9154e3de792d10 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Thu, 22 Mar 2012 15:23:14 +0100 Subject: [PATCH 2/2] Flushing the cache now empty the cache registry --- lib/Alchemy/Phrasea/Cache/Manager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Cache/Manager.php b/lib/Alchemy/Phrasea/Cache/Manager.php index be278499bd..a4ca420fad 100644 --- a/lib/Alchemy/Phrasea/Cache/Manager.php +++ b/lib/Alchemy/Phrasea/Cache/Manager.php @@ -48,7 +48,7 @@ class Manager $this->parser = new \Symfony\Component\Yaml\Yaml(); $this->core = $core; - $this->registry = $this->parser->parse($file); + $this->registry = $this->parser->parse($file) ? : array(); } protected function exists($name) @@ -63,6 +63,8 @@ class Manager $this->get($cacheKey, $service_name)->getDriver()->flush(); } + file_put_contents($this->cacheFile->getPathname(), ''); + return $this; }