In MDL-73145, a new $CFG setting was added to let define the preset
to be installed.
This patch replaces the method call to the new one that has been
moved from tool_admin_presets plugin to core_adminpresets component.
A new setting, $CFG->setsitepresetduringinstall, has been added to
config file, to let admins define the site admin preset to be applied
during the Moodle installation.
Besides, a new parameter, "--sitepreset" has been also added
to admin/cli/install.php, to let define it too when running the
upgrade process using CLI.
Once the admin reaches the Plugin dependencies check with a failed
plugin dependency, the "Continue" button should take him/her to the
previous page where the dependency can be sorted out, or the plugin
installation cancelled. Also the "Cancel this installation" should work
on this page, too.
None of this was happening correctly because the page with failed
dependencies is loaded with "confirmplugincheck" set to 1 as a result
of confirming the previous step. We must explicitly override it back to
0 to navigate the user back to the previous step.
* Plugins can now explicitly declare supported and incompatible Moodle
versions in version.php
- $plugin->supported[37,39];
supported takes an array of ascending numbers, that correspond to a
range of branch numbers of supported versions, inclusive. Moodle
versions that are outside of this range will produce a message
notifying at install time, but will allow for installation.
- $plugin->incompatible = 36;
incompatible takes a single int corresponding to the first incompatible
branch. Any Moodle versions including and below this will be prevented
from installing the plugin, and a message will be given when
attempting installation.
There is an existing warning if cron doesn't run at all (hasn't run
for 24 hours). This commit adds a warning if cron hasn't run for 3
minutes, based on the recommendation that cron should run every
minute.
We can't really control the direct web access to directories in dirroot,
that is part of the server setup. So we at least warn admins as they may
not realize the risks of having directories like vendor or node_modules
exposed.
Credit goes to Petr Škoda for mentioning the PHPUnit issue CVE-2017-9841
to me.
* Introduce a new php compatible library which can be used
early in execution, without Moodle dependencies
* Use it where we previously had hardcoded checks
This was originally suggested in MDL-39007.
This is:
a) To help avoid devs going on a wild goose chase to find a perf issue
when it's caused by css building
b) To make it clearer that this should never be enabled on production
sites (we already have a warning in the performance report, but who
looks at that)
Now that boost is the default theme and builds css itself, it's more
critical.
Moodle 3.2 and up will require PHP >= 5.6.5. Hopefully some day we'll
have this centralized with MDL-39007, just it's not done yet.
Thanks to Stephen Bourget for raising this!
This was a regression of my recent improvement of rendering the "Check
for updates" button. There is now unified parameter ?fetchupdates=1 that
can be used on either admin/index.php or admin/plugins.php, so that we
can use a common UI widget for both locations (without the need to pass
the URL explicitly).
The admin setting updateautodeploy no longer exists. The two existing
config.php flags $CFG->disableupdateautodeploy and
$CFG->disableonclickaddoninstall merged into a single one.
If there is an available archived zip with the version of the plugin
currently installed, we can use it to cancel/abort the upgrade of the
plugin. This is internally handled as the installation of the archived
zip and goes through all the validation and confirmation.
Additionally, some other parts were improved. Most notably, renderer no
longer decides itself if some installation can be cancelled but it
always asks the controller (plugin manager).
The button for installation was moved to the left so there should be
first buttons to add things, and then buttons to cancel things (which is
common in normal forms).
The plugin manager's method install_remote_plugins() has been changed to
install_plugins() and it is now able to install plugins from the
provided list of locally available ZIP files, too. This is used by the
Install plugins admin tool.
The plugins check screen (displayed during core upgrade and/or plugins
upgrade) now supports installation of remote plugins. This includes
installation of missing dependencies (both single and bulk mode) and
installation of available updates (both single and bulk mode).
All the HTTP query parameters supported by admin/index.php are now
explicitly enlisted. Previously, the \core\update\deployer used
its own additional parameters (and was source of some serious problems
in the past).
The implementation uses the plugin manager as the controller and
provides an unified interface for installing any remote plugin or
plugins (be it available update or missing dependency).
As a side effect, we now validate available updates which was not
happening before.
The plugins check screen now provides buttons to cancel installation of
a plugin. Available only for new installations (not upgrades) and for
additional plugins (not standard), given that the web server process has
write access to the plugin folder.
This has also been reported as MDL-48535.
As a part of the patch, there is improved processing of page URLs during
the upgrade. All this dancing around $reload URL is not needed once the
$PAGE->url is properly set to guide the admin on the correct page during
the upgrade process.
Before this patch, whenever core_plugin_manager::get_plugins() was
called, it always attached info about available updates. But this is
needed only in quite rare cases, such as when the admin is looking at
the Plugins overview and Plugins check screens. There is no need to load
this on other places and for non-admin users.
The patch removes the loading from the method
core_plugin_manager::get_plugins_of_type() and implements lazy loading
directly in the plugininfo classes so that it is loaded only when
\core\plugininfo\base::available_updates() is actually called.
The method should check against $CFG->disableupdatenotifications and not
$CFG->disableupdateautodeploy. This had to be a copy&paste mistake from
the \core\update\deployer::enabled().
While looking at it, I also fixed couple of places where this method
should and could be used.
The upgrade key can be defined in the main config.php as
$CFG->upgradekey. If it is defined there, then its value must be
provided every time the site is being upgraded, regardless the
administrator is logged in or not.
This patch replaces all homegrown timezone
stuff with standard PHP date/time code.
The main change is the introduction of core_date
class that returns normalised user and server
timezones. From now on nobody should be using
$CFG->timezone or $user->timezone directly!
Other new features and fixes:
* admins are prompted for timezone during install
* editing of other users is finally fixed
* timezones are displayed in user profile
* new $this->setTimezone() in phpunit
* time locale is now automatically reset in phpunit
* timezone is now automatically reset in phpunit
* phpunit has Australia/Perth as default timezone
Rather than using module cron, use scheduled tasks to work out
if cron has been running recently.
This is not perfect, the admin could disble all tasks, or reschedule
them - but its not complex to compute.