Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28093

Block: Community - get_string errors when blocks or activities not available

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Blocks, Hub
    • Labels:
    • Testing Instructions:
      Hide

      1) Login to qa.moodle.net (as admin) and un-register and re-register the site
      2) Login as manager or teacher and add the community block to a course
      3) Search MOOCH for all available courses to enrol in
      4) Observe get_string notices

      Show
      1) Login to qa.moodle.net (as admin) and un-register and re-register the site 2) Login as manager or teacher and add the community block to a course 3) Search MOOCH for all available courses to enrol in 4) Observe get_string notices
    • Workaround:
      Hide

      turning debugging down will hide these exceptions

      Show
      turning debugging down will hide these exceptions
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      From the community block (on qa.moodle.net) when searching for Mooch courses (with debugging set to show all errors) we are getting exceptions thrown for non-existing strings. For example,

      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()

      ( ! ) Notice: Undefined property: stdClass::$backupsize in /html/blocks/community/renderer.php on line 263

      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()
      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()
      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()
      Invalid get_string() identifier: 'modulename' or component 'flashcard'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 211 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()

      In this case, the issue is being caused by the direct use of get_string around lines 205 and 211:

      205: $blockhtml.=get_string('pluginname','block_'.$content->modulename)." (".$content->contentcount.")";
      211: $activitieshtml .= get_string('modulename', $content->modulename);

      Since we are going to be receiving courses from any number of sites which may have who knows what in those courses, this seems like a good opportunity and reason to make use of string_exists and if it does not then we can give some other output about the block or activity module not being installed. There may be other places where you have done a similar type thing to build the course content and we should probably check for those strings first rather than allowing get_string to throw an exception.

      Peace - Anthony

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rwijaya Rossiani Wijaya
              Reporter:
              aborrow Anthony Borrow
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, David Mudrák (@mudrd8mz), Helen Foster
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: