Change daily execution to hourly execution in PHP
I asked this question before, but asked it in a unclear way, so I am trying again.
I am trying to get this PHP to execute hourly instead of daily. It's a wordpress plugin that imports RSS feeds. It's GPL. I just have cheap hosting so I don't have access to command line/ cron on the server.
I have searched here and found this post: PHP Running an hourly script but it didn't help me understand. I don't know PHP, I have tried editing it, broken it, googled it, broken it again etc
If anyone could edit this so that it should work I'd be eternally grateful.
This is the original working code that executes daily: http://pastebin.ca/2313994
I'm looking at this bit where we define post days:
define('SCRD_DEFAULT_POST_DAYS', 'a:7:{s:6:"Monday";i:0;s:7:"Tuesday";i:0;s:9:"Wednesday";i:0;s:8:"Thursday";i:0;s:6:"Friday";i:1;s:8:"Saturday";i:0;s:6:"Sunday";i:0;}');
I'm thinking that if I knew the PHP for all 24 hours I could enter all 24 values and it would fool the script into running hourly?
What is the code to define all 24 hours?
s:6:"12:00";?:?;?:?:"13:00";?:?;?:?:"14:00";?:?;?:?: etc
Or would this approach not work?
I have googled: define('SCRD_DEFAULT_POST_DAYS', but only find this post and the original code.
I have already tried editing this part: define('SCRD_DEFAULT_HOUR', '17'); to read
define('SCRD_DEFAULT_HOUR', '17' '18' '19' '20' etc but it didn't work for me.
Solutions
Plugin author here.
You're looking in the
wrong place
. To hack this, you want to manipulate the function where the next digest is scheduled, particularly
function scrd_do_digest
which starts on line 65.
I haven't tested this, but I would start by replacing the code on line 67:
$next_digest = $right_now + 3600; // schedule for one hour from now
Now this is a total hack, so if you do this the other places where the next digest time is displayed will be lying to you. Also, any time you update the settings, the next posting of the digest will be set according to the schedule you set in the UI. You might be able to use the "Post Now" button to get the ball rolling early.