[MediaWiki-commits] [Gerrit] Re-apply "Add PHP error logging to Sentry extension" - change (mediawiki...Sentry)
jenkins-bot has submitted this change and it was merged. Change subject: Re-apply "Add PHP error logging to Sentry extension" .. Re-apply "Add PHP error logging to Sentry extension" This re-applies commit bad0a30696330fea11521db0bacc784f53bf7288, which broke beta due to relying on a composer library not added to mediawiki/vendor, but I1f2179bd61fff3b794a8c4fdcb5e2f45324e12bb should have taken care of that. (This reverts cbf7c77208dddfd5bee852565b478e77d889ecbd.) (Backport PHP logging to the LTS release.) Bug: T85188 Bug: T101252 Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec Cherry-Picked-From: f5523f7606446ccea7ed7014981c50ce9cf75b7e --- M .gitignore M Sentry.php M SentryHooks.php A composer.json 4 files changed, 45 insertions(+), 1 deletion(-) Approvals: Gergő Tisza: Looks good to me, approved jenkins-bot: Verified diff --git a/.gitignore b/.gitignore index 3c3629e..e32f354 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -node_modules +node_modules/ +vendor/ +composer.lock + diff --git a/Sentry.php b/Sentry.php index f80f939..607ffdc 100644 --- a/Sentry.php +++ b/Sentry.php @@ -31,6 +31,8 @@ $wgHooks['BeforePageDisplay'][] = 'SentryHooks::onBeforePageDisplay'; $wgHooks['UnitTestsList'][] = 'SentryHooks::onUnitTestsList'; $wgHooks['ResourceLoaderTestModules'][] = 'SentryHooks::onResourceLoaderTestModules'; +$wgHooks['LogException'][] = 'SentryHooks::onLogException'; +SentryHooks::onRegistration(); /** * Sentry DSN (http://raven.readthedocs.org/en/latest/config/#the-sentry-dsn) @@ -52,3 +54,9 @@ */ $wgSentryLogOnError = true; +/** + * Log PHP errors automatically. + * @var bool + */ +$wgSentryLogPhpErrors = true; + diff --git a/SentryHooks.php b/SentryHooks.php index c653f8a..d8b8031 100644 --- a/SentryHooks.php +++ b/SentryHooks.php @@ -56,4 +56,24 @@ } return substr( $dsn, 0, $colon_pos ) . substr( $dsn, $at_pos ); } + + public static function onRegistration() { + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { + require_once( __DIR__ . '/vendor/autoload.php' ); + } + } + + public static function onLogException( Exception $e ) { + global $wgSentryDsn, $wgSentryLogPhpErrors; + + if ( !$wgSentryLogPhpErrors ) { + return true; + } + + $client = new Raven_Client( $wgSentryDsn ); + $client->captureException( $e ); + + return true; + } } + diff --git a/composer.json b/composer.json new file mode 100644 index 000..4cb5c4a --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "mediawiki/sentry", + "type": "mediawiki-extension", + "description": "Send MediaWiki errors to Sentry, a realtime, platform-agnostic error logging and aggregation platform", + "keywords": ["MediaWiki", "Sentry", "error logging"], + "homepage": "https://www.mediawiki.org/wiki/Extension:Sentry";, + "license" : "MIT", + + "require": { + "composer/installers": ">=1.0.1", + "raven/raven": "0.12.0" + } +} -- To view, visit https://gerrit.wikimedia.org/r/223510 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Sentry Gerrit-Branch: REL1_23 Gerrit-Owner: Gergő Tisza Gerrit-Reviewer: BryanDavis Gerrit-Reviewer: Gergő Tisza Gerrit-Reviewer: Gilles Gerrit-Reviewer: Legoktm Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Re-apply "Add PHP error logging to Sentry extension" - change (mediawiki...Sentry)
Gergő Tisza has uploaded a new change for review. https://gerrit.wikimedia.org/r/223510 Change subject: Re-apply "Add PHP error logging to Sentry extension" .. Re-apply "Add PHP error logging to Sentry extension" This re-applies commit bad0a30696330fea11521db0bacc784f53bf7288, which broke beta due to relying on a composer library not added to mediawiki/vendor, but I1f2179bd61fff3b794a8c4fdcb5e2f45324e12bb should have taken care of that. (This reverts cbf7c77208dddfd5bee852565b478e77d889ecbd.) Bug: T85188 Bug: T101252 Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec (cherry picked from commit f5523f7606446ccea7ed7014981c50ce9cf75b7e) --- M .gitignore M Sentry.php M SentryHooks.php A composer.json 4 files changed, 45 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Sentry refs/changes/10/223510/1 diff --git a/.gitignore b/.gitignore index 3c3629e..e32f354 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -node_modules +node_modules/ +vendor/ +composer.lock + diff --git a/Sentry.php b/Sentry.php index f80f939..607ffdc 100644 --- a/Sentry.php +++ b/Sentry.php @@ -31,6 +31,8 @@ $wgHooks['BeforePageDisplay'][] = 'SentryHooks::onBeforePageDisplay'; $wgHooks['UnitTestsList'][] = 'SentryHooks::onUnitTestsList'; $wgHooks['ResourceLoaderTestModules'][] = 'SentryHooks::onResourceLoaderTestModules'; +$wgHooks['LogException'][] = 'SentryHooks::onLogException'; +SentryHooks::onRegistration(); /** * Sentry DSN (http://raven.readthedocs.org/en/latest/config/#the-sentry-dsn) @@ -52,3 +54,9 @@ */ $wgSentryLogOnError = true; +/** + * Log PHP errors automatically. + * @var bool + */ +$wgSentryLogPhpErrors = true; + diff --git a/SentryHooks.php b/SentryHooks.php index c653f8a..d8b8031 100644 --- a/SentryHooks.php +++ b/SentryHooks.php @@ -56,4 +56,24 @@ } return substr( $dsn, 0, $colon_pos ) . substr( $dsn, $at_pos ); } + + public static function onRegistration() { + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { + require_once( __DIR__ . '/vendor/autoload.php' ); + } + } + + public static function onLogException( Exception $e ) { + global $wgSentryDsn, $wgSentryLogPhpErrors; + + if ( !$wgSentryLogPhpErrors ) { + return true; + } + + $client = new Raven_Client( $wgSentryDsn ); + $client->captureException( $e ); + + return true; + } } + diff --git a/composer.json b/composer.json new file mode 100644 index 000..4cb5c4a --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "mediawiki/sentry", + "type": "mediawiki-extension", + "description": "Send MediaWiki errors to Sentry, a realtime, platform-agnostic error logging and aggregation platform", + "keywords": ["MediaWiki", "Sentry", "error logging"], + "homepage": "https://www.mediawiki.org/wiki/Extension:Sentry";, + "license" : "MIT", + + "require": { + "composer/installers": ">=1.0.1", + "raven/raven": "0.12.0" + } +} -- To view, visit https://gerrit.wikimedia.org/r/223510 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Sentry Gerrit-Branch: REL1_23 Gerrit-Owner: Gergő Tisza ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Re-apply "Add PHP error logging to Sentry extension" - change (mediawiki...Sentry)
jenkins-bot has submitted this change and it was merged. Change subject: Re-apply "Add PHP error logging to Sentry extension" .. Re-apply "Add PHP error logging to Sentry extension" This re-applies commit bad0a30696330fea11521db0bacc784f53bf7288, which broke beta due to relying on a composer library not added to mediawiki/vendor, but I1f2179bd61fff3b794a8c4fdcb5e2f45324e12bb should have taken care of that. (This reverts cbf7c77208dddfd5bee852565b478e77d889ecbd.) Bug: T85188 Bug: T101252 Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec --- M .gitignore M Sentry.php M SentryHooks.php A composer.json 4 files changed, 45 insertions(+), 1 deletion(-) Approvals: BryanDavis: Looks good to me, approved Paladox: Looks good to me, but someone else must approve Hashar: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/.gitignore b/.gitignore index 3c3629e..e32f354 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -node_modules +node_modules/ +vendor/ +composer.lock + diff --git a/Sentry.php b/Sentry.php index f80f939..607ffdc 100644 --- a/Sentry.php +++ b/Sentry.php @@ -31,6 +31,8 @@ $wgHooks['BeforePageDisplay'][] = 'SentryHooks::onBeforePageDisplay'; $wgHooks['UnitTestsList'][] = 'SentryHooks::onUnitTestsList'; $wgHooks['ResourceLoaderTestModules'][] = 'SentryHooks::onResourceLoaderTestModules'; +$wgHooks['LogException'][] = 'SentryHooks::onLogException'; +SentryHooks::onRegistration(); /** * Sentry DSN (http://raven.readthedocs.org/en/latest/config/#the-sentry-dsn) @@ -52,3 +54,9 @@ */ $wgSentryLogOnError = true; +/** + * Log PHP errors automatically. + * @var bool + */ +$wgSentryLogPhpErrors = true; + diff --git a/SentryHooks.php b/SentryHooks.php index c653f8a..d8b8031 100644 --- a/SentryHooks.php +++ b/SentryHooks.php @@ -56,4 +56,24 @@ } return substr( $dsn, 0, $colon_pos ) . substr( $dsn, $at_pos ); } + + public static function onRegistration() { + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { + require_once( __DIR__ . '/vendor/autoload.php' ); + } + } + + public static function onLogException( Exception $e ) { + global $wgSentryDsn, $wgSentryLogPhpErrors; + + if ( !$wgSentryLogPhpErrors ) { + return true; + } + + $client = new Raven_Client( $wgSentryDsn ); + $client->captureException( $e ); + + return true; + } } + diff --git a/composer.json b/composer.json new file mode 100644 index 000..4cb5c4a --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "mediawiki/sentry", + "type": "mediawiki-extension", + "description": "Send MediaWiki errors to Sentry, a realtime, platform-agnostic error logging and aggregation platform", + "keywords": ["MediaWiki", "Sentry", "error logging"], + "homepage": "https://www.mediawiki.org/wiki/Extension:Sentry";, + "license" : "MIT", + + "require": { + "composer/installers": ">=1.0.1", + "raven/raven": "0.12.0" + } +} -- To view, visit https://gerrit.wikimedia.org/r/216753 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Sentry Gerrit-Branch: master Gerrit-Owner: Gergő Tisza Gerrit-Reviewer: BryanDavis Gerrit-Reviewer: Gilles Gerrit-Reviewer: Hashar Gerrit-Reviewer: Legoktm Gerrit-Reviewer: Paladox Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Re-apply "Add PHP error logging to Sentry extension" - change (mediawiki...Sentry)
Gergő Tisza has uploaded a new change for review. https://gerrit.wikimedia.org/r/216753 Change subject: Re-apply "Add PHP error logging to Sentry extension" .. Re-apply "Add PHP error logging to Sentry extension" This re-applies commit bad0a30696330fea11521db0bacc784f53bf7288, which broke beta due to relying on a composer library not added to mediawiki/vendor, but I1f2179bd61fff3b794a8c4fdcb5e2f45324e12bb should have taken care of that. Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec --- M .gitignore M Sentry.php M SentryHooks.php A composer.json 4 files changed, 45 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Sentry refs/changes/53/216753/1 diff --git a/.gitignore b/.gitignore index 3c3629e..e32f354 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -node_modules +node_modules/ +vendor/ +composer.lock + diff --git a/Sentry.php b/Sentry.php index f80f939..607ffdc 100644 --- a/Sentry.php +++ b/Sentry.php @@ -31,6 +31,8 @@ $wgHooks['BeforePageDisplay'][] = 'SentryHooks::onBeforePageDisplay'; $wgHooks['UnitTestsList'][] = 'SentryHooks::onUnitTestsList'; $wgHooks['ResourceLoaderTestModules'][] = 'SentryHooks::onResourceLoaderTestModules'; +$wgHooks['LogException'][] = 'SentryHooks::onLogException'; +SentryHooks::onRegistration(); /** * Sentry DSN (http://raven.readthedocs.org/en/latest/config/#the-sentry-dsn) @@ -52,3 +54,9 @@ */ $wgSentryLogOnError = true; +/** + * Log PHP errors automatically. + * @var bool + */ +$wgSentryLogPhpErrors = true; + diff --git a/SentryHooks.php b/SentryHooks.php index c653f8a..d8b8031 100644 --- a/SentryHooks.php +++ b/SentryHooks.php @@ -56,4 +56,24 @@ } return substr( $dsn, 0, $colon_pos ) . substr( $dsn, $at_pos ); } + + public static function onRegistration() { + if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { + require_once( __DIR__ . '/vendor/autoload.php' ); + } + } + + public static function onLogException( Exception $e ) { + global $wgSentryDsn, $wgSentryLogPhpErrors; + + if ( !$wgSentryLogPhpErrors ) { + return true; + } + + $client = new Raven_Client( $wgSentryDsn ); + $client->captureException( $e ); + + return true; + } } + diff --git a/composer.json b/composer.json new file mode 100644 index 000..b07f188 --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "name": "mediawiki/sentry", + "type": "mediawiki-extension", + "description": "Send MediaWiki errors to Sentry, a realtime, platform-agnostic error logging and aggregation platform", + "keywords": ["MediaWiki", "Sentry", "error logging"], + "homepage": "https://www.mediawiki.org/wiki/Extension:Sentry";, + "license" : "MIT", + + "require": { + "composer/installers": ">=1.0.1", + "raven/raven": "0.12.0" + } +} -- To view, visit https://gerrit.wikimedia.org/r/216753 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5fe94f746a95bcb9dd5b3a63e634cdd5dd5e83ec Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Sentry Gerrit-Branch: master Gerrit-Owner: Gergő Tisza ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits