5571 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
73c2a35420 MDL-46455 backup: Implement backup of standard logstore
Using standard subplugin support, this commit implements
the backup of logstore subplugins in general and the
standard logstore in particular. Notes:

- Uses a custom final element (base64_encode_final_element) to
  support the storage of serialized 'other' information in logs.
- Organization: Instead of directly extending backup_subplugin,
  every logstore extends backup_tool_log_logstore_subplugin just
  in case any shared code is needed in the future.
- Implements both course and activity logs, sharing the structure
  completely (both are based in contextid to pick the target
  information, from database or whatever other logstores use).
2015-10-09 16:23:09 -07:00
David Mudrák
c20e9ae836 MDL-49329 admin: Add ability to cancel upgrade of the plugin
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).
2015-10-09 23:37:32 +02:00
Dan Poltawski
9ff7c33ba5 MDL-50412 admin: prevent fatal errors on reports admin page 2015-10-09 14:46:35 +01:00
David Mudrák
a2e1e0d0f1 MDL-49329 admin: Archive plugin code before removing it from dirroot
This should allow the admin to revert the upgrade of existing plugins,
such when the dependency chain leads to a dead-end. Additionally, we
archive (as a last-chance copy) the to-be-installed plugins when
cancelling their installation. This is mainly for developers who could
otherwise loose their code. For the same reason, plugins are being
archived upon uninstallation, too.
2015-10-09 14:33:47 +02:00
David Mudrák
4d7528f9bc MDL-49329 admin: Require confirmation before cancelling plugin install 2015-10-09 09:50:46 +02:00
David Mudrák
4fff948910 MDL-49329 admin: Convert install plugins tool to use new APIs
Most of the functionality provided by this tool (typically the
validation and actual deployment of the plugin package) has been moved
to the core level. So this is becoming just a thin wrapper and user
interface for installing new plugins via the administration UI.

Also fixes MDL-49600 as we no longer keep the unzipped contents of the
packages in the persistent temp directories.
2015-10-09 09:50:46 +02:00
David Mudrák
2d00be61f1 MDL-49329 admin: Make plugin manager able to install from local zips too
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.
2015-10-09 09:50:46 +02:00
David Mudrák
8726c07cd0 MDL-49329 admin: Use the new plugins management on Plugins overview page
The plugins overview page now uses the new plugins management features,
most notably the ability to install all available updates at once.
2015-10-09 09:50:45 +02:00
David Mudrák
531381f914 MDL-49329 admin: Support plugins installation during upgrade
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.
2015-10-09 09:50:45 +02:00
David Mudrák
c948b813ae MDL-49329 admin: Add plugin manager method for installing remote packs
The new method core_plugin_manager::install_remote_plugins() will serve
as a backend for all the ways of installing ZIP packages from the moodle
plugins directory, such as installing new plugins (by clicking the
Install button in the plugins directory), installing available updates
(single and bulk mode) and installing missing dependencies (single and
bulk mode).

The method should be used both for validation pre-check screen and,
after the confirmation, for actual installation. Note that we
intentionally repeat the whole procedure after confirmation. Unzipping
plugins is cheap and fast and the ZIPs themselves are already available
in the \core\update\code_manager's cache.

We will need to add support for archiving existing code to prevent
accidental data-loss.

This basically provides what mdeploy.php was doing, but better. We now
have consistent way of installing all remote ZIP packages, always
validate them and we can perform bulk operations, too.
2015-10-09 09:50:44 +02:00
Mifsud Gaël
f209d5e1be MDL-51083 admin: Prevent password autofill in authentication settings 2015-10-09 14:04:34 +08:00
David Mudrák
44371554a9 MDL-49329 admin: Improve plugins overview page rendering
Provides a bit more compact layout. Finally cleans up the relevant LESS
files and makes available updates info boxes consistent across all
screens where they are displayed.
2015-10-08 23:32:04 +02:00
David Mudrák
3bca7dbfa6 MDL-49329 admin: Get rid of mdeploy and \core\update\deployer class
The mdeploy.php standalone script (used to download and unzip plugins
into the dirroot) and the \core\update\deployer class (as a
communication bridge between the core and the mdeploy.php) was
originally designed and implemented with the assumption that it would be
eventually used for updating the Moodle core itself, too. Therefore it
was written as standalone utility without dependency on the Moodle core
libraries.

However, it never happened and there is no real demand for that. So now
there is no need to have and maintain a completely parallel solution for
common things like fetching and unzipping plugin ZIPs.

Additional reasoning for mdeploy.php was that the core is not very
reliable during the core upgrade and we could run into various troubles.
This does not seem to be that bad. We rely on a lot of core
functionality (such as output rendering, DB access etc) and plugins
deployment seems to work well (and better) with common core libraries.

So long mdeploy, and thanks for all the hard work you did for us.
2015-10-08 23:32:04 +02:00
David Mudrák
228cbda3ea MDL-49329 admin: Fix plugins check page if no plugins require attention
A legacy undefined variable was used here and there was no way to get to
the full list mode view.
2015-10-08 23:32:04 +02:00
David Mudrák
36977a6d08 MDL-49329 admin: If unable to install a plugin, display the reason 2015-10-08 23:32:04 +02:00
David Mudrák
35f2b67442 MDL-49329 admin: Fix the API for getting remote plugin info
The previous version of the plugin manager's method
get_remote_plugin_info() was suitable for installing missing
dependencies only. To make use of for installing new plugins and/or
available updates, it must be clear that we are requesting information
for the particular plugin version only, not "given or higher" version.
2015-10-08 23:32:04 +02:00
David Mudrák
0ec7d10128 MDL-49329 admin: Improve Plugins check page
Better inform about the number of plugins requiring attention vs total
plugins. Clean up the renderer.
2015-10-08 23:32:03 +02:00
David Mudrák
9137a89a1a MDL-49329 admin: Improve the UI for installing dependencies 2015-10-08 23:32:03 +02:00
David Mudrák
2f29cf6e63 MDL-49329 admin: Add ability to cancel installation of a new plugin
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.
2015-10-08 23:32:03 +02:00
David Mudrák
f2d8ed45e3 MDL-49329 admin: Introduce new \core\update\validator class
This is not really new class. Originally, the validator was implemented
in the scope of the tool_installaddon plugin. But we need its features
in other parts at the core level (e.g. during the upgrade to validate
available missing dependencies or available updates). Looking back, it
was a mistake to have it implemented at the plugin level rather than the
core level.

So this patch moves the tool_installaddon_validator class to
\core\update\validator class, together with associated unit tests,
fixture files and strings. There were changes made in the
tool_installaddon to make use of this new class instead of the old one.

This is a great step towards the bright future, hopefully there won't be
many regressions.

AMOS BEGIN
 MOV [validationmsg_componentmatch,tool_installaddon],[validationmsg_componentmatch,core_plugin]
 MOV [validationmsg_componentmismatchname,tool_installaddon],[validationmsg_componentmismatchname,core_plugin]
 MOV [validationmsg_componentmismatchname_help,tool_installaddon],[validationmsg_componentmismatchname_help,core_plugin]
 MOV [validationmsg_componentmismatchname_info,tool_installaddon],[validationmsg_componentmismatchname_info,core_plugin]
 MOV [validationmsg_componentmismatchtype,tool_installaddon],[validationmsg_componentmismatchtype,core_plugin]
 MOV [validationmsg_componentmismatchtype_info,tool_installaddon],[validationmsg_componentmismatchtype_info,core_plugin]
 MOV [validationmsg_filenotexists,tool_installaddon],[validationmsg_filenotexists,core_plugin]
 MOV [validationmsg_filesnumber,tool_installaddon],[validationmsg_filesnumber,core_plugin]
 MOV [validationmsg_filestatus,tool_installaddon],[validationmsg_filestatus,core_plugin]
 MOV [validationmsg_filestatus_info,tool_installaddon],[validationmsg_filestatus_info,core_plugin]
 MOV [validationmsg_foundlangfile,tool_installaddon],[validationmsg_foundlangfile,core_plugin]
 MOV [validationmsg_maturity,tool_installaddon],[validationmsg_maturity,core_plugin]
 MOV [validationmsg_maturity_help,tool_installaddon],[validationmsg_maturity_help,core_plugin]
 MOV [validationmsg_missingcomponent,tool_installaddon],[validationmsg_missingcomponent,core_plugin]
 MOV [validationmsg_missingcomponent_help,tool_installaddon],[validationmsg_missingcomponent_help,core_plugin]
 MOV [validationmsg_missingcomponent_link,tool_installaddon],[validationmsg_missingcomponent_link,core_plugin]
 MOV [validationmsg_missingexpectedlangenfile,tool_installaddon],[validationmsg_missingexpectedlangenfile,core_plugin]
 MOV [validationmsg_missingexpectedlangenfile_info,tool_installaddon],[validationmsg_missingexpectedlangenfile_info,core_plugin]
 MOV [validationmsg_missinglangenfile,tool_installaddon],[validationmsg_missinglangenfile,core_plugin]
 MOV [validationmsg_missinglangenfolder,tool_installaddon],[validationmsg_missinglangenfolder,core_plugin]
 MOV [validationmsg_missingversion,tool_installaddon],[validationmsg_missingversion,core_plugin]
 MOV [validationmsg_missingversionphp,tool_installaddon],[validationmsg_missingversionphp,core_plugin]
 MOV [validationmsg_multiplelangenfiles,tool_installaddon],[validationmsg_multiplelangenfiles,core_plugin]
 MOV [validationmsg_onedir,tool_installaddon],[validationmsg_onedir,core_plugin]
 MOV [validationmsg_onedir_help,tool_installaddon],[validationmsg_onedir_help,core_plugin]
 MOV [validationmsg_pathwritable,tool_installaddon],[validationmsg_pathwritable,core_plugin]
 MOV [validationmsg_pluginversion,tool_installaddon],[validationmsg_pluginversion,core_plugin]
 MOV [validationmsg_release,tool_installaddon],[validationmsg_release,core_plugin]
 MOV [validationmsg_requiresmoodle,tool_installaddon],[validationmsg_requiresmoodle,core_plugin]
 MOV [validationmsg_rootdir,tool_installaddon],[validationmsg_rootdir,core_plugin]
 MOV [validationmsg_rootdir_help,tool_installaddon],[validationmsg_rootdir_help,core_plugin]
 MOV [validationmsg_rootdirinvalid,tool_installaddon],[validationmsg_rootdirinvalid,core_plugin]
 MOV [validationmsg_rootdirinvalid_help,tool_installaddon],[validationmsg_rootdirinvalid_help,core_plugin]
 MOV [validationmsg_targetexists,tool_installaddon],[validationmsg_targetexists,core_plugin]
 MOV [validationmsg_targetexists_help,tool_installaddon],[validationmsg_targetexists_help,core_plugin]
 MOV [validationmsg_unknowntype,tool_installaddon],[validationmsg_unknowntype,core_plugin]
 MOV [validationmsg_versionphpsyntax,tool_installaddon],[validationmsg_versionphpsyntax,core_plugin]
 MOV [validationmsglevel_debug,tool_installaddon],[validationmsglevel_debug,core_plugin]
 MOV [validationmsglevel_error,tool_installaddon],[validationmsglevel_error,core_plugin]
 MOV [validationmsglevel_info,tool_installaddon],[validationmsglevel_info,core_plugin]
 MOV [validationmsglevel_warning,tool_installaddon],[validationmsglevel_warning,core_plugin]
AMOS END
2015-10-08 23:32:03 +02:00
David Mudrák
5a92cd0b8d MDL-49329 admin: Display missing dependencies on plugins check screen
The patch improves the dependencies resolution in the plugin manager so
that the information about availability of the missing dependency is
included and can be displayed at the Plugins check screen during the
upgrade.
2015-10-08 23:32:03 +02:00
David Mudrák
48900324b3 MDL-49329 admin: Introduce new \core\update\api client class
The purpose of this class is to provide a general client for all APIs
available at https://download.moodle.org/api/ (e.g. available updates,
plugin info, plugins list etc). Currently, fetching data from this API
is done separately at several places. This leads to code duplication and
harder maintenance (I know it well).

Additionally, the existing client was implemented as
tool_installaddon_pluginfo_client in the admin/tool/installaddon/ scope.
I will soon need to use the same functionality in the
core_plugin_manager and it would hurt my karma if the core was depending
on a class provided by a admin tool plugin (even if it is standard one).

So, there is new \core\update\api client implementing the version 1.3 of
the pluginfo API. There is a TODO note left for remaining services.
2015-10-08 23:32:03 +02:00
David Mudrák
7eb87eff65 MDL-49329 admin: Move requirements resolving to the plugin manager
The patch moves the resolving logic from the renderer (where it should
not really be) to the plugin manager (controller). This is needed
because we will need the very same logic to be used at other places.
2015-10-08 23:32:02 +02:00
David Mudrák
30d8bc5f66 MDL-49329 admin: Do not always load info about available updates
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.
2015-10-08 23:32:02 +02:00
David Mudrák
e9d3c21228 MDL-49329 admin: Fix \core\update\checker::enabled() logic
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.
2015-10-08 23:32:02 +02:00
David Mudrák
fd17898c0c MDL-49329 admin: Improve the styling of the Plugins check screen
The intention here is to make the table a little bit more compact (using
less columns) and to make use of the bootstrap based label elements if
available.
2015-10-08 23:32:02 +02:00
David Monllao
5307265d0d Merge branch 'MDL-51632_echo_url' of git://github.com/moodlerooms/moodle 2015-10-07 15:24:36 +08:00
David Monllao
b0fca9208b Merge branch 'MDL-51478-master' of git://github.com/jleyva/moodle 2015-10-05 13:38:43 +08:00
Mark Nielsen
aff1db055f MDL-51632 tool_generator: Print URL of the generated course 2015-10-01 11:03:12 -07:00
Dan Poltawski
a3b1172dcb Merge branch 'MDL-50602-master' of https://github.com/StudiUM/moodle 2015-09-29 16:03:52 +01:00
Juan Leyva
6b6deb8e74 MDL-51478 webservice: Enable the Mobile service by default 2015-09-25 10:05:04 +02:00
David Mudrák
6ef02f8479 MDL-51261 admin: Add option to define upgradekey via cli installer 2015-09-24 21:02:33 +02:00
David Mudrák
98b32c9e7e MDL-51261 admin: Support upgrade key requirement on the site upgrade
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.
2015-09-24 21:02:33 +02:00
David Mudrák
a277654f7f MDL-51261 admin: Fix the heading when displaying all plugins
Not directly related to the issue but spotted while developing it and it
is not worth of submitting in a separate issue.

At the Plugins check page, when the "Display the full list of installed
plugins" link was followed, the heading at the next page read something
like "Number of plugins requiring your attention: 357". That is
misleading as this is actually not the number of displayed plugins, not
the number of plugins requiring attention.
2015-09-24 21:02:33 +02:00
Jean-Philippe Gaudreau
2b7c85da17 MDL-50602 - Automated backup: Remove old backups associated to courses
Refactoring and renaming of settings.
2015-09-24 14:08:17 -04:00
Serge Gauthier
694f195da0 MDL-50602 - Automated backup: Remove old backups associated to courses 2015-09-24 14:02:19 -04:00
rajesh Taneja
267033a979 MDL-50940 behat: Added support for field matching with xpath 2015-09-24 13:00:15 +08:00
Dan Poltawski
11a83dbb1e Merge branch 'MDL-49973-master' of git://github.com/cameron1729/moodle 2015-09-22 09:44:44 +01:00
Damyon Wiese
28de777199 MDL-51222 Javascript: Trigger events for filters on DOM insertion
When nodes are added to the dom, they may need to be re-processed by a JS based
filter. To do this we need to trigger the legacy YUI event filter-content-updated.

To make this easier I added some wrappers to template that will insert the node, run any
JS and trigger the event.

I also changed existing yui code to call the amd function to trigger the event. This way
all jquery and yui listeners will always be notified.
2015-09-22 15:40:51 +08:00
Dan Poltawski
f3164da6cf Merge branch 'MDL-51330-master' of https://github.com/sammarshallou/moodle 2015-09-21 12:10:35 +01:00
David Mudrák
7d62bc2417 MDL-51403 install: Improve the language validation in the CLI installer
There are two essential improvements here. Firstly, by replacing the
file_exists() check with array_key_exists() we make sure that only
actual language code will be written into the config.php file (and not
the empty value in case of input that does not pass the PARAM_SAFEDIR
cleaning).

Additionally, we no longer display the full list of available languages
by default. The list can be displayed in the interactive mode by typing
the ? character instead of the language code. This makes the overall
interface cleaner, does not cause the header information (such as the
Moodle version) to scroll away and makes the nice cli logo more visible
(which was the main motivation for the whole patch anyway ;-).
2015-09-17 21:06:32 +02:00
Marina Glancy
70fb46c87f MDL-51427 user: correctly use strings for phone1 and phone2
Thanks to Olumuyiwa Taiwo for original patch

AMOS BEGIN
  CPY [phone,core],[phone1,core]
AMOS END
2015-09-16 13:37:46 +08:00
Andrew Davis
6537778044 MDL-49973 changed continue to delete on delete confirmations 2015-09-14 17:40:34 +08:00
David Monllao
742548e251 Merge branch 'wip-mdl-51101' of git://github.com/rajeshtaneja/moodle 2015-09-14 16:18:01 +08:00
Andrew Nicols
ac43dc23e4 Merge branch 'MDL-50783-master' of git://github.com/damyon/moodle 2015-09-14 15:52:42 +08:00
Damyon Wiese
ba224fb42c MDL-50783 Ajax: Configure how to call a webservice through db/service.php
Now the db/service.php array can contain these extra keys to provide information
on how a webservice may be called:

    'ajax' => true (Default is false)

Replaces the xx_is_allowed_from_ajax callback.

    'loginrequired' => false (Default is true)

Means that this webservice can be called through lib/ajax/service-nosession.php
which sets NO_MOODLE_COOKIES to true (faster). This is only safe for webservices returning
static public data (e.g. get_string).
2015-09-14 15:10:21 +08:00
Mark Nelson
53914e4465 MDL-51051 core_grades: 'Categories and items' => 'Gradebook setup' 2015-09-14 08:23:32 +08:00
Rajesh Taneja
d8ada0f19b MDL-51101 behat: Removed old behat steps checking feature
This was introduced when there were no features
testing all the steps. Now we have all use-cases
so removing this feature file
2015-09-10 14:43:59 +08:00
Marina Glancy
2ff1f05183 MDL-51357 roles: fix table layout after MDL-38763 2015-09-09 13:07:11 +08:00
sam marshall
b9dba4e3aa MDL-51330 Cron: In log, scheduled tasks don't show component 2015-09-07 18:40:05 +01:00