original_string: protected static function update_backup_cached_record($record, $extrarecord, $key, $existingrecord = null) {
          global $DB;
          // Update only if extrarecord is not empty.
          if (!empty($extrarecord)) {
              $extrarecord['id'] = self::$backupidsexist[$key];
              $DB->update_record('backup_ids_temp', $extrarecord);
              // Update existing cache or add new record to cache.
              if (isset(self::$backupidscache[$key])) {
                  $record = array_merge((array)self::$backupidscache[$key], $extrarecord);
                  self::$backupidscache[$key] = (object) $record;
              } else if (self::$backupidscachesize > 0) {
                  if ($existingrecord) {
                      self::$backupidscache[$key] = $existingrecord;
                  } else {
                      // Retrive record from database and cache updated records.
                      self::$backupidscache[$key] = $DB->get_record('backup_ids_temp', $record);
                  }
                  $record = array_merge((array)self::$backupidscache[$key], $extrarecord);
                  self::$backupidscache[$key] = (object) $record;
                  self::$backupidscachesize--;
              }
          }
      }
code: protected static function update_backup_cached_record($record, $extrarecord, $key, $existingrecord = null) {
          global $DB;
          // Update only if extrarecord is not empty.
          if (!empty($extrarecord)) {
              $extrarecord['id'] = self::$backupidsexist[$key];
              $DB->update_record('backup_ids_temp', $extrarecord);
              // Update existing cache or add new record to cache.
              if (isset(self::$backupidscache[$key])) {
                  $record = array_merge((array)self::$backupidscache[$key], $extrarecord);
                  self::$backupidscache[$key] = (object) $record;
              } else if (self::$backupidscachesize > 0) {
                  if ($existingrecord) {
                      self::$backupidscache[$key] = $existingrecord;
                  } else {
                      // Retrive record from database and cache updated records.
                      self::$backupidscache[$key] = $DB->get_record('backup_ids_temp', $record);
                  }
                  $record = array_merge((array)self::$backupidscache[$key], $extrarecord);
                  self::$backupidscache[$key] = (object) $record;
                  self::$backupidscachesize--;
              }
          }
      }
code_tokens: protected static function update_backup_cached_record ( $ record , $ extrarecord , $ key , $ existingrecord = null ) { global $ DB ; // Update only if extrarecord is not empty. if ( ! empty ( $ extrarecord ) ) { $ extrarecord [ 'id' ] = self :: $ backupidsexist [ $ key ] ; $ DB -> update_record ( 'backup_ids_temp' , $ extrarecord ) ; // Update existing cache or add new record to cache. if ( isset ( self :: $ backupidscache [ $ key ] ) ) { $ record = array_merge ( ( array ) self :: $ backupidscache [ $ key ] , $ extrarecord ) ; self :: $ backupidscache [ $ key ] = ( object ) $ record ; } else if ( self :: $ backupidscachesize > 0 ) { if ( $ existingrecord ) { self :: $ backupidscache [ $ key ] = $ existingrecord ; } else { // Retrive record from database and cache updated records. self :: $ backupidscache [ $ key ] = $ DB -> get_record ( 'backup_ids_temp' , $ record ) ; } $ record = array_merge ( ( array ) self :: $ backupidscache [ $ key ] , $ extrarecord ) ; self :: $ backupidscache [ $ key ] = ( object ) $ record ; self :: $ backupidscachesize -- ; } } }
docstring: Updates existing backup record
  
  @param array $record record which needs to be updated
  @param array $extrarecord extra record which needs to be updated
  @param string $key unique key which is used to identify cached record
  @param stdClass $existingrecord (optional) existing record
docstring_tokens: Updates existing backup record