-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.php
37 lines (31 loc) · 1.17 KB
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace MyProject;
require_once 'main.php';
require_once 'database.php';
require_once 'config.php';
require_once 'amazon_api.php';
require_once 'debug.php';
// Check if the script was called directly
if (php_sapi_name() !== 'cli' || !isset($_SERVER['WRAPPER_SCRIPT'])) {
die("Error: This script must be run through the wrapper.\n");
}
// Initialize Debug and get the log file path
Debug::init();
$logFilePath = Debug::getLogFilePath();
echo "Amazon Rank Updater\n";
echo "===================\n";
echo "Started at: " . date('Y-m-d H:i:s') . "\n";
echo "Log file: $logFilePath\n";
echo "Environment variables:\n";
echo "PHP_VERBOSE: " . ($_SERVER['PHP_VERBOSE'] == 1 ? 'Set' : 'Not set') . "\n";
echo "PHP_LIVE_MODE: " . ($_SERVER['PHP_LIVE_MODE'] == 1 ? 'Set' : 'Not set') . "\n";
echo "PHP_DEBUG_MODE: " . ($_SERVER['PHP_DEBUG_MODE'] == 1 ? 'Set' : 'Not set') . "\n";
echo "===================\n\n";
try {
main(); // Starte die Hauptlogik
} catch (\Exception $e) {
$fatalErrorMessage = "Fatal error: " . $e->getMessage();
Debug::log($fatalErrorMessage, "CRITICAL");
Debug::sendErrorEmail("Amazon Rank Updater - Fatal Error", $fatalErrorMessage);
exit(1);
}