r14665 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14664‎ | r14665 | r14666 >
Date:15:12, 8 June 2006
Author:midom
Status:old
Tags:
Comment:
revert back to 14660
Modified paths:
  • /trunk/phase3/includes/HistoryBlob.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -56,9 +56,14 @@
5757 require_once( 'Hooks.php' );
5858 require_once( 'Namespace.php' );
5959 require_once( 'User.php' );
 60+require_once( 'Skin.php' );
 61+require_once( 'OutputPage.php' );
6062 require_once( 'MagicWord.php' );
 63+require_once( 'Block.php' );
 64+require_once( 'MessageCache.php' );
6165 require_once( 'Parser.php' );
6266 require_once( 'LoadBalancer.php' );
 67+require_once( 'HistoryBlob.php' );
6368 require_once( 'ProxyTools.php' );
6469 require_once( 'ObjectCache.php' );
6570 require_once( 'SpecialPage.php' );
Index: trunk/phase3/includes/Title.php
@@ -1163,7 +1163,8 @@
11641164 * Check that the corresponding skin exists
11651165 */
11661166 function isValidCssJsSubpage() {
1167 - return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), Skin::getSkinNames() ) );
 1167+ global $wgValidSkinNames;
 1168+ return( $this->isCssJsSubpage() && array_key_exists( $this->getSkinFromCssJsSubpage(), $wgValidSkinNames ) );
11681169 }
11691170 /**
11701171 * Trim down a .css or .js subpage title to get the corresponding skin name
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -444,7 +444,7 @@
445445 * @access private
446446 */
447447 function mainPrefsForm( $status , $message = '' ) {
448 - global $wgUser, $wgOut, $wgLang, $wgContLang;
 448+ global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
449449 global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
450450 global $wgDisableLangConversion;
451451 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
@@ -721,9 +721,9 @@
722722 $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
723723 $mptitle = Title::newMainPage();
724724 $previewtext = wfMsg('skinpreview');
725 - # Only show members of Skin::getSkinNames() rather than
 725+ # Only show members of $wgValidSkinNames rather than
726726 # $skinNames (skins is all skin names from Language.php)
727 - foreach (Skin::getSkinNames() as $skinkey => $skinname ) {
 727+ foreach ($wgValidSkinNames as $skinkey => $skinname ) {
728728 if ( in_array( $skinkey, $wgSkipSkins ) ) {
729729 continue;
730730 }
Index: trunk/phase3/includes/Skin.php
@@ -9,8 +9,27 @@
1010 */
1111
1212 # See skin.txt
 13+require_once( 'Linker.php' );
1314 require_once( 'Image.php' );
1415
 16+# Get a list of available skins
 17+# Build using the regular expression '^(.*).php$'
 18+# Array keys are all lower case, array value keep the case used by filename
 19+#
 20+
 21+$skinDir = dir( $wgStyleDirectory );
 22+
 23+# while code from www.php.net
 24+while (false !== ($file = $skinDir->read())) {
 25+ // Skip non-PHP files, hidden files, and '.dep' includes
 26+ if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
 27+ $aSkin = $matches[1];
 28+ $wgValidSkinNames[strtolower($aSkin)] = $aSkin;
 29+ }
 30+}
 31+$skinDir->close();
 32+unset($matches);
 33+
1534 /**
1635 * The main skin class that provide methods and properties for all other skins.
1736 * This base class is also the "Standard" skin.
@@ -25,8 +44,6 @@
2645 var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
2746 var $rcMoveIndex;
2847 /**#@-*/
29 -
30 - private static $validSkinNames;
3148
3249 /** Constructor, call parent constructor */
3350 function Skin() { parent::Linker(); }
@@ -37,33 +54,10 @@
3855 * @static
3956 */
4057 function getSkinNames() {
41 - if (!is_array(Skin::$validSkinNames)) {
42 - Skin::initializeSkinNames();
43 - }
44 - return Skin::$validSkinNames;
 58+ global $wgValidSkinNames;
 59+ return $wgValidSkinNames;
4560 }
4661
47 -
48 - /** Initialize a list of available skins
49 - * Build using the regular expression '^(.*).php$'
50 - * Array keys are all lower case, array value keep the case used by filename
51 - */
52 -
53 - function initializeSkinNames() {
54 - global $wgStyleDirectory;
55 - $skinDir = dir( $wgStyleDirectory );
56 -
57 - # while code from www.php.net
58 - while (false !== ($file = $skinDir->read())) {
59 - // Skip non-PHP files, hidden files, and '.dep' includes
60 - if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
61 - $aSkin = $matches[1];
62 - Skin::$validSkinNames[strtolower($aSkin)] = $aSkin;
63 - }
64 - }
65 - $skinDir->close();
66 - }
67 -
6862 /**
6963 * Normalize a skin preference value to a form that can be loaded.
7064 * If a skin can't be found, it will fall back to the configured
Index: trunk/phase3/includes/HistoryBlob.php
@@ -174,14 +174,15 @@
175175 * the same blob. By keeping the last-used one open, we avoid
176176 * redundant unserialization and decompression overhead.
177177 */
 178+global $wgBlobCache;
 179+$wgBlobCache = array();
178180
 181+
179182 /**
180183 * @package MediaWiki
181184 */
182185 class HistoryBlobStub {
183186 var $mOldId, $mHash, $mRef;
184 -
185 - static private $blobCache = array();
186187
187188 /** @todo document */
188189 function HistoryBlobStub( $hash = '', $oldid = 0 ) {
@@ -213,8 +214,9 @@
214215 /** @todo document */
215216 function getText() {
216217 $fname = 'HistoryBlob::getText';
217 - if( isset( HistoryBlobStub::$blobCache[$this->mOldId] ) ) {
218 - $obj = HistoryBlobStub::$blobCache[$this->mOldId];
 218+ global $wgBlobCache;
 219+ if( isset( $wgBlobCache[$this->mOldId] ) ) {
 220+ $obj = $wgBlobCache[$this->mOldId];
219221 } else {
220222 $dbr =& wfGetDB( DB_SLAVE );
221223 $row = $dbr->selectRow( 'text', array( 'old_flags', 'old_text' ), array( 'old_id' => $this->mOldId ) );
@@ -253,7 +255,7 @@
254256 // Save this item for reference; if pulling many
255257 // items in a row we'll likely use it again.
256258 $obj->uncompress();
257 - HistoryBlobStub::$blobCache = array( $this->mOldId => $obj );
 259+ $wgBlobCache = array( $this->mOldId => $obj );
258260 }
259261 return $obj->getItem( $this->mHash );
260262 }

Status & tagging log