original_string: public function update_options($options = null) {
          global $DB;
          $classname = 'repository_' . $this->_typename;
          $instanceoptions = repository::static_function($this->_typename, 'get_instance_option_names');
          if (empty($instanceoptions)) {
              // update repository instance name if this plugin type doesn't have muliti instances
              $params = array();
              $params['type'] = $this->_typename;
              $instances = repository::get_instances($params);
              $instance = array_pop($instances);
              if ($instance) {
                  $DB->set_field('repository_instances', 'name', $options['pluginname'], array('id'=>$instance->id));
              }
              unset($options['pluginname']);
          }
  
          if (!empty($options)) {
              $this->_options = $options;
          }
  
          foreach ($this->_options as $name => $value) {
              set_config($name, $value, $this->_typename);
          }
  
          cache::make('core', 'repositories')->purge();
          return true;
      }
code: public function update_options($options = null) {
          global $DB;
          $classname = 'repository_' . $this->_typename;
          $instanceoptions = repository::static_function($this->_typename, 'get_instance_option_names');
          if (empty($instanceoptions)) {
              // update repository instance name if this plugin type doesn't have muliti instances
              $params = array();
              $params['type'] = $this->_typename;
              $instances = repository::get_instances($params);
              $instance = array_pop($instances);
              if ($instance) {
                  $DB->set_field('repository_instances', 'name', $options['pluginname'], array('id'=>$instance->id));
              }
              unset($options['pluginname']);
          }
  
          if (!empty($options)) {
              $this->_options = $options;
          }
  
          foreach ($this->_options as $name => $value) {
              set_config($name, $value, $this->_typename);
          }
  
          cache::make('core', 'repositories')->purge();
          return true;
      }
code_tokens: public function update_options ( $ options = null ) { global $ DB ; $ classname = 'repository_' . $ this -> _typename ; $ instanceoptions = repository :: static_function ( $ this -> _typename , 'get_instance_option_names' ) ; if ( empty ( $ instanceoptions ) ) { // update repository instance name if this plugin type doesn't have muliti instances $ params = array ( ) ; $ params [ 'type' ] = $ this -> _typename ; $ instances = repository :: get_instances ( $ params ) ; $ instance = array_pop ( $ instances ) ; if ( $ instance ) { $ DB -> set_field ( 'repository_instances' , 'name' , $ options [ 'pluginname' ] , array ( 'id' => $ instance -> id ) ) ; } unset ( $ options [ 'pluginname' ] ) ; } if ( ! empty ( $ options ) ) { $ this -> _options = $ options ; } foreach ( $ this -> _options as $ name => $ value ) { set_config ( $ name , $ value , $ this -> _typename ) ; } cache :: make ( 'core' , 'repositories' ) -> purge ( ) ; return true ; }
docstring: Update plugin options into the config_plugin table
  
  @param array $options
  @return bool
docstring_tokens: Update plugin options into the config_plugin table