441 Commits

Author SHA1 Message Date
Paul Holden
8023990caf
MDL-77838 repository: preserve empty dirs in download if selected. 2024-03-22 16:21:18 +00:00
Eloy Lafuente (stronk7)
29a541724f
MDL-65292 style: Fix all the function declaration ordering
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration

It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.

So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
2024-02-28 23:47:47 +01:00
Paul Holden
70323bc04f
MDL-74466 repository: avoid passing around sesskey when not required. 2023-12-04 09:22:27 +00:00
Sara Arjona
cc9430929d
MDL-77708 docs: Update references from docs.moodle.org/dev 2023-09-26 10:30:19 +02:00
Jun Pataleta
be35034f1c
Merge branch 'MDL-76974' of https://github.com/paulholden/moodle 2023-08-28 17:03:27 +08:00
Sara Arjona
7430208d56
MDL-78884 files: Deprecate size parameter for icons
The parameter $size of the following functions has been deprecated and is not used any more:
  - file_extension_icon
  - file_file_icon
  - file_folder_icon
  - file_mimetype_icon
  - mimeinfo_from_type
  - url_guess_icon

That way, the sized icons (xxxxxxx-yyy.png) can be removed and replaced by SVG, to make it easier
to keep them updated because once they are replaced, there will only be one single file for each
MIME icon.
2023-08-23 07:30:16 +02:00
Paul Holden
b30245b3e2
MDL-76974 javascript: convert remaining uses of old preferences API.
Implement component preference definition callbacks, update JS code
to use the `core_user/repository` module instead of the now deprecated
API.
2023-08-22 14:43:34 +01:00
Paul Holden
2974f5aeb6
MDL-50272 repository: deprecate base class get_file_size method. 2023-07-04 16:54:28 +01:00
Andrew Nicols
8d1a2c960a
MDL-78019 core: Whitespace fixes 2023-06-01 10:20:06 +08:00
Anupama Sarjoshi
b4b9248b78 MDL-78019 core: Logs to record user file deleted from draft area 2023-05-26 17:45:36 +01:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Meirza
59c6b2dccd MDL-77342 repository: Added class properties that are not declared.
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-03-26 14:48:29 +07:00
cescobedo
0a5d387398 MDL-72615 core: Remove boxnet portfolio and repository 2021-10-27 06:24:55 +02:00
sam marshall
e332d1849d MDL-72643 core: Improve display_size
Allows display_size to use a fixed unit for easy comparison of
multiple results, and fixed decimal places for the same reason.

Improves behaviour by using consistent decimal places and a
consistent space before the unit (the previous one only has a space
before 'bytes', not before 'KB').

Of existing uses, all the ones that displayed a 'maxbytes' type
configuration setting (which are likely to have an 'exact' size
and would be better shown as 512 KB rather than 512.0 KB) have been
changed to use 0 decimal places, to preserve previous behaviour.
All the uses which were showing an actual file or memory size have
been left as default (1 decimal place).
2021-09-27 16:52:33 +01:00
Tim Hunt
385ce8a5e1 MDL-71313 repositories: warn if get_instances context is wrong type 2021-04-12 20:30:43 +01:00
Marina Glancy
465d1ef495 MDL-70921 repository: filter function can not accept argument by ref
PHP8.0 shows error that filter function accepts value by reference
The nested filtering was never working but also this function was never called on a tree with sub-levels,
so this logic is now removed
2021-02-25 18:24:52 +01:00
Sara Arjona
3d0541c03a Merge branch 'MDL-68758-master' of git://github.com/peterRd/moodle 2020-05-27 09:46:47 +02:00
Peter Dias
31788c8cf2 MDL-68758 core_repository: Allow ability to download files on all views. 2020-05-27 14:20:15 +08:00
Tom Dickman
4399e4759a MDL-45184 tool_licenses: Add custom licenses
This feature adds an admin tool for creating custom licenses.
Now custom licenses can be added and amended in Moodle, and the site
default can be set to a custom license.

Core licenses remain hard-coded and are uneditable, so they will always
require update within Moodle core updates, and maintain their
internationalisation through core language strings.

This also includes fundamental changes to the license API including
the addition of license caching and deprecation of no longer required
admin settings for license management.
2020-05-26 12:08:05 +10:00
Peter
a216d86c6c MDL-33671 core: Add ability to download selected items
Utilise the new checkbox-toggleall functionality
2020-03-03 07:20:35 +08:00
Peter
2f03923602 MDL-33671 core: Allow for bulk delete of files
* Enable bulk delete in a details view
* Behat tests for new functionality
* Unit test for new function
2020-03-03 07:20:35 +08:00
Adrian Greeve
f1d1a60e0a MDL-61131 repositories: Added a key to verify incoming urls. 2018-01-09 11:34:37 +01:00
Adrian Greeve
33e385a5fb MDL-37757 repositories: Deleting a repository deletes files.
If the user decides to remove a repository all of the linked
files are now deleted along with file references. This was causing
problems such as the course page displaying an error with no recourse
to fix the problem.
2017-11-16 14:46:40 +08:00
Cameron Ball
03756f0bdb
MDL-59700 filestorage: Rework repositories to avoid add_file_to_pool
For historical reasons repositories need to call add_file_to_pool
to sync file records. However now that a before_file_created hook
has been added additional information is needed by add_file_to_pool.

Ideally add_file_to_pool and friends will become private/protected,
so we need to remove all uses of it in core.

This patch adds some new methods to the file class to allow syncing
to be managed internally by the file and the file_storage class.
2017-08-07 15:50:15 +08:00
Jake Dallimore
84fb93a77e Merge branch 'MDL-58297-master' of git://github.com/andrewnicols/moodle 2017-04-11 10:49:07 +08:00
Andrew Nicols
e6a4780452 MDL-58297 core: Update to use new hashing functions 2017-04-07 10:40:23 +08:00
Damyon Wiese
eb47ad4a6e MDL-58220 repository: More docs / comments
More docs / comments for the reference_file_selected function used by controlled links.
2017-04-03 13:43:26 +08:00
Damyon Wiese
141ee541ca MDL-58219 repository: Change how controlled links work
Files are copied to the system user as soon as they are uploaded. Write access is then controlled when
serving links to the file.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
Damyon Wiese
151b0f9409 MDL-58132 repositories: Controlled link file type
This introduces a new "controlled link" file type where the file is not
stored in Moodle - but Moodle will control the access permissions on the file.

Plugins can "freeze" a filearea which means Moodle will take ownership of all the remote
files of this type.

When accessing a file, if the "filebrowser" infomation indicates the current user can write to the file, they
will be granted temporary write access.

Part of MDL-58220
2017-04-03 13:40:13 +08:00
Damyon Wiese
989e14fea0 MDL-58128 googledocs: Support reference files.
Add options so the admin can control the types of files this repository can support (and the default).

Part of MDL-58220
2017-04-03 13:40:13 +08:00
Damyon Wiese
663640f5b3 MDL-40759 icons: convert uses of pix_url to pix_icon
Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
2017-03-17 15:52:17 +08:00
Andrew Nicols
16a34ae189 MDL-46375 core_files: Split parts of file_storage into new file system
This change moves all operations which deal with the fetching/updating, or
setting of files from the file_storage class into a new file_system class.

A new file_system can be specified in the config.php and used to replace
all relevant methods in order to move the file system component to an
alternative solution.
2017-02-14 08:42:28 +08:00
Frederic Massart
df52c272cf
MDL-54785 files: Deprecate the support for $usepost and related 2016-06-23 12:41:03 +08:00
Frederic Massart
048f8073d1
Revert "Merge branch 'MDL-54110_master' of https://github.com/marxjohnson/moodle"
This reverts commit 016e0abfbc1992f01eadfdef02de6e56ffad8e9f, reversing
changes made to 58a2f0ac40f24da9c9955110902f8e14cd0d8419.
2016-06-23 11:51:44 +08:00
Frederic Massart
796f86f753
Revert "MDL-54110 repositories: Whitespace, Typo + unit test fixes"
This reverts commit 7e4d43e1a263f7003207a382251de900341db92c.
2016-06-23 11:51:44 +08:00
Andrew Nicols
388a8dbc4f MDL-54584 repository: Set a default filename in prepare_file 2016-05-16 11:07:38 +08:00
Andrew Nicols
7e4d43e1a2 MDL-54110 repositories: Whitespace, Typo + unit test fixes 2016-05-11 10:39:40 +08:00
Mark Johnson
121b67411f MDL-54110 repositories: Allow repositories to ignore post_max_size
Repositories can now override usespost() if they don't upload using POST
requests. This restores the ability of users with
moodle/course:ignorefilesizelimits to upload files of unlimited size
lost in MDL-44626.
2016-05-10 16:10:24 +01:00
Ben Tindell
a2fb838e82 MDL-53577 repository: Added maxbytes error message
Changing the error message that is displayed to users when they
upload a file that is greater than the maximum upload size. Does not
include all upload cases; focuses on those most used by students.
2016-04-04 15:33:40 -05:00
Ruslan Kabalin
11362ae3ff MDL-50887 antivirus: Use namespace referenced classes. 2016-02-29 09:31:09 +00:00
Ruslan Kabalin
1a980fdadb MDL-50887 antivirus: Fix style issues. 2016-02-25 09:55:45 +00:00
Ruslan Kabalin
375223c6db MDL-50887 antivirus: Deprecate functions no longer required.
This also removes abandoned strings that are no longer in use (since
1e23ff2 landed).
2016-02-25 09:55:45 +00:00
Ruslan Kabalin
001feb6649 MDL-50887 antivirus: Refactor antivirus scanning to use new plugin.
This patch moves existing scanning functionality to plugin level. It does
not add anything new, just refactors the existing functionality.

AMOS BEGIN
  MOV [clamemailsubject,core],[emailsubject,antivirus]
  MOV [clamfailed,core],[clamfailed,antivirus_clamav]
  MOV [clamlost,core],[invalidpathtoclam,antivirus_clamav]
  MOV [clamunknownerror,core],[unknownerror,antivirus_clamav]
  MOV [virusfounduser,core],[virusfounduser,antivirus]
AMOS END
2016-02-25 09:55:45 +00:00
Andrew Nicols
a9e12347b7 MDL-52217 repository: prepare_file should use per-request directory
The repository API defaults has a function, prepare_file, which is
responsible for creating a unique file to be used during the current
request.

This is usually used in the repository's get_file() function to store the
file before it is used elsewhere in the API to save the file to the
filestorage API.
It is also sometimes used to temporarily store credentials for the lifetime
of the session.

In all cases, this file is only expected to exist for the duration of the
session.

Switching to use of a per-request directory using make_request_directory()
ensures that the tempdir does not grow without control.

This commit also adds an upgrade step to remove all old temp directories
created by any repository currently installed.
2016-02-15 15:54:05 +08:00
Marina Glancy
58e5ab1bac MDL-51985 files: sync timemodified when possible 2015-10-30 14:46:09 +08:00
John Okely
e6904efc52 MDL-42166 repositories: Finalise deprecation of repository sync methods 2014-12-16 15:57:50 +08:00
Marina Glancy
e29bb97c07 MDL-45616 repositories: API changes to avoid serialized data in user input 2014-07-07 14:41:20 +08:00
Marina Glancy
56964b7948 MDL-45616 repositories: use json encoding instead of serialization 2014-07-07 14:41:20 +08:00
Marina Glancy
5ad3f3c61e MDL-45616 repositories: more clearly distinguish when we use source and when reference
Function repository::get_moodle_file() should always be called on packed reference and not on the source received from user.
Also added phpdocs to some other methods that were confusing source and reference
2014-07-07 14:41:20 +08:00
Tim Hunt
5bcfd504df MDL-45618 Fix @since PHPdoc tags. 2014-05-19 17:03:04 +01:00