fuer diesen Request nicht weiter versuchen. Sonst wartet // jeder Aufruf erneut auf einen Timeout. if ($tot) { return false; } if (!function_exists('pg_connect')) { $tot = true; return false; } if ($verbindung === null) { $ini_pfad = dirname(__FILE__) . '/config.ini'; if (!is_readable($ini_pfad)) { $tot = true; return false; } $ini = @parse_ini_file($ini_pfad, true); if (!$ini || empty($ini['postgresql'])) { $tot = true; return false; } $pg = $ini['postgresql']; // connect_timeout ist der wichtigste Parameter hier: liegt Postgres, // wartet der Checkout hoechstens zwei Sekunden statt bis zum PHP-Timeout. $dsn = sprintf( 'host=%s port=%s dbname=%s user=%s password=%s connect_timeout=2', isset($pg['host']) ? $pg['host'] : 'localhost', isset($pg['port']) ? $pg['port'] : '5432', isset($pg['database']) ? $pg['database'] : '', isset($pg['user']) ? $pg['user'] : '', isset($pg['password']) ? $pg['password'] : '' ); $verbindung = @pg_connect($dsn); if (!$verbindung) { $verbindung = null; $tot = true; error_log('shop_event: keine PG-Verbindung -- Ereignisprotokoll uebersprungen'); return false; } } $werte = array( (string)$ereignis, isset($daten['order_id']) && $daten['order_id'] !== '' ? (int)$daten['order_id'] : null, isset($daten['order_number']) ? (string)$daten['order_number'] : null, isset($daten['payment_method']) && $daten['payment_method'] !== '' ? (int)$daten['payment_method'] : null, isset($daten['betrag']) && $daten['betrag'] !== '' ? (float)$daten['betrag'] : null, isset($daten['paypal_token']) ? (string)$daten['paypal_token'] : null, isset($daten['transaction_id']) ? (string)$daten['transaction_id'] : null, isset($daten['customer_id']) && $daten['customer_id'] !== '' ? (int)$daten['customer_id'] : null, function_exists('session_id') && session_id() ? session_id() : null, isset($daten['detail']) ? (string)$daten['detail'] : null ); $ergebnis = @pg_query_params( $verbindung, 'INSERT INTO shop_order_events (ereignis, order_id, order_number, payment_method, betrag, paypal_token, transaction_id, customer_id, session_id, detail) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)', $werte ); if (!$ergebnis) { // Einmal melden, dann Ruhe -- ein volllaufendes Log hilft niemandem. $tot = true; error_log('shop_event: INSERT fehlgeschlagen (' . $ereignis . ') -- ' . @pg_last_error($verbindung)); return false; } return true; } } /* EOF */