PleaseStand has uploaded a new change for review.
https://gerrit.wikimedia.org/r/120054
Change subject: Use ProfileSection class from core
......................................................................
Use ProfileSection class from core
... instead of a separate class (Score_ScopedProfiling) that
predates ProfileSection and does exactly the same thing.
As ProfileSection was added in 1.22, removed "tested with MediaWiki
1.19alpha" from the README file.
Change-Id: I84f1b06019809557d60e019d0e20bf986496a97e
---
M README
M Score.body.php
M Score.php
3 files changed, 9 insertions(+), 43 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score
refs/changes/54/120054/1
diff --git a/README b/README
index f563dbf..bece82e 100644
--- a/README
+++ b/README
@@ -15,7 +15,7 @@
for more information.
-This extension was tested with MediaWiki 1.19alpha from SVN and LilyPond
2.12.3.
+This extension was tested with LilyPond 2.12.3.
Setup
diff --git a/Score.body.php b/Score.body.php
index c9782dc..3a192f0 100644
--- a/Score.body.php
+++ b/Score.body.php
@@ -28,39 +28,6 @@
}
/**
- * Helper class for mixing profiling with code that throws exceptions.
- * It produces matching wfProfileIn/Out calls for scopes.
- * This could be done with a try-finally construct instead, but we want to be
- * backwards compatible with PHP 5.3 for now.
- */
-class Score_ScopedProfiling {
- /**
- * Profiling ID such as a method name.
- */
- private $id;
-
- /**
- * Creates new scoped profiling.
- * The new scoped profiling will profile out as soon as its destructor
- * is called (normally when the variable holding the created object
- * goes out of scope).
- *
- * @param $id string profiling ID, most commonly a method name.
- */
- public function __construct( $id ) {
- $this->id = $id;
- wfProfileIn( $id );
- }
-
- /**
- * Out-profiles on end of scope.
- */
- public function __destruct() {
- wfProfileOut( $this->id );
- }
-}
-
-/**
* Score exception
*/
class ScoreException extends Exception {
@@ -148,7 +115,7 @@
private static function getLilypondVersion() {
global $wgScoreLilyPond;
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
if ( !is_executable( $wgScoreLilyPond ) ) {
throw new ScoreException( wfMessage(
'score-notexecutable', $wgScoreLilyPond ) );
@@ -240,7 +207,7 @@
public static function render( $code, array $args, Parser $parser,
PPFrame $frame ) {
global $wgTmpDirectory;
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
try {
$baseUrl = self::getBaseUrl();
@@ -397,7 +364,7 @@
* @throws ScoreException if an error occurs.
*/
private static function generateHTML( &$parser, $code, $options ) {
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
try {
$backend = self::getBackend();
$fileIter = $backend->getFileList(
@@ -567,7 +534,7 @@
private static function generatePngAndMidi( $code, $options, &$metaData
) {
global $wgScoreLilyPond, $wgScoreTrim;
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
if ( !is_executable( $wgScoreLilyPond ) ) {
throw new ScoreException( wfMessage(
'score-notexecutable', $wgScoreLilyPond ) );
@@ -794,7 +761,7 @@
private static function generateOgg( $sourceFile, $options,
$remoteDest, &$metaData ) {
global $wgScoreTimidity;
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
if ( !is_executable( $wgScoreTimidity ) ) {
throw new ScoreException( wfMessage(
'score-timiditynotexecutable', $wgScoreTimidity ) );
@@ -852,7 +819,7 @@
* @throws MWException if an error occurs.
*/
private static function generateLilypond( $code, $options ) {
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
/* Delete old file if necessary */
self::cleanupFile( $options['lilypond_path'] );
@@ -885,7 +852,7 @@
private static function generateLilypondFromAbc( $code,
$factoryDirectory, $destFile ) {
global $wgScoreAbc2Ly;
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
if ( !is_executable( $wgScoreAbc2Ly ) ) {
throw new ScoreException( wfMessage(
'score-abc2lynotexecutable', $wgScoreAbc2Ly ) );
@@ -953,7 +920,7 @@
private static function trimImage( $source, $dest ) {
global $wgImageMagickConvertCommand;
- $prof = new Score_ScopedProfiling( __METHOD__ );
+ $prof = new ProfileSection( __METHOD__ );
$cmd = wfEscapeShellArg( $wgImageMagickConvertCommand )
. ' -trim '
diff --git a/Score.php b/Score.php
index dbfcf47..434556e 100644
--- a/Score.php
+++ b/Score.php
@@ -94,7 +94,6 @@
$wgExtensionMessagesFiles['Score'] = "$scoreBase/Score.i18n.php";
$wgAutoloadClasses['Score'] = "$scoreBase/Score.body.php";
$wgAutoloadClasses['ScoreException'] = "$scoreBase/Score.body.php";
-$wgAutoloadClasses['Score_ScopedProfiling'] = "$scoreBase/Score.body.php";
/**
* Init routine.
--
To view, visit https://gerrit.wikimedia.org/r/120054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I84f1b06019809557d60e019d0e20bf986496a97e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits