The API delete feature does not work like awaited with an empty "reason" parameter.
The bug is reproducible with the SVN r44509.
What I do:
- Call the delete API function with following parameters: 'action' => 'delete', 'title' => $my_image.ext, 'token' => $my_valid_edit_token, 'format' => 'xml'
What I get:
- the HTTP response looks like following: <?xml version="1.0"?><api><error code="internal_api_error_DBQueryError" info="Database query error">
#0 /var/www/mirror/fr/includes/db/Database.php(591): Database->reportQueryError('Column 'log_com...', 1048, 'INSERT INTO l...', 'LogPage::saveCo...', false) #1 /var/www/mirror/fr/includes/db/Database.php(1311): Database->query('INSERT INTO l...', 'LogPage::saveCo...') #2 /var/www/mirror/fr/includes/LogPage.php(73): Database->insert('logging', Array, 'LogPage::saveCo...') #3 /var/www/mirror/fr/includes/LogPage.php(316): LogPage->saveContent() #4 /var/www/mirror/fr/includes/Article.php(2475): LogPage->addEntry('delete', Object(Title), NULL, Array) #5 /var/www/mirror/fr/includes/FileDeleteForm.php(112): Article->doDeleteArticle(NULL, false, '3') #6 /var/www/mirror/fr/includes/api/ApiDelete.php(165): FileDeleteForm::doDelete(Object(Title), Object(LocalFile), NULL, NULL, false) #7 /var/www/mirror/fr/includes/api/ApiDelete.php(76): ApiDelete::deleteFile('74b91b5b5aec710...', Object(Title), NULL, NULL, false) #8 /var/www/mirror/fr/includes/api/ApiMain.php(427): ApiDelete->execute() #9 /var/www/mirror/fr/includes/api/ApiMain.php(260): ApiMain->executeAction() #10 /var/www/mirror/fr/includes/api/ApiMain.php(244): ApiMain->executeActionWithErrorHandling() #11 /var/www/mirror/fr/api.php(77): ApiMain->execute() #12 {main}
</error></api> - The image is deleted but it is impossible to restore it.
What I want:
- No API error
- A "restorable" image
Remarks:
- If I give a non-empty string reason, it works like I want.
- I suppose the code does not work correctly with an non-empty string reason and is not able to insert a log entry in the old images table or something like that, and for this reason the image is forever lost (in the DB).
Version: 1.14.x
Severity: major