$page->cachedcontent, FORMAT_HTML, $context->id, 'mod_wiki', 'attachments', $subwiki->id);
$returnedpage['caneditpage'] = wiki_user_can_edit($subwiki);
+ // Get page version.
+ $version = wiki_get_current_version($page->id);
+ if (!empty($version)) {
+ $returnedpage['version'] = $version->version;
+ }
+
$result = array();
$result['page'] = $returnedpage;
$result['warnings'] = $warnings;
'title' => new external_value(PARAM_RAW, 'Page title.'),
'cachedcontent' => new external_value(PARAM_RAW, 'Page contents.'),
'contentformat' => new external_format_value('cachedcontent', VALUE_OPTIONAL),
- 'caneditpage' => new external_value(PARAM_BOOL, 'True if user can edit the page.')
+ 'caneditpage' => new external_value(PARAM_BOOL, 'True if user can edit the page.'),
+ 'version' => new external_value(PARAM_INT, 'Latest version of the page.', VALUE_OPTIONAL),
), 'Page'
),
'warnings' => new external_warnings()
'title' => $this->firstpage->title,
'cachedcontent' => $this->firstpage->cachedcontent,
'contentformat' => 1,
- 'caneditpage' => true
+ 'caneditpage' => true,
+ 'version' => 1
);
$result = mod_wiki_external::get_page_contents($this->firstpage->id);
'title' => $this->fpsepg1indstu->title,
'cachedcontent' => $this->fpsepg1indstu->cachedcontent,
'contentformat' => 1,
- 'caneditpage' => true
+ 'caneditpage' => true,
+ 'version' => 1
);
$result = mod_wiki_external::get_page_contents($this->fpsepg1indstu->id);
* External functions that were returning file information now return the following file fields:
filename, filepath, mimetype, filesize, timemodified and fileurl.
Those fields are now marked as VALUE_OPTIONAL for backwards compatibility.
+* External function get_page_contents now returns the page version. This new field is marked as VALUE_OPTIONAL for backwards compatibility.
=== 3.1 ===
* Added a new param $sort to wiki_get_page_list function. Default value behaves exactly like before (sort by title ASC).