original_string: public function edit_store_instance($name, $plugin, $configuration) {
          if (!array_key_exists($name, $this->configstores)) {
              throw new cache_exception('The requested instance does not exist.');
          }
          $plugins = core_component::get_plugin_list_with_file('cachestore', 'lib.php');
          if (!array_key_exists($plugin, $plugins)) {
              throw new cache_exception('Invalid plugin name specified. The plugin either does not exist or is not valid.');
          }
          $class = 'cachestore_'.$plugin;
          $file = $plugins[$plugin];
          if (!class_exists($class)) {
              if (file_exists($file)) {
                  require_once($file);
              }
              if (!class_exists($class)) {
                  throw new cache_exception('Invalid cache plugin specified. The plugin does not contain the required class.'.$class);
              }
          }
          $this->configstores[$name] = array(
              'name' => $name,
              'plugin' => $plugin,
              'configuration' => $configuration,
              'features' => $class::get_supported_features($configuration),
              'modes' => $class::get_supported_modes($configuration),
              'mappingsonly' => !empty($configuration['mappingsonly']),
              'class' => $class,
              'default' => $this->configstores[$name]['default'] // Can't change the default.
          );
          if (array_key_exists('lock', $configuration)) {
              $this->configstores[$name]['lock'] = $configuration['lock'];
              unset($this->configstores[$name]['configuration']['lock']);
          }
          $this->config_save();
          return true;
      }
code: public function edit_store_instance($name, $plugin, $configuration) {
          if (!array_key_exists($name, $this->configstores)) {
              throw new cache_exception('The requested instance does not exist.');
          }
          $plugins = core_component::get_plugin_list_with_file('cachestore', 'lib.php');
          if (!array_key_exists($plugin, $plugins)) {
              throw new cache_exception('Invalid plugin name specified. The plugin either does not exist or is not valid.');
          }
          $class = 'cachestore_'.$plugin;
          $file = $plugins[$plugin];
          if (!class_exists($class)) {
              if (file_exists($file)) {
                  require_once($file);
              }
              if (!class_exists($class)) {
                  throw new cache_exception('Invalid cache plugin specified. The plugin does not contain the required class.'.$class);
              }
          }
          $this->configstores[$name] = array(
              'name' => $name,
              'plugin' => $plugin,
              'configuration' => $configuration,
              'features' => $class::get_supported_features($configuration),
              'modes' => $class::get_supported_modes($configuration),
              'mappingsonly' => !empty($configuration['mappingsonly']),
              'class' => $class,
              'default' => $this->configstores[$name]['default'] // Can't change the default.
          );
          if (array_key_exists('lock', $configuration)) {
              $this->configstores[$name]['lock'] = $configuration['lock'];
              unset($this->configstores[$name]['configuration']['lock']);
          }
          $this->config_save();
          return true;
      }
code_tokens: public function edit_store_instance ( $ name , $ plugin , $ configuration ) { if ( ! array_key_exists ( $ name , $ this -> configstores ) ) { throw new cache_exception ( 'The requested instance does not exist.' ) ; } $ plugins = core_component :: get_plugin_list_with_file ( 'cachestore' , 'lib.php' ) ; if ( ! array_key_exists ( $ plugin , $ plugins ) ) { throw new cache_exception ( 'Invalid plugin name specified. The plugin either does not exist or is not valid.' ) ; } $ class = 'cachestore_' . $ plugin ; $ file = $ plugins [ $ plugin ] ; if ( ! class_exists ( $ class ) ) { if ( file_exists ( $ file ) ) { require_once ( $ file ) ; } if ( ! class_exists ( $ class ) ) { throw new cache_exception ( 'Invalid cache plugin specified. The plugin does not contain the required class.' . $ class ) ; } } $ this -> configstores [ $ name ] = array ( 'name' => $ name , 'plugin' => $ plugin , 'configuration' => $ configuration , 'features' => $ class :: get_supported_features ( $ configuration ) , 'modes' => $ class :: get_supported_modes ( $ configuration ) , 'mappingsonly' => ! empty ( $ configuration [ 'mappingsonly' ] ) , 'class' => $ class , 'default' => $ this -> configstores [ $ name ] [ 'default' ] // Can't change the default. ) ; if ( array_key_exists ( 'lock' , $ configuration ) ) { $ this -> configstores [ $ name ] [ 'lock' ] = $ configuration [ 'lock' ] ; unset ( $ this -> configstores [ $ name ] [ 'configuration' ] [ 'lock' ] ) ; } $ this -> config_save ( ) ; return true ; }
docstring: Edits a give plugin instance.
  
  The plugin instance is determined by its name, hence you cannot rename plugins.
  This function also calls save so you should redirect immediately, or at least very shortly after
  calling this method.
  
  @param string $name
  @param string $plugin
  @param array $configuration
  @return bool
  @throws cache_exception
docstring_tokens: Edits a give plugin instance .