original_string: private function write_definitions_to_cache(array $definitions) {
  
          // Preserve the selected sharing option when updating the definitions.
          // This is set by the user and should never come from caches.php.
          foreach ($definitions as $key => $definition) {
              unset($definitions[$key]['selectedsharingoption']);
              unset($definitions[$key]['userinputsharingkey']);
              if (isset($this->configdefinitions[$key]) && isset($this->configdefinitions[$key]['selectedsharingoption'])) {
                  $definitions[$key]['selectedsharingoption'] = $this->configdefinitions[$key]['selectedsharingoption'];
              }
              if (isset($this->configdefinitions[$key]) && isset($this->configdefinitions[$key]['userinputsharingkey'])) {
                  $definitions[$key]['userinputsharingkey'] = $this->configdefinitions[$key]['userinputsharingkey'];
              }
          }
  
          $this->configdefinitions = $definitions;
          foreach ($this->configdefinitionmappings as $key => $mapping) {
              if (!array_key_exists($mapping['definition'], $definitions)) {
                  unset($this->configdefinitionmappings[$key]);
              }
          }
          $this->config_save();
      }
code: private function write_definitions_to_cache(array $definitions) {
  
          // Preserve the selected sharing option when updating the definitions.
          // This is set by the user and should never come from caches.php.
          foreach ($definitions as $key => $definition) {
              unset($definitions[$key]['selectedsharingoption']);
              unset($definitions[$key]['userinputsharingkey']);
              if (isset($this->configdefinitions[$key]) && isset($this->configdefinitions[$key]['selectedsharingoption'])) {
                  $definitions[$key]['selectedsharingoption'] = $this->configdefinitions[$key]['selectedsharingoption'];
              }
              if (isset($this->configdefinitions[$key]) && isset($this->configdefinitions[$key]['userinputsharingkey'])) {
                  $definitions[$key]['userinputsharingkey'] = $this->configdefinitions[$key]['userinputsharingkey'];
              }
          }
  
          $this->configdefinitions = $definitions;
          foreach ($this->configdefinitionmappings as $key => $mapping) {
              if (!array_key_exists($mapping['definition'], $definitions)) {
                  unset($this->configdefinitionmappings[$key]);
              }
          }
          $this->config_save();
      }
code_tokens: private function write_definitions_to_cache ( array $ definitions ) { // Preserve the selected sharing option when updating the definitions. // This is set by the user and should never come from caches.php. foreach ( $ definitions as $ key => $ definition ) { unset ( $ definitions [ $ key ] [ 'selectedsharingoption' ] ) ; unset ( $ definitions [ $ key ] [ 'userinputsharingkey' ] ) ; if ( isset ( $ this -> configdefinitions [ $ key ] ) && isset ( $ this -> configdefinitions [ $ key ] [ 'selectedsharingoption' ] ) ) { $ definitions [ $ key ] [ 'selectedsharingoption' ] = $ this -> configdefinitions [ $ key ] [ 'selectedsharingoption' ] ; } if ( isset ( $ this -> configdefinitions [ $ key ] ) && isset ( $ this -> configdefinitions [ $ key ] [ 'userinputsharingkey' ] ) ) { $ definitions [ $ key ] [ 'userinputsharingkey' ] = $ this -> configdefinitions [ $ key ] [ 'userinputsharingkey' ] ; } } $ this -> configdefinitions = $ definitions ; foreach ( $ this -> configdefinitionmappings as $ key => $ mapping ) { if ( ! array_key_exists ( $ mapping [ 'definition' ] , $ definitions ) ) { unset ( $ this -> configdefinitionmappings [ $ key ] ) ; } } $ this -> config_save ( ) ; }
docstring: Writes the updated definitions for the config file.
  @param array $definitions
docstring_tokens: Writes the updated definitions for the config file .