*
* @var array
*/
- public $limit = array();
+ public $limit = [];
/**
* Key => value entries of namespaces and their priorities
*
* @var array
*/
- public $priorities = array();
+ public $priorities = [];
/**
* A one-dimensional array of namespaces in the wiki
*
* @var array
*/
- public $namespaces = array();
+ public $namespaces = [];
/**
* When this sitemap batch was generated
public $timestamp;
/**
- * A database slave object
+ * A database replica DB object
*
* @var object
*/
*/
public function __construct() {
parent::__construct();
- $this->mDescription = "Creates a sitemap for the site";
+ $this->addDescription( 'Creates a sitemap for the site' );
$this->addOption(
'fspath',
'The file system path to save to, e.g. /tmp/sitemap; defaults to current directory',
$this->identifier = $this->getOption( 'identifier', wfWikiID() );
$this->compress = $this->getOption( 'compress', 'yes' ) !== 'no';
$this->skipRedirects = $this->getOption( 'skip-redirects', false ) !== false;
- $this->dbr = $this->getDB( DB_SLAVE );
+ $this->dbr = $this->getDB( DB_REPLICA );
$this->generateNamespaces();
$this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() );
$this->findex = fopen( "{$this->fspath}sitemap-index-{$this->identifier}.xml", 'wb' );
}
$res = $this->dbr->select( 'page',
- array( 'page_namespace' ),
- array(),
+ [ 'page_namespace' ],
+ [],
__METHOD__,
- array(
+ [
'GROUP BY' => 'page_namespace',
'ORDER BY' => 'page_namespace',
- )
+ ]
);
foreach ( $res as $row ) {
*/
function getPageRes( $namespace ) {
return $this->dbr->select( 'page',
- array(
+ [
'page_namespace',
'page_title',
'page_touched',
'page_is_redirect'
- ),
- array( 'page_namespace' => $namespace ),
+ ],
+ [ 'page_namespace' => $namespace ],
__METHOD__
);
}
// bug 17961: make a title with the longest possible URL in this namespace
$title = Title::makeTitle( $namespace, str_repeat( "\xf0\xa8\xae\x81", 63 ) . "\xe5\x96\x83" );
- $this->limit = array(
+ $this->limit = [
strlen( $this->openFile() ),
strlen( $this->fileEntry(
$title->getCanonicalURL(),
$this->priority( $namespace )
) ),
strlen( $this->closeFile() )
- );
+ ];
}
}