original_string: public static function update($existing, $data) {
          global $DB;
          $data = array_intersect_key((array)$data,
                  array('enabled' => 1, 'tagcollid' => 1,
                      'callback' => 1, 'callbackfile' => 1, 'showstandard' => 1,
                      'multiplecontexts' => 1));
          foreach ($data as $key => $value) {
              if ($existing->$key == $value) {
                  unset($data[$key]);
              }
          }
          if (!$data) {
              return;
          }
  
          if (!empty($data['tagcollid'])) {
              self::move_tags($existing->component, $existing->itemtype, $data['tagcollid']);
          }
  
          $data['id'] = $existing->id;
          $DB->update_record('tag_area', $data);
  
          // Reset cache.
          cache::make('core', 'tags')->delete('tag_area');
      }
code: public static function update($existing, $data) {
          global $DB;
          $data = array_intersect_key((array)$data,
                  array('enabled' => 1, 'tagcollid' => 1,
                      'callback' => 1, 'callbackfile' => 1, 'showstandard' => 1,
                      'multiplecontexts' => 1));
          foreach ($data as $key => $value) {
              if ($existing->$key == $value) {
                  unset($data[$key]);
              }
          }
          if (!$data) {
              return;
          }
  
          if (!empty($data['tagcollid'])) {
              self::move_tags($existing->component, $existing->itemtype, $data['tagcollid']);
          }
  
          $data['id'] = $existing->id;
          $DB->update_record('tag_area', $data);
  
          // Reset cache.
          cache::make('core', 'tags')->delete('tag_area');
      }
code_tokens: public static function update ( $ existing , $ data ) { global $ DB ; $ data = array_intersect_key ( ( array ) $ data , array ( 'enabled' => 1 , 'tagcollid' => 1 , 'callback' => 1 , 'callbackfile' => 1 , 'showstandard' => 1 , 'multiplecontexts' => 1 ) ) ; foreach ( $ data as $ key => $ value ) { if ( $ existing -> $ key == $ value ) { unset ( $ data [ $ key ] ) ; } } if ( ! $ data ) { return ; } if ( ! empty ( $ data [ 'tagcollid' ] ) ) { self :: move_tags ( $ existing -> component , $ existing -> itemtype , $ data [ 'tagcollid' ] ) ; } $ data [ 'id' ] = $ existing -> id ; $ DB -> update_record ( 'tag_area' , $ data ) ; // Reset cache. cache :: make ( 'core' , 'tags' ) -> delete ( 'tag_area' ) ; }
docstring: Update the tag area
  
  @param stdClass $existing current record from DB table tag_area
  @param array|stdClass $data fields that need updating
docstring_tokens: Update the tag area