Exemple #1
0
 /**
  * _getLastMediaRevisionAt is a helperfunction to internalmedia() and _media()
  * which returns an existing media revision less or equal to rev or date_at
  *
  * @author lisps
  * @param string $media_id
  * @access protected
  * @return string revision ('' for current)
  */
 function _getLastMediaRevisionAt($media_id)
 {
     if (!$this->date_at || media_isexternal($media_id)) {
         return '';
     }
     $pagelog = new MediaChangeLog($media_id);
     return $pagelog->getLastRevisionAt($this->date_at);
 }
Exemple #2
0
/**
 * Returns a full media id
 *
 * @author Andreas Gohr <*****@*****.**>
 *
 * @param string  $ns     namespace which is context of id
 * @param string &$page   (reference) relative media id, updated to resolved id
 * @param bool   &$exists (reference) updated with existance of media
 */
function resolve_mediaid($ns, &$page, &$exists, $rev = '', $date_at = false)
{
    $page = resolve_id($ns, $page);
    if ($rev !== '' && $date_at) {
        $medialog = new MediaChangeLog($page);
        $medialog_rev = $medialog->getLastRevisionAt($rev);
        if ($medialog_rev !== false) {
            $rev = $medialog_rev;
        }
    }
    $file = mediaFN($page, $rev);
    $exists = @file_exists($file);
}