2007-03-31 23:36:58 +00:00
|
|
|
<?php
|
2012-05-11 08:34:29 +00:00
|
|
|
/**
|
|
|
|
|
* Variant of QueryPage which formats the result as a simple link to the page.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup SpecialPage
|
|
|
|
|
*/
|
2007-03-31 23:36:58 +00:00
|
|
|
|
2018-04-04 12:52:10 +00:00
|
|
|
use Wikimedia\Rdbms\IResultWrapper;
|
2017-02-10 18:09:05 +00:00
|
|
|
use Wikimedia\Rdbms\IDatabase;
|
2017-02-19 05:03:13 +00:00
|
|
|
|
2007-03-31 23:36:58 +00:00
|
|
|
/**
|
|
|
|
|
* Variant of QueryPage which formats the result as a simple link to the page
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage
|
2007-03-31 23:36:58 +00:00
|
|
|
*/
|
2010-12-22 14:16:25 +00:00
|
|
|
abstract class PageQueryPage extends QueryPage {
|
2013-11-16 20:27:54 +00:00
|
|
|
/**
|
|
|
|
|
* Run a LinkBatch to pre-cache LinkCache information,
|
|
|
|
|
* like page existence and information for stub color and redirect hints.
|
|
|
|
|
* This should be done for live data and cached data.
|
|
|
|
|
*
|
2014-12-09 09:05:22 +00:00
|
|
|
* @param IDatabase $db
|
2018-04-04 12:52:10 +00:00
|
|
|
* @param IResultWrapper $res
|
2013-11-16 20:27:54 +00:00
|
|
|
*/
|
|
|
|
|
public function preprocessResults( $db, $res ) {
|
2016-10-29 20:46:17 +00:00
|
|
|
$this->executeLBFromResultWrapper( $res );
|
2013-11-16 20:27:54 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-31 23:36:58 +00:00
|
|
|
/**
|
|
|
|
|
* Format the result as a simple link to the page
|
|
|
|
|
*
|
2013-04-14 19:18:38 +00:00
|
|
|
* @param Skin $skin
|
|
|
|
|
* @param object $row Result row
|
2007-03-31 23:36:58 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function formatResult( $skin, $row ) {
|
|
|
|
|
global $wgContLang;
|
2012-04-10 09:28:48 +00:00
|
|
|
|
2007-03-31 23:36:58 +00:00
|
|
|
$title = Title::makeTitleSafe( $row->namespace, $row->title );
|
2012-04-10 09:28:48 +00:00
|
|
|
|
2010-11-30 19:06:28 +00:00
|
|
|
if ( $title instanceof Title ) {
|
|
|
|
|
$text = $wgContLang->convert( $title->getPrefixedText() );
|
2017-03-23 18:09:41 +00:00
|
|
|
return $this->getLinkRenderer()->makeLink( $title, $text );
|
2012-04-10 09:28:48 +00:00
|
|
|
} else {
|
2016-02-17 09:09:32 +00:00
|
|
|
return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ],
|
2012-04-10 09:28:48 +00:00
|
|
|
Linker::getInvalidTitleDescription( $this->getContext(), $row->namespace, $row->title ) );
|
2010-11-30 19:06:28 +00:00
|
|
|
}
|
2007-03-31 23:36:58 +00:00
|
|
|
}
|
|
|
|
|
}
|