r52546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52545‎ | r52546 | r52547 >
Date:15:07, 29 June 2009
Author:shinjiman
Status:reverted (Comments)
Tags:
Comment:
show the version information of GeSHi currently using, only show the version when the required geshi.php was found.
Modified paths:
  • /trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
@@ -61,6 +61,11 @@
6262 $wgExtensionFunctions[] = 'efSyntaxHighlight_GeSHiSetup';
6363 }
6464
 65+if ( file_exists( $dir . 'geshi/geshi.php' ) ) {
 66+ require( 'geshi/geshi.php' );
 67+ $wgExtensionCredits['parserhook']['SyntaxHighlight_GeSHi']['version'] = GESHI_VERSION;
 68+}
 69+
6570 /**
6671 * Register parser hook
6772 */

Follow-up revisions

RevisionCommit summaryAuthorDate
r52550tweak for r52546, use require_once() to make the class file only load once.shinjiman16:29, 29 June 2009
r52555revert r52546 and r52550 for slow loading for the class, per CodeReview.shinjiman17:06, 29 June 2009
r52642show the version information of GeSHi currently using, only show the version ...shinjiman19:34, 1 July 2009

Comments

#Comment by Nikerabbit (talk | contribs)   15:54, 29 June 2009

Any way to not load it on every request?

#Comment by Shinjiman (talk | contribs)   16:05, 29 June 2009

Maybe use require_once() on both main file and class file (in SyntaxHighlight_GeSHi::initialise())?

#Comment by Shinjiman (talk | contribs)   16:30, 29 June 2009

require_once() is used instead of require() on r52550.

#Comment by Nikerabbit (talk | contribs)   16:48, 29 June 2009

Better, but the original issues is still valid. Is there any hooks that it would only be checked when viewing Special:Version?

#Comment by Shinjiman (talk | contribs)   17:10, 29 June 2009

Check for file existence, open the file and read through until 'GESHI_VERSION' occurs and read the value on the value of GESHI_VERSION. After this, close the file.

Is that read the file stright through is faster than load the required file using require()?

#Comment by Tim Starling (talk | contribs)   06:24, 30 June 2009

No it would not be faster. Nikerabbit: no, there is no hook. I would suggest just not implementing the feature.

#Comment by Shinjiman (talk | contribs)   19:21, 1 July 2009

Seems the hook listed in Manual:Hooks/SpecialVersionExtensionTypes can be used to get the version information when Special:Version is loaded.

#Comment by Shinjiman (talk | contribs)   19:35, 1 July 2009

Redone in r52642.

#Comment by Tim Starling (talk | contribs)   16:56, 29 June 2009

Revert this, it is slow.

#Comment by Shinjiman (talk | contribs)   17:07, 29 June 2009

Reverted on r52555.

Status & tagging log