Last modified: 2012-05-15 14:26:14 UTC
Yes, I know 1.13.0 is ancient, but I'm stuck with it for now, I'm afraid! I installed the appropriate version of the extension into extensions/SyntaxHighlight_GeSHi. It loads successfully, but when I tried to use it, I got error messages. The first was easily fixed as I changed require( 'geshi/geshi.php' ); to require( 'extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php' ); in SyntaxHighlight_GeSHi.class.php, but now I get this: Fatal error: Class 'GeSHi' not found in /usr/local/apache2/htdocs/wiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php on line 171 169 private static function prepare( $text, $lang ) { 170 self::initialise(); 171 $geshi = new GeSHi( $text, $lang ); 172 if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) 173 return null; 174 $geshi->set_encoding( 'UTF-8' ); 175 $geshi->enable_classes(); 176 $geshi->set_overall_class( "source-$lang" ); 177 $geshi->enable_keyword_links( false ); 178 return $geshi; 179 } I'm not really a PHP speaker, so any suggestion would be welcome, please!
(In reply to comment #0) > Yes, I know 1.13.0 is ancient, but I'm stuck with it for now, I'm afraid! > > I installed the appropriate version of the extension into > extensions/SyntaxHighlight_GeSHi. It loads successfully, but when I tried to > use it, I got error messages. The first was easily fixed as I changed > > require( 'geshi/geshi.php' ); > to > require( 'extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php' > ); > This isn't correct, revert it back Do you actually have the geshi folder/svn external? ie in extensions/SyntaxHighlight_GeSHi there should be a folder called geshi
(In reply to comment #1) > (In reply to comment #0) > > Yes, I know 1.13.0 is ancient, but I'm stuck with it for now, I'm afraid! > > > > I installed the appropriate version of the extension into > > extensions/SyntaxHighlight_GeSHi. It loads successfully, but when I tried to > > use it, I got error messages. The first was easily fixed as I changed > > > > require( 'geshi/geshi.php' ); > > to > > require( 'extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php' > > ); > > > > This isn't correct, revert it back > > > Do you actually have the geshi folder/svn external? ie in > extensions/SyntaxHighlight_GeSHi there should be a folder called geshi I'm going to take it as a no... Grabbing r37906.tar.gz">http://upload.wikimedia.org/ext-dist/SyntaxHighlight_GeSHi-MW1.13-r37906.tar.gz from http://www.mediawiki.org/wiki/Special:ExtensionDistributor/SyntaxHighlight_GeSHi See the instructions http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_13/extensions/SyntaxHighlight_GeSHi/README?view=markup ;)
Thanks Sam, I was just about to reply to your first post, but will try the second now. Hang on ... I downloaded that file yesterday: SyntaxHighlight_GeSHi-MW1.13-r37906.tar.gz and installed it, but Version shows: SyntaxHighlight (Version r37495) Provides syntax highlighting <source> using GeSHi Highlighter It looks as if I may have the wrong version: ntm-igdev02:/home/sam.sexton/TGSTWiki/extensions/temp: gtar zxf ../SyntaxHighlight_GeSHi-MW1.13-r37906.tar.gz ntm-igdev02:/home/sam.sexton/TGSTWiki/extensions/temp: cd SyntaxHighlight_GeSHi ntm-igdev02:/home/sam.sexton/TGSTWiki/extensions/temp/SyntaxHighlight_GeSHi: grep 374 * SyntaxHighlight_GeSHi.php: 'svn-revision' => '$LastChangedRevision: 37495 $', ntm-igdev02:/home/sam.sexton/TGSTWiki/extensions/temp/SyntaxHighlight_GeSHi: ntm-igdev02:/home/sam.sexton/TGSTWiki/extensions: sum SyntaxHighlight_GeSHi-MW1.13-r37906.tar.gz 31692 37 SyntaxHighlight_GeSHi-MW1.13-r37906.tar.gz ntm-igdev02:/home/sam.sexton/TGSTWiki/extensions: Could this be the problem?
I don't think you need to worry about it: 'svn-date' => '$LastChangedDate: 2008-07-10 12:45:20 +0000 (Thu, 10 Jul 2008) $', 'svn-revision' => '$LastChangedRevision: 37495 $', http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_13/extensions/SyntaxHighlight_GeSHi/?view=log That file just hasn't been updated in a while, whereas other things in the directory have been, so the version number being picked for the file is different
Hi Sam - I've reviewed the instructions and tried reverting as you suggested, but still get the same error ... [7083](root@ntm-igdev02)/usr/local/apache2/htdocs/wiki: grep Syn LocalSettings.php # 120305 Added SyntaxHighlight_GeSHi. # 120305: added SyntaxHighlight_GeSHi: require_once('extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php'); [7084](root@ntm-igdev02)/usr/local/apache2/htdocs/wiki: cd extensions 10:19 [7085](root@ntm-igdev02)/usr/.../extensions: ls -lR SyntaxHighlight_GeSHi/ SyntaxHighlight_GeSHi/: total 121 -rw-r--r-- 1 daemon wiki 1757 Jul 23 2008 README -rw-r--r-- 1 daemon wiki 8320 Mar 6 10:35 SyntaxHighlight_GeSHi.class.php -rw-r--r-- 1 daemon wiki 44944 Jul 23 2008 SyntaxHighlight_GeSHi.i18n.php -rw-r--r-- 1 daemon wiki 2828 Jul 23 2008 SyntaxHighlight_GeSHi.php [7086](root@ntm-igdev02)/usr/.../extensions: cd SyntaxHighlight_GeSHi/ 10:19 [7087](root@ntm-igdev02)/usr/.../SyntaxHighlight_GeSHi: tail *class* wfLoadExtensionMessages( 'SyntaxHighlight_GeSHi' ); if( !class_exists( 'GeSHi' ) ) require( 'geshi/geshi.php' ); # 120305 Sam Sexton Replaced above with our names and had to add extensions/. # require( 'extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php' ); self::$initialised = true; } return true; } } [7088](root@ntm-igdev02)/usr/.../SyntaxHighlight_GeSHi: I then edited and previewed this page (this is the text copied from the displayed page): User:Sam.Sexton/sample.pl < User:Sam.Sexton <syntaxhighlight lang="-"></syntaxhighlight> <syntaxhighlight lang="perl"> !/bin/perl -w Sample to demonstrate syntax highlighter open IN,"/tmp/infile"; $STUFF = (<IN>); close IN; print "I've stuffed myself"; </syntaxhighlight> and I then get: Warning: SyntaxHighlight_GeSHi::require(geshi/geshi.php) [syntaxhighlight-geshi.require]: failed to open stream: No such file or directory in /usr/local/apache2/htdocs/wiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php on line 269 Fatal error: SyntaxHighlight_GeSHi::require() [function.require]: Failed opening required 'geshi/geshi.php' (include_path='/usr/local/apache2/htdocs/wiki:/usr/local/apache2/htdocs/wiki/includes:/usr/local/apache2/htdocs/wiki/languages:.:/php/includes') in /usr/local/apache2/htdocs/wiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php on line 269 If I then adjust the require in SyntaxHighlight_GeSHi.class.php to match the dir and file names, as in the instructions, I just get: Fatal error: Class 'GeSHi' not found in /usr/local/apache2/htdocs/wiki/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php on line 171 which seems like a step in the right direction to me...? Here's the line referred to in the error: 169 private static function prepare( $text, $lang ) { 170 self::initialise(); 171 $geshi = new GeSHi( $text, $lang ); 172 if( $geshi->error() == GESHI_ERROR_NO_SUCH_LANG ) 173 return null; 174 $geshi->set_encoding( 'UTF-8' ); 175 $geshi->enable_classes(); 176 $geshi->set_overall_class( "source-$lang" ); 177 $geshi->enable_keyword_links( false ); 178 return $geshi; 179 } 180
The comment about changing "require_once( 'geshi/geshi.php' );" is when you've got it in some other location If, per the README, you do "svn checkout http://geshi.svn.sourceforge.net/svnroot/geshi/trunk/geshi-1.0.X/src/ geshi", you will then have the geshi folder at "extensions/SyntaxHighlight_GeSHi/geshi", and you shouldn't need to change anything
Thanks, I've got there at last! I can not access Sourceforge's SVN from my server or my laptop, due to corporate firewall obstruction. So, I installed Tortoise on my personal laptop, checked out as requested, transferred the geshi dir to the server, installed it and it's working, but I really wonder why geshi/* and geshi.php can't be included in the tarball - all the other extensions I've installed have come all-inclusive and it's been a matter of a few minutes to install them. Unfortunately this one was different, but at least I've got it working now.
(In reply to comment #7) > Thanks, I've got there at last! > > I can not access Sourceforge's SVN from my server or my laptop, due to > corporate firewall obstruction. So, I installed Tortoise on my personal laptop, > checked out as requested, transferred the geshi dir to the server, installed it > and it's working, but I really wonder why geshi/* and geshi.php can't be > included in the tarball - all the other extensions I've installed have come > all-inclusive and it's been a matter of a few minutes to install them. > Unfortunately this one was different, but at least I've got it working now. It is for newer versions. It was added as a svn external in some later revision (note, 1.13 dates back to July 2008!). Same for numerous other extensions with large external dependencies.