From 644f8a0acc834e552dd5b9b14dac485f33b2f8ba Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 18 Feb 2006 04:34:10 +0000 Subject: [PATCH] * Remove legacy PHPTal code, hasn't been maintained in ages. * Tweak UserLogin include order for APC issue --- RELEASE-NOTES | 2 + includes/Skin.php | 10 +- includes/SkinPHPTal.php | 150 ---------------------------- includes/SkinTemplate.php | 9 +- includes/SpecialUserlogin.php | 1 + skins/disabled/Amethyst.php | 33 ------- skins/disabled/Amethyst.pt | 151 ---------------------------- skins/disabled/Chick.php | 34 ------- skins/disabled/Chick.pt | 100 ------------------- skins/disabled/MonoBook.pt | 142 -------------------------- skins/disabled/MonoBookTal.php | 44 --------- skins/disabled/WikimediaWiki.php | 94 ------------------ skins/disabled/WikimediaWiki.pt | 165 ------------------------------- 13 files changed, 8 insertions(+), 927 deletions(-) delete mode 100644 includes/SkinPHPTal.php delete mode 100644 skins/disabled/Amethyst.php delete mode 100644 skins/disabled/Amethyst.pt delete mode 100644 skins/disabled/Chick.php delete mode 100644 skins/disabled/Chick.pt delete mode 100644 skins/disabled/MonoBook.pt delete mode 100644 skins/disabled/MonoBookTal.php delete mode 100644 skins/disabled/WikimediaWiki.php delete mode 100644 skins/disabled/WikimediaWiki.pt diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 277665f8fa..6f1f4544e1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -628,6 +628,8 @@ fully support the editing toolbar, but was found to be too confusing. * Fix missing bad title check in Special:Booksources * Remove empty booksources string in fy * Avoid corrupting inside +* Remove legacy PHPTal code, hasn't been maintained in ages. +* Tweak Userlogin include order for APC issue === Caveats === diff --git a/includes/Skin.php b/includes/Skin.php index b2e56dfa61..c0b7ba1d46 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -31,8 +31,7 @@ $skinDir->close(); unset($matches); /** - * The main skin class that provide methods and properties for all other skins - * including PHPTal skins. + * The main skin class that provide methods and properties for all other skins. * This base class is also the "Standard" skin. * @package MediaWiki */ @@ -114,8 +113,7 @@ class Skin extends Linker { global $IP; - # Grab the skin class and initialise it. Each skin checks for PHPTal - # and will not load if it's not enabled. + # Grab the skin class and initialise it. wfSuppressWarnings(); // Preload base classes to work around APC/PHP5 bug include_once( $IP.'/skins/'.$skinName.'.deps.php' ); @@ -275,7 +273,7 @@ class Skin extends Linker { $wgRequest->getVal( 'wpEditToken' ) ); } - # get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way) + # get the user/site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way) function getUserStylesheet() { global $wgOut, $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage; $sheet = $this->getStylesheet(); @@ -1328,7 +1326,7 @@ END; wfMsg( 'postcomment' ), 'action=edit§ion=new' ); } - /* these are used extensively in SkinPHPTal, but also some other places */ + /* these are used extensively in SkinTemplate, but also some other places */ /*static*/ function makeSpecialUrl( $name, $urlaction='' ) { $title = Title::makeTitle( NS_SPECIAL, $name ); return $title->getLocalURL( $urlaction ); diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php deleted file mode 100644 index 286733ee9e..0000000000 --- a/includes/SkinPHPTal.php +++ /dev/null @@ -1,150 +0,0 @@ -skinname = 'monobook'; - $this->stylename = 'monobook'; - $this->template = 'MonoBook'; - } - - /** - * If using PHPTAL 0.7 on PHP 4.x, return a PHPTAL template object. - * If using PHPTAL 1.0 on PHP 5.x, return a bridge object. - * @return object - * @access private - */ - function &setupTemplate( $file, $repository=false, $cache_dir=false ) { - if( defined( 'NEW_PHPTAL' ) ) { - return new PHPTAL_version_bridge( $file . '.pt', $repository, $cache_dir ); - } else { - 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; - } - } -} - -/** - * @todo document - * @package MediaWiki - * @subpackage Skins - */ -class PHPTAL_version_bridge { - function PHPTAL_version_bridge( $file, $repository=false, $cache_dir=false ) { - $this->tpl =& new PHPTAL( $file ); - if( $repository ) { - $this->tpl->setTemplateRepository( $repository ); - } - } - - function set( $name, $value ) { - $this->tpl->$name = $value; - } - - function setRef($name, &$value) { - $this->set( $name, $value ); - } - - function setTranslator( &$t ) { - $this->tpl->setTranslator( $t ); - } - - function execute() { - /* - try { - */ - return $this->tpl->execute(); - /* - } - catch (Exception $e) { - echo "
We caught an exception...\n "; - echo $e; - echo "
"; - } - */ - } -} - -} // end of if( class_exists( 'PHPTAL' ) ) -} // end of if( class_exists( 'PEAR' ) ) -?> diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 604425161d..04c4882bfe 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -27,10 +27,6 @@ if ( ! defined( 'MEDIAWIKI' ) ) * to the computations individual esi snippets need. Most importantly no body * parsing for most of those of course. * - * PHPTAL support has been moved to a subclass in SkinPHPTal.php, - * and is optional. You'll need to install PHPTAL manually to use - * skins that depend on it. - * * @package MediaWiki * @subpackage Skins */ @@ -96,9 +92,6 @@ class SkinTemplate extends Skin { /** * For QuickTemplate, the name of the subclass which * will actually fill the template. - * - * In PHPTal mode, name of PHPTal template to be used. - * '.pt' will be automaticly added to it on PHPTAL object creation */ var $template; @@ -327,7 +320,7 @@ class SkinTemplate extends Skin { $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace() ; - $res = $dbr->query( $sql, 'SkinPHPTal::outputPage'); + $res = $dbr->query( $sql, 'SkinTemplate::outputPage'); $x = $dbr->fetchObject( $res ); $numberofwatchingusers = $x->n; if ($numberofwatchingusers > 0) { diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 591fd32d26..a9b4d5cd1a 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -459,6 +459,7 @@ class LoginForm { $titleObj = Title::makeTitle( NS_SPECIAL, 'Userlogin' ); + require_once( 'SkinTemplate.php' ); require_once( 'templates/Userlogin.php' ); if ( $this->mType == 'signup' ) { diff --git a/skins/disabled/Amethyst.php b/skins/disabled/Amethyst.php deleted file mode 100644 index c97d679839..0000000000 --- a/skins/disabled/Amethyst.php +++ /dev/null @@ -1,33 +0,0 @@ -skinname = 'amethyst'; - $this->stylename = 'amethyst'; - $this->template = 'MonobookTemplate'; - } -} - -?> diff --git a/skins/disabled/Amethyst.pt b/skins/disabled/Amethyst.pt deleted file mode 100644 index 58f90f20c2..0000000000 --- a/skins/disabled/Amethyst.pt +++ /dev/null @@ -1,151 +0,0 @@ - - - - - ${headlinks} - Exciting xhtml slimfast - - - - - - - - - -
-
-
- -
-

Leonardo da Vinci

-
-

From Wikipedia, the free encyclopedia.

-
-
-
- - ${bodytext} - - -
-
-
-
-
-
-
Views
- -
-
-
Personal Tools
-
- -
-
- - - - - -
-
Language
-
- -
-
-
-
- -
- ${reporttime} - - diff --git a/skins/disabled/Chick.php b/skins/disabled/Chick.php deleted file mode 100644 index 8f3a42ee06..0000000000 --- a/skins/disabled/Chick.php +++ /dev/null @@ -1,34 +0,0 @@ -skinname = 'chick'; - $this->template = 'Chick'; - } - function printSource() { return ''; } -} - -} -?> diff --git a/skins/disabled/Chick.pt b/skins/disabled/Chick.pt deleted file mode 100644 index a1ce3359f4..0000000000 --- a/skins/disabled/Chick.pt +++ /dev/null @@ -1,100 +0,0 @@ - - - - -
- Exciting xhtml slimfast - - - - - - - - - -
-

Leonardo da Vinci

-
From Wikipedia, the free encyclopedia.
-
-
-
- - -
- -
- -
- Views: - Linktext -
- -
- Personal Tools: - Log in -
- - - - - -
- Other languages: - English -
- -
- - -
- - diff --git a/skins/disabled/MonoBook.pt b/skins/disabled/MonoBook.pt deleted file mode 100644 index 062fece424..0000000000 --- a/skins/disabled/MonoBook.pt +++ /dev/null @@ -1,142 +0,0 @@ - - - - -
- Exciting xhtml slimfast - - - - - - - - - - - - -
-
-
- -
-

Leonardo da Vinci

-
-

From Wikipedia, the free encyclopedia.

-
-
-
- -
- - -
-
-
-
-
-
-
Views
- -
-
-
Personal Tools
-
- -
-
- - -
-
Navigation
-
- -
-
- - -
-
Language
-
- -
-
-
-
- -
-
- - diff --git a/skins/disabled/MonoBookTal.php b/skins/disabled/MonoBookTal.php deleted file mode 100644 index 8a666c6119..0000000000 --- a/skins/disabled/MonoBookTal.php +++ /dev/null @@ -1,44 +0,0 @@ -skinname = 'monobooktal'; - $this->stylename = 'monobook'; - $this->template = 'MonoBook'; - } - } - -} -?> diff --git a/skins/disabled/WikimediaWiki.php b/skins/disabled/WikimediaWiki.php deleted file mode 100644 index 96ae1fac43..0000000000 --- a/skins/disabled/WikimediaWiki.php +++ /dev/null @@ -1,94 +0,0 @@ -skinname = 'wikimediawiki'; - $this->stylename = 'monobook'; - $this->template = 'WikimediaWiki'; - } - - # build array of common navigation links - function buildNavUrls () { - global $wgTitle, $wgUser, $wgRequest; - global $wgSiteSupportPage; - - $action = $wgRequest->getText( 'action' ); - $oldid = $wgRequest->getVal( 'oldid' ); - $diff = $wgRequest->getVal( 'diff' ); - // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes - $nav_urls = array(); - $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage'))); - $nav_urls['randompage'] = (wfMsgForContent('randompage') != '-') ? array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage'))) : false; - $nav_urls['recentchanges'] = (wfMsgForContent('recentchanges') != '-') ? array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges'))) : false; - $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.urlencode( $this->thispage )))); - $nav_urls['currentevents'] = (wfMsgForContent('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false; - $nav_urls['portal'] = (wfMsgForContent('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false; - $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.urlencode( $this->thispage )))); - $nav_urls['bugreports'] = (wfMsgForContent('bugreports') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage'))) : false; - $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage)); - $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage'))); - $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload'))); - $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages'))); - - - # Specific for mediawiki.org menu - $nav_urls['aboutmediawiki'] = (wfMsgForContent('aboutmediawiki') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('aboutmediawiki-url'))) : false; - $nav_urls['projects'] = (wfMsgForContent('projects') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('projects-url'))) : false; - $nav_urls['membership'] = (wfMsgForContent('membership') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('membership-url'))) : false; - $nav_urls['pressroom'] = (wfMsgForContent('pressroom') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('pressroom-url'))) : false; - $nav_urls['software'] = (wfMsgForContent('software') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('software-url'))) : false; - $nav_urls['localchapters'] = (wfMsgForContent('localchapters') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('localchapters-url'))) : false; - $nav_urls['contactus'] = (wfMsgForContent('contactus') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('contactus-url'))) : false; - - if( $wgTitle->getNamespace() == NS_USER || $wgTitle->getNamespace() == NS_USER_TALK ) { - $id = User::idFromName($wgTitle->getText()); - $ip = User::isIP($wgTitle->getText()); - } else { - $id = 0; - $ip = false; - } - - if ( 0 != $wgUser->getID() ) { # show only to signed in users - if($id) { - # can only email non-anons - $nav_urls['emailuser'] = array( - 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) ) - ); - # only non-anons have contrib list - $nav_urls['contributions'] = array( - 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) ) - ); - } - } - - - return $nav_urls; - } -} - -} -?> diff --git a/skins/disabled/WikimediaWiki.pt b/skins/disabled/WikimediaWiki.pt deleted file mode 100644 index dc1d3fa33c..0000000000 --- a/skins/disabled/WikimediaWiki.pt +++ /dev/null @@ -1,165 +0,0 @@ - - - - - ${headlinks} - Exciting xhtml slimfast - - - - - - - - - -
-
-
- -
-

Leonardo da Vinci

-
-

From Wikipedia, the free encyclopedia.

-
-
-
- - ${bodytext} - - -
-
-
-
-
-
-
Views
- -
-
-
Personal Tools
-
- -
-
- - - - - -
-
Language
-
- -
-
-
-
- -
- ${reporttime} - - -- 2.20.1