Jump to content

Recommended Posts

Hi

 

I have inherited a php/mysql site that I need to get functioning properly.

 

The people that wrote it were very reluctant to hand over the files even though we had paid them in full.

 

Anyhow, I have a file which I am pretty sure is designed to be run either manually or through a cron job on a certain day of the week (the word cron is actually in the file name).

 

I am hoping for some help to change it so I can run it on any day so I can test the site. This file collects data from an xml feed and dumps the info we need into the db.

 

$saturday = date("Y-m-d",strtotime("Today"));
include("db.php");

 

From another file. I think this is where the variable $saturday is defined.

 

$saturday = date("Y-m-d",strtotime("This Saturday"));
if (date("D")=="Sat")
$saturday = date("Y-m-d");

if (date("D")!="Sat" && date("D")!="Fri")
$saturday = date("Y-m-d",strtotime("This Saturday"));

 

Cheers

 

Link to comment
https://forums.phpfreaks.com/topic/232835-script-designed-to-run-on-a-certain-day/
Share on other sites

well crons are scheduled runs. So if your looking to have it run any time or any day based on your choice I would figure it would be best to just copy the concept minus the date constraints to another file that you can just visit in your browser. But keep in mind the people who had made it originally may have done it on Sat for a specific reason, could be what ever the cron is doing is data intense and not something you just wanna run whenever, could be it connects to another system to get new data of which that system only updates once a week.. could be that same concept of connecting to another system where they system provider specifies in the terms you are only allowed to do it once a week, etc.. Im not familiar with your site or its code or what ever its true functionality is and the little code you shown is irrelivant per say to the need your describing. But thats only merely my own 2 cents. I could be wrong :)

Hi Monkeytooth

 

Thanks for the reply

 

 

well crons are scheduled runs. So if your looking to have it run any time or any day based on your choice I would figure it would be best to just copy the concept minus the date constraints to another file that you can just visit in your browser.

 

How exactly would I do that? Do you think the bits of code I pasted what makes the script get the data for Saturday when run on a Friday?

 

 

But keep in mind the people who had made it originally may have done it on Sat for a specific reason, could be what ever the cron is doing is data intense and not something you just wanna run whenever, could be it connects to another system to get new data of which that system only updates once a week.. could be that same concept of connecting to another system where they system provider specifies in the terms you are only allowed to do it once a week, etc.. Im not familiar with your site or its code or what ever its true functionality is and the little code you shown is irrelivant per say to the need your describing. But thats only merely my own 2 cents. I could be wrong :)

 

It was designed to get data that is relevant for that day of the week but similar data is available from the same source on every day of the week. It is not a large amount of data at all. It is a free data source provided in xml.

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.