Prevent division by zero.

Closes #55.
This commit is contained in:
Daniel Kraus
2021-05-08 15:05:35 +02:00
parent c1dca118de
commit 96bdd0ad23
2 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,9 @@ For changes prior to version 6.0.0, please see [`NEWS.old`](news.old).
- Fixed a regression concerning `linktitles-cli` progress display that was
introduced in v8.0.0.
- Prevent a division-by-zero error that could occur on the LinkTitles special
page.
## [8.0.0][] - 2021-04-06
### Changed

View File

@ -247,7 +247,14 @@ EOF
* @return undefined
*/
private function addCompletedInfo( &$output, $start, $end, $reloads ) {
$pagesPerReload = sprintf('%0.1f', $end / $reloads);
if ( $reloads > 0 ) {
$pagesPerReload = sprintf( '%0.1f', $end / $reloads );
}
else
{
$pagesPerReload = sprintf( '%0.1f', $end );
}
$output->addWikiMsg( 'linktitltes-special-completed-info', $end,
$config->specialPageReloadAfter, $reloads, $pagesPerReload
);