Skip to content
Snippets Groups Projects

Dev#29947 miop migration typo3 iteration finale import a partir de mardi 17

Compare and
+ 64
14
Preferences
Compare changes
Files
@@ -223,9 +223,8 @@ class Class_Import_Typo3 {
$t3news = $this->t3db->findAllSitesSince($update_date);
foreach($t3news as $new) {
if ($site = Class_Sitotheque::findFirstByCustomFieldValue(SELF::UID_TYPO3_CF,
$new['uid'])) {
$this->updateSite($site,$new);
if ($site = $this->_getSite($new['uid'])) {
$this->updateSite($site, $new);
continue;
}
@@ -236,6 +235,11 @@ class Class_Import_Typo3 {
}
protected function _getSite($uid) {
return Class_Sitotheque::findFirstByCustomFieldValue(SELF::UID_TYPO3_CF, $uid);
}
public function importSites() {
Class_Sitotheque::deleteBy([]);
@@ -899,27 +903,38 @@ class Class_Import_Typo3 {
public function postProcess() {
$this->_cleanArticles();
$this
->_cleanArticles()
->_cleanSites();
}
protected function _cleanSites() {
$this->_cleanModelsBy('findRemovableArticles', '_getSite');
return $this;
}
protected function _cleanArticles() {
foreach(['findRemovableArticles', 'findRemovableContents', 'findRemovableEvents'] as $method)
$this->_cleanArticlesBy($method);
foreach(['findRemovableArticles',
'findRemovableContents',
'findRemovableEvents'] as $method)
$this->_cleanModelsBy($method, '_getArticle');
return $this;
}
protected function _cleanArticlesBy($method) {
foreach($this->t3db->$method() as $item)
if ($article = $this->_getArticle($item['uid']))
$this->_cleanArticle($article);
protected function _cleanModelsBy($db_method, $model_getter) {
foreach($this->t3db->$db_method() as $item)
if ($model = $this->$model_getter($item['uid']))
$this->_cleanModel($model);
}
protected function _cleanArticle($article) {
$article->unindex();
$article->deleteWithCustomFields();
/** @param $model use Trait_Indexable, Trait_CustomFields */
protected function _cleanModel($model) {
$model->unindex();
$model->deleteWithCustomFields();
}
}
\ No newline at end of file