Report Improvements by Xon

Report Improvements by Xon 2.18.3

No permission to download
The next version will fix this edge-case, but for now I can propose another workaround.

Just updated 2.13.x -> 2.14.8
ErrorException: [E_WARNING] Attempt to read property "prefix_id" on null src/addons/SV/ReportImprovements/Job/Upgrades/EnrichReportPostInstall.php:63
This happens because there is a report for a still existing post that has had it's thread hard-deleted. This shouldn't happen.

The quick & dirty way is to assign these posts to a new thread.
SQL:
select xf_report.content_id
from xf_report
straight_join xf_post on xf_report.content_id = xf_post.post_id
left join xf_thread on xf_thread.thread_id = xf_post.thread_id
where xf_report.content_type = 'post' and xf_thread.thread_id is null

This will get a list of affected post_id. If this is a just a few it is easy to just update xf_post set thread_id = ? where post_id = ? otherwise it make take a little more work.
 
Thank you very much.
I have found only one affected post. I have corrected that, now the script ran successfully to the end.
 
  • Like
Reactions: Xon
I have found a mini bug:
When someone reacts to a comment in a report, the alert does not show the avatar of the responder, but the avatar of the commenter.

In the following screenshot you can see the correct avatar of the user "Rollo_82" in the first alert.
In the second alert, his name is shown and linked, but my avatar is shown and my profile is linked.

1681464903992.png
 
I have found a mini bug:
When someone reacts to a comment in a report, the alert does not show the avatar of the responder, but the avatar of the commenter.
I'm unable to reproduce this. The reaction icon is populated from the alert user, which is the same place the username is pulled from.

This may be cause by custom templates/themes, or less likely a 3rd party add-on.

Can you inspect the xf_user_alert record for those two linked report comments.
SQL:
select *
from xf_user_report 
where content_type = 'report_comment' and action = 'reaction' and alerted_user_id = ? 
order by 1 desc
Adding your user-id in place of the ?
 
The database entries look normal. user_id and username are correct.

The wrong avatar also appears with the default template.

But I could notice that the correct avatar is displayed when I disable the template modification "svReportImprov_alert_macros".
Left enabled, right disabled:
1681487002635.webp

Might it have something to do with $alert.Content.ViewableUser?
 
Sorry if I am annoying with my messages ;)

I am not sure if the following error is caused by Report Improvements or Search Improvements, both are mentioned. It appears only after I updated Report Improvements from 2.13.x -> 2.14.8 and installed Search Improvements 2.9.7 for the first time as a dependency.

The last two updates RI 2.14.9 and SI 2.9.8 were installed yesterday, no change.

The media that the specified reports are about no longer exist (hard deleted).
The error messages appear regularly, currently about 5-15 per day. A rebuild search index (incl Delete the index before rebuilding) generates even 500+ messages.

ErrorException: Error accessing title for report (97) [E_WARNING] Undefined array key "title" src/addons/XFMG/Report/Media.php:105

Stack trace

#0 src/addons/XFMG/Report/Media.php(105): XF::handlePhpError(2, '[E_WARNING] Und...', '/var/www/vhosts...', 105)
#1 src/XF/Entity/Report.php(86): XFMG\Report\Media->getContentTitle(Object(SV\SignupAbuseBlocking\XF\Entity\Report))
#2 src/addons/SV/ReportImprovements/XF/Entity/Report.php(452): XF\Entity\Report->getTitle()
#3 src/XF/Mvc/Entity/Entity.php(167): SV\ReportImprovements\XF\Entity\Report->getTitle()
#4 src/XF/Mvc/Entity/Entity.php(119): XF\Mvc\Entity\Entity->get('title')
#5 src/addons/SV/ReportImprovements/XF/Repository/Report.php(128): XF\Mvc\Entity\Entity->__get('title')
#6 src/addons/SV/ReportImprovements/Search/Data/Report.php(50): SV\ReportImprovements\XF\Repository\Report->svPreloadReports(Object(XF\Mvc\Entity\ArrayCollection))
#7 src/XF/Search/Search.php(266): SV\ReportImprovements\Search\Data\Report->getContent(Array, true)
#8 src/XF/ResultSet.php(230): XF\Search\Search->getResultSetData('report', Array, true, Array)
#9 src/XF/ResultSet.php(214): XF\ResultSet->loadResultsData(true)
#10 src/XF/ResultSet.php(183): XF\ResultSet->limitToViewableResults()
#11 src/XF/ResultSet.php(193): XF\ResultSet->sliceResults(0, '200', true)
#12 src/XF/Search/Search.php(216): XF\ResultSet->limitResults('200', true)
#13 src/XF/Search/Search.php(181): XF\Search\Search->executeSearch(Object(SV\SearchImprovements\XF\Search\Query\KeywordQuery), '200', Object(Closure), true)
#14 src/XF/Repository/Search.php(33): XF\Search\Search->search(Object(SV\SearchImprovements\XF\Search\Query\KeywordQuery))
#15 src/addons/SV/SearchImprovements/XF/Repository/Search.php(72): XF\Repository\Search->runSearch(Object(SV\SearchImprovements\XF\Search\Query\KeywordQuery), Array, true)
#16 src/XF/Pub/Controller/Search.php(437): SV\SearchImprovements\XF\Repository\Search->runSearch(Object(SV\SearchImprovements\XF\Search\Query\KeywordQuery), Array, true)
#17 src/XF/Pub/Controller/Search.php(119): XF\Pub\Controller\Search->runSearch(Object(SV\SearchImprovements\XF\Search\Query\KeywordQuery), Array)
#18 src/addons/SV/SearchImprovements/XF/Pub/Controller/Search.php(86): XF\Pub\Controller\Search->actionSearch()
#19 src/XF/Mvc/Dispatcher.php(352): SV\SearchImprovements\XF\Pub\Controller\Search->actionSearch(Object(XF\Mvc\ParameterBag))
#20 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Search', 'Search', Object(XF\Mvc\RouteMatch), Object(SV\SearchImprovements\XF\Pub\Controller\SearchPatchFirst), NULL)
#21 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\SearchImprovements\XF\Pub\Controller\SearchPatchFirst), NULL)
#22 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#23 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#24 src/XF.php(524): XF\App->run()
#25 index.php(20): XF::runApp('XF\\Pub\\App')
#26 {main}

Request state

array(4) {
["url"] => string(48) "/search/search?c[users]=lmm123&order=date"
["referrer"] => string(55) "https://www.123.com/media/20140801_081320.2751/"
["_GET"] => array(3) {
["q"] => string(13) "search/search"
["c"] => array(1) {
["users"] => string(6) "lmm123"
}
["order"] => string(4) "date"
}
["_POST"] => array(0) {
}
}
 
The media that the specified reports are about no longer exist (hard deleted).
The error messages appear regularly, currently about 5-15 per day. A rebuild search index (incl Delete the index before rebuilding) generates even 500+ messages.

ErrorException: Error accessing title for report (97) [E_WARNING] Undefined array key "title" src/addons/XFMG/Report/Media.php:105
This is from a very old and likely buggy report. If you access that report (97) via <yoursite>/reports/97/ you'll get a similar warning or likely an error 500.

I think the best solution may be to just delete the broken report, since recovering the data is essentially impossible.

This can be done with:
SQL:
delete from xf_report where report_id = 97;
delete from xf_report_comment where report_id = 97;
But I do recommend care be taken!
 
Thank you very much.

Yes, the 97 is very old (2015). Was only meant as an example.
I currently have 500+ error messages like this. The most recent ones are about reports from 2021.
I think it is easier to delete all reports.
 
Unsure if this plugin is causing this

Code:
XF\Db\Exception: MySQL query error [1048]: Column 'warning_definition_id' cannot be null in src/XF/Db/AbstractStatement.php at line 230
[LIST=1]
[*]XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 198
[*]XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 79
[*]XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 96
[*]XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 220
[*]XF\Db\AbstractAdapter->insert() in src/XF/Mvc/Entity/Entity.php at line 1521
[*]XF\Mvc\Entity\Entity->_saveToSource() in src/XF/Mvc/Entity/Entity.php at line 1253
[*]XF\Mvc\Entity\Entity->save() in src/addons/SV/ReportImprovements/Service/WarningLog/Creator.php at line 452
[*]SV\ReportImprovements\Service\WarningLog\Creator->_save() in src/XF/Service/ValidateAndSavableTrait.php at line 42
[*]SV\ReportImprovements\Service\WarningLog\Creator->save() in src/addons/SV/ReportImprovements/Repository/ReportQueue.php at line 243
[*]SV\ReportImprovements\Repository\ReportQueue->SV\ReportImprovements\Repository\{closure}() in src/XF.php at line 625
[*]XF::asVisitor() in src/addons/SV/ReportImprovements/Repository/ReportQueue.php at line 250
[*]SV\ReportImprovements\Repository\ReportQueue->logToReport() in src/addons/SV/ReportImprovements/Behavior/ReportResolver.php at line 176
[*]SV\ReportImprovements\Behavior\ReportResolver->logToReport() in src/addons/SV/ReportImprovements/Behavior/ReportResolver.php at line 60
[*]SV\ReportImprovements\Behavior\ReportResolver->postSave() in src/XF/Mvc/Entity/Entity.php at line 1280
[*]XF\Mvc\Entity\Entity->save() in src/XF/Mvc/Entity/Entity.php at line 1323
[*]XF\Mvc\Entity\Entity->saveIfChanged() in src/addons/SV/ReportImprovements/XF/Entity/Warning.php at line 63
[*]SV\ReportImprovements\XF\Entity\Warning->_postSave() in src/XF/Mvc/Entity/Entity.php at line 1277
[*]XF\Mvc\Entity\Entity->save() in src/XF/Service/User/Warn.php at line 174
[*]XF\Service\User\Warn->_save() in src/addons/SV/WarningImprovements/XF/Service/User/Warn.php at line 104
[*]SV\WarningImprovements\XF\Service\User\Warn->_save() in src/addons/SV/ReportImprovements/XF/Service/User/Warn.php at line 104
[*]SV\ReportImprovements\XF\Service\User\Warn->_save() in src/XF/Service/ValidateAndSavableTrait.php at line 42
[*]XF\Service\User\Warn->save() in src/XF/ControllerPlugin/Warn.php at line 43
[*]XF\ControllerPlugin\Warn->actionWarn() in src/addons/SV/WarningImprovements/XF/ControllerPlugin/Warn.php at line 57
[*]SV\WarningImprovements\XF\ControllerPlugin\Warn->actionWarn() in src/addons/SV/ReportImprovements/XF/ControllerPlugin/Warn.php at line 134
[*]SV\ReportImprovements\XF\ControllerPlugin\Warn->actionWarn() in src/XF/Pub/Controller/Post.php at line 492
[*]XF\Pub\Controller\Post->actionWarn() in src/XF/Mvc/Dispatcher.php at line 352
[*]XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
[*]XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
[*]XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
[*]XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2483
[*]XF\App->run() in src/XF.php at line 524
[*]XF::runApp() in index.php at line 20
[/LIST]

offending field ; thread ban reason.
 
@Xon, just got this in my error log... related to @Bob's Link Directory it looks like
Code:
Server error log
Error: Call to undefined method SV\ReportImprovements\XF\Entity\User::canViewImsQuestions() src/addons/XenAddons/LD/Pub/Controller/Item.php:111
Generated by: Unknown account May 20, 2023 at 12:52 PM
Stack trace
#0 src/XF/Mvc/Dispatcher.php(352): XenAddons\LD\Pub\Controller\Item->actionLatestQuestions(Object(XF\Mvc\ParameterBag))
#1 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XenAddons\\LD:It...', 'LatestQuestions', Object(XF\Mvc\RouteMatch), Object(XenAddons\LD\Pub\Controller\Item), NULL)
#2 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XenAddons\LD\Pub\Controller\Item), NULL)
#3 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#4 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#5 src/XF.php(524): XF\App->run()
#6 index.php(20): XF::runApp('XF\\Pub\\App')
#7 {main}
Request state
array(4) {
  ["url"] => string(32) "/link-directory/latest-questions"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["/link-directory/latest-questions"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

Was running the .15 version, so just updated to the .16 and will see if it repeats.
 
Last edited:
That is a unrelated to my add-on, it will be an issue in src/addons/XenAddons/LD/Pub/Controller/Item.php or at worst another add-on incorrectly extending XF\Entity\User (possible not using the XFCP_ system).

You might see this sort of error during upgrades.
 
Top Bottom