2015-08-20 13:14:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class AllinfoboxesQueryPage extends PageQueryPage {
|
|
|
|
|
|
|
|
const ALL_INFOBOXES_TYPE = 'AllInfoboxes';
|
|
|
|
|
|
|
|
function __construct() {
|
|
|
|
parent::__construct( self::ALL_INFOBOXES_TYPE );
|
|
|
|
}
|
|
|
|
|
2018-08-03 09:54:47 +00:00
|
|
|
function getGroupName() {
|
|
|
|
return 'pages';
|
2018-08-06 13:16:36 +00:00
|
|
|
}
|
2018-08-03 09:54:47 +00:00
|
|
|
|
2015-08-20 13:14:23 +00:00
|
|
|
public function sortDescending() {
|
2018-08-03 08:49:28 +00:00
|
|
|
return false;
|
2015-08-20 13:14:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isExpensive() {
|
|
|
|
return true;
|
|
|
|
}
|
2018-08-06 13:16:36 +00:00
|
|
|
|
2018-08-05 09:44:51 +00:00
|
|
|
public function getOrderFields() {
|
|
|
|
return [ 'title' ];
|
|
|
|
}
|
2015-08-20 13:14:23 +00:00
|
|
|
|
2018-08-05 09:44:51 +00:00
|
|
|
public function getCacheOrderFields() {
|
|
|
|
return $this->getOrderFields();
|
|
|
|
}
|
2018-08-16 09:25:53 +00:00
|
|
|
|
2018-08-03 08:49:28 +00:00
|
|
|
function getQueryInfo() {
|
2018-10-11 18:26:59 +00:00
|
|
|
$query = [
|
2018-10-19 19:11:28 +00:00
|
|
|
'tables' => [ 'page', 'page_props' ],
|
2018-08-03 08:49:28 +00:00
|
|
|
'fields' => [
|
2018-10-11 18:26:59 +00:00
|
|
|
'namespace' => 'page.page_namespace',
|
|
|
|
'title' => 'page.page_title',
|
2018-10-19 19:11:28 +00:00
|
|
|
'value' => 'page.page_id',
|
|
|
|
'infoboxes' => 'page_props.pp_value'
|
2018-08-03 08:49:28 +00:00
|
|
|
],
|
|
|
|
'conds' => [
|
2018-10-11 18:26:59 +00:00
|
|
|
'page.page_is_redirect' => 0,
|
2018-10-19 19:11:28 +00:00
|
|
|
'page.page_namespace' => NS_TEMPLATE,
|
|
|
|
'page_props.pp_value IS NOT NULL',
|
|
|
|
'page_props.pp_value != \'\''
|
|
|
|
],
|
|
|
|
'join_conds' => [
|
|
|
|
'page_props' => [
|
|
|
|
'INNER JOIN',
|
|
|
|
'page.page_id = page_props.pp_page AND page_props.pp_propname = "infoboxes"'
|
|
|
|
]
|
2018-08-03 08:49:28 +00:00
|
|
|
]
|
|
|
|
];
|
2018-10-11 18:26:59 +00:00
|
|
|
|
2018-10-19 19:11:28 +00:00
|
|
|
$subpagesBlacklist = $this->getConfig( 'AllInfoboxesSubpagesBlacklist' );
|
|
|
|
foreach ( $subpagesBlacklist as $subpage ) {
|
|
|
|
$query['conds'][] = 'page.page_title NOT LIKE %/' . mysql_real_escape_string( $subpage );
|
2018-10-11 18:26:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $query;
|
2015-08-20 13:14:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the querycache table
|
|
|
|
*
|
2018-08-06 13:16:36 +00:00
|
|
|
* @see QueryPage::recache
|
|
|
|
*
|
2018-10-19 19:11:28 +00:00
|
|
|
* @param bool $limit Limit for SQL statement
|
2018-08-06 13:16:36 +00:00
|
|
|
* @param bool $ignoreErrors Whether to ignore database errors
|
2015-08-20 13:14:23 +00:00
|
|
|
*
|
2016-02-22 12:14:41 +00:00
|
|
|
* @return int number of rows updated
|
2015-08-20 13:14:23 +00:00
|
|
|
*/
|
|
|
|
public function recache( $limit = false, $ignoreErrors = true ) {
|
2018-10-19 19:11:28 +00:00
|
|
|
$res = parent::recache( $limit, $ignoreErrors );
|
2015-08-20 13:14:23 +00:00
|
|
|
|
2017-07-12 12:21:06 +00:00
|
|
|
Hooks::run( 'AllInfoboxesQueryRecached' );
|
2018-08-03 08:49:28 +00:00
|
|
|
return $res;
|
2015-08-20 13:14:23 +00:00
|
|
|
}
|
|
|
|
}
|