Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ignore missing documents or cms.

  • Loading branch information...
commit 52b20d0b14661707d43734e4455c6deb36233f7f 1 parent 74e12d5
diml authored

Showing 1 changed file with 8 additions and 7 deletions. Show diff stats Hide diff stats

  1. +8 7 search/documents/resource_document.php
15 search/documents/resource_document.php
@@ -20,8 +20,8 @@
20 20 /**
21 21 * requires and includes
22 22 */
23   -require_once("$CFG->dirroot/search/documents/document.php");
24   -require_once("$CFG->dirroot/mod/resource/lib.php");
  23 +require_once($CFG->dirroot.'/search/documents/document.php');
  24 +require_once($CFG->dirroot.'/mod/resource/lib.php');
25 25
26 26 /* *
27 27 * a class for representing searchable information
@@ -99,11 +99,12 @@ function resource_get_content_for_index(&$notneeded) {
99 99 if ($resources = get_records_sql($query)){
100 100 foreach($resources as $aResource){
101 101 $coursemodule = get_field('modules', 'id', 'name', 'resource');
102   - $cm = get_record('course_modules', 'course', $aResource->course, 'module', $coursemodule, 'instance', $aResource->id);
103   - $context = get_context_instance(CONTEXT_MODULE, $cm->id);
104   - $aResource->id = $cm->id;
105   - $documents[] = new ResourceSearchDocument(get_object_vars($aResource), $context->id);
106   - mtrace("finished $aResource->name");
  102 + if($cm = get_record('course_modules', 'course', $aResource->course, 'module', $coursemodule, 'instance', $aResource->id)){
  103 + $context = get_context_instance(CONTEXT_MODULE, $cm->id);
  104 + $aResource->id = $cm->id;
  105 + $documents[] = new ResourceSearchDocument(get_object_vars($aResource), $context->id);
  106 + mtrace("finished $aResource->name");
  107 + }
107 108 }
108 109 }
109 110

0 comments on commit 52b20d0

Please sign in to comment.
Something went wrong with that request. Please try again.