-2

I have two things in place.

  1. Just a normal, run of the mill wordpress site, userspice.com

  2. A downloadable php script called UserSpice that is used for managing users/controlling access to pages, etc. It's a complete PDO/OOP rewrite of UserCake. It is going through a lot of updates and features are being added weekly. UserSpice 4 has a dashboard for the administrator to administrate things. I would like the dashboard to be able to phone home to UserSpice.com to check what the latest version of UserSpice (the php app) is and offer to download the update.

I have searched extensively, but most searches involve updating the php version, NOT the app itself. Is there a particular phone home api or something like that which is built specifically for this purpose. I would assume it would involve just putting a version.txt or xml file in the root of userspice.com that contains the current version, but ideally I would want it to phone home at some sort of interval so as not to bring the userspice.com server down with useless requests.

4

1 回答 1

0

I tend to embed a constant in the code with the current version number and update it as necessary (usually manually to match notes in a version history page). That makes it easy to put the version on the screen and use it in code logic.

That's better both because you don't have to read the file and it's one less component to manage and distribute.

"Phone home" is then implemented using a web api call that compares the internal constant with the return value from the api call to your central website. That can be called from jquery so that it doesn't slow down the page load. A couple of seconds after the admin page loads something would display in the header with the "new version" message attached.

于 2016-02-10T00:54:33.343 回答