Skip to content
Snippets Groups Projects
Commit 23a4e61d authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

rel #21694 : PseudoRecords phase memory clean

parent 3b32b91c
4 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1120Master,!1071Dev #21694 stop delete notice,!1063Dev #21694 stop delete notice
<?php <?php
error_reporting(E_ERROR | E_PARSE); error_reporting(E_ERROR | E_PARSE);
define("PATCH_LEVEL","264"); define("PATCH_LEVEL","265");
define("APPLI","cosmogramme"); define("APPLI","cosmogramme");
define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs");
......
<?php
$adapter = Zend_Db_Table::getDefaultAdapter();
$adapter->query('ALTER TABLE `album` MODIFY `notice_id` int(11) null default null');
$adapter->query('UPDATE `album` SET `notice_id`=null WHERE `notice_id`=0');
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software * along with BOKEH; 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
*/ */
...@@ -36,17 +36,17 @@ class Class_Autocomplete_Index { ...@@ -36,17 +36,17 @@ class Class_Autocomplete_Index {
return $this->getBasePath() . $this->file_name; return $this->getBasePath() . $this->file_name;
} }
public static function getClassFor($name) { public static function getClassFor($name) {
foreach (['Title' => new Class_Autocomplete_IndexTitle(), foreach (['Title' => new Class_Autocomplete_IndexTitle(),
'Author' => new Class_Autocomplete_IndexAuthor()] 'Author' => new Class_Autocomplete_IndexAuthor()]
as $k => $clazz) { as $k => $clazz) {
if ((false !== strpos($name, $k))) if ((false !== strpos($name, $k)))
return $clazz; return $clazz;
} }
return new Class_Autocomplete_IndexNull(); return new Class_Autocomplete_IndexNull();
} }
public static function getMethodFor($name) { public static function getMethodFor($name) {
if ('search' == substr($name, 0, 6)) if ('search' == substr($name, 0, 6))
...@@ -85,6 +85,7 @@ class Class_Autocomplete_Index { ...@@ -85,6 +85,7 @@ class Class_Autocomplete_Index {
$current = $response->done; $current = $response->done;
Class_Notice::clearCache(); Class_Notice::clearCache();
Class_CodifAuteur::clearCache();
Storm_Model_Loader::resetCache(); Storm_Model_Loader::resetCache();
gc_collect_cycles(); gc_collect_cycles();
} while($response->done < $response->total); } while($response->done < $response->total);
......
...@@ -92,7 +92,7 @@ class Class_Cosmogramme_Chronometre { ...@@ -92,7 +92,7 @@ class Class_Cosmogramme_Chronometre {
$elapsed = 1; $elapsed = 1;
$mean = $total / ($elapsed / 60); $mean = $total / ($elapsed / 60);
return number_format($mean, 0, ',', '.') return number_format($mean, 0, ',', ' ')
. ' ' . $label . ' par minute'; . ' ' . $label . ' par minute';
} }
} }
......
...@@ -23,22 +23,27 @@ ...@@ -23,22 +23,27 @@
abstract class Class_Cosmogramme_Integration_PhasePseudoRecord abstract class Class_Cosmogramme_Integration_PhasePseudoRecord
extends Class_Cosmogramme_Integration_PhaseAbstract { extends Class_Cosmogramme_Integration_PhaseAbstract {
protected $_model_id_field;
/** @var Trait_Indexable */ /** @var Trait_Indexable */
protected $_model_name; protected $_model_name;
protected function _getModelIdField() { protected function _getModelIdField() {
return call_user_func([$this->_model_name, 'getIdField']); if (!$this->_model_id_field)
$this->_model_id_field = call_user_func([$this->_model_name, 'getIdField']);
return $this->_model_id_field;
} }
protected function _loadPage() { protected function _loadPage() {
$this->_cleanMemory();
$id_field = $this->_getModelIdField(); $id_field = $this->_getModelIdField();
return call_user_func_array([$this->_model_name, 'findAllBy'], return call_user_func([$this->_model_name, 'findAllBy'],
[['where' => $id_field . ' > ' . $this->_getData('pointeur_reprise'), ['where' => $id_field . ' > ' . $this->_getData('pointeur_reprise'),
'order' => $id_field, 'order' => $id_field,
'limit' => 100 'limit' => 100]);
]]);
} }
...@@ -55,6 +60,7 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord ...@@ -55,6 +60,7 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord
protected function _runPage($models) { protected function _runPage($models) {
$this->_log->ecrire($this->_getData('nombre') . '<br>');
foreach($models as $model) { foreach($models as $model) {
if ($this->isTimeOut()) if ($this->isTimeOut())
return; return;
...@@ -85,7 +91,7 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord ...@@ -85,7 +91,7 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord
return; return;
} }
$this->_incrementCount(Class_Cosmogramme_Integration_Phase::RECORD_UPDATE); $this->_incrementCount(Class_Cosmogramme_Integration_Phase::RECORD_FULLUPDATE);
} }
...@@ -124,4 +130,11 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord ...@@ -124,4 +130,11 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord
->startOnFile() ->startOnFile()
->startOnRecords(); ->startOnRecords();
} }
protected function _cleanMemory() {
Storm_Model_Abstract::unsetLoaders();
Storm_Model_Loader::resetCache();
gc_collect_cycles();
}
} }
\ No newline at end of file
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