Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Added new parameter @notify to file creation function - MDL-75850 #1112

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/apis/subsystems/files/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,19 @@ $fs = get_file_storage();
$fs->create_file_from_storedfile($fileinfo, $existingfile);
```

#### Notification requirements for new files

By default, the `$notify` parameter has a value of `true` and will call the after_file_created hook after files are created. If you prefer not to do this, you can set it to `false`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very unclear. What parameter? Of which function? What are we trying to achieve? I would mentioned the function directly and explained a new argument meaning - thery is no connection between argument name notufy and the fact that we are calling come hook. And same appies to the section name - what requirement is meant?


```php title="Create a file from a file on disk, but do not trigger the after_file_created hook"
$fs = get_file_storage();

// Create a file from a file on disk, but do not trigger the after_file_created hook.
$fs->create_file_from_pathname($fileinfo, $requestdir . '/helloworld.txt', false);
```

The same principle also applies to the other functions.

### List all files in a particular file area

You may need to fetch a list of all files in a specific file area. You can do this using the `file_storage::get_area_files()` API, which will return array of `stored_file` objects, for example:
Expand Down
Loading