wiki download: only include the latest page revision
This commit is contained in:
parent
cb3fb0049f
commit
e84281b620
@ -140,11 +140,16 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$zip = new \ZipArchive;
|
$zip = new \ZipArchive;
|
||||||
$r = $zip->open($zip_filepath, \ZipArchive::CREATE);
|
$r = $zip->open($zip_filepath, \ZipArchive::CREATE);
|
||||||
if($r === true) {
|
if($r === true) {
|
||||||
$i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'",
|
$pages = [];
|
||||||
|
$i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' order by revision desc",
|
||||||
dbesc($resource_id)
|
dbesc($resource_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if($i) {
|
if($i) {
|
||||||
foreach($i as $iv) {
|
foreach($i as $iv) {
|
||||||
|
if(in_array($iv['mid'],$pages))
|
||||||
|
continue;
|
||||||
|
|
||||||
if($iv['mimetype'] === 'text/plain') {
|
if($iv['mimetype'] === 'text/plain') {
|
||||||
$content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
|
$content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
|
||||||
}
|
}
|
||||||
@ -156,6 +161,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
$fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . Zlib\NativeWikiPage::get_file_ext($iv);
|
$fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . Zlib\NativeWikiPage::get_file_ext($iv);
|
||||||
$zip->addFromString($fname,$content);
|
$zip->addFromString($fname,$content);
|
||||||
|
$pages[] = $iv['mid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user