Go to the documentation of this file.
32 require_once __DIR__ .
'/cleanupTable.inc';
43 'index' =>
'img_name',
44 'callback' =>
'processRow',
48 parent::__construct();
49 $this->mDescription =
"Script to clean up broken, unparseable upload filenames";
65 $cleaned = rawurldecode( $cleaned );
71 $cleaned =
$wgContLang->checkTitleEncoding( $cleaned );
79 $this->
output(
"page $source ($cleaned) is illegal.\n" );
81 if ( $safe ===
false ) {
89 $munged =
$title->getDBkey();
90 $this->
output(
"page $source ($munged) doesn't match self.\n" );
102 if ( $this->dryrun ) {
103 $this->
output(
"DRY RUN: would delete bogus row '$name'\n" );
105 $this->
output(
"deleting bogus row '$name'\n" );
107 $db->delete(
'image',
114 if ( !isset( $this->repo ) ) {
117 return $this->repo->getRootDirectory() .
'/' . $this->repo->getHashPath(
$name ) .
$name;
121 return $db->selectField(
'image',
'1',
array(
'img_name' =>
$name ), __METHOD__ );
125 return $db->selectField(
'page',
'1',
array(
'page_namespace' =>
NS_FILE,
'page_title' =>
$name ), __METHOD__ );
130 if ( !file_exists(
$path ) ) {
131 $this->
output(
"missing file: $path\n" );
150 while ( $conflict ) {
151 $this->
output(
"Rename conflicts with '$final'...\n" );
157 $finalPath = $this->
filePath( $final );
159 if ( $this->dryrun ) {
160 $this->
output(
"DRY RUN: would rename $path to $finalPath\n" );
162 $this->
output(
"renaming $path to $finalPath\n" );
164 $db->begin( __METHOD__ );
165 $db->update(
'image',
166 array(
'img_name' => $final ),
167 array(
'img_name' => $orig ),
169 $db->update(
'oldimage',
170 array(
'oi_name' => $final ),
171 array(
'oi_name' => $orig ),
174 array(
'page_title' => $final ),
175 array(
'page_title' => $orig,
'page_namespace' =>
NS_FILE ),
177 $dir = dirname( $finalPath );
178 if ( !file_exists(
$dir ) ) {
180 $this->
output(
"RENAME FAILED, COULD NOT CREATE $dir" );
181 $db->rollback( __METHOD__ );
185 if ( rename(
$path, $finalPath ) ) {
186 $db->commit( __METHOD__ );
188 $this->
error(
"RENAME FAILED" );
189 $db->rollback( __METHOD__ );
195 return preg_replace(
'/^(.*)(\..*?)$/',
196 "\\1$suffix\\2",
$name );
200 $x = preg_replace_callback(
202 array( $this,
'hexChar' ),
206 if ( is_null(
$test ) ||
$test->getDBkey() !== $x ) {
207 $this->
error(
"Unable to generate safe title from '$name', got '$x'" );
static singleton()
Get a RepoGroup instance.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
require_once RUN_MAINTENANCE_IF_MAIN
__construct()
Default constructor.
appendTitle( $name, $suffix)
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 content language as $wgContLang
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Generic class to cleanup a database table.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
Maintenance script to clean up broken, unparseable upload filenames.
if(count( $args)==0) $dir
if(PHP_SAPI !='cli') $source
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
static legalChars()
Get a regex character class describing the legal characters in a link.
static decodeCharReferences( $text)
Decode any character references, numeric or named entities, in the text and return a UTF-8 string.