The Wordpress upgrade system works locally using the same mechanism used to make scheduling posts and other tasks on the site, called wp-cron
.
Cron
is the name of the task scheduler embedded in Unix systems, and the wp-cron
is an "adaptation" of this same functionality to run on systems that are not permanently running, such as a PHP site.
PHP only runs when the server receives a request, that is, in the case of Wordpress, when a user accesses the site. What the wp-cron
does is to check, at each access, if there is a scheduled task to be accomplished, and if yes, start this task. This check is started with an action linked to init
, shot into the archive wp-includes/default-filters.php
.
One of the tasks included by default is to check, twice a day, if there is a notice of new version of Wordpress published on the central site. This check is done in the function wp_version_check()
, on file wp-includes/update.php
. This function makes a request POST
for http://api.wordpress.org/core/version-check/1.7/
sending your system details, and this API responds with the newest version available for auto-update (not all sites can be updated directly to newer versions, so it checks the versions of your PHP, mysql, etc, and then it checks to see which version is right for you.
Made this check, Wordpress saves this information in a transient
called update_core
.
From there, each time you access the wp-admin
it checks if the version stored in transient
is higher than the current one and, if you have automatic updates enabled, it already triggers the update. If not, it shows you the message asking to update.
Damn, thanks for your help, brother.
– Victor
Thanks, @Victorhermes. If the answer solved your question, mark there as accepted to help those who have other similar questions later.
– Ricardo Moraleida