Skip to content
Snippets Groups Projects
Verified Commit 549fa54a authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #11937 TIME 0:30 fix multiple errors in migration

parent 1f27d32c
No related branches found
No related tags found
No related merge requests found
......@@ -23,47 +23,49 @@ foreach ($customs as $custom) {
$loadedXml = simplexml_load_file($path);
if ($loadedXml) {
foreach ($loadedXml->COLLECTION[0]->categories->category as $category) {
$aCategories[] = (string)$category->id;
}
if (!empty($aCategories)) {
$indexingModels = \IndexingModel\models\IndexingModelModel::get([
'select'=> ['id'],
'where' => ['category not in (?)'],
'data' => [$aCategories]
]);
if (!empty($indexingModels)) {
$indexingModelsId = array_column($indexingModels, 'id');
\IndexingModel\models\IndexingModelFieldModel::delete([
'where' => ['model_id in (?)'],
'data' => [$indexingModelsId]
if (!empty($loadedXml->COLLECTION[0]->categories->category)) {
foreach ($loadedXml->COLLECTION[0]->categories->category as $category) {
$aCategories[] = (string)$category->id;
}
if (!empty($aCategories)) {
$indexingModels = \IndexingModel\models\IndexingModelModel::get([
'select'=> ['id'],
'where' => ['category not in (?)'],
'data' => [$aCategories]
]);
if (!empty($indexingModels)) {
$indexingModelsId = array_column($indexingModels, 'id');
\IndexingModel\models\IndexingModelFieldModel::delete([
'where' => ['model_id in (?)'],
'data' => [$indexingModelsId]
]);
}
\IndexingModel\models\IndexingModelModel::delete([
'where' => ['category not in (?)'],
'data' => [$aCategories]
]);
}
\IndexingModel\models\IndexingModelModel::delete([
'where' => ['category not in (?)'],
'data' => [$aCategories]
$defaultCategory = (string)$loadedXml->COLLECTION[0]->categories->default_category;
\IndexingModel\models\IndexingModelModel::update([
'set' => [
'"default"' => 'false'
],
'where' => ['1=?'],
'data' => [1]
]);
\IndexingModel\models\IndexingModelModel::update([
'set' => [
'"default"' => 'true'
],
'where' => ['category = ?'],
'data' => [$defaultCategory],
]);
}
$defaultCategory = (string)$loadedXml->COLLECTION[0]->categories->default_category;
\IndexingModel\models\IndexingModelModel::update([
'set' => [
'"default"' => 'false'
],
'where' => ['1=?'],
'data' => [1]
]);
\IndexingModel\models\IndexingModelModel::update([
'set' => [
'"default"' => 'true'
],
'where' => ['category = ?'],
'data' => [$defaultCategory],
]);
$i = 0;
foreach ($loadedXml->COLLECTION as $value) {
......
......@@ -18,7 +18,7 @@ foreach ($customs as $custom) {
$folders = \SrcCore\models\DatabaseModel::select([
'select' => ['folders_system_id', 'typist', 'destination', 'folder_name', 'parent_id'],
'table' => ['folder_tmp'],
'order_by' => ['level asc']
'order_by' => ['folder_level asc']
]);
if (!empty($folders)) {
......
......@@ -222,7 +222,7 @@ foreach ($customs as $custom) {
}
\SrcCore\models\DatabaseModel::update([
'set' => ['keyword' => null],
'set' => ['keyword' => ''],
'table' => 'actions',
'where' => ['keyword = ?'],
'data' => ['indexing']
......@@ -230,4 +230,3 @@ foreach ($customs as $custom) {
printf("Migration Indexing Basket (CUSTOM {$custom}) : " . $migrated . " action(s) avec des status (mot clé indexation) trouvé(s) et migré(s).\n");
}
......@@ -13,18 +13,20 @@ foreach ($customs as $custom) {
$xmlfile = null;
$path = "custom/{$custom}/apps/maarch_entreprise/xml/entreprise.xml";
$xmlfile = simplexml_load_file($path);
if (file_exists($path)) {
$xmlfile = simplexml_load_file($path);
if ($xmlfile) {
unset($xmlfile->process_modes);
if ($xmlfile) {
unset($xmlfile->process_modes);
$res = $xmlfile->asXML();
$fp = fopen($path, "w+");
if ($fp) {
fwrite($fp, $res);
}
$res = $xmlfile->asXML();
$fp = fopen($path, "w+");
if ($fp) {
fwrite($fp, $res);
}
$migrated++;
$migrated++;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment