219 Commits

Author SHA1 Message Date
Mikhail Golenkov
ed5e808052 MDL-70337 backup: Enhance automated backup logs readability 2021-05-24 10:29:02 +10:00
Bas Brands
f9e1c2587a MDL-28452 core_user: migrate social profile fields
Create a new profile field type, move all existing content of the fields
'icq', 'skype', 'aim', 'yahoo', 'msn' and 'url' in the mdl_user table to
theses new profile fields if needed.

AMOS BEGIN
MOV [aimid,core],[aimid,courseimage,profilefield_social]
MOV [yahooid,core],[yahooid,profilefield_social]
MOV [skypeid,core],[skypeid,profilefield_social]
MOV [icqnumber,core],[icqnumber,profilefield_social]
MOV [msnid,core],[msnid,profilefield_social]
MOV [webpage,core],[webpage,profilefield_social]
AMOS END
2021-04-21 11:22:25 +02:00
Jun Pataleta
ebf078458d Merge branch 'MDL-71036' of https://github.com/stronk7/moodle 2021-03-17 20:05:25 +08:00
Eloy Lafuente (stronk7)
ba5b6089d5 MDL-71036 phpunit: Renamed various regexp-related assertions
In PHPUnit 9.1, the following regexp-related assertions
have been deprecated and there are new alternatives for
all them:
    - assertRegExp()     -> assertMatchesRegularExpression()
    - assertNotRegExp()  -> assertDoesNotMatchRegularExpression()

This is about to, simply, move all cases to the new alternatives.

Source: https://github.com/sebastianbergmann/phpunit/blob/9.1.0/ChangeLog-9.1.md

Regexp to find all them:

    ag 'assertRegExp|assertNotRegExp' -li
2021-03-11 19:22:24 +01:00
Mikhail Golenkov
e9eb3ad6c5 MDL-71044 backup: backup_cleanup_task task to remove old files 2021-03-07 21:46:47 +11:00
Eloy Lafuente (stronk7)
f6711bb394 MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:45:59 +02:00
Eloy Lafuente (stronk7)
5b188629c7 MDL-68780 unit tests: Add missing ->destroy() calls to controllers
Every backup and restore controller always need to call
to their ->destroy() method in charge of finalizing loggers,
closing file handlers and destroy some circular references.

This is specially important within unit tests, because
open resources cannot be reset between tests, causing problems,
specially within Windows that locks all those files.
2020-05-20 11:02:00 +02:00
Matt Porritt
01436f7539 MDL-64843 Backup: Course copy user interface
This patch adds better core support for copying courses.
There is now a simplified and dedicated UI for copying
courses. This can be accessed from the course context
menu or course management screens.

All backups are done asynchronously and there can be multiple
copies of a course in flight at once.
2020-05-15 06:02:02 +00:00
Paul Holden
5526870052 MDL-67731 backup: fix async restores in progress table listing. 2020-03-22 19:57:34 +00:00
John Yao
d0734df404 MDL-65729 Backup: Split individual backups into ad-hoc tasks
* refactor run automated backup
* new backup status of Queued
* adhoc task for backing up a course
* course locking for course backup adhoc task
* use Moodle locking instead of custom locking for run automated backup task
* add unit tests to extracted methods
2019-12-04 15:10:23 +11:00
cescobedo
e24f4a2ecd MDL-66593 core_backup: Replace h5p/embed.php url for H5PEMBED@$ 2019-10-30 06:46:35 +01:00
Matt Porritt
d7e4481e98 MDL-35773 Backup: API should have option to not backup files
Allow both UI and automated backups to be created without
including files.  Instead include only file references.
This is essentially implementing "SAMESITE" to backup files
instead of only for import and export functionality.
A new backup setting to include files (defaults to yes)
has been included.

The restore process will also look for and attempt to
restore files from the trashdir as part of restoring
backups.  Additionally to support this process the
ammount of time files are kept in trashdir before they
are cleaned up via cron is also adjustable via admin
setting.
2019-07-26 11:59:56 +08:00
Eloy Lafuente (stronk7)
11cdea3fad MDL-65201 backup: amend tests to apply for the final agreed criteria
backup nextstarttime ASC
course timemodified DESC
2019-06-06 11:16:01 +02:00
Eloy Lafuente (stronk7)
bcd4862e84 MDL-65201 backup: fix wrong sorting that was missed on integration 2019-06-06 10:08:02 +02:00
Matt Porritt
c2716719a6 MDL-65201 Backup: Automated backup course ordering
This patch adds sort ordering to the way courses are
automatically backed up. It sets the following preference:

