aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiDelete.php
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/changetagsJames D. Forrester2025-03-251-1/+1
| | | | | Bug: T353458 Change-Id: I3cf44dfe5425f2efb8409c83571c427447b053af
* Namespace all remaining files in includes/filerepoJames D. Forrester2025-03-191-2/+2
| | | | | Bug: T353458 Change-Id: I35864ad9bd48701703c51367d62f8ebde963c52d
* Namespace all remaining files in includes/pageJames D. Forrester2025-03-181-1/+1
| | | | | Bug: T353458 Change-Id: I7a9c74f2106655d41ae029742090253f541bd4a6
* api: Use type-declaration for string arg in ApiBase::__constructUmherirrender2024-10-171-9/+1
| | | | | | | Also for all sub-classes Remove simple doc-blocks without further information Change-Id: I981934efe32d44f52e5ab865a9b887be5bd0f41e
* Add namespace to includes/api classesJames D. Forrester2024-09-251-0/+10
| | | | | Bug: T353458 Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
* Make use of the ??= and ?? operators where it makes sensethiemowmde2024-08-261-5/+2
| | | | | | | | This touches various production classes and maintenance scripts. The code should do the exact same as before. The main benefit is that the syntax avoids any repetition. Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
* Use StatusValue::getMessages() instead of deprecated methodsBartosz Dziewoński2024-05-181-2/+2
| | | | | | | | | This commit replaces some of the uses of getErrorsArray(), getWarningsArray(), getErrorsByType(), and getErrors(). In many cases the code becomes shorter and clearer. Follow-up to Ibc4ce11594cf36ce7b2495d2636ee080d3443b04. Change-Id: Id0ebeac26ae62231edb48458dbd2e13ddcbd0a9e
* Move user options related classes into its own namespaceMartin Urbanec2023-11-291-1/+1
| | | | | | | | | | | | | There are a couple of user options related classes already, and the T321527 work on dynamic defaults is going to add even more. Let's move them into a separate namespace to make core a bit more organized. Old name is kept as an alias for compatibility purposes. Bug: T321527 Bug: T352284 Change-Id: I9822eb1553870b876d0b8a927e4e86c27d83bd52
* Get correct main page in API call examplesAmmar Abdulhamid2023-09-201-2/+6
| | | | | | | | | | | | | | Remove hardcoded "Main Page" and use whatever the main page of the wiki is. Many wikis have their main page in a different title than the default or even in a different namespace entirely. With the hardcoded title this produces broken/redlink for the doc examples and makes it overall less useful. Most typical examples; Mediawiki.org itself, Wikidata.org, etc. Bug: T235207 Change-Id: Ia9eee76544cad153166dd5a2eb8e8c1bf3a38b74
* Use real type hints for services etc. in api/ except ApiQuery*.phpBartosz Dziewoński2023-08-291-5/+2
| | | | | | | | | | | | | | | Mostly used find-and-replace: Find: /\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|) Replace with: \3 \1 \4 Followed by some manual review to make sure I'm not changing too much, omitting some changes that looked too complicated and anything that caused test failures, and some whitespace fixes. Change-Id: I6ec7587607df4f1a4f448a096c3e44c4e5270b70
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-251-0/+1
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* Api: Fix some very old copyright statements for RoanJames D. Forrester2023-03-161-1/+1
| | | | Change-Id: I820a2d388922653a6a5b9048b0feaafbb4297d91
* Follow-up 0f13e81a1: Fix namespace of FileDeleteFormJames D. Forrester2023-03-091-1/+1
| | | | Change-Id: I1587380f669d5434c7f32ed359ab48fc6f79ce6b
* Reorg: Move five page-related classes to page/ out of includes/Amir Sarabadani2023-02-231-0/+1
| | | | | | | | | | | | These classes: - MergeHistory - MovePage - ProtectionForm - BadFileLookup (to MediaWiki\Page\File) - FileDeleteForm (to MediaWiki\Page\File) Bug: T321882 Change-Id: Ibeb488ba322c62a34042a0307bbb5562773bcad1
* api: Replace numerous more deprecated constantsReedy2022-06-061-2/+2
| | | | Change-Id: I498a315b8b4b56d5e2f939e797adbe0487cd7d07
* api: Replace numerous deprecated constantsReedy2022-06-061-5/+6
| | | | Change-Id: I34ffcb70efbfa257da8dab6e0790aa0d697caf5b
* Use MainConfigNames instead of string literals, #2Aryeh Gregor2022-04-131-2/+4
| | | | | | | This covers all occurrences of /onfig->.*get( '/ in includes/. Undoubtedly there are still plenty more to go. Change-Id: I33196c4153437778496f40436bcde399638ac361
* ApiDelete: add option to delete associated talk pageDayllan Maza2022-02-221-10/+43
| | | | | | | | | | | | | | | This works thanks to the new "deletetalk" parameter (the name is consistent with "movetalk" to ApiMove). The API will return with a warning if the page is already a talk page, or if the talk page doesn't exist. Note that the API response doesn't expose information about the talk page deletion. This would likely be a breaking change to the module, and is also not too easy to implement until FileDeleteForm is refactored as well. Bug: T263209 Change-Id: I30f2da190433a3ef9c0ac375f23b68acd3d6f190
* Change return format of DeletePage againDaimona Eaytoy2021-11-291-10/+7
| | | | | | | | | | | | | | | | | | In retrospect, I rushed the previous patch: we really need a way to tell which deletion an ID belong to (and whether it was scheduled). So make both result getters return an array with known keys that can be used programmatically. Right now the class can only delete a single page, and thus there's a single constant and this change is effectively a noop. The deletionWasScheduled() method, introduced in 1.37, was hard-deprecated out of an abundance of caution. There are no known uses on codesearch, so it can probably just be removed in the next release. Also reorder constructor params to DeletePage -- BacklinkCacheFactory is a service injected by the factory, hence it shouldn't be grouped together with value objects injected by the caller. Change-Id: I32679b7cacc638ec3e9dc5b8dfe9bcc794b22ecf
* Use DeletePage in FileDeleteForm and fix output of ApiDeleteDaimona Eaytoy2021-11-181-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | - Use DeletePage in FileDeleteForm instead of WikiPage::doDeleteArticleReal - Properly handle scheduled deletions in FileDeleteForm: previously, a null status value could indicate a missing page OR a scheduled deletion, but the code always assumed the first, and it would generate a duplicated log entry. The API response would also not contain the "delete-scheduled" message. This has been broken since the introduction of scheduled deletion. - In ApiDelete, for file deletions, check whether the status is OK not good. The two might be equivalent, but this way it's more consistent. - Add some documentation for the Status objects returned by file-related methods. This is still incomplete, as there are many methods using Status and none of them says what the status could be. In particular, this means that for now we keep checking whether the status is OK instead of good, even though it's unclear what could produce a non-fatal error. - In LocalFileDeleteBatch, avoid using a class property for the returned status, as that's hard to follow. Instead, use a local variable and pass it around when needed. Bug: T288758 Change-Id: I22d60c05bdd4a3ea531e63dbb9e49efc36935137
* Deprecate $hasHistory param to ContentHandler::getAutoDeleteReason()Daimona Eaytoy2021-11-111-4/+1
| | | | | | | | | | | | Unused except for DeleteAction, which now uses a custom query (similar to the one in ContentHandler::getAutoDeleteReason). Passing the parameter is hence hard-deprecated, and it will be removed in 1.39. Also escalate the exception logging from wfDebug to error, since we want to know what exceptions are being caught. Bug: T288282 Change-Id: I91ed9574da68bc7ff36e968f016da390b6d295ed
* Merge "ApiDelete: pass in page title to 'deleted-scheduled' message"jenkins-bot2021-10-211-1/+1
|\
| * ApiDelete: pass in page title to 'deleted-scheduled' messageMusikAnimal2021-10-201-1/+1
| | | | | | | | Change-Id: I894f8d51d60de0f8f3f078fc00be07dd4a347d7b
* | Change return format of DeletePage entrypointsDaimona Eaytoy2021-10-201-4/+14
|/ | | | | | | | | | | | Instead of putting logID/false in the status' value, add getters that can be used to retrieve this information. Also, make it return an array of log IDs, which is easier to expand later on to account for deletion of related pages (e.g. associated talk page). Note: this change will be backported to 1.37. Bug: T288758 Change-Id: I7ef64242ae0cb7018a4b1e8eb004a5563925b9a4
* Use DeletePage in ApiDelete and DeletePageJobDaimona Eaytoy2021-10-051-41/+37
| | | | | Bug: T288758 Change-Id: I1cd9b18214df93bdcc0ff1e9dbd937368841e538
* api: Inject services into ApiWatchlistTraitUmherirrender2021-07-061-1/+10
| | | | | Bug: T259960 Change-Id: I73596f8c924ec4a02a7042608d19a35f82bb752a
* api: Inject services into ApiDeleteUmherirrender2021-06-291-7/+18
| | | | | Bug: T259960 Change-Id: I8d3956edfddfbd77411c47d003ca7a0549086a2b
* ApiDelete: eliminate User class usages.Petr Pchelko2021-06-111-7/+8
| | | | Change-Id: I46d9ed663e3aed6165c96e8caab00581bc78a78c
* Use the edited page's title for magic words in action=edit error messagesBartosz Dziewoński2021-05-211-0/+1
| | | | | | | | | | | Allow specifying the title used for rendering error messages in ApiErrorFormatter. Then, specify one in ApiEditPage (and a few similar modules that deal with single pages) once we've figured out which page is being edited. Bug: T247661 Change-Id: Ic3d70efc23744ef6e90abc445f3babebf45c4697
* Convert ChangeTags public interface to Authority.Petr Pchelko2021-02-241-1/+1
| | | | | Bug: T275507 Change-Id: I3b7f99391ab299df2b046a2878010cf6afe7fed7
* Document list of change tags as string[]Umherirrender2020-11-201-2/+2
| | | | Change-Id: I0ce2a8154af82a363fef126033b5819c4ee84842
* Remove requirement for ApiWatchlistTrait to be in ApiBase.Ammar Abdulhamid2020-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This trait is not needed in ApiBase and its presence here is proving to be problematic. See I795db12. In this patch, the trait usage (more precisely the 'use statement') has been removed from ApiBase and accordingly the signatures of ApiWatchlistTrait::getWatchlistValue() and ::setWatch() have been altered to now require User object. With these changes, the abstract getUser() method in the trait is no longer needed, so it has been removed also. All core usages of the affected functions are fixed in this patch. The trait is used in only one extension according to codesearch tool, the extension will be fixed in Ic22e163. Bug: T262175 Bug: T248512 Follow-up: Ia18627b9824dca81f44f0571e8420d89b7626cf6 Change-Id: Idabcea71edfca9e7ed42000a258c99ff407873d4
* Use strict (in)equality with namespaces constants when LHS is definitely an ↵Ed Sanders2020-07-311-2/+2
| | | | | | integer Change-Id: I8fede00dfe1270d93c5d78d3c36e788cddfc8a99
* Add watchlist expiry support to applicable APIsMusikAnimal2020-07-131-11/+22
| | | | | | | | | | | This introduces an ApiWatchlistTrait that refactors out common code across APIs that allow you to watch pages. Some methods have been migrated from ApiBase and changed completely, but codesearch suggests they aren't being used outside the API modules in this patch. Bug: T248512 Bug: T248514 Change-Id: Ia18627b9824dca81f44f0571e8420d89b7626cf6
* Use MediaWikiServices::getRepoGroup in api related classesUmherirrender2020-04-111-1/+4
| | | | Change-Id: Ifa75012ea5572b56be499f355f9b97663ad17fcc
* ApiDelete: Make ::delete(File)? only accept a wikipage, make privateDannyS7122020-03-201-6/+14
| | | | | | | | | | | No classes extend ApiDelete, and this is essentially a breaking change (previously accepted WikiPage or Article) Update calls to WikiPage::doDeleteArticleReal to use the new signature Bug: T247869 Bug: T247870 Change-Id: I48d9d8a2e1df92b81d8e477434c15e8ab3e90f3c
* Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-101-2/+2
| | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* Unsuppress another phan issue (part 7)Daimona Eaytoy2019-09-031-0/+2
| | | | | | | Bug: T231636 Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9 Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0 Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
* Fix function/class caseMax Semenik2019-03-291-1/+1
| | | | Change-Id: I18c205736be9d76d2c09a6dc4d7377740a742ccc
* ApiDelete: Handle batched deletions properlyBrad Jorsch2018-12-201-2/+9
| | | | | | | | | When batched deletions via the job queue were added in Ie800fb5a, the way this was reported caused ApiDelete to report an error. Instead it should report success with appropriate signaling to the client. Bug: T212356 Change-Id: I1ef66277e988572c6720cf3e3cb36b18530746b4
* Fix PhanTypeMismatchDeclaredParamUmherirrender2018-07-071-1/+1
| | | | | | Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
* Improve test coverage for ApiDelete.phpAryeh Gregor2018-03-261-1/+2
| | | | | | | Still missing a test for file deletion, because I didn't figure out a simple way to create a file page that I can test on. Change-Id: I276e84b4f7777e5dd5be5520e572b9b9bb0c0633
* Remove "Created on" from file header commentsUmherirrender2018-01-261-4/+0
| | | | | | | | | It is the job of git and svn to provide this information/metadata. The form was different, some with short, some with long month name some with leading zero at the day, some without. The year is also present in the Copyright clause Change-Id: If006907b82b9e45f13cfa2e45d41107a95570e1a
* API: Account for PHP 7.2 changeBrad Jorsch2017-12-041-1/+1
| | | | | | | | | | PHP 7.2 broke existing functionality in making count( null ) raise a warning. So add tests for null all over the place, or change tests where we know the value is null or an array (but not false, empty-string, or 0) to just cast to boolean. Bug: T182004 Change-Id: Idfe23a07daa9f60eee72f2daf04304be87057a29
* Add missing & to @param documentation to match functon callUmherirrender2017-08-111-2/+2
| | | | Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
* API: Allow deleting files without corresponding pagesBrad Jorsch2017-06-121-3/+13
| | | | | | | | Such a deletion doesn't currently produce a log entry, but that's a different bug that also occurs via the web UI. Bug: T167693 Change-Id: If6e751aa28960243db49ac9b81fe518edba11bd5
* Make API documentation links language awareBaha2017-04-051-1/+1
| | | | | | | | | | | | | | Links generated by the API are now aware of the user's preferred language and will show documents in that language if available. To test, log in to mediawiki.org and set your language preference to 'es', then on an MediaWiki installation with this patch view the generated expanded API help at `api.php?action=help&recursivesubmodules=1&modules=main`. Each link to documentation on mediawiki.org should take you to its translated /es subpage, if one exists. Bug: T104518 Change-Id: I339a1f3ae1bce9d759cf251899d57c32b1def91e
* API: i18n for warnings and errorsBrad Jorsch2016-12-061-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | API warnings and error messages are currently hard-coded English strings. This patch changes that. With a few exceptions, this patch should be compatible with non-updated extensions: * The change to ApiBase::$messageMap will blow up anything trying to mess with it. * The changes to the 'ApiCheckCanExecute' hook will cause a wrong (probably unparsed) error message to be emitted for extensions not already using an ApiMessage. Unless they're currently broken like Wikibase. Bug: T37074 Bug: T47843 Depends-On: Ia2b66b57cd4eaddc30b3ffdd7b97d6ca3e02d898 Depends-On: I2e1bb975bb0045476c03ebe6cdec00259bae22ec Depends-On: I53987bf87c48f6c00deec17a8e957d24fcc3eaa6 Depends-On: Ibf93a459eb62d30f7c70d20e91ec9faeb80d10ed Depends-On: I3cf889811f44a15935e454dd42f081164d4a098c Depends-On: Ieae527de86735ddcba34724730e8730fb277b99b Depends-On: I535344c29d51521147c2a26c341dae38cec3e931 Change-Id: Iae0e2ce3bd42dd4776a9779664086119ac188412
* Move tagging of API deletions to RC savecenarium2016-09-211-12/+10
| | | | | | | | | Since the recent change save of logged actions is now deferred, we need to move tagging of API deletions to the RC save, like other API actions do already. Otherwise, only the log gets tagged, not the RC. Bug: T108564 Change-Id: I4e6e18e7f8fb7a6b0932e7579bafddcc1b0a9758
* Convert all array() syntax to []Kunal Mehta2016-02-171-21/+21
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b