- b2evolution CMS Support Forums
- b2evolution Development
- Bug reports
- v7.2.2 Prune old hits Undefined variable: sessions_rows_affected
1 djkimmb2e Dec 24, 2020 06:12
Recently upgraded 2 old blogs version 6.10.3-stable (date 2018-10-02) to 7.2.2-stable released on 2020-10-06. This was done after moving to a new dedicated server in a new facility with new CentOS v7.8 and upgrading to PHP 7.3. Blogs are https://www.greatlakesbass.com/glblog/ and https://www.greatlakesbass.com/news/ . Since the move and b2evo upgrade the "Prune old hits & sessions (includes OPTIMIZE)" job on my scheduler - which was working fine before all this - shows as an Error result. The other job erring out (and not working at all) is "Poll the antispam blacklist" job. All other jobs are finishing without error. I won't go into the antispam issue - no idea after lots of checking why it is not working - it worked fine before my server move.
In Scheduled Job Details for the Prune old hits & sessions job no actual error is shown. 20-22 tasks show completed in about a second each time it runs. I got a hint at the error in the "Error in task" email message. It says "Error code: 100" but I cannot find a list of error codes anywhere on this website other than the api-related list, so doesn't do me much good. I finally found additional error info by going to my Maintenance tab and manually running the Prune old hits & sessions job.
The error was: Notice: Undefined variable: sessions_rows_affected in /home/xxxxxx/public_html/glblog/inc/sessions/model/_hitlist.class.php on line 268
I believe I have fixed this issue on my 2 blogs for myself after looking at that file and comparing the new v7.2.2 code to the older version 6 code. I believe the variable 'sessions_rows_affected' was used in version 6 but the new version 7.2.2 uses either sessions_rows_affected_i or sessions_rows_affected_total instead, and maybe this instance of just 'sessions_rows_affected' on line 268 was overlooked when the _hitlist.class.php file was being rewritten? I changed the value on line 268 in my 2 instances of this file and the job now appears to work without an error.
Original code:
$Debuglog->add( 'Hitlist::dbprune(): Total autopruned '.$sessions_rows_affected.' rows from T_sessions.', 'request' );
Change to:
$Debuglog->add( 'Hitlist::dbprune(): Total autopruned '.$sessions_rows_affected_total.' rows from T_sessions.', 'request' );
I wanted to share this with other people in case they see the same error, and also to let those of you writing the code know in case this code does need to be updated, and possibly I did not arrive at the correct solution? Thanks, Dan
Posted text to wrong topic so deleted and set this to review