Warning Improvements by Xon

Warning Improvements by Xon 2.9.5

No permission to download
I changed warning to 21 it worked. Back to 20 and it worked. So seemed that editing/resaving the warning made it start working again!
 
  • Like
Reactions: Xon
Received the following error on trying to upgrade from 2.7.11 directly to 2.8.3.
The upgrade did appear to complete, and it shows 2.8.3 in the addons list, but the admin panel now shows the "There are manual rebuild jobs awaiting completion" prompt, and clicking to continue that just returns this error again.

Code:
Server error log
XF\Db\Exception: MySQL statement prepare error [1146]: Table '[mydatabase].xf_sv_warning_log' doesn't exist
src/XF/Db/AbstractStatement.php:230

[HEADING=2]Stack trace[/HEADING]
SELECT warning_id
FROM xf_warning
WHERE warning_id > ?
  AND NOT exists (SELECT warning_id FROM xf_sv_warning_log WHERE xf_sv_warning_log.warning_id = xf_warning.warning_id)
ORDER BY warning_id
          
LIMIT 100
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 1146, '42S02')
#1 src/XF/Db/Mysqli/Statement.php(41): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1146, '42S02')
#2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(172): XF\Db\AbstractAdapter->query('
                SELECT war...', Array)
#5 src/addons/SV/ReportImprovements/Job/WarningLogMigration.php(32): XF\Db\AbstractAdapter->fetchAllColumn('
                SELECT war...', Array)
#6 src/XF/Job/AbstractRebuildJob.php(30): SV\ReportImprovements\Job\WarningLogMigration->getNextIds(0, 100)
#7 src/XF/Job/Atomic.php(40): XF\Job\AbstractRebuildJob->run(8)
#8 src/XF/Job/Manager.php(260): XF\Job\Atomic->run(8)
#9 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#10 src/XF/Job/Manager.php(171): XF\Job\Manager->runJobEntry(Array, 8)
#11 src/XF/Cli/Runner.php(223): XF\Job\Manager->runById(76122, 8)
#12 src/XF/Cli/Runner.php(112): XF\Cli\Runner->postExecutionCleanUp(Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 cmd.php(15): XF\Cli\Runner->run()
#14 {main}
 
Last edited:
Question about this line item:

Warning; All user group titles will be visible if they are applied in a Warning Action

Who are the group titles visible to? Staff, or the members who receive the warnings?
 
After Upgrade, 2 Server errors:

1.

ErrorException: Fatal Error: Trait 'SV\WarningImprovements\Entity\SupportsEmbedMetadataTrait' not found src/addons/SV/WarningImprovements/XF/Entity/Post.php:13

Stack-Trace

#0 [internal function]: XF::handleFatalError()
#1 {main}

Code:
array(4) {
  ["url"] => string(52) "/threads/geist-in-novi-pazar-gesichtet.203073/page-2"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

2.

Exception: Could not find class SV\WarningImprovements\XF\Entity\UserOption when attempting to extend XF\Entity\UserOption src/XF/Extension.php:176

Stack-Trace​


#0 src/XF/Mvc/Entity/Manager.php(55): XF\Extension->extendClass('XF\\Entity\\UserO...')
#1 src/XF/Mvc/Entity/Manager.php(723): XF\Mvc\Entity\Manager->getEntityClassName('XF:UserOption')
#2 src/XF/Repository/User.php(189): XF\Mvc\Entity\Manager->instantiateEntity('XF:UserOption', Array, Array)
#3 src/XF/Repository/User.php(186): XF\Repository\User->_hydrateGuestUserData(Array)
#4 src/XF/Repository/User.php(135): XF\Repository\User->_hydrateGuestUserData(Array)
#5 src/XF/Repository/User.php(32): XF\Repository\User->getGuestUser()
#6 src/XF/App.php(1921): XF\Repository\User->getVisitor(NULL, Array)
#7 src/XF/Pub/App.php(158): XF\App->getVisitorFromSession(Object(XF\Session\Session))
#8 src/XF/App.php(2349): XF\Pub\App->start(true)
#9 src/XF.php(524): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}

Code:
array(4) {
  ["url"] => string(64) "/threads/krajina-serben-aus-dem-heutigen-kroatien.383388/page-17"
  ["referrer"] => string(45) "https://balkanforum.info/goto/post?id=5258833"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
If that happened during the upgrade, it can be ignored. It is only if it keeps happening, that indicates you haven't uploaded all files
 
@Xon

When creating/editing a warning action, does the Warning Category configure the action to only consider points applied by warnings in that category, or is it just for organization?

1667512947282.webp
 
@Xon

When creating/editing a warning action, does the Warning Category configure the action to only consider points applied by warnings in that category, or is it just for organization?

View attachment 275966
Yes. If you set an explicit warning category, the warning category will only count points for warnings in that category. This is a fairly powerful advanced feature,
 
Warnings/Bans with time-based expiry are now be removed on the 1st visit after the expiry time, rather than needing to wait for the hourly cron task to run.

I'm having an issue with this feature not working correctly. The ban expiration date and time is correct, but the member isn't getting unbanned until the Delete expired bans cron runs. In the example below, the member was supposed to be unbanned at 9:57AM (current time is 10:15AM).

1668449813386.webp

  • The member was banned via a Warning Action with the expiry set to 1 hour.
  • I did log in as the member from a private browser (to trigger the unban).
  • I changed Job run trigger to Activity based trigger, in case this was causing the issue. We normally leave this set to Server based trigger, so the server cronjob is still configured (not sure if this makes a difference without the option set to server based trigger).
Any idea as to what I can check next?
 
@Joe Link check the xf_user_option.sv_pending_warning_expiry field for that user is being set correctly. It should have an value set to 1 hour after the ban.

This will help isolate which part of the code is being buggy
 
@Joe Link check the xf_user_option.sv_pending_warning_expiry field for that user is being set correctly. It should have an value set to 1 hour after the ban.

This will help isolate which part of the code is being buggy

I just had a chance to check this, thanks for the advice.

I checked that field and the value was 1699645276 (Friday, November 10, 2023 11:41:16 AM PST). This is the correct date of the warning expiry, but I believe that's independent of the ban expiry which was triggered by a warning action (as a result of the warning).
Not sure if it's helpful, but I checked xf_user_ban and it has the correct expiration for a new test ban (same as the other, the warning action is configured to ban the member for one hour). It appears to have the correct expiry time of 1668623797 (Wednesday, November 16, 2022 10:36:37 AM).

The next Delete expired bans cron runs at 10:45AM. I have a timer set to observe whether the ban expires when it's supposed to per the Warning Improvements feature (Wednesday, November 16, 2022 10:36:37 AM) or not until the cron runs.
 
  • Like
Reactions: Xon
The next Delete expired bans cron runs at 10:45AM. I have a timer set to observe whether the ban expires when it's supposed to per the Warning Improvements feature (Wednesday, November 16, 2022 10:36:37 AM) or not until the cron runs.

The member was not unbanned when they should have been, even though the ban expiration time was set correctly in xf_user_ban. The ban ends date/time was correct, but the member was not unbanned until the cron ran.

1668624299299.webp



Not sure if it's helpful, but another interesting thing I've noticed is the ban screen shown to the member (ignore the time on this one, as it's different than the one mentioned above).

Before the ban expires, there's an expiration date/time and no Log out link:

1668624607253.webp

Once that date/time has passed, the banned member is shown this screen, without the date but with the Log out link:

1668624370931.webp
 
  • Like
Reactions: Xon
Warnings/Bans with time-based expiry are now be removed on the 1st visit after the expiry time, rather than needing to wait for the hourly cron task to run.

I'm having an issue with this feature not working correctly. The ban expiration date and time is correct, but the member isn't getting unbanned until the Delete expired bans cron runs. In the example below, the member was supposed to be unbanned at 9:57AM (current time is 10:15AM).

View attachment 276485

  • The member was banned via a Warning Action with the expiry set to 1 hour.
  • I did log in as the member from a private browser (to trigger the unban).
  • I changed Job run trigger to Activity based trigger, in case this was causing the issue. We normally leave this set to Server based trigger, so the server cronjob is still configured (not sure if this makes a difference without the option set to server based trigger).
Any idea as to what I can check next?
If I understand correctly, you will have to set the cron for that to run more often, to get closer to what you want.

I never ban someone for less than a day and then it doesn't matter much if it gets almost an hour wrong.

Could a warning be enough instead and if that is not followed a one day ban?
 
Top Bottom