If enabled, Moodle sites will check for updates every night sometimes
between 01:00 AM and 06:00 AM local time. The actual offset will be
generated randomly at the beginning and used consistently since then.
This way, the queries against the server are supposed to be spread in
time.
Serious site admins should not try to upgrade their sites later than
01:00 AM as they are too tired already. Neither should they do it before
06:00 AM as they did not have a morning coffee yet and are too tired yet
:-)
We are displaying available updates for installed plugins only. It was
decided (by me and Eloy) that we will not display info about available
Moodle update during the upgrade. It seems to be redundant as the admin
just uploaded a new version of Moodle so they probably chose what they
wanted.
The status_uptodate is a flag that the plugin's on-disk version and the
in-db version are in sync, that is no upgrade will be performed.
However, there can be a newer version of the plugin available. So using
the term "up-to-date" may be confusing.
The filelib is usually loaded already. However, during some steps of the
upgrade the curl class must be available to perform fetches of updates
and the library does not need to be loaded yet.
In case of Moodle code itself, there is no plugin_manager like class
available so the checker class itself must be aware of versions and
actually do the checks. On the other hand, we can always rely that
version, release and maturity are always returned by the remote server.
The purpose of the class is to fetch the information about available
updates for the Moodle core and/or Moodle components from a remote site
and cache it locally.
We will need to know our major version to fetch the relevant data from remote
servers. This patch also fixes yet another place where the version used
to be hard-coded.
These changes are motivated by feedback from Tim Hunt (17 October 2011
in the developers chat room). The combination of using an interface, but
then putting all the useful information in public fields, was not good
design of this library. So I am merging the plugin_information interface
and the plugintype_base class into a new abstract class plugininfo_base.
This new class defines the basic API of all information holding
subclasses. This does not change the code, just puts the documentation
closer to the methods they are actually implemented.
Classes with magic properties such as context do not pass through json_encode().
The solution is to implement iterator in such classes and convert what we
feed to json_encode to array using 'foreach' before we pass it to json_encode():
- class context implements IteratorAggregate
- added function convert_to_array() that converts anything to array
- before calling json_encode we convert the argument to array