1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Bugfix: Don't crash when updating stats if no pages have any tags yet

This commit is contained in:
Starbeamrainbowlabs 2019-05-06 20:31:08 +01:00
parent c177b66b42
commit f3d797695e
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 2 additions and 1 deletions

View file

@ -8,6 +8,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
### Fixed ### Fixed
- Fixed double-escaping of rendered HTML when nesting templates - Fixed double-escaping of rendered HTML when nesting templates
- Squashed a warning if the search index doesn't exist yet - Squashed a warning if the search index doesn't exist yet
- Fixed the stats updater if no pages in the system have tags yet
### Added ### Added
- [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example. - [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example.

View file

@ -175,7 +175,7 @@ register_module([
$tag_counts[] = count($page_entry->tags ?? []); $tag_counts[] = count($page_entry->tags ?? []);
$result = new stdClass(); // value, state, completed $result = new stdClass(); // value, state, completed
$result->value = round(array_sum($tag_counts) / count($tag_counts), 3); $result->value = empty($tag_counts) ? -1 : round(array_sum($tag_counts) / count($tag_counts), 3);
$result->completed = true; $result->completed = true;
return $result; return $result;
} }