====== COMMON_WIKIPAGE_SAVE ====== ---- dataentry event ---- Description: Intercept or modify saving of a wiki page DefaultAction: save the given content and create a new revision Preventable: yes Added_dt: 2016-02-24 ---- This event is signalled by [[xref>saveWikiText()]] in [[xref>inc/common.php]] when a page is saved, handlers can use it to: * prevent saves by either preventing the default action or overwriting the contentChanged field in a BEFORE hook * enforce saves even when no content changed by overwriting the contentChanged field in a BEFORE hook * adjust the saved content by modifying the newContent field in a BEFORE hook * adjust the stored change log information (summary, type, extras) in an AFTER hook * easily know if a page was deleted, created or edited by inspecting the changeType field * do whatever they want before or after a wiki page is saved ===== Passed Data ===== The passed [[xref>Doku_Event]] has the field ''$data''. ''$data'' is an array with the following keys: * ''id'' -- the page ID of the page to save * ''file'' -- the path to the corresponding file of that page * ''revertFrom'' -- if this save is a revert to an older version, that older version is in here. falsy otherwise * ''oldRevision'' -- this is the revision date (timestamp) of the page before the save * ''newRevision'' -- this is the revision date (timestamp) of the page after the save (only available in the AFTER event) * ''newContent'' -- the new page content to be saved * ''oldContent'' -- the page's content before saving * ''summary'' -- the edit summary * ''contentChanged'' -- a boolean comparing newContent and oldContent. The default action is only executed when this is true. A BEFORE hook could change it to true to force saving even when the page content did not change * ''changeInfo'' -- additional info to be stored with the changelog. usually empty. Contains ''revertFrom'' for reverts. * ''changeType'' -- one of the following constants: * ''DOKU_CHANGE_TYPE_EDIT'' * ''DOKU_CHANGE_TYPE_REVERT'' * ''DOKU_CHANGE_TYPE_CREATE'' * ''DOKU_CHANGE_TYPE_DELETE'' * ''DOKU_CHANGE_TYPE_MINOR_EDIT'' * ''sizechange'' -- contains after saving the size (in bytes) of the saved change ===== See also ===== * [[codesearch>COMMON_WIKIPAGE_SAVE|Code related to this event]] used in any DokuWiki's files, plugins and templates * [[devel:Action Plugins]] * [[devel:Events]]