summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/inc/common.php b/inc/common.php
index a073ebeaa..75c3e8574 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1005,6 +1005,7 @@ function saveWikiText($id,$text,$summary,$minor=false){
}else{
// save file (datadir is created in io_saveFile)
io_saveFile($file,$text);
+ saveMetadata($id, $file, $minor);
$del = false;
}
@@ -1020,6 +1021,27 @@ function saveWikiText($id,$text,$summary,$minor=false){
}
/**
+ * saves the metadata for a page
+ *
+ * @author Esther Brunner <wikidesign@gmail.com>
+ */
+function saveMetadata($id, $file, $minor){
+ global $INFO;
+
+ $user = $_SERVER['REMOTE_USER'];
+
+ $meta = array();
+ if (!$INFO['exists']){ // newly created
+ $meta['date']['created'] = @filectime($file);
+ if ($user) $meta['creator'] = $INFO['userinfo']['name'];
+ } elseif (!$minor) { // non-minor modification
+ $meta['date']['modified'] = @filemtime($file);
+ if ($user) $meta['contributor'][$user] = $INFO['userinfo']['name'];
+ }
+ p_set_metadata($id, $meta, true);
+}
+
+/**
* moves the current version to the attic and returns its
* revision date
*