mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Add offset & count to recent-changes action
This commit is contained in:
parent
e715c2049f
commit
242f197ccf
4 changed files with 21 additions and 4 deletions
|
@ -8,6 +8,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
||||||
- Added `interwiki_index_location` setting to control the location of the interwiki index (which is a CSV file that is documented in the main _Pepperminty Wiki_ documentation), which has to be specified in order for it to activate
|
- Added `interwiki_index_location` setting to control the location of the interwiki index (which is a CSV file that is documented in the main _Pepperminty Wiki_ documentation), which has to be specified in order for it to activate
|
||||||
- Provides new module api functions: `interwiki_pagename_parse`, `interwiki_pagename_resolve`, `interwiki_get_pagename_url`, and `is_interwiki_link`
|
- Provides new module api functions: `interwiki_pagename_parse`, `interwiki_pagename_resolve`, `interwiki_get_pagename_url`, and `is_interwiki_link`
|
||||||
- Added CSV support to the `recent-changes` action.
|
- Added CSV support to the `recent-changes` action.
|
||||||
|
- Added `count` and `offset` GET parameters to `recent-changes` action.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Completely reworked the README to refactor out the documentation to its [own static site](https://starbeamrainbowlabs.com/labs/peppermint/_docpress/)
|
- Completely reworked the README to refactor out the documentation to its [own static site](https://starbeamrainbowlabs.com/labs/peppermint/_docpress/)
|
||||||
|
|
|
@ -409,7 +409,7 @@ if($settings->sessionprefix == "auto")
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
/** The version of Pepperminty Wiki currently running. */
|
/** The version of Pepperminty Wiki currently running. */
|
||||||
$version = "v0.18-dev";
|
$version = "v0.18-dev";
|
||||||
$commit = "6aa55c74bfe5a6dfffc96d3c7d8c041d4a707abd";
|
$commit = "e715c2049f0782f46919fd2b220eac9292183075";
|
||||||
/// Environment ///
|
/// Environment ///
|
||||||
/** Holds information about the current request environment. */
|
/** Holds information about the current request environment. */
|
||||||
$env = new stdClass();
|
$env = new stdClass();
|
||||||
|
@ -3701,11 +3701,13 @@ register_module([
|
||||||
file_put_contents($paths->recentchanges, "[]");
|
file_put_contents($paths->recentchanges, "[]");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} ?action=recent-changes[&format={code}] Get a list of recent changes
|
* @api {get} ?action=recent-changes[&offset={number}][&count={number}][&format={code}] Get a list of recent changes
|
||||||
* @apiName RecentChanges
|
* @apiName RecentChanges
|
||||||
* @apiGroup Stats
|
* @apiGroup Stats
|
||||||
* @apiPermission Anonymous
|
* @apiPermission Anonymous
|
||||||
*
|
*
|
||||||
|
* @apiParam {number} offset If specified, start returning changes from this many changes in. 0 is the beginning.
|
||||||
|
* @apiParam {number} count If specified, return at most this many changes. A value of 0 means no limit (the default) - apart from the limit on the number of changes stored by the server (configurable in pepppermint.json).
|
||||||
* @apiParam {string} format The format to return the recent changes in. Valid values: html, json, csv. Default: html.
|
* @apiParam {string} format The format to return the recent changes in. Valid values: html, json, csv. Default: html.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -3725,9 +3727,15 @@ register_module([
|
||||||
global $settings, $paths, $pageindex;
|
global $settings, $paths, $pageindex;
|
||||||
|
|
||||||
$format = $_GET["format"] ?? "html";
|
$format = $_GET["format"] ?? "html";
|
||||||
|
$offset = intval($_GET["offset"] ?? 0);
|
||||||
|
$count = intval($_GET["count"] ?? 0);
|
||||||
|
|
||||||
$recent_changes = json_decode(file_get_contents($paths->recentchanges));
|
$recent_changes = json_decode(file_get_contents($paths->recentchanges));
|
||||||
|
|
||||||
|
// Limit the number of changes displayed if requested
|
||||||
|
if($count > 0)
|
||||||
|
$recent_changes = array_slice($recent_changes, $offset, $count);
|
||||||
|
|
||||||
switch($format) {
|
switch($format) {
|
||||||
case "html":
|
case "html":
|
||||||
$content = "\t\t<h1>Recent Changes</h1>\n";
|
$content = "\t\t<h1>Recent Changes</h1>\n";
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds recent changes. Access through the 'recent-changes' action.",
|
"description": "Adds recent changes. Access through the 'recent-changes' action.",
|
||||||
"id": "feature-recent-changes",
|
"id": "feature-recent-changes",
|
||||||
"lastupdate": 1548353858,
|
"lastupdate": 1548354223,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,11 +15,13 @@ register_module([
|
||||||
file_put_contents($paths->recentchanges, "[]");
|
file_put_contents($paths->recentchanges, "[]");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} ?action=recent-changes[&format={code}] Get a list of recent changes
|
* @api {get} ?action=recent-changes[&offset={number}][&count={number}][&format={code}] Get a list of recent changes
|
||||||
* @apiName RecentChanges
|
* @apiName RecentChanges
|
||||||
* @apiGroup Stats
|
* @apiGroup Stats
|
||||||
* @apiPermission Anonymous
|
* @apiPermission Anonymous
|
||||||
*
|
*
|
||||||
|
* @apiParam {number} offset If specified, start returning changes from this many changes in. 0 is the beginning.
|
||||||
|
* @apiParam {number} count If specified, return at most this many changes. A value of 0 means no limit (the default) - apart from the limit on the number of changes stored by the server (configurable in pepppermint.json).
|
||||||
* @apiParam {string} format The format to return the recent changes in. Valid values: html, json, csv. Default: html.
|
* @apiParam {string} format The format to return the recent changes in. Valid values: html, json, csv. Default: html.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
@ -39,9 +41,15 @@ register_module([
|
||||||
global $settings, $paths, $pageindex;
|
global $settings, $paths, $pageindex;
|
||||||
|
|
||||||
$format = $_GET["format"] ?? "html";
|
$format = $_GET["format"] ?? "html";
|
||||||
|
$offset = intval($_GET["offset"] ?? 0);
|
||||||
|
$count = intval($_GET["count"] ?? 0);
|
||||||
|
|
||||||
$recent_changes = json_decode(file_get_contents($paths->recentchanges));
|
$recent_changes = json_decode(file_get_contents($paths->recentchanges));
|
||||||
|
|
||||||
|
// Limit the number of changes displayed if requested
|
||||||
|
if($count > 0)
|
||||||
|
$recent_changes = array_slice($recent_changes, $offset, $count);
|
||||||
|
|
||||||
switch($format) {
|
switch($format) {
|
||||||
case "html":
|
case "html":
|
||||||
$content = "\t\t<h1>Recent Changes</h1>\n";
|
$content = "\t\t<h1>Recent Changes</h1>\n";
|
||||||
|
|
Loading…
Reference in a new issue