original_string: protected static function locate_definitions($coreonly = false) {
          global $CFG;
  
          $files = array();
          if (file_exists($CFG->dirroot.'/lib/db/caches.php')) {
              $files['core'] = $CFG->dirroot.'/lib/db/caches.php';
          }
  
          if (!$coreonly) {
              $plugintypes = core_component::get_plugin_types();
              foreach ($plugintypes as $type => $location) {
                  $plugins = core_component::get_plugin_list_with_file($type, 'db/caches.php');
                  foreach ($plugins as $plugin => $filepath) {
                      $component = clean_param($type.'_'.$plugin, PARAM_COMPONENT); // Standardised plugin name.
                      $files[$component] = $filepath;
                  }
              }
          }
  
          $definitions = array();
          foreach ($files as $component => $file) {
              $filedefs = self::load_caches_file($file);
              foreach ($filedefs as $area => $definition) {
                  $area = clean_param($area, PARAM_AREA);
                  $id = $component.'/'.$area;
                  $definition['component'] = $component;
                  $definition['area'] = $area;
                  if (array_key_exists($id, $definitions)) {
                      debugging('Error: duplicate cache definition found with id: '.$id, DEBUG_DEVELOPER);
                      continue;
                  }
                  $definitions[$id] = $definition;
              }
          }
  
          return $definitions;
      }
code: protected static function locate_definitions($coreonly = false) {
          global $CFG;
  
          $files = array();
          if (file_exists($CFG->dirroot.'/lib/db/caches.php')) {
              $files['core'] = $CFG->dirroot.'/lib/db/caches.php';
          }
  
          if (!$coreonly) {
              $plugintypes = core_component::get_plugin_types();
              foreach ($plugintypes as $type => $location) {
                  $plugins = core_component::get_plugin_list_with_file($type, 'db/caches.php');
                  foreach ($plugins as $plugin => $filepath) {
                      $component = clean_param($type.'_'.$plugin, PARAM_COMPONENT); // Standardised plugin name.
                      $files[$component] = $filepath;
                  }
              }
          }
  
          $definitions = array();
          foreach ($files as $component => $file) {
              $filedefs = self::load_caches_file($file);
              foreach ($filedefs as $area => $definition) {
                  $area = clean_param($area, PARAM_AREA);
                  $id = $component.'/'.$area;
                  $definition['component'] = $component;
                  $definition['area'] = $area;
                  if (array_key_exists($id, $definitions)) {
                      debugging('Error: duplicate cache definition found with id: '.$id, DEBUG_DEVELOPER);
                      continue;
                  }
                  $definitions[$id] = $definition;
              }
          }
  
          return $definitions;
      }
code_tokens: protected static function locate_definitions ( $ coreonly = false ) { global $ CFG ; $ files = array ( ) ; if ( file_exists ( $ CFG -> dirroot . '/lib/db/caches.php' ) ) { $ files [ 'core' ] = $ CFG -> dirroot . '/lib/db/caches.php' ; } if ( ! $ coreonly ) { $ plugintypes = core_component :: get_plugin_types ( ) ; foreach ( $ plugintypes as $ type => $ location ) { $ plugins = core_component :: get_plugin_list_with_file ( $ type , 'db/caches.php' ) ; foreach ( $ plugins as $ plugin => $ filepath ) { $ component = clean_param ( $ type . '_' . $ plugin , PARAM_COMPONENT ) ; // Standardised plugin name. $ files [ $ component ] = $ filepath ; } } } $ definitions = array ( ) ; foreach ( $ files as $ component => $ file ) { $ filedefs = self :: load_caches_file ( $ file ) ; foreach ( $ filedefs as $ area => $ definition ) { $ area = clean_param ( $ area , PARAM_AREA ) ; $ id = $ component . '/' . $ area ; $ definition [ 'component' ] = $ component ; $ definition [ 'area' ] = $ area ; if ( array_key_exists ( $ id , $ definitions ) ) { debugging ( 'Error: duplicate cache definition found with id: ' . $ id , DEBUG_DEVELOPER ) ; continue ; } $ definitions [ $ id ] = $ definition ; } } return $ definitions ; }
docstring: Locates all of the definition files.
  
  @param bool $coreonly If set to true only core definitions will be updated.
  @return array
docstring_tokens: Locates all of the definition files .