Ither Posted April 4, 2021 Report Share Posted April 4, 2021 (edited) Just some technical heads up -- know there were threads at one point trying to figure out "why" a cron job on maintenance.php failed. I was looking at the original PHPVMS build against Clark's 5.5 build and I noticed that MainController::Run('Maintenance', 'resetpirepcount'); MainController::Run('Maintenance', 'resethours'); which translates to the respected Maintenance module function has this added CodonModule::checkPermission(MAINTENANCE); This is not in the original PHPVMS builds. The error is being caused because no matter what you do in a cronjob you are not an authenticated user. When the checkPermission function is fired it's coming back Unauthorized because you are not actually logged in (this is why the script runs perfectly fine from the admin page when you are logged in.) I've pretty much given up on figuring out how to make myself appear authenticated and decided to change the code to make it work (reason I did this is that I have Discord hooks sending messages when my maintenance starts and finishes, the error "unauthorized user" would break that. What did I do to get around that cron job error? The cronjob runs by access to the physical file on your server. There's no possible threat in that as the processor has access to the physical file. If your cronjobs are done properly you are fine. Open up the file admin/maintenance.php Add the following line at very top just beneath; <?php so that this file will not run from web browser; it will only run by a cron job. if (php_sapi_name() !='cli') exit; Open up the file admin/modules/Maintenance/Maintenance.php Locate the following functions: public static function resetpirepcount() public function resethours() Comment out the line that matches below with // //CodonModule::checkPermission(MAINTENANCE); You should now be able to run your cron job without it giving an error. Edited April 4, 2021 by Ither Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.