original_string: public static function get_components_and_fileareas($filter = null) {
          $components = array();
          // Get all the plugins of this type
          $qtypes = core_component::get_plugin_list('qtype');
          foreach ($qtypes as $name => $path) {
              // Apply filter if specified
              if (!is_null($filter) && $filter != $name) {
                  continue;
              }
              // Calculate the componentname
              $componentname = 'qtype_' . $name;
              // Get the plugin fileareas (all them MUST belong to the same component)
              $classname = 'backup_qtype_' . $name . '_plugin';
              if (class_exists($classname)) {
                  $elements = call_user_func(array($classname, 'get_qtype_fileareas'));
                  if ($elements) {
                      // If there are elements, add them to $components
                      $components[$componentname] = $elements;
                  }
              }
          }
          return $components;
      }
code: public static function get_components_and_fileareas($filter = null) {
          $components = array();
          // Get all the plugins of this type
          $qtypes = core_component::get_plugin_list('qtype');
          foreach ($qtypes as $name => $path) {
              // Apply filter if specified
              if (!is_null($filter) && $filter != $name) {
                  continue;
              }
              // Calculate the componentname
              $componentname = 'qtype_' . $name;
              // Get the plugin fileareas (all them MUST belong to the same component)
              $classname = 'backup_qtype_' . $name . '_plugin';
              if (class_exists($classname)) {
                  $elements = call_user_func(array($classname, 'get_qtype_fileareas'));
                  if ($elements) {
                      // If there are elements, add them to $components
                      $components[$componentname] = $elements;
                  }
              }
          }
          return $components;
      }
code_tokens: public static function get_components_and_fileareas ( $ filter = null ) { $ components = array ( ) ; // Get all the plugins of this type $ qtypes = core_component :: get_plugin_list ( 'qtype' ) ; foreach ( $ qtypes as $ name => $ path ) { // Apply filter if specified if ( ! is_null ( $ filter ) && $ filter != $ name ) { continue ; } // Calculate the componentname $ componentname = 'qtype_' . $ name ; // Get the plugin fileareas (all them MUST belong to the same component) $ classname = 'backup_qtype_' . $ name . '_plugin' ; if ( class_exists ( $ classname ) ) { $ elements = call_user_func ( array ( $ classname , 'get_qtype_fileareas' ) ) ; if ( $ elements ) { // If there are elements, add them to $components $ components [ $ componentname ] = $ elements ; } } } return $ components ; }
docstring: Returns all the components and fileareas used by all the installed qtypes
  
  The method introspects each qtype, asking it about fileareas used. Then,
  one 2-level array is returned. 1st level is the component name (qtype_xxxx)
  and 2nd level is one array of filearea => mappings to look
  
  Note that this function is used both in backup and restore, so it is important
  to use the same mapping names (usually, name of the table in singular) always
  
  TODO: Surely this can be promoted to backup_plugin easily and make it to
  work for ANY plugin, not only qtypes (but we don't need it for now)
docstring_tokens: Returns all the components and fileareas used by all the installed qtypes