Updates all files that are referencing this file with the new contenthash
and filesize

@param stored_file $storedfile
185886
public function update_references_to_storedfile(stored_file $storedfile) {
        global $CFG, $DB;
        $params = array();
        $params['contextid'] = $storedfile->get_contextid();
        $params['component'] = $storedfile->get_component();
        $params['filearea']  = $storedfile->get_filearea();
        $params['itemid']    = $storedfile->get_itemid();
        $params['filename']  = $storedfile->get_filename();
        $params['filepath']  = $storedfile->get_filepath();
        $reference = self::pack_reference($params);
        $referencehash = sha1($reference);

        $sql = "SELECT repositoryid, id FROM {files_reference}
                 WHERE referencehash = ?";
        $rs = $DB->get_recordset_sql($sql, array($referencehash));

        $now = time();
        foreach ($rs as $record) {
            $this->update_references($record->id, $now, null,
                    $storedfile->get_contenthash(), $storedfile->get_filesize(), 0, $storedfile->get_timemodified());
        }
        $rs->close();
    }
1235948
public function createUploadedFile($chunks = null, $storageFile = null)
    {
        $chunkFile = $this->chunkFile();
        $storageFile = $storageFile ?: $this->storageFile();

        if (is_null($chunks) === false) {
            for ($i = 0; $i < $chunks; $i++) {
                $chunk = $chunkFile.'.'.$i;
                $this->files->append(
                    $storageFile,
                    $this->files->get($chunk)
                );
                $this->files->delete($chunk);
            }
        } else {
            $this->files->move($chunkFile, $storageFile);
        }

        return $this->files->createUploadedFile(
            $storageFile, $this->name, $this->getMimeType()
        );
    }
761027
protected function loadStatements(File $phpcsFile) {
		if ($this->existingStatements !== null) {
			return;
		}

		$existingStatements = $this->getUseStatements($phpcsFile);
		$this->existingStatements = $existingStatements;
		$this->allStatements = $existingStatements;
		$this->newStatements = [];
	}
1028483
def updateFile( dbid, rid, filename, fileAttachmentFieldName, additionalFieldsToSet = nil )
      if dbid and rid and filename and fileAttachmentFieldName
         clearFieldValuePairList
         addFieldValuePair( fileAttachmentFieldName, nil, filename, nil )
         if additionalFieldsToSet and additionalFieldsToSet.is_a?( Hash )
            additionalFieldsToSet.each{ |fieldName,fieldValue|
               addFieldValuePair( fieldName, nil, nil, fieldValue )
            }
         end
         return editRecord( dbid, rid, @fvlist )
      end
      nil
   end
1099364
public function copy_existing_file($oldfile) {
        if (array_key_exists($oldfile->get_contenthash(), $this->newfilehashes)) {
            return $this->newfilehashes[$oldfile->get_contenthash()];
        }
        $fs = get_file_storage();
        $file_record = $this->new_file_record_base($oldfile->get_filename());
        if ($dir = $this->get('format')->get_file_directory()) {
            $file_record->filepath = '/'. $dir . '/';
        }
        try {
            $newfile = $fs->create_file_from_storedfile($file_record, $oldfile->get_id());
            $this->newfilehashes[$newfile->get_contenthash()] = $newfile;
            return $newfile;
        } catch (file_exception $e) {
            return false;
        }
    }
938045
public function setUploadedFile($uploadedFile)
	{
		$this->clear();

		if ($uploadedFile == LARACLIP_NULL) {
			return;
		}

		$this->uploadedFile = $this->IOWrapper->make($uploadedFile);
		$this->instanceWrite('file_name', $this->uploadedFile->getFilename());
		$this->instanceWrite('file_size', $this->uploadedFile->getSize());
		$this->instanceWrite('content_type', $this->uploadedFile->getMimeType());
		$this->instanceWrite('updated_at', date('Y-m-d H:i:s'));
		$this->queueAllForWrite();
	}
453745
public function loadStatementsFromCache($file_path, $file_modified_time, $file_content_hash)
    {
        $root_cache_directory = Config::getInstance()->getCacheDirectory();

        if (!$root_cache_directory) {
            return;
        }

        $file_cache_key = $this->getParserCacheKey(
            $file_path
        );

        $parser_cache_directory = $root_cache_directory . DIRECTORY_SEPARATOR . self::PARSER_CACHE_DIRECTORY;

        $file_content_hashes = $this->new_file_content_hashes + $this->getExistingFileContentHashes();

        $cache_location = $parser_cache_directory . DIRECTORY_SEPARATOR . $file_cache_key;

        if (isset($file_content_hashes[$file_cache_key])
            && $file_content_hash === $file_content_hashes[$file_cache_key]
            && is_readable($cache_location)
            && filemtime($cache_location) > $file_modified_time
        ) {
            if ($this->use_igbinary) {
                /** @var array<int, \PhpParser\Node\Stmt> */
                $stmts = igbinary_unserialize((string)file_get_contents($cache_location));
            } else {
                /** @var array<int, \PhpParser\Node\Stmt> */
                $stmts = unserialize((string)file_get_contents($cache_location));
            }

            return $stmts;
        }
    }
1321630
private function updateFile()
    {
        if (is_null($this->file_path)) {
            throw new StorageException('Invalid file path');
        }

        file_put_contents(
            $this->file_path,
            serialize(
                [
                    'tokens' => $this->tokens,
                    'states' => $this->states
                ]
            )
        );
    }
798044
@GuardedBy("writeLock")
   private void updateFileList(FileListCacheValue fileList) {
      if (writeAsync) {
         cacheNoRetrieve.putAsync(fileListCacheKey, fileList);
      }
      else {
         if (trace) {
            log.tracef("Updating file listing view from %s", getAddress(cacheNoRetrieve));
         }
         cacheNoRetrieve.put(fileListCacheKey, fileList);
      }
   }
1356766
protected function fileUpdate()
    {
        foreach ($this->getAsserts() as $field => $asserts) {
            if ($this->$field instanceof UploadedFile) {
                $tempField = '_'.$field;
                $tempFile = $this->getFilePath($tempField, true);
                is_file($tempFile) && unlink($tempFile);
                $this->bean->removeProperty($tempField);

                $this->$field = $this->moveFile($this->$field);
            }
        }
    }
1320485
public function saveCacheFile()
    {
        if ($this->store !== null) {
            file_put_contents($this->cacheFile, $this->createCache($this->store), LOCK_EX);
            $this->store = null;
        }
    }
193533
public function modify(SplFileInfo $generatedFile, SplFileInfo $templateFile, array $modifiers, Inflector $inflector)
    {
        foreach ($modifiers as $modifierAlias => $modifierData) {
            if ($modifier = $this->contentModifiers->get($modifierAlias)) {
                $this->filesystem->dumpFile(
                    $generatedFile->getRealPath(),
                    $modifier->modify(
                        $generatedFile,
                        is_array($modifierData) ? $modifierData : array(),
                        $inflector,
                        $templateFile
                    )
                );
            }
        }
    }
447744
def update(self, source_file, configuration, declarations, included_files):
        

        record = record_t(
            source_signature=file_signature(source_file),
            config_signature=configuration_signature(configuration),
            included_files=included_files,
            included_files_signature=list(
                map(
                    file_signature,
                    included_files)),
            declarations=declarations)
        # Switched over to holding full record in cache so we don't have
        # to keep creating records in the next method.
        self.__cache[record.key()] = record
        self.__cache[record.key()].was_hit = True
        self.__needs_flushed = True
358426
public function setFile($file, $contentDisposition = null, $autoLastModified = true)
    {
        $this->file = $file;

        if ($autoLastModified) {
            $this->setAutoLastModified();
        }

        if ($contentDisposition) {
            $this->setContentDisposition($contentDisposition);
        }

        return $this;
    }
283092
public function updateFile($filename, $prefix)
    {
        $this->fvFilename = $filename;
        $this->fvPrefix = $prefix;
        $this->save();
        $this->logVersionUpdate(self::UT_REPLACE_FILE);
    }
96434
function loadPNG( $storedPath, $storedFile )
    {
        if ( !function_exists( 'ImageCreateFromPNG' ) )
            return false;
        $this->ImageObject = ImageCreateFromPNG( $storedPath . '/' . $storedFile );
        if ( $this->ImageObject )
        {
            $this->ImageObjectRef = eZImageInterface::registerImage( $this->ImageObject );
            return true;
        }
        return false;
    }
252846
function setStoredFile( $file, $path, $type )
    {
        $this->StoredFile = $file;
        $this->StoredPath = $path;
        $this->StoredType = $type;
    }