47 if ( !$pageObj->exists() ) {
51 $titleObj = $pageObj->getTitle();
56 $errors = $titleObj->getUserPermissionsErrors(
'delete',
$user );
57 if ( count( $errors ) ) {
63 if ( count(
$params[
'tags'] ) ) {
65 if ( !$tagStatus->isOK() ) {
70 if ( $titleObj->getNamespace() ==
NS_FILE ) {
93 } elseif (
$params[
'unwatch'] ) {
98 $this->
setWatch( $watch, $titleObj,
'watchdeletion' );
101 'title' => $titleObj->getPrefixedText(),
118 $title = $page->getTitle();
121 if ( is_null( $reason ) ) {
125 $reason = $page->getAutoDeleteReason( $hasHistory );
126 if ( $reason ===
false ) {
127 return [ [
'cannotdelete',
$title->getPrefixedText() ] ];
134 return $page->doDeleteArticleReal( $reason,
false, 0,
true, $error, $user, $tags );
147 &$reason = null, $suppress =
false, $tags = []
149 $title = $page->getTitle();
151 $file = $page->getFile();
152 if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) {
153 return self::delete( $page, $user, $reason, $tags );
158 return [ [
'invalidoldimage' ] ];
161 if ( !$oldfile->exists() || !$oldfile->isLocal() || $oldfile->getRedirected() ) {
162 return [ [
'nodeleteablefile' ] ];
166 if ( is_null( $reason ) ) {
219 'action=delete&title=Main%20Page&token=123ABC'
220 =>
'apihelp-delete-example-simple',
221 'action=delete&title=Main%20Page&token=123ABC&reason=Preparing%20for%20move'
222 =>
'apihelp-delete-example-reason',
227 return 'https://www.mediawiki.org/wiki/API:Delete';
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
getResult()
Get the result object.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
setWatch($watch, $titleObj, $userOption=null)
Set a watch (or unwatch) based the based on a watchlist parameter.
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
getTitleOrPageId($params, $load=false)
Get a WikiPage object from a title or pageid param, if possible.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
static singleton()
Get a RepoGroup instance.
namespace and then decline to actually register it file or subcat img or subcat $title
getModuleName()
Get the name of the module being executed by this instance.
API module that facilitates deleting pages.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
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
static deleteFile(Page $page, User $user, $oldimage, &$reason=null, $suppress=false, $tags=[])
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
This abstract class implements many basic API functions, and is the base of all API classes...
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
dieStatus($status)
Throw a UsageException based on the errors in the Status object.
getUser()
Get the User object.
dieUsageMsg($error)
Output the error message related to a certain array.
execute()
Extracts the title and reason from the request parameters and invokes the local delete() function wit...
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page