From d1a10207d170ca0e9baa27833fea3ec28aaa7c61 Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Sat, 7 Apr 2018 13:47:39 +0100
Subject: [PATCH] Made rebuilding search idnex progress bar fill up completely
 when done

---
 Changelog.md                  | 3 ++-
 build/index.php               | 6 +++---
 module_index.json             | 6 +++---
 modules/feature-guiconfig.php | 4 ++--
 modules/feature-search.php    | 2 +-
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/Changelog.md b/Changelog.md
index 3a72b53..7350eda 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -5,12 +5,12 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
 
 ### Added
  - [Rest API] Added support for the `mode` parameter to the `random` action.
- - Fixed various issues with both the module api & the rest api docs.
  - 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)
 
 ### Fixed
+ - Fixed various issues with both the module api & the rest api docs.
  - Properly escaped content of short code box on file pages
  - Display a more meaningful message to a logged in user if editing is disabled
  - Fixed fetching the size of SVGs in some cases
@@ -24,6 +24,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
  - Fixed floating images that have captions
  - [Rest API] Fix `checklogin` action documentation
  - Fix link on credits page
+ - Made rebuild search index progress bar fill completely up when done & neatened up UI placement
 
 ### Changed
  - Disallow uploads if editing is disabled. Previously files could still be uploaded even if editing was disabled - unless `upload_enabled` was set to `false`.
diff --git a/build/index.php b/build/index.php
index 660c847..7ebe8a3 100644
--- a/build/index.php
+++ b/build/index.php
@@ -2982,9 +2982,9 @@ register_module([
 			$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 .= "<h2>Actions</h2>";
 			
-			$content .= "<button class='action-invindex-rebuild'>Rebuild Search Index</button><br />\n";
-			$content .= "<output class='action-invindex-rebuild-latestmessage'></output><br />\n";
+			$content .= "<button class='action-invindex-rebuild'>Rebuild Search Index</button>\n";
 			$content .= "<progress class='action-invindex-rebuild-progress' min='0' max='100' value='0' style='display: none;'></progress><br />\n";
+			$content .= "<output class='action-invindex-rebuild-latestmessage'></output><br />\n";
 			
 			$invindex_rebuild_script = <<<SCRIPT
 window.addEventListener("load", function(event) {
@@ -4171,7 +4171,7 @@ class search
 			if(!file_exists($page_filename)) {
 				echo("data: [" . ($i + 1) . " / $max] Error: Can't find $page_filename\n");
 				flush();
-				$missing_files++;
+				$i++; $missing_files++;
 				continue;
 			}
 			$pagesource = Normalizer::normalize(file_get_contents($page_filename), Normalizer::FORM_C);
diff --git a/module_index.json b/module_index.json
index ad1395a..519707d 100755
--- a/module_index.json
+++ b/module_index.json
@@ -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": 1499800843,
+        "lastupdate": 1523105202,
         "optional": false
     },
     {
@@ -104,7 +104,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.",
         "id": "feature-search",
-        "lastupdate": 1521391886,
+        "lastupdate": 1523105081,
         "optional": false
     },
     {
@@ -122,7 +122,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File\/' prefix.",
         "id": "feature-upload",
-        "lastupdate": 1523104505,
+        "lastupdate": 1523104941,
         "optional": false
     },
     {
diff --git a/modules/feature-guiconfig.php b/modules/feature-guiconfig.php
index 4bd9e11..99fa1c8 100644
--- a/modules/feature-guiconfig.php
+++ b/modules/feature-guiconfig.php
@@ -38,9 +38,9 @@ register_module([
 			$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 .= "<h2>Actions</h2>";
 			
-			$content .= "<button class='action-invindex-rebuild'>Rebuild Search Index</button><br />\n";
-			$content .= "<output class='action-invindex-rebuild-latestmessage'></output><br />\n";
+			$content .= "<button class='action-invindex-rebuild'>Rebuild Search Index</button>\n";
 			$content .= "<progress class='action-invindex-rebuild-progress' min='0' max='100' value='0' style='display: none;'></progress><br />\n";
+			$content .= "<output class='action-invindex-rebuild-latestmessage'></output><br />\n";
 			
 			$invindex_rebuild_script = <<<SCRIPT
 window.addEventListener("load", function(event) {
diff --git a/modules/feature-search.php b/modules/feature-search.php
index e39648e..0918e20 100644
--- a/modules/feature-search.php
+++ b/modules/feature-search.php
@@ -588,7 +588,7 @@ class search
 			if(!file_exists($page_filename)) {
 				echo("data: [" . ($i + 1) . " / $max] Error: Can't find $page_filename\n");
 				flush();
-				$missing_files++;
+				$i++; $missing_files++;
 				continue;
 			}
 			$pagesource = Normalizer::normalize(file_get_contents($page_filename), Normalizer::FORM_C);
