r77309 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77308‎ | r77309 | r77310 >
Date:23:12, 25 November 2010
Author:vasilievvv
Status:ok (Comments)
Tags:
Comment:
* Show "skin does not exist error" only when the skin is inputted in the wrong case. This seems to be the original intention. Otherwise it renders the warning on the completely legitimate subpages with user scripts.
* Deprecate isValidUserCssJSSubpage() as having a very confusing title. User scripts *are* valid user JS subpages.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -274,6 +274,24 @@
275275 return $this->deletedSinceEdit;
276276 }
277277
 278+ /**
 279+ * Checks whether the user entered a skin name in uppercase,
 280+ * e.g. "User:Example/Monobook.css" instead of "monobook.css"
 281+ */
 282+ protected function isWrongCaseCssJsPage() {
 283+ if( $this->mTitle->isCssJsSubpage() ) {
 284+ $name = $this->mTitle->getSkinFromCssJsSubpage();
 285+ $skins = array_merge(
 286+ array_keys( Skin::getSkinNames() ),
 287+ array( 'common' )
 288+ );
 289+ return !in_array( $name, $skins )
 290+ && in_array( strtolower( $name ), $skins );
 291+ } else {
 292+ return false;
 293+ }
 294+ }
 295+
278296 function submit() {
279297 $this->edit();
280298 }
@@ -360,7 +378,7 @@
361379 $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
362380 $this->isCssSubpage = $this->mTitle->isCssSubpage();
363381 $this->isJsSubpage = $this->mTitle->isJsSubpage();
364 - $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
 382+ $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage();
365383
366384 # Show applicable editing introductions
367385 if ( $this->formtype == 'initial' || $this->firsttime )
@@ -1407,7 +1425,7 @@
14081426 } else {
14091427 if ( $this->isCssJsSubpage ) {
14101428 # Check the skin exists
1411 - if ( !$this->isValidCssJsSubpage ) {
 1429+ if ( $this->isWrongCaseCssJsPage ) {
14121430 $wgOut->wrapWikiMsg( "<div class='error' id='mw-userinvalidcssjstitle'>\n$1\n</div>", array( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ) );
14131431 }
14141432 if ( $this->formtype !== 'preview' ) {
Index: trunk/phase3/includes/Title.php
@@ -1898,21 +1898,12 @@
18991899
19001900 /**
19011901 * Is this a *valid* .css or .js subpage of a user page?
1902 - * Check that the corresponding skin exists
19031902 *
19041903 * @return \type{\bool}
 1904+ * @deprecated
19051905 */
19061906 public function isValidCssJsSubpage() {
1907 - if ( $this->isCssJsSubpage() ) {
1908 - $name = $this->getSkinFromCssJsSubpage();
1909 - if ( $name == 'common' ) {
1910 - return true;
1911 - }
1912 - $skinNames = Skin::getSkinNames();
1913 - return array_key_exists( $name, $skinNames );
1914 - } else {
1915 - return false;
1916 - }
 1907+ return $this->isCssJsSubpage();
19171908 }
19181909
19191910 /**
Index: trunk/phase3/RELEASE-NOTES
@@ -438,6 +438,8 @@
439439 * Fixed PHP warnings when updating a broken MySQL database.
440440 * (bug 26023) Corrected deleteBacth.php's documentation
441441 * (bug 25451) Improved datetime representation in 32 bit php >= 5.2.
 442+* Show "skin does not exist error" only when the skin is inputted in the wrong
 443+ case.
442444
443445 === API changes in 1.17 ===
444446 * (bug 22738) Allow filtering by action type on query=logevent.

Follow-up revisions

RevisionCommit summaryAuthorDate
r77356Fix r77309 per CR: use appropriate function in ResourceLoaderWikiModule to ch...vasilievvv14:55, 27 November 2010

Comments

#Comment by Nikerabbit (talk | contribs)   07:42, 26 November 2010

ResourceLoader still uses isValidCssJsSubpage().

#Comment by VasilievVV (talk | contribs)   15:00, 27 November 2010

Fixed in r77356.

Status & tagging log