1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-25 17:23:00 +00:00

Implement delayed indexing. Fixes #66.

This commit is contained in:
Starbeamrainbowlabs 2016-04-30 11:40:18 +01:00
parent c41c76688f
commit e86c67dcad
5 changed files with 22 additions and 1 deletions

View file

@ -95,6 +95,7 @@ Key | Value | Explanation
`logo_postition`| left|right | The side of the site name at which the logo should be placed. Only has an effect if the above is not set to an empty string. `logo_postition`| left|right | The side of the site name at which the logo should be placed. Only has an effect if the above is not set to an empty string.
`updateurl` | url | The url from which to fetch updates. Defaults to the master (development) branch. If there is sufficient demand, a separate stable branch will be created. Note that if you use the automatic updater currently it won't save your module choices. **MAKE SURE THAT THIS POINTS TO A *HTTPS* URL, OTHERWISE SOMEONE COULD INJECT A VIRUS INTO YOUR WIKI!** `updateurl` | url | The url from which to fetch updates. Defaults to the master (development) branch. If there is sufficient demand, a separate stable branch will be created. Note that if you use the automatic updater currently it won't save your module choices. **MAKE SURE THAT THIS POINTS TO A *HTTPS* URL, OTHERWISE SOMEONE COULD INJECT A VIRUS INTO YOUR WIKI!**
`sitesecret` | string | The secret key used to perform 'dangerous' actions, like updating the wiki. It is strongly advised that you change this! `sitesecret` | string | The secret key used to perform 'dangerous' actions, like updating the wiki. It is strongly advised that you change this!
`delayed_indexing_time` | integer | The amount of time, in seconds, that pages should be blocked from being indexed by search engines after their last edit. Set to 0 to disable. This is called delayed indexing. More information can be found [here](http://c2.com/cgi/wiki?DelayedIndexing).
`editing` | boolean | Determines whether editing is enabled. Set to false to disable disting for all users (anonymous or otherwise). `editing` | boolean | Determines whether editing is enabled. Set to false to disable disting for all users (anonymous or otherwise).
`maxpagesize` | integer | The maximum number of characters allowed on a single page. The default is 135,000 characters, which is about 50 pages. `maxpagesize` | integer | The maximum number of characters allowed on a single page. The default is 135,000 characters, which is about 50 pages.
`clean_raw_html`| boolean | Whether page sources should be cleaned of HTML before rendering. If set to true any raw HTML will be escaped before rendering. Note that this shouldn't affect code blocks - they should alwys be escaped. It is STRONGLY recommended that you keep this option turned on, **_ESPECIALLY_** if you allow anonymous edits as no sanitizing whatsoever is performed on the HTML. If you need a feature that the markdown parser doesn't have, please open an issue. Also note that some parsers may override this setting and escape HTML sequences anyway. `clean_raw_html`| boolean | Whether page sources should be cleaned of HTML before rendering. If set to true any raw HTML will be escaped before rendering. Note that this shouldn't affect code blocks - they should alwys be escaped. It is STRONGLY recommended that you keep this option turned on, **_ESPECIALLY_** if you allow anonymous edits as no sanitizing whatsoever is performed on the HTML. If you need a feature that the markdown parser doesn't have, please open an issue. Also note that some parsers may override this setting and escape HTML sequences anyway.

View file

@ -137,6 +137,10 @@ $settings->data_storage_dir = ".";
// It is strongly advised that you change this! // It is strongly advised that you change this!
$settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02"; $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02";
// The amount of time, in seconds, that pages should be blocked from being
// indexed by search engines after their last edit. Aka delayed indexing.
$settings->delayed_indexing_time = 0;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// Navigation ////////////////////////////////// ////////////////////////////////// Navigation //////////////////////////////////
@ -4256,6 +4260,12 @@ register_module([
$content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n"; $content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n";
// Prevent indexing of this page if it's still within the noindex
// time period
if(isset($settings->delayed_indexing_time) and
time() - $pageindex->{$env->page}->lastmodified < $settings->delayed_indexing_time)
header("x-robots-tag: noindex");
// Content only mode: Sends only the raw rendered page // Content only mode: Sends only the raw rendered page
if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes") if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes")
exit(parse_page_source($content)); exit(parse_page_source($content));

View file

@ -176,7 +176,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You really should include this one.", "description": "Allows you to view pages. You really should include this one.",
"id": "page-view", "id": "page-view",
"lastupdate": 1458906065, "lastupdate": 1462012572,
"optional": false "optional": false
}, },
{ {

View file

@ -102,6 +102,12 @@ register_module([
$content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n"; $content .= "\n\t\t<!-- Took " . (microtime(true) - $parsing_start) . " seconds to parse page source -->\n";
// Prevent indexing of this page if it's still within the noindex
// time period
if(isset($settings->delayed_indexing_time) and
time() - $pageindex->{$env->page}->lastmodified < $settings->delayed_indexing_time)
header("x-robots-tag: noindex");
// Content only mode: Sends only the raw rendered page // Content only mode: Sends only the raw rendered page
if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes") if(isset($_GET["contentonly"]) and $_GET["contentonly"] === "yes")
exit(parse_page_source($content)); exit(parse_page_source($content));

View file

@ -134,6 +134,10 @@ $settings->data_storage_dir = ".";
// It is strongly advised that you change this! // It is strongly advised that you change this!
$settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02"; $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02";
// The amount of time, in seconds, that pages should be blocked from being
// indexed by search engines after their last edit. Aka delayed indexing.
$settings->delayed_indexing_time = 0;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// Navigation ////////////////////////////////// ////////////////////////////////// Navigation //////////////////////////////////