Automattic\WooCommerce\Internal\ProductFeed\Storage
JsonFileFeed::end
{@inheritDoc}
Method of the class: JsonFileFeed{}
No Hooks.
Returns
null. Nothing (null).
Usage
$JsonFileFeed = new JsonFileFeed(); $JsonFileFeed->end(): void;
JsonFileFeed::end() JsonFileFeed::end code WC 11.1.2
public function end(): void {
if ( ! is_resource( $this->file_handle ) ) {
return;
}
fwrite( $this->file_handle, ']' );
// Do not unlock explicitly before closing: fclose() flushes PHP's userspace stream buffer to the
// OS and only then releases the lock. Unlocking first would open a window in which another process
// could acquire the lock and start writing while this process's buffered bytes are still pending,
// interleaving output — the exact corruption the lock prevents.
fclose( $this->file_handle );
$this->file_handle = null;
$this->file_completed = true;
}