These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

[Request] Quick PHP code review (34 lines of code)

Author
Golden Gnu
Lobach Inc.
#1 - 2017-04-20 15:54:38 UTC
Hi awesome PHP programmers.

I would like some PHP code reviewed (it's only 34 lines of code).
I'm a terrible PHP programmer, so I would really like someone with better knowledge of PHP to review the code, so, I can use it with confidence.

The code is on GitHub

The code is intended to cache the Citadel API at stop.hammerti.me.uk and update once an hour. If the update fails it should serve the cached file unchanged. If the update succeed it should update the cached file and serve it.

There is no reward, sorry...

Creator of jEveAssets - the asset manager

"Download is the meaning of life, upload is the meaning of intelligent life"

Sciencegeek deathdealer
Echelon Research
Goonswarm Federation
#2 - 2017-04-20 20:53:22 UTC
It seems like you would want to make those first two conditionals an if else if statement for readability.

If the files does not exist
Download the file
else if the file is older than an hour
Download the file


Everything else looks fine logically, though my PHP is a bit rusty as well.
Golden Gnu
Lobach Inc.
#3 - 2017-04-21 07:47:57 UTC
Thanks, I will update that.
Thank you a million for reviewing the code :)

Creator of jEveAssets - the asset manager

"Download is the meaning of life, upload is the meaning of intelligent life"