Skip to content

Commit

Permalink
TaskAPerms: move error reporting to top of file
Browse files Browse the repository at this point in the history
for better debugging
  • Loading branch information
NovemLinguae committed Aug 24, 2024
1 parent e571441 commit 7928dce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 0 additions & 5 deletions TaskAPerms/src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ public static function setHeaders() {
header( 'Content-Type:text/plain; charset=utf-8; Content-Encoding: none' );
}

public static function setErrorReporting() {
ini_set( "display_errors", 1 );
error_reporting( E_ALL );
}

public static function dieIfInvalidPassword( $correctPassword ) {
// Keep randos from running the bot in browser and in bash
$hasWrongWebPassword = ( $_GET['password'] ?? '' ) != $correctPassword;
Expand Down
9 changes: 8 additions & 1 deletion TaskAPerms/src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// https://novem-bot.toolforge.org/task-a/index.php?password=

ini_set( "display_errors", 1 );
error_reporting( E_ALL );

require_once 'botclasses.php';
require_once 'Controller.php';
require_once 'Database.php';
Expand All @@ -12,7 +15,6 @@
require_once 'View.php';

View::setHeaders();
View::setErrorReporting();
// set_time_limit(1440); # 24 minutes

View::dieIfInvalidPassword( $urlAndCliPassword );
Expand Down Expand Up @@ -56,4 +58,9 @@

$c->writeUpdate();

// Close PDO connections.
unset( $enwiki );
unset( $metawiki );
unset( $centralauth );

View::print( "\nMission accomplished.\n\n" ); // extra line breaks at end for CLI

0 comments on commit 7928dce

Please sign in to comment.