Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1518,11 +1518,9 @@ |
1519 | 1519 | 'nolinkshere-ns', |
1520 | 1520 | 'isredirect', |
1521 | 1521 | 'istemplate', |
1522 | | - 'isimage', |
1523 | 1522 | 'whatlinkshere-prev', |
1524 | 1523 | 'whatlinkshere-next', |
1525 | 1524 | 'whatlinkshere-links', |
1526 | | - 'whatlinkshere-hideimages', |
1527 | 1525 | 'whatlinkshere-hideredirs', |
1528 | 1526 | 'whatlinkshere-hidetrans', |
1529 | 1527 | 'whatlinkshere-hidelinks', |
Index: trunk/phase3/includes/SpecialWhatlinkshere.php |
— | — | @@ -51,7 +51,6 @@ |
52 | 52 | $opts->add( 'hideredirs', false ); |
53 | 53 | $opts->add( 'hidetrans', false ); |
54 | 54 | $opts->add( 'hidelinks', false ); |
55 | | - $opts->add( 'hideimages', false ); |
56 | 55 | |
57 | 56 | $opts->fetchValuesFromRequest( $this->request ); |
58 | 57 | $opts->validateIntBounds( 'limit', 0, 5000 ); |
— | — | @@ -95,7 +94,6 @@ |
96 | 95 | $hidelinks = $this->opts->getValue( 'hidelinks' ); |
97 | 96 | $hideredirs = $this->opts->getValue( 'hideredirs' ); |
98 | 97 | $hidetrans = $this->opts->getValue( 'hidetrans' ); |
99 | | - $hideimages = $target->getNamespace() != NS_IMAGE || $this->opts->getValue( 'hideimages' ); |
100 | 98 | |
101 | 99 | $fetchlinks = !$hidelinks || !$hideredirs; |
102 | 100 | |
— | — | @@ -117,10 +115,6 @@ |
118 | 116 | 'tl_title' => $target->getDBkey(), |
119 | 117 | ); |
120 | 118 | |
121 | | - $ilConds = array( |
122 | | - 'page_id=il_from', |
123 | | - 'il_to' => $target->getDBkey(), |
124 | | - ); |
125 | 119 | |
126 | 120 | $namespace = $this->opts->getValue( 'namespace' ); |
127 | 121 | if ( is_int($namespace) ){ |
— | — | @@ -155,19 +149,13 @@ |
156 | 150 | $tlConds, __METHOD__, $options ); |
157 | 151 | } |
158 | 152 | |
159 | | - if( !$hideimages ) { |
160 | | - $options['ORDER BY'] = 'il_from'; |
161 | | - $ilRes = $dbr->select( array( 'imagelinks', 'page' ), $fields, |
162 | | - $ilConds, __METHOD__, $options ); |
163 | | - } |
164 | | - |
165 | | - if( ( !$fetchlinks || !$dbr->numRows( $plRes ) ) && ( $hidetrans || !$dbr->numRows( $tlRes ) ) && ( $hideimages || !$dbr->numRows( $ilRes ) ) ) { |
| 153 | + if( ( !$fetchlinks || !$dbr->numRows( $plRes ) ) && ( $hidetrans || !$dbr->numRows( $tlRes ) ) ) { |
166 | 154 | if ( 0 == $level ) { |
167 | 155 | $wgOut->addHTML( $this->whatlinkshereForm() ); |
168 | 156 | $errMsg = is_int($namespace) ? 'nolinkshere-ns' : 'nolinkshere'; |
169 | 157 | $wgOut->addWikiMsg( $errMsg, $this->target->getPrefixedText() ); |
170 | 158 | // Show filters only if there are links |
171 | | - if( $hidelinks || $hidetrans || $hideredirs || $hideimages ) |
| 159 | + if( $hidelinks || $hidetrans || $hideredirs ) |
172 | 160 | $wgOut->addHTML( $this->getFilterPanel() ); |
173 | 161 | } |
174 | 162 | return; |
— | — | @@ -179,7 +167,6 @@ |
180 | 168 | if( $fetchlinks ) { |
181 | 169 | while ( $row = $dbr->fetchObject( $plRes ) ) { |
182 | 170 | $row->is_template = 0; |
183 | | - $row->is_image = 0; |
184 | 171 | $rows[$row->page_id] = $row; |
185 | 172 | } |
186 | 173 | $dbr->freeResult( $plRes ); |
— | — | @@ -188,19 +175,10 @@ |
189 | 176 | if( !$hidetrans ) { |
190 | 177 | while ( $row = $dbr->fetchObject( $tlRes ) ) { |
191 | 178 | $row->is_template = 1; |
192 | | - $row->is_image = 0; |
193 | 179 | $rows[$row->page_id] = $row; |
194 | 180 | } |
195 | 181 | $dbr->freeResult( $tlRes ); |
196 | 182 | } |
197 | | - if( !$hideimages ) { |
198 | | - while ( $row = $dbr->fetchObject( $ilRes ) ) { |
199 | | - $row->is_template = 0; |
200 | | - $row->is_image = 1; |
201 | | - $rows[$row->page_id] = $row; |
202 | | - } |
203 | | - $dbr->freeResult( $ilRes ); |
204 | | - } |
205 | 183 | |
206 | 184 | // Sort by key and then change the keys to 0-based indices |
207 | 185 | ksort( $rows ); |
— | — | @@ -259,7 +237,7 @@ |
260 | 238 | static $msgcache = null; |
261 | 239 | if ( $msgcache === null ) { |
262 | 240 | static $msgs = array( 'isredirect', 'istemplate', 'semicolon-separator', |
263 | | - 'whatlinkshere-links', 'isimage' ); |
| 241 | + 'whatlinkshere-links' ); |
264 | 242 | $msgcache = array(); |
265 | 243 | foreach ( $msgs as $msg ) { |
266 | 244 | $msgcache[$msg] = wfMsgHtml( $msg ); |
— | — | @@ -276,8 +254,6 @@ |
277 | 255 | $props[] = $msgcache['isredirect']; |
278 | 256 | if ( $row->is_template ) |
279 | 257 | $props[] = $msgcache['istemplate']; |
280 | | - if( $row->is_image ) |
281 | | - $props[] = $msgcache['isimage']; |
282 | 258 | |
283 | 259 | if ( count( $props ) ) { |
284 | 260 | $propsText = '(' . implode( $msgcache['semicolon-separator'], $props ) . ')'; |
— | — | @@ -390,10 +366,7 @@ |
391 | 367 | unset($changed['target']); // Already in the request title |
392 | 368 | |
393 | 369 | $links = array(); |
394 | | - $types = array( 'hidetrans', 'hidelinks', 'hideredirs' ); |
395 | | - if( $this->target->getNamespace() == NS_IMAGE ) |
396 | | - $types[] = 'hideimages'; |
397 | | - foreach( $types as $type ) { |
| 370 | + foreach( array( 'hidetrans', 'hidelinks', 'hideredirs' ) as $type ) { |
398 | 371 | $chosen = $this->opts->getValue( $type ); |
399 | 372 | $msg = wfMsgHtml( "whatlinkshere-{$type}", $chosen ? $show : $hide ); |
400 | 373 | $overrides = array( $type => !$chosen ); |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | |
89 | 89 | $this->closeShowImage(); |
90 | 90 | $this->imageHistory(); |
91 | | - |
| 91 | + $this->imageLinks(); |
92 | 92 | |
93 | 93 | if ( $showmeta ) { |
94 | 94 | global $wgStylePath, $wgStyleVersion; |
— | — | @@ -111,12 +111,10 @@ |
112 | 112 | */ |
113 | 113 | function showTOC( $metadata ) { |
114 | 114 | global $wgLang; |
115 | | - $wlh = SpecialPage::getTitleFor( 'Whatlinkshere' ); |
116 | | - $backlinksUrl = $wlh->getLocalUrl( 'hidelinks=1&hidetrans=1&target=' . urlencode( $this->mTitle->getFullText() ) ); |
117 | 115 | $r = '<ul id="filetoc"> |
118 | 116 | <li><a href="#file">' . $wgLang->getNsText( NS_IMAGE ) . '</a></li> |
119 | 117 | <li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li> |
120 | | - <li><a href="' . htmlspecialchars( $backlinksUrl ) . '">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' . |
| 118 | + <li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>' . |
121 | 119 | ($metadata ? ' <li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>' : '') . ' |
122 | 120 | </ul>'; |
123 | 121 | return $r; |
— | — | @@ -494,6 +492,36 @@ |
495 | 493 | |
496 | 494 | } |
497 | 495 | |
| 496 | + function imageLinks() |
| 497 | + { |
| 498 | + global $wgUser, $wgOut; |
| 499 | + |
| 500 | + $wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" ); |
| 501 | + |
| 502 | + $dbr = wfGetDB( DB_SLAVE ); |
| 503 | + $page = $dbr->tableName( 'page' ); |
| 504 | + $imagelinks = $dbr->tableName( 'imagelinks' ); |
| 505 | + |
| 506 | + $sql = "SELECT page_namespace,page_title FROM $imagelinks,$page WHERE il_to=" . |
| 507 | + $dbr->addQuotes( $this->mTitle->getDBkey() ) . " AND il_from=page_id"; |
| 508 | + $sql = $dbr->limitResult($sql, 500, 0); |
| 509 | + $res = $dbr->query( $sql, "ImagePage::imageLinks" ); |
| 510 | + |
| 511 | + if ( 0 == $dbr->numRows( $res ) ) { |
| 512 | + $wgOut->addHtml( '<p>' . wfMsg( "nolinkstoimage" ) . "</p>\n" ); |
| 513 | + return; |
| 514 | + } |
| 515 | + $wgOut->addHTML( '<p>' . wfMsg( 'linkstoimage' ) . "</p>\n<ul>" ); |
| 516 | + |
| 517 | + $sk = $wgUser->getSkin(); |
| 518 | + while ( $s = $dbr->fetchObject( $res ) ) { |
| 519 | + $name = Title::MakeTitle( $s->page_namespace, $s->page_title ); |
| 520 | + $link = $sk->makeKnownLinkObj( $name, "" ); |
| 521 | + $wgOut->addHTML( "<li>{$link}</li>\n" ); |
| 522 | + } |
| 523 | + $wgOut->addHTML( "</ul>\n" ); |
| 524 | + } |
| 525 | + |
498 | 526 | /** |
499 | 527 | * Delete the file, or an earlier version of it |
500 | 528 | */ |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2422,8 +2422,8 @@ |
2423 | 2423 | cannot move a page over itself.', |
2424 | 2424 | 'immobile_namespace' => 'Source or destination title is of a special type; |
2425 | 2425 | cannot move pages from and into that namespace.', |
2426 | | -'imagenocrossnamespace' => 'Cannot move file to non-file namespace', |
2427 | | -'imagetypemismatch' => 'The new file extension does not match its type', |
| 2426 | +'imagenocrossnamespace' => "Cannot move file to non-file namespace", |
| 2427 | +'imagetypemismatch' => "The new file extension does not match its type", |
2428 | 2428 | |
2429 | 2429 | # Export |
2430 | 2430 | 'export' => 'Export pages', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -103,7 +103,6 @@ |
104 | 104 | shared when $wgSharedDB is enabled. |
105 | 105 | * Drop-down AJAX search suggestions (turn on $wgEnableMWSuggest) |
106 | 106 | * More relevant search snippets (turn on $wgAdvancedSearchHighlighting) |
107 | | -* Image links are now displayed using Special:Whatlinkshere |
108 | 107 | |
109 | 108 | === Bug fixes in 1.13 === |
110 | 109 | |