Nextcloud PHP API (master)

MetadataLiveEvent extends AMetadataEvent
in package

MetadataLiveEvent is an event initiated when a file is created or updated.

The app contains the Node related to the created/updated file, and a FilesMetadata that already contains the currently known metadata.

Setting new metadata, or modifying already existing metadata with different value, will trigger the save of the metadata in the database.

Tags
see
AMetadataEvent::getMetadata()
see
AMetadataEvent::getNode()
see
MetadataLiveEvent::requestBackgroundJob()
since
28.0.0

Table of Contents

Properties

$metadata  : IFilesMetadata
$node  : Node
$propagationStopped  : bool
$runAsBackgroundJob  : bool

Methods

__construct()  : mixed
Compatibility constructor
getMetadata()  : IFilesMetadata
returns metadata. if known, it already contains data from the database.
getNode()  : Node
returns related node
isPropagationStopped()  : bool
{@inheritDoc}
isRunAsBackgroundJobRequested()  : bool
return true if any app that catch this event requested a re-run as background job
requestBackgroundJob()  : void
For heavy process, call this method if your app prefers to update metadata on a background/cron job, instead of the live process.
stopPropagation()  : void
Stops the propagation of the event to further event listeners

Properties

$propagationStopped

private bool $propagationStopped = false
Tags
since
22.0.0

Methods

__construct()

Compatibility constructor

public __construct() : mixed

In Nextcloud 17.0.0 this event class used a now deprecated/removed Symfony base class that had a constructor (with default arguments). To lower the risk of a breaking change (PHP won't allow parent constructor calls if there is none), this empty constructor's only purpose is to hopefully not break existing sub- classes of this class.

Tags
since
18.0.0

getMetadata()

returns metadata. if known, it already contains data from the database.

public getMetadata() : IFilesMetadata

If the object is modified using its setters, changes are stored in database at the end of the event.

Tags
since
28.0.0
Return values
IFilesMetadata

isPropagationStopped()

{@inheritDoc}

public isPropagationStopped() : bool
Tags
since
22.0.0
see
StoppableEventInterface
Return values
bool

isRunAsBackgroundJobRequested()

return true if any app that catch this event requested a re-run as background job

public isRunAsBackgroundJobRequested() : bool
Tags
since
28.0.0
Return values
bool

requestBackgroundJob()

For heavy process, call this method if your app prefers to update metadata on a background/cron job, instead of the live process.

public requestBackgroundJob() : void

A similar MetadataBackgroundEvent will be broadcast on next cron tick.

Tags
since
28.0.0

stopPropagation()

Stops the propagation of the event to further event listeners

public stopPropagation() : void
Tags
since
22.0.0

        
On this page

Search results