Closed AnthonyPayan closed 1 year ago
Hi,
Could you provide the full log trace for the error SQL Error "1146": La table 'my_glpi.glpi_knowbaseitems_knowbaseitemcategories' n'existe pas in query "SELECT * FROM `glpi_knowbaseitems_knowbaseitemcategories` WHERE `knowbaseitems_id` = '951'
?
Hi, I did not find the error for id 951 but I have the same error for another id
[2022-11-17 14:26:06] glpisqllog.ERROR: DBmysql::query() in C:\wamp64\www\my_glpi\src\DBmysql.php line 370
** MySQL query error:
SQL: SELECT FROM glpi_knowbaseitems_knowbaseitemcategories
WHERE knowbaseitems_id
= '904'
Error: La table 'my_glpi.glpi_knowbaseitems_knowbaseitemcategories' n'existe pas
Backtrace :
src\DBmysqlIterator.php:112
src\DBmysql.php:1056 DBmysqlIterator->execute()
src\CommonDBTM.php:577 DBmysql->request()
src\CommonDBTM.php:6258 CommonDBTM->find()
src\KnowbaseItem.php:423 CommonDBTM->load1NTableData()
src\CommonDBTM.php:311 KnowbaseItem->post_getFromDB()
src\CommonDBConnexity.php:253 CommonDBTM->getFromDB()
src\CommonDBConnexity.php:155 CommonDBConnexity::getItemFromArray()
src\CommonDBRelation.php:841 CommonDBConnexity->getConnexityItem()
src\Document_Item.php:227 CommonDBRelation->post_addItem()
src\CommonDBTM.php:1325 Document_Item->post_addItem()
install\migrations\update_9.5.1_to_9.5.2.php:104 CommonDBTM->add()
src\Update.php:258 update951to952()
install\update.php:143 Update->doUpdates()
install\update.php:252 doUpdateDb()
{"user":"@ANTHONY","mem_usage":"0.009\", 5.46Mio)"}
for the content that comes out of the html feed, it's because I'm in super admin mode and there are php errors much further down the list
When I dump in glpi/ajax/knowbase.php file
I get cat_id = 0 when I display the root category.
C:\wamp64\www\my_glpi\ajax\knowbase.php:57: array (size=3) 'action' => string 'getItemslist' (length=12) 'cat_id' => string '0' (length=1) 'start' => string '0' (length=1)
And the cat_id changes well when I click on another category, and displays ONLY the files of the requested category. the problem is really on the root category cat_id = '0' = all the knowledge base to display.
Hello,
We need more informations ?
Hi,
1) You had following errors during migration, so maybe you have some inconsistent data in your database. You should have restored your backup until we provide a fix, but if you cannot restore your backup, you will have to deal with this.
Building inline images data in glpi_documents_items SQL Error "1146": La table 'my_glpi.glpi_knowbaseitems_knowbaseitemcategories' n'existe pas in query "SELECT * FROM `glpi_knowbaseitems_knowbaseitemcategories` WHERE `knowbaseitems_id` = '951'
2) Following error is probably due to orphaned data in glpi_document_items
.
for the content that comes out of the html feed, it's because I'm in super admin mode and there are php errors much further down the list
You should be able to ignore these entries by applying this patch:
diff --git a/src/KnowbaseItem.php b/src/KnowbaseItem.php
index 9a2689b792..ee524cd633 100644
--- a/src/KnowbaseItem.php
+++ b/src/KnowbaseItem.php
@@ -2005,10 +2005,13 @@ class KnowbaseItem extends CommonDBVisible implements ExtraVisibilityCriteria
] + getEntitiesRestrictCriteria('', '', '', true)
]);
foreach ($iterator as $docs) {
- $doc = new Document();
- $doc->getFromDB($docs["documents_id"]);
- echo $doc->getDownloadLink();
- $j++;
+ $doc = new Document();
+ if (!$doc->getFromDB($docs["documents_id"])) {
+ // Orphan row, ignore it
+ continue;
+ }
+ echo $doc->getDownloadLink();
+ $j++;
if ($j > 1) {
echo "<br>";
}
3) For the initial issue, I do not have time to investigate on it, so I do not know if provided information is sufficient.
@AnthonyPayan
Could you test #13443 ?
@AnthonyPayan
Could you test #13443 ?
Helo, i test #13443 and it's ok problem solved !
Thank you for the work provided!
Best wishes
Hi,
- You had following errors during migration, so maybe you have some inconsistent data in your database. You should have restored your backup until we provide a fix, but if you cannot restore your backup, you will have to deal with this.
Building inline images data in glpi_documents_items SQL Error "1146": La table 'my_glpi.glpi_knowbaseitems_knowbaseitemcategories' n'existe pas in query "SELECT * FROM `glpi_knowbaseitems_knowbaseitemcategories` WHERE `knowbaseitems_id` = '951'
- Following error is probably due to orphaned data in
glpi_document_items
.for the content that comes out of the html feed, it's because I'm in super admin mode and there are php errors much further down the list
You should be able to ignore these entries by applying this patch:
diff --git a/src/KnowbaseItem.php b/src/KnowbaseItem.php index 9a2689b792..ee524cd633 100644 --- a/src/KnowbaseItem.php +++ b/src/KnowbaseItem.php @@ -2005,10 +2005,13 @@ class KnowbaseItem extends CommonDBVisible implements ExtraVisibilityCriteria ] + getEntitiesRestrictCriteria('', '', '', true) ]); foreach ($iterator as $docs) { - $doc = new Document(); - $doc->getFromDB($docs["documents_id"]); - echo $doc->getDownloadLink(); - $j++; + $doc = new Document(); + if (!$doc->getFromDB($docs["documents_id"])) { + // Orphan row, ignore it + continue; + } + echo $doc->getDownloadLink(); + $j++; if ($j > 1) { echo "<br>"; }
- For the initial issue, I do not have time to investigate on it, so I do not know if provided information is sufficient.
same for this solution it works,
Thanks !
Code of Conduct
Is there an existing issue for this?
Version
10.0.5
Bug description
Hello.
After update 9.4.5 > 10.0.5 all the knowledge base is duplicate in the root category.
ENVIRONMENT :
Screenshot -> https://postimg.cc/JycXgSYC
Relevant log output
Page URL
http://my_glpi/front/knowbaseitem.php
Steps To reproduce
Your GLPI setup information
Informations sur le système, l'installation et la configuration
Server
GLPI constants
Libraries
SQL replicas
Notifications
Plugins list
Anything else?
No response