mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'MDL-59459_Increase_file_indexing_coverage' of https://github.com/mattporritt/moodle
This commit is contained in:
commit
743c937dae
33 changed files with 765 additions and 68 deletions
|
@ -34,6 +34,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class activity extends \core_search\base_activity {
|
||||
|
||||
/**
|
||||
* Returns true if this area uses file indexing.
|
||||
*
|
||||
|
@ -44,21 +45,14 @@ class activity extends \core_search\base_activity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add all the folder files to the index.
|
||||
* Return the context info required to index files for
|
||||
* this search area.
|
||||
*
|
||||
* @param document $document The current document
|
||||
* @return null
|
||||
* @return array
|
||||
*/
|
||||
public function attach_files($document) {
|
||||
$fs = get_file_storage();
|
||||
public function get_search_fileareas() {
|
||||
$fileareas = array('intro', 'content'); // Fileareas.
|
||||
|
||||
$cm = $this->get_cm($this->get_module_name(), $document->get('itemid'), $document->get('courseid'));
|
||||
$context = \context_module::instance($cm->id);
|
||||
|
||||
$files = $fs->get_area_files($context->id, 'mod_folder', 'content', 0, 'sortorder DESC, id ASC', false);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$document->add_stored_file($file);
|
||||
}
|
||||
return $fileareas;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue