Go to the documentation of this file.
26 require_once __DIR__ .
'/Maintenance.php';
35 parent::__construct();
37 $this->
addOption(
'delete',
"Actually delete the page" );
38 $this->
addArg(
'title',
'Title to delete' );
48 $tbl_pag = $dbw->tableName(
'page' );
49 $tbl_rec = $dbw->tableName(
'recentchanges' );
50 $tbl_rev = $dbw->tableName(
'revision' );
53 $this->
output(
"Searching for \"$name\"..." );
56 $id =
$title->getArticleID();
57 $real =
$title->getPrefixedText();
58 $isGoodArticle =
$title->isContentPage();
59 $this->
output(
"found \"$real\" with ID $id.\n" );
61 # Get corresponding revisions
62 $this->
output(
"Searching for revisions..." );
63 $res = $dbw->query(
"SELECT rev_id FROM $tbl_rev WHERE rev_page = $id" );
66 $revs[] = $row->rev_id;
68 $count =
count( $revs );
69 $this->
output(
"found $count.\n" );
71 # Delete the page record and associated recent changes entries
73 $this->
output(
"Deleting page record..." );
74 $dbw->query(
"DELETE FROM $tbl_pag WHERE page_id = $id" );
75 $this->
output(
"done.\n" );
76 $this->
output(
"Cleaning up recent changes..." );
77 $dbw->query(
"DELETE FROM $tbl_rec WHERE rc_cur_id = $id" );
78 $this->
output(
"done.\n" );
83 # Delete revisions as appropriate
84 if ( $delete && $count ) {
85 $this->
output(
"Deleting revisions..." );
87 $this->
output(
"done.\n" );
91 # Update stats as appropriate
93 $this->
output(
"Updating site stats..." );
94 $ga = $isGoodArticle ? -1 : 0;
97 $this->
output(
"done.\n" );
100 $this->
output(
"not found in database.\n" );
109 $tbl_rev = $dbw->tableName(
'revision' );
111 $set = implode(
', ', $ids );
112 $dbw->query(
"DELETE FROM $tbl_rev WHERE rev_id IN ( $set )" );
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Maintenance script that erases a page record from the database.
addDescription( $text)
Set the description text.
execute()
Do the actual work.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
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
beginTransaction(IDatabase $dbw, $fname)
Begin a transcation on a DB.
namespace and then decline to actually register it file or subcat img or subcat $title
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Class for handling updates to the site_stats table.
Allows to change the fields on the form that will be generated $name
commitTransaction(IDatabase $dbw, $fname)
Commit the transcation on a DB handle and wait for replica DBs to catch up.
purgeRedundantText( $delete=true)
Support function for cleaning up redundant text records.
__construct()
Default constructor.
addArg( $arg, $description, $required=true)
Add some args that are needed.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
output( $out, $channel=null)
Throw some output to the user.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
hasOption( $name)
Checks to see if a particular option exists.
getArg( $argId=0, $default=null)
Get an argument.