An entity is a database-tracked object that usually has a VPID (but not alwasy, see e.g. options).
Derived ChangeInfos have these things in common:
- The VP-Action tag value has the form of "entityName/action/entityId",
e.g. "post/create/8F805A77ABC9485BA3F114E3E251E5FD" or "option/edit/blogname".
Most commonly, the entityId is VPID.
- Subclasses usually provide a set of VP tags to store additional info to commits, usually
in the form of "VP-EntityType-Something: value", e.g. "VP-Post-Title: Hello world". These
tags are used when the commit is read later and human-friendly message is rendered in the UI.
public function __construct($action, $entityId, $termName, $termVpId, $metaKey) { parent::__construct("termmeta", $action, $entityId); $this->termName = $termName; $this->termVpId = $termVpId; $this->metaKey = $metaKey; }
public function __construct($action, $entityId, $userLogin, $userMetaKey, $userVpId) { parent::__construct("usermeta", $action, $entityId); $this->userLogin = $userLogin; $this->userMetaKey = $userMetaKey; $this->userVpId = $userVpId; }
public function getChangedFiles() { $changes = parent::getChangedFiles(); $changes[] = array("type" => "all-storage-files", "entity" => "option"); // sometimes term change can affect option (e.g. deleting menu) return $changes; }
public function __construct($action, $entityId, $postType, $postTitle, $postVpId, $metaKey) { parent::__construct("postmeta", $action, $entityId); $this->postType = $postType; $this->postTitle = $postTitle; $this->postVpId = $postVpId; $this->metaKey = $metaKey; }
public function getChangedFiles() { $result = parent::getChangedFiles(); if ($this->getEntityId() == "rewrite_rules") { $result[] = array("type" => "path", "path" => ABSPATH . ".htaccess"); } return $result; }
public function __construct($action, $entityId, $commentAuthor, $commentedPost) { parent::__construct("comment", $action, $entityId); $this->commentAuthor = $commentAuthor; $this->commentedPost = $commentedPost; }
public function __construct($action, $entityId, $userLogin) { parent::__construct("user", $action, $entityId); $this->userLogin = $userLogin; }
public function getChangedFiles() { $changes = parent::getChangedFiles(); if ($this->postType !== "attachment") { return $changes; } $changes[] = array("type" => "path", "path" => WP_CONTENT_DIR . "/uploads/*"); return $changes; }