Backup courses that do not have an entry in backup_courses first,
as they are likely new and never been backed up.
Backup courses that have the oldest next start time in backup_courses.
Give preference to most recently modified courses over other courses.
2019-06-04 23:09:57 +00:00
Eloy Lafuente (stronk7)
3c62200fa0 MDL-65498 backup: Add a couple of missing destroy() calls
Specially noticeable under Windows, where some resources/files
are kept open/busy/locked, causing all sort of problems, easily
detectable in phpunit resets.
2019-05-06 00:01:55 +02:00
David Monllaó
03876f0b89 Merge branch 'MDL-65207-master' of git://github.com/lameze/moodle 2019-04-24 17:52:10 +02:00
Adrian Greeve
4962446a44 Merge branch 'MDL-65308' of git://github.com/stronk7/moodle 2019-04-24 09:27:07 +08:00
Eloy Lafuente (stronk7)
0b9d7d93f8 MDL-65308 core: change a couple of unsafe preg_quote() cases
With PHP 7.3, the hash (#) is being escaped by preg_quote().

While normally that doesnt have much impact and normal operations
continue working perfectly... when the results of the function are
used to match against the same string... they don't match anymore.

Have found a couple of there double-uses in core and this
commit fixes them. Covered with tests.
2019-04-16 01:40:47 +02:00
Matt Porritt
2cd901a4e7 MDL-28505 Backup: Asynchronous backup and restore
This patch adds asynchronous backup and restore functionality
to Moodle. This is an optional feature and is not enabled by
default. It can be enabled by site administrators.
Asynchronous backup and restores are actioned by the Moodle
adhoc task API. The progress of backup and restores is
displayedin the Moodle UI.  Users can also be sent a message
when a backup or restore operation completes via the
Moodle messaging API.
2019-04-09 00:15:42 +00:00
Simey Lameze
9bec0e7e74 MDL-65207 core: replace typos by actually 2019-04-01 08:49:18 +08:00
Brendan Heywood
af368c1076 MDL-65321 backups: Only require minimal async backup libs if needed 2019-04-13 23:43:01 +10:00
Damyon Wiese
dcb35b721c MDL-63920 backup: Email string improvement
Change from semicolon to colon in email.
2018-11-20 16:14:35 +08:00
Andrew Hancox
820f28c61b MDL-61578 backup: Added unit test for is_course_modified check. 2018-07-10 10:50:30 +08:00
Michael Hawkins
4b9c2928d4 MDL-61578 backup: Prevent backup logging triggering fresh backups.
Thanks to Renaat Debleu for their contribution to this solution.
2018-07-10 10:50:30 +08:00
Matteo Scaramuccia
ef844148a9 MDL-60923 backup: Added $CFG->backuptempdir
The new setting will allow to host the temporary backup files
into a specific target directory. Defaults to '$CFG->tempdir/backup'.

Calling make_backup_temp_directory() checks that the required sub-directory
will be properly created under the new target directory.
2018-04-16 23:50:28 +02:00
Shamim Rezaie
8df402e401 MDL-61132 Questions: Adapt logic on backup/restore
Modifying backup/restore to adapt with "Top" categories.
2018-02-05 11:58:57 +11:00
Ankit Agarwal
23876070b9 MDL-59908 backup: Add tests to make sure both http(s) schemes are parsed 2017-08-24 10:33:24 +05:30
Mark Nelson
f1dd575c6f MDL-59737 core_backup: changed reference to domain doesntexist.com 2017-08-07 17:17:58 +08:00
Dmitrii Metelkin
597c6f2a09 MDL-58811 backup: fix an extra slash on restore for the legacy files 2017-05-16 14:35:16 +10:00
Eric Merrill
880fc15bf0 MDL-47162 core_message: Updating all uses of messaging to add courseid 2016-10-31 14:13:13 -04:00
Amanda Doughty
cc350fd9c8 MDL-47162 core_message: Add course id to message eventdata 2016-10-27 18:11:27 +02:00
Daniel Neis Araujo
fbcdb0d710 MDL-22078 course: add end date 2016-10-03 09:51:36 +08:00
Eloy Lafuente (stronk7)
53f95c99cb MDL-54205 backup: loggers close() and destroy()
Any backup & restore operation may be leaving opened files
if a file logger is being used. This implementes the close()
method, so every logger can close any resource.

Also, the recommended backup_controlled::destroy() method
now calls to new logger::destroy() method in charge of
deleting all the references and closing any resource.

Finally, some internally used controllers, were missing
their destroy call, leading to associated loggers to
remain open. Now all them are explicitly deltroyed.
2016-05-13 01:54:28 +02:00
Simey Lameze
11d4bea28b MDL-50268 core: proper deprecation of get_file_url() method 2016-01-18 13:44:22 +08:00
Russell Smith
eb8c0cb163 MDL-52402 backup: Improve debugging output on failed log restores 2015-12-05 10:08:06 +11:00
Eloy Lafuente (stronk7)
8827b67aeb MDL-52141 backup: test restore_log_rule don't modify passed log anymore 2015-12-03 18:52:26 +01:00
Russell Smith
a8137ec25f MDL-52141 backup: Ensure we don't alter the log record when parsing it. 2015-12-03 11:11:07 +01:00
Jean-Philippe Gaudreau
e10c9acc19 MDL-50602 - Automated backup: Add constants for storage types
Improve the code readability significantly by adding constants for storage types.
2015-09-24 14:08:18 -04: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
Dan Poltawski
77679fb2e5 Merge branch 'MDL-36957-master' of git://github.com/FMCorz/moodle 2015-06-02 11:07:57 +01:00
Martin Mastny
4ee052641e MDL-49493 backup: Implemented missing methods for anonymous backup 2015-05-25 10:35:11 +08:00
Dan Poltawski
9b67b43b21 Merge branch 'MDL-49755' of git://github.com/mr-russ/moodle 2015-04-14 17:45:56 +01:00
Petr Skoda
e49cb057a1 MDL-49828 timezones: fix typos introduced by MDL-49684 2015-04-12 12:11:10 +12:00
Frederic Massart
725d18f980 MDL-36957 backup: Allow invalid setting level in backup info file 2015-04-09 17:33:52 +08:00
Petr Skoda
d6e7a63d9a MDL-49684 timezones: rewrite timezone support
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
2015-04-06 13:53:51 +12:00
Russell Smith
9129827158 MDL-49755 backup: Cache backup information. 2015-04-05 20:03:08 +10:00
David Monllao
59aebbed70 MDL-48595 logstore: Replacing references to deprecated interfaces 2015-03-09 08:25:37 +08:00
Eloy Lafuente (stronk7)
16dafa5d9f Merge branch 'MDL-48266-master' of git://github.com/FMCorz/moodle
Conflicts:
	version.php
2015-01-26 19:19:35 +01:00