Added commit hash to debug & configure actions

This commit is contained in:
Starbeamrainbowlabs 2018-04-22 17:52:57 +01:00
parent 121183a7fd
commit 407d383a12
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
7 changed files with 20 additions and 13 deletions

View File

@ -7,6 +7,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Add json support to the search action :D
- Added page moves to the recent changes page (#151)
- Hyperlinked image preview on file pages to the original image (#153)
- Added the commit hash Pepperminty Wiki was built against to the master settings configuration page, and the debug action
- [Rest API] Added support for the `mode` parameter to the `random` action
- [Rest API] Added `format` parameter to `recentchanges` action
- [Rest API] Added `comments-fetch` action to return a page's comments as JSON

View File

@ -387,6 +387,7 @@ if($settings->css === "auto")
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "v0.16-dev";
$commit = "121183a7fd298d52fa4d81a30a5f3e084ed66a33";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@ -1771,7 +1772,7 @@ class page_renderer
if(module_exists("feature-user-preferences")) {
$result .= "<a href='?action=user-preferences'>$settings->user_preferences_button_text</a>";
}
$result .= " <a href='?page=" . rawurlencode("$settings->user_page_prefix/$env->user") . "'>" . self::render_username($env->user) . "</a>";
$result .= self::render_username($env->user);
$result .= " <small>(<a href='index.php?action=logout'>Logout</a>)</small>";
$result .= "</span>";
//$result .= page_renderer::$nav_divider;
@ -3008,7 +3009,7 @@ register_module([
* ██████ ██████ ██ ████ ██ ██ ██████ ██████ ██ ██ ███████
*/
add_action("configure", function() {
global $settings, $env, $guiConfig;
global $settings, $env, $guiConfig, $version, $commit;
if(!$env->is_admin)
{
@ -3022,6 +3023,7 @@ register_module([
$content = "<h1>Master Control Panel</h1>\n";
$content .= "<p>This page lets you configure $settings->sitename's master settings. Please be careful - you can break things easily on this page if you're not careful!</p>\n";
$content .= "<p>You're currently running Pepperminty WIki $version+" . substr($commit, 0, 7) . ".</p>\n";
$content .= "<h2>Actions</h2>";
$content .= "<button class='action-invindex-rebuild' title='Rebuilds the index that is consulted when searching the wiki. Hit this button if some pages are not showing up.'>Rebuild Search Index</button>\n";
@ -6004,7 +6006,7 @@ register_module([
* ██████ ███████ ██████ ██████ ██████
*/
add_action("debug", function() {
global $settings, $env, $paths, $version;
global $settings, $env, $paths, $version, $commit;
header("content-type: text/plain");
if(!$env->is_admin)
@ -6015,7 +6017,7 @@ register_module([
$title = "$settings->sitename debug report";
echo("$title\n");
echo(str_repeat("=", strlen($title)) . "\n");
echo("Powered by Pepperminty Wiki version $version.\n");
echo("Powered by Pepperminty Wiki version $version+" . substr($commit, 0, 7) . ".\n");
echo("This report may contain personal information.\n\n");
echo("Environment: ");
echo(var_export($env, true));
@ -6488,9 +6490,9 @@ window.addEventListener("load", function(event) {
});
/**
* @api {post} ?action=save&page={pageName} Save an edit to a page.
* @api {post} ?action=save&page={pageName} Save an edit to a page
* @apiDescription Saves an edit to a page. If an edit conflict is encountered, then a conflict resolution page is returned instead.
* @apiName EditPage
* @apiName SavePage
* @apiGroup Editing
* @apiPermission Anonymous
*

View File

@ -10,6 +10,7 @@ mb_internal_encoding("UTF-8");
/////////////////////////////////////////////////////////////////////////////
/** The version of Pepperminty Wiki currently running. */
$version = "{version}";
$commit = "{commit}";
/// Environment ///
/** Holds information about the current request environment. */
$env = new stdClass();
@ -1394,7 +1395,7 @@ class page_renderer
if(module_exists("feature-user-preferences")) {
$result .= "<a href='?action=user-preferences'>$settings->user_preferences_button_text</a>";
}
$result .= " <a href='?page=" . rawurlencode("$settings->user_page_prefix/$env->user") . "'>" . self::render_username($env->user) . "</a>";
$result .= self::render_username($env->user);
$result .= " <small>(<a href='index.php?action=logout'>Logout</a>)</small>";
$result .= "</span>";
//$result .= page_renderer::$nav_divider;

View File

@ -68,7 +68,7 @@
"author": "Starbeamrainbowlabs",
"description": "The module everyone has been waiting for! Adds a web based gui that lets mods change the wiki settings.",
"id": "feature-guiconfig",
"lastupdate": 1523105460,
"lastupdate": 1524415857,
"optional": false
},
{
@ -149,7 +149,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds a debug action for administrator use only that collects a load of useful information to make reporting bugs easier.",
"id": "page-debug-info",
"lastupdate": 1483389558,
"lastupdate": 1524415876,
"optional": false
},
{
@ -167,7 +167,7 @@
"author": "Starbeamrainbowlabs",
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id": "page-edit",
"lastupdate": 1524408762,
"lastupdate": 1524409010,
"optional": false
},
{

View File

@ -22,7 +22,7 @@ register_module([
* ██████ ██████ ██ ████ ██ ██ ██████ ██████ ██ ██ ███████
*/
add_action("configure", function() {
global $settings, $env, $guiConfig;
global $settings, $env, $guiConfig, $version, $commit;
if(!$env->is_admin)
{
@ -36,6 +36,7 @@ register_module([
$content = "<h1>Master Control Panel</h1>\n";
$content .= "<p>This page lets you configure $settings->sitename's master settings. Please be careful - you can break things easily on this page if you're not careful!</p>\n";
$content .= "<p>You're currently running Pepperminty WIki $version+" . substr($commit, 0, 7) . ".</p>\n";
$content .= "<h2>Actions</h2>";
$content .= "<button class='action-invindex-rebuild' title='Rebuilds the index that is consulted when searching the wiki. Hit this button if some pages are not showing up.'>Rebuild Search Index</button>\n";

View File

@ -24,7 +24,7 @@ register_module([
* ██████ ███████ ██████ ██████ ██████
*/
add_action("debug", function() {
global $settings, $env, $paths, $version;
global $settings, $env, $paths, $version, $commit;
header("content-type: text/plain");
if(!$env->is_admin)
@ -35,7 +35,7 @@ register_module([
$title = "$settings->sitename debug report";
echo("$title\n");
echo(str_repeat("=", strlen($title)) . "\n");
echo("Powered by Pepperminty Wiki version $version.\n");
echo("Powered by Pepperminty Wiki version $version+" . substr($commit, 0, 7) . ".\n");
echo("This report may contain personal information.\n\n");
echo("Environment: ");
echo(var_export($env, true));

View File

@ -40,11 +40,13 @@ $settings = str_replace([ "<?php", "?>" ], "", $settings);
$core = str_replace([
"//{settings}",
"{version}",
"{commit}",
"{guiconfig}",
"{default-css}"
], [
$settings,
trim(file_get_contents("version")),
exec("git rev-parse HEAD"),
trim(file_get_contents("peppermint.guiconfig.json")),
trim(file_get_contents("theme_default.css"))
], $core);