From f571b7e068300906fc91f571214fe9938e179f9a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 19 Nov 2004 07:37:46 +0000 Subject: [PATCH] * remove PHP5 warning; PHPTAL no longer needed for MonoBook * set $wgUsePHPTal to false; not sure if it's really needed anymore. Disabled TAL version of MonoBook * re-enabled display of PEAR errors from PHPTal skins (if they get used) --- config/index.php | 10 +--------- includes/DefaultSettings.php | 14 +++++++++----- includes/Skin.php | 21 --------------------- includes/SkinPHPTal.php | 15 +++++++++++++++ includes/SkinTemplate.php | 17 ++++++++++++----- skins/{ => disabled}/MonoBook.pt | 0 skins/{ => disabled}/MonoBookTal.php | 9 ++++++++- 7 files changed, 45 insertions(+), 41 deletions(-) rename skins/{ => disabled}/MonoBook.pt (100%) rename skins/{ => disabled}/MonoBookTal.php (63%) diff --git a/config/index.php b/config/index.php index fe0ad95f2e..9a446b83f6 100644 --- a/config/index.php +++ b/config/index.php @@ -190,15 +190,7 @@ $conf = new ConfigData; install_version_checks(); -print "
  • PHP " . phpversion() . ": "; -if( version_compare( phpversion(), "5.0", "lt" ) ) { - print "ok"; -} else { - print " the MonoBook skin will be disabled due to an incompatibility - between the PHPTAL template library and PHP 5. The wiki should - function normally, but with the older look and feel."; -} -print "
  • \n"; +print "
  • PHP " . phpversion() . ": ok
  • \n"; if( ini_get( "register_globals" ) ) { ?> diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 58b6a25f8d..11c9cea97e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -608,12 +608,16 @@ $wgSVGConverters = array( $wgSVGConverter = 'ImageMagick'; # Pick one of the above $wgSVGConverterPath = ''; # If not in the executable PATH, specify -# PHPTal is a library for page templates. MediaWiki includes -# a recent PHPTal distribution. It is required to use the -# Monobook (default) skin. +# PHPTAL is a library for page templates. This is optional; +# MediaWiki's internal skins no longer use it but you might +# create your own custom skin using it. # -# Currently it does not work on PHP5. -$wgUsePHPTal = version_compare( phpversion(), "5.0", "lt" ); +# Use PHPTAL 0.7.0 for PHP 4.x or PHPTAL 1.0.0 for PHP 5.0. +# http://phptal.sourceforge.net/ +# +# Leave it off to avoid trying to load the template library +# if you're not going to be using any such skins. +$wgUsePHPTal = false; if( !isset( $wgCommandLineMode ) ) { $wgCommandLineMode = false; diff --git a/includes/Skin.php b/includes/Skin.php index 9bb6a52001..406e83cb3c 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -14,27 +14,6 @@ if( defined( "MEDIAWIKI" ) ) { # See skin.doc require_once( 'Image.php' ); -# These are the INTERNAL names, which get mapped directly to class names and -# file names in ./skins/. For display purposes, the Language class has -# internationalized names -# -/* -$wgValidSkinNames = array( - 'standard' => 'Standard', - 'nostalgia' => 'Nostalgia', - 'cologneblue' => 'CologneBlue' -); -if( $wgUsePHPTal ) { - #$wgValidSkinNames[] = 'PHPTal'; - #$wgValidSkinNames['davinci'] = 'DaVinci'; - #$wgValidSkinNames['mono'] = 'Mono'; - #$wgValidSkinNames['monobookminimal'] = 'MonoBookMinimal'; - $wgValidSkinNames['monobook'] = 'MonoBook'; - $wgValidSkinNames['myskin'] = 'MySkin'; - $wgValidSkinNames['chick'] = 'Chick'; -} -*/ - # Get a list of all skins available in /skins/ # Build using the regular expression '^(.*).php$' # Array keys are all lower case, array value keep the case used by filename diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index 944612ef0e..082e52fc00 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -77,6 +77,21 @@ class SkinPHPTal extends SkinTemplate { return new PHPTAL( $file . '.pt', $repository, $cache_dir ); } } + + /** + * Output the string, or print error message if it's + * an error object of the appropriate type. + * + * @param mixed $str + * @access private + */ + function printOrError( &$str ) { + if( PEAR::isError( $str ) ) { + echo $str->toString(), "\n"; + } else { + echo $str; + } + } } class PHPTAL_version_bridge { diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index ae5c304c65..855ac93225 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -317,13 +317,20 @@ class SkinTemplate extends Skin { $res = $tpl->execute(); // result may be an error - #if (PEAR::isError($res)) { - # echo $res->toString(), "\n"; - #} else { - echo $res; - #} + $this->printOrError( $res ); } + + /** + * Output the string, or print error message if it's + * an error object of the appropriate type. + * + * @param mixed $str + * @access private + */ + function printOrError( &$str ) { + echo $str; + } /** * build array of urls for personal toolbar diff --git a/skins/MonoBook.pt b/skins/disabled/MonoBook.pt similarity index 100% rename from skins/MonoBook.pt rename to skins/disabled/MonoBook.pt diff --git a/skins/MonoBookTal.php b/skins/disabled/MonoBookTal.php similarity index 63% rename from skins/MonoBookTal.php rename to skins/disabled/MonoBookTal.php index 7fe1eace20..d565122a84 100644 --- a/skins/MonoBookTal.php +++ b/skins/disabled/MonoBookTal.php @@ -1,6 +1,13 @@