Go to the documentation of this file.
41 if ( !is_resource(
$sink ) || get_resource_type(
$sink ) !==
'stream' ) {
42 throw new InvalidArgumentException(
'$sink must be a file handle' );
57 'xmlns' =>
'http://www.mediawiki.org/xml/sitelist-1.0/',
62 foreach ( $sites as $site ) {
67 fflush( $this->sink );
77 $siteAttr = [
'type' => $site->
getType() ];
95 fwrite( $this->sink,
"\t\t" .
Xml::element(
'forward',
null,
'' ) .
"\n" );
103 foreach ( $ids as $id ) {
104 fwrite( $this->sink,
"\t\t" .
Xml::element(
'localid', [
'type' =>
$type ], $id ) .
"\n" );
getType()
Returns the type of the site (ie mediawiki).
static openElement( $element, $attribs=null)
This opens an XML element.
getGlobalId()
Returns the global site identifier (ie enwiktionary).
getSource()
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getGroup()
Gets the group of the site (ie wikipedia).
exportSite(Site $site)
Writes a <site> tag representing the given Site object.
exportSites( $sites)
Writes a <site> tag for each Site object in $sites, and encloses the entire list between <sites> tags...
getAllPaths()
Returns the paths as associative array.
static closeElement( $element)
Shortcut to close an XML element.
shouldForward()
Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site,...
getLocalIds()
Returns all local ids.