summaryrefslogtreecommitdiff
path: root/inc/changelog.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/changelog.php')
-rw-r--r--inc/changelog.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/inc/changelog.php b/inc/changelog.php
index 6af336fc2..d1ef7973e 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -83,17 +83,19 @@ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extr
'extra' => str_replace($strip, '', $extra)
);
+ $wasCreated = ($type===DOKU_CHANGE_TYPE_CREATE);
+ $wasReverted = ($type===DOKU_CHANGE_TYPE_REVERT);
// update metadata
if (!$wasRemoved) {
$oldmeta = p_read_metadata($id);
$meta = array();
- if (!$INFO['exists'] && empty($oldmeta['persistent']['date']['created'])){ // newly created
+ if ($wasCreated && empty($oldmeta['persistent']['date']['created'])){ // newly created
$meta['date']['created'] = $created;
if ($user){
$meta['creator'] = $INFO['userinfo']['name'];
$meta['user'] = $user;
}
- } elseif (!$INFO['exists'] && !empty($oldmeta['persistent']['date']['created'])) { // re-created / restored
+ } elseif (($wasCreated || $wasReverted) && !empty($oldmeta['persistent']['date']['created'])) { // re-created / restored
$meta['date']['created'] = $oldmeta['persistent']['date']['created'];
$meta['date']['modified'] = $created; // use the files ctime here
$meta['creator'] = $oldmeta['persistent']['creator'];
@@ -349,7 +351,7 @@ function _handleRecent($line,$ns,$flags,&$seen){
// check existance
if($flags & RECENTS_SKIP_DELETED){
$fn = (($flags & RECENTS_MEDIA_CHANGES) ? mediaFN($recent['id']) : wikiFN($recent['id']));
- if(!@file_exists($fn)) return false;
+ if(!file_exists($fn)) return false;
}
return $recent;
@@ -496,14 +498,14 @@ abstract class ChangeLog {
if($first < 0) {
$first = 0;
- } else if(@file_exists($this->getFilename())) {
+ } else if(file_exists($this->getFilename())) {
// skip current revision if the page exists
$first = max($first + 1, 0);
}
$file = $this->getChangelogFilename();
- if(!@file_exists($file)) {
+ if(!file_exists($file)) {
return $revs;
}
if(filesize($file) < $this->chunk_size || $this->chunk_size == 0) {
@@ -725,13 +727,15 @@ abstract class ChangeLog {
* If file larger than $chuncksize, only chunck is read that could contain $rev.
*
* @param int $rev revision timestamp
- * @return array(fp, array(changeloglines), $head, $tail, $eof)|bool
- * returns false when not succeed. fp only defined for chuck reading, needs closing.
+ * @return array|false
+ * if success returns array(fp, array(changeloglines), $head, $tail, $eof)
+ * where fp only defined for chuck reading, needs closing.
+ * otherwise false
*/
protected function readloglines($rev) {
$file = $this->getChangelogFilename();
- if(!@file_exists($file)) {
+ if(!file_exists($file)) {
return false;
}