lib/private/Files/Cache/Propagator.php
/**
	 * @param string $internalPath
	 * @param int $time
	 * @param int $sizeDifference number of bytes the file has grown
	 */
@param string $internalPath
@param int $time
@param int $sizeDifference number of bytes the file has grown
@param string $internalPath @param int $time @param int $sizeDifference number of bytes the file has grown
public function propagateChange($internalPath, $time, $sizeDifference = 0) {
		$storageId = (int)$this->storage->getStorageCache()->getNumericId();
		$parents = $this->getParents($internalPath);
		if ($this->inBatch) {
			foreach ($parents as $parent) {
				$this->addToBatch($parent, $time, $sizeDifference);
			}
			return;
		}
		$parentHashes = array_map('md5', $parents);
		$etag = uniqid(); 
		$builder = $this->connection->getQueryBuilder();
		$hashParams = array_map(function ($hash) use ($builder) {
			return $builder->expr()->literal($hash);
		}, $parentHashes);
		$builder->update('filecache')
			->set('mtime', $builder->createFunction('GREATEST(`mtime`, ' . $builder->createNamedParameter((int)$time, IQueryBuilder::PARAM_INT) . ')'))
			->set('etag', $builder->createNamedParameter($etag, IQueryBuilder::PARAM_STR))
			->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
			->andWhere($builder->expr()->in('path_hash', $hashParams));
		$builder->execute();
		if ($sizeDifference !== 0) {
			$builder = $this->connection->getQueryBuilder();
			$builder->update('filecache')
				->set('size', $builder->createFunction('`size` + ' . $builder->createNamedParameter($sizeDifference)))
				->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))
				->andWhere($builder->expr()->in('path_hash', $hashParams))
				->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT)));
		}
		$builder->execute();
	}
public function propagateChange ( $ internalPath , $ time , $ sizeDifference = 0 ) { $ storageId = ( int ) $ this -> storage -> getStorageCache ( ) -> getNumericId ( ) ; $ parents = $ this -> getParents ( $ internalPath ) ; if ( $ this -> inBatch ) { foreach ( $ parents as $ parent ) { $ this -> addToBatch ( $ parent , $ time , $ sizeDifference ) ; } return ; } $ parentHashes = array_map ( 'md5' , $ parents ) ; $ etag = uniqid ( ) ; $ builder = $ this -> connection -> getQueryBuilder ( ) ; $ hashParams = array_map ( function ( $ hash ) use ( $ builder ) { return $ builder -> expr ( ) -> literal ( $ hash ) ; } , $ parentHashes ) ; $ builder -> update ( 'filecache' ) -> set ( 'mtime' , $ builder -> createFunction ( 'GREATEST(`mtime`, ' . $ builder -> createNamedParameter ( ( int ) $ time , IQueryBuilder :: PARAM_INT ) . ')' ) ) -> set ( 'etag' , $ builder -> createNamedParameter ( $ etag , IQueryBuilder :: PARAM_STR ) ) -> where ( $ builder -> expr ( ) -> eq ( 'storage' , $ builder -> createNamedParameter ( $ storageId , IQueryBuilder :: PARAM_INT ) ) ) -> andWhere ( $ builder -> expr ( ) -> in ( 'path_hash' , $ hashParams ) ) ; $ builder -> execute ( ) ; if ( $ sizeDifference !== 0 ) { $ builder = $ this -> connection -> getQueryBuilder ( ) ; $ builder -> update ( 'filecache' ) -> set ( 'size' , $ builder -> createFunction ( '`size` + ' . $ builder -> createNamedParameter ( $ sizeDifference ) ) ) -> where ( $ builder -> expr ( ) -> eq ( 'storage' , $ builder -> createNamedParameter ( $ storageId , IQueryBuilder :: PARAM_INT ) ) ) -> andWhere ( $ builder -> expr ( ) -> in ( 'path_hash' , $ hashParams ) ) -> andWhere ( $ builder -> expr ( ) -> gt ( 'size' , $ builder -> expr ( ) -> literal ( - 1 , IQueryBuilder :: PARAM_INT ) ) ) ; } $ builder -> execute ( ) ; }
@param string $internalPath
 @param int $time
 @param int $sizeDifference number of bytes the file has grown
@param string $internalPath @param int $time @param int $sizeDifference number of bytes the file has grown
// since we give all folders the same etag we don't ask the storage for the etag // we need to do size separably so we can ignore entries with uncalculated size