fix function name media_isexternal()
remove empty rev from ml() rename getProperRevision() to getLastRevisionAt() make getLastRevisionAt() a method of ChangeLog
This commit is contained in:
parent
ac6dc646a5
commit
78b874e68a
3
doku.php
3
doku.php
|
@ -49,7 +49,8 @@ $SUF = cleanText($INPUT->post->str('suffix'));
|
|||
$SUM = $INPUT->post->str('summary');
|
||||
|
||||
if($DATE_AT) {
|
||||
$rev_t = getProperRevision($ID,$DATE_AT);
|
||||
$pagelog = new PageChangeLog($ID);
|
||||
$rev_t = $pagelog->getLastRevisionAt($DATE_AT);
|
||||
if($rev_t === '') {
|
||||
$REV = '';
|
||||
} else if ($rev_t === false) {
|
||||
|
|
|
@ -771,6 +771,25 @@ abstract class ChangeLog {
|
|||
public function isCurrentRevision($rev) {
|
||||
return $rev == @filemtime($this->getFilename());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an existing revision for a specific date which is
|
||||
* the current one or younger or equal then the date
|
||||
*
|
||||
* @param string $id
|
||||
* @param number $date_at timestamp
|
||||
* @return string revision ('' for current)
|
||||
*/
|
||||
function getLastRevisionAt($date_at){
|
||||
//requested date_at(timestamp) younger or equal then modified_time($this->id) => load current
|
||||
if($date_at >= @filemtime($this->getFilename())) {
|
||||
return '';
|
||||
} else if ($rev = $this->getRelativeRevision($date_at+1, -1)) { //+1 to get also the requested date revision
|
||||
return $rev;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PageChangelog extends ChangeLog {
|
||||
|
@ -870,25 +889,3 @@ function getRevisions($id, $first, $num, $chunk_size=8192, $media=false) {
|
|||
return $changelog->getRevisions($first, $num);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an existing revision for a specific date which is
|
||||
* the current one or less or equal then the date
|
||||
*
|
||||
* @param string $id
|
||||
* @param number $date_at
|
||||
* @param boolean $media
|
||||
* @return string revision ('' for current)
|
||||
*/
|
||||
function getProperRevision($id,$date_at,$media = false){
|
||||
$modified_time = @filemtime($media?mediaFN($id):wikiFN($id));
|
||||
if(((int)$date_at) >= $modified_time) { //requestet REV younger or equal then time($id) => load current
|
||||
return '';
|
||||
} else {
|
||||
$log = new PageRevisionLog($id);
|
||||
if($rev = $log->getRelativeRevision($date_at+1, -1,$media)) {
|
||||
return $rev;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -484,6 +484,7 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false)
|
|||
if(empty($more['w'])) unset($more['w']);
|
||||
if(empty($more['h'])) unset($more['h']);
|
||||
if(isset($more['id']) && $direct) unset($more['id']);
|
||||
if(isset($more['rev']) && !$more['rev']) unset($more['rev']);
|
||||
$more = buildURLparams($more, $sep);
|
||||
} else {
|
||||
$matches = array();
|
||||
|
|
|
@ -1060,7 +1060,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
|
|||
$height=null, $cache=null, $render = true) {
|
||||
|
||||
$ret = '';
|
||||
$intern = !is_externalmedia($src);
|
||||
$intern = !media_isexternal($src);
|
||||
list($ext,$mime,$dl) = mimetype($src);
|
||||
if(substr($mime,0,5) == 'image'){
|
||||
// first get the $title
|
||||
|
@ -1248,7 +1248,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
|
|||
* @return string revision ('' for current)
|
||||
*/
|
||||
function _getProperMediaRevision($media_id){
|
||||
return getProperRevision($media_id,$this->date_at,true);
|
||||
$pagelog = new MediaChangeLog($media_id);
|
||||
return $pagelog->getLastRevisionAt($this->date_at);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue