r106982 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106981‎ | r106982 | r106983 >
Date:21:29, 21 December 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
* FU r106752: unbreak urls to ForeignAPIRepo file thumbnails. FileRepo no longer uses bogus <public root URL>/thumb default for the thumnail URL when the public root URL wasn't even set. This was making ForeignAPIRepo not set it since it saw that it was already set.
* Cleaned up and added some missing sanity checks for scriptDirUrl member in FileRepo. Made some related documentation tweaks.
* Removed pointless getRepo() call in File.
Modified paths:
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/file/File.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/file/File.php
@@ -1293,8 +1293,7 @@
12941294 * @return bool
12951295 */
12961296 function isLocal() {
1297 - $repo = $this->getRepo();
1298 - return $repo && $repo->isLocal();
 1297+ return $this->repo && $this->repo->isLocal();
12991298 }
13001299
13011300 /**
Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -42,9 +42,6 @@
4343 function __construct( $info ) {
4444 // Required settings
4545 $this->name = $info['name'];
46 - $this->url = isset( $info['url'] )
47 - ? $info['url']
48 - : false; // a subclass will need to set the URL (e.g. ForeignAPIRepo)
4946 if ( $info['backend'] instanceof FileBackendBase ) {
5047 $this->backend = $info['backend']; // useful for testing
5148 } else {
@@ -67,9 +64,14 @@
6865 $this->initialCapital = isset( $info['initialCapital'] )
6966 ? $info['initialCapital']
7067 : MWNamespace::isCapitalized( NS_FILE );
71 - $this->thumbUrl = isset( $info['thumbUrl'] )
72 - ? $info['thumbUrl']
73 - : "{$this->url}/thumb";
 68+ $this->url = isset( $info['url'] )
 69+ ? $info['url']
 70+ : false; // a subclass may set the URL (e.g. ForeignAPIRepo)
 71+ if ( isset( $info['thumbUrl'] ) ) {
 72+ $this->thumbUrl = $info['thumbUrl'];
 73+ } else {
 74+ $this->thumbUrl = $this->url ? "{$this->url}/thumb" : false;
 75+ }
7476 $this->hashLevels = isset( $info['hashLevels'] )
7577 ? $info['hashLevels']
7678 : 2;
@@ -414,7 +416,7 @@
415417 /**
416418 * Get the public root URL of the repository
417419 *
418 - * @return string
 420+ * @return string|false
419421 */
420422 public function getRootUrl() {
421423 return $this->url;
@@ -526,11 +528,14 @@
527529 *
528530 * @param $query mixed Query string to append
529531 * @param $entry string Entry point; defaults to index
530 - * @return string
 532+ * @return string|false
531533 */
532534 public function makeUrl( $query = '', $entry = 'index' ) {
533 - $ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php';
534 - return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
 535+ if ( isset( $this->scriptDirUrl ) ) {
 536+ $ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php';
 537+ return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
 538+ }
 539+ return false;
535540 }
536541
537542 /**
@@ -603,13 +608,14 @@
604609 /**
605610 * Get the URL of the stylesheet to apply to description pages
606611 *
607 - * @return string
 612+ * @return string|false
608613 */
609614 public function getDescriptionStylesheetUrl() {
610 - if ( $this->scriptDirUrl ) {
 615+ if ( isset( $this->scriptDirUrl ) ) {
611616 return $this->makeUrl( 'title=MediaWiki:Filepage.css&' .
612617 wfArrayToCGI( Skin::getDynamicStylesheetQuery() ) );
613618 }
 619+ return false;
614620 }
615621
616622 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106752Merged FileBackend branch. Manually avoiding merging the many prop-only chang...aaron03:52, 20 December 2011

Comments

#Comment by 😂 (talk | contribs)   21:36, 21 December 2011

Every time I see FU I keep thinking how wonderful pre-commit review is going to be.

#Comment by Aaron Schulz (talk | contribs)   21:56, 21 December 2011

Not sure it would help much for cases like this. It was in a branch for a good while, nobody wanted to look at it though. At least with patchsets, the unified diff is more accessible I suppose, so maybe people will look more.

#Comment by Catrope (talk | contribs)   22:00, 21 December 2011

I think he's talking about the ability to flat-out refuse, or amend, commit summaries containing "FU" ;)

#Comment by Aaron Schulz (talk | contribs)   22:04, 21 December 2011

We know it means "follow-up", I don't see the big fuss. We aren't giddy little schoolkids anymore...

That said, when I made LSLockManager, I was original going to call it LSDLockManager...

#Comment by 😂 (talk | contribs)   22:06, 21 December 2011

"Follow-up" is the second meaning that comes to mind every time I see "FU"

#Comment by Tim Starling (talk | contribs)   11:35, 22 December 2011

Is that why people keep tagging them lamecommitsummary? Because everyone assumes Aaron is telling a revision to f*** itself?

#Comment by P858snake (talk | contribs)   11:43, 22 December 2011

Yes, well mainly the part about "FU" being lame and un-descriptive in a way, Can't contest to the latter part of that question.

Status & tagging log