From e84281b620650db8f066f2643c1f9089a88e088d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 16 Sep 2017 15:48:48 -0700 Subject: wiki download: only include the latest page revision --- Zotlabs/Module/Wiki.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index 6055b0b38..2668229ee 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -140,11 +140,16 @@ class Wiki extends \Zotlabs\Web\Controller { $zip = new \ZipArchive; $r = $zip->open($zip_filepath, \ZipArchive::CREATE); 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) ); + if($i) { foreach($i as $iv) { + if(in_array($iv['mid'],$pages)) + continue; + if($iv['mimetype'] === 'text/plain') { $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); $zip->addFromString($fname,$content); + $pages[] = $iv['mid']; } -- cgit v1.2.3