mDb->convertSortmode("title_asc"); $result = $this->mDb->query($query,[]); while ($res = $result->fetchRow()) { $page_id = $res["page_id"]; $content = $this->export_wiki_page($page_id, 0); $tar->addData($page_id, $content, $gBitSystem->getUTCTime()); } $tar->toTar( $pExportFile, false); return ''; } function export_wiki_page($page_id, $nversions = 1) { global $gBitSystem; $head = ''; $head .= "Date: " . $gBitSystem->mServerTimestamp->get_rfc2822_datetime(). "\r\n"; $head .= sprintf("Mime-Version: 1.0 (Produced by Tiki)\r\n"); $iter = $this->get_page_history($page_id); $gWikiPage = new BitPage( $page_id ); $gWikiPage->load(); $info = $gWikiPage->mInfo; $parts = []; $parts[] = MimeifyPageRevision($info); if ($nversions > 1 || $nversions == 0) { foreach ($iter as $revision) { $parts[] = MimeifyPageRevision($revision); if ($nversions > 0 && count($parts) >= $nversions) break; } } if (count($parts) > 1) return $head . MimeMultipart($parts); assert ($parts); return $head . $parts[0]; } // Returns all the versions for this page // without the data itself function get_page_history($page_id) { $query = "SELECT lc.`title`, th.`description`, th.`version`, th.`last_modified`, th.`user_id`, th.`ip`, th.`data`, th.`history_comment`, uu.`login` as `creator_user`, uu.`real_name` " . "FROM `".BIT_DB_PREFIX."wiki_pages` wp " . "INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON (lc.`content_id` = wp.`content_id`) " . "INNER JOIN `".BIT_DB_PREFIX."liberty_content_history` th ON (th.`page_id` = th.`page_id`) " . "INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON (uu.`user_id` = th.`user_id`) " . "WHERE wp.`page_id`=? order by th.".$this->mDb->convertSortmode("version_desc"); $result = $this->mDb->query($query,[$page_id]); $ret = []; while ($res = $result->fetchRow()) { array_push( $ret, $res ); } return $ret; } } $exportlib = new ExportLib();