28require_once __DIR__ .
'/cleanupTable.inc';
37 parent::__construct();
38 $this->
addDescription(
'Script to clean up broken, unparseable titles' );
52 &&
$title->getNamespace() == $row->page_namespace
53 &&
$title->getDBkey() === $row->page_title
60 if ( $row->page_namespace ==
NS_FILE && $this->fileExists( $row->page_title ) ) {
61 $this->
output(
"file $row->page_title needs cleanup, please run cleanupImages.php.\n" );
63 } elseif ( is_null(
$title ) ) {
64 $this->
output(
"page $row->page_id ($display) is illegal.\n" );
68 $this->
output(
"page $row->page_id ($display) doesn't match self.\n" );
82 $row =
$dbr->selectRow(
'image', [
'img_name' ], [
'img_name' =>
$name ], __METHOD__ );
84 return $row !==
false;
91 $legal =
'A-Za-z0-9_/\\\\-';
92 $legalized = preg_replace_callback(
"!([^$legal])!",
95 if ( $legalized ==
'.' ) {
98 if ( $legalized ==
'_' ) {
99 $legalized =
'(space)';
101 $legalized =
'Broken/' . $legalized;
104 if ( is_null(
$title ) ) {
105 $clean =
'Broken/id:' . $row->page_id;
106 $this->
output(
"Couldn't legalize; form '$legalized' still invalid; using '$clean'\n" );
108 } elseif (
$title->exists() ) {
109 $clean =
'Broken/id:' . $row->page_id;
110 $this->
output(
"Legalized for '$legalized' exists; using '$clean'\n" );
114 $dest =
$title->getDBkey();
115 if ( $this->dryrun ) {
116 $this->
output(
"DRY RUN: would rename $row->page_id ($row->page_namespace," .
117 "'$row->page_title') to ($row->page_namespace,'$dest')\n" );
119 $this->
output(
"renaming $row->page_id ($row->page_namespace," .
120 "'$row->page_title') to ($row->page_namespace,'$dest')\n" );
122 $dbw->update(
'page',
123 [
'page_title' => $dest ],
124 [
'page_id' => $row->page_id ],
136 $prior =
$title->getPrefixedDBkey();
138 $prior =
$title->getDBkey();
141 # Old cleanupTitles could move articles there. See bug 23147.
142 $ns = $row->page_namespace;
147 # Namespace which no longer exists. Put the page in the main namespace
148 # since we don't have any idea of the old namespace name. See bug 68501.
153 $clean =
'Broken/' . $prior;
155 if ( !$verified || $verified->exists() ) {
156 $blah =
"Broken/id:" . $row->page_id;
157 $this->
output(
"Couldn't legalize; form '$clean' exists; using '$blah'\n" );
162 if ( is_null(
$title ) ) {
163 $this->
error(
"Something awry; empty title.",
true );
165 $ns =
$title->getNamespace();
166 $dest =
$title->getDBkey();
168 if ( $this->dryrun ) {
169 $this->
output(
"DRY RUN: would rename $row->page_id ($row->page_namespace," .
170 "'$row->page_title') to ($ns,'$dest')\n" );
172 $this->
output(
"renaming $row->page_id ($row->page_namespace," .
173 "'$row->page_title') to ($ns,'$dest')\n" );
175 $dbw->update(
'page',
177 'page_namespace' => $ns,
178 'page_title' => $dest
180 [
'page_id' => $row->page_id ],
static singleton()
Get an instance of this class.
static exists( $index)
Returns whether the specified namespace exists.
error( $err, $die=0)
Throw an error to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
addDescription( $text)
Set the description text.
Generic class to cleanup a database table.
Maintenance script to clean up broken, unparseable titles.
moveInconsistentPage( $row, $title)
__construct()
Default constructor.
static makeName( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false)
Make a prefixed DB key from a DB key and a namespace index.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
when a variable name is used in a it is silently declared as a new local masking the global
namespace and then decline to actually register it file or subcat img or subcat $title
Allows to change the fields on the form that will be generated $name
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
require_once RUN_MAINTENANCE_IF_MAIN