aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/categoryChangesAsRdf.php
Commit message (Collapse)AuthorAgeFilesLines
* Remove 2-line PHPDocs that just repeat the types from the codethiemowmde2025-01-171-1/+0
| | | | | | | | | | | | | | | | Same as Ia294bf4 did for 1-line comments. This patch removes slightly more complex 2-line PHPDoc comments that don't add any new information to the code, but literally repeat what the code already says. They say "don't document the code, code the documentation", and we are doing this more and more. We just tend to forget to remove the obsolete comments. Note I'm also removing a line of text in a few cases when it's very short and literally says the same as the method name. Again, such comments add zero new information. Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
* BatchRowIterator: Use SelectQueryBuilder directlyBartosz Dziewoński2025-01-071-59/+45
| | | | | | | | | | | Allow passing a SelectQueryBuilder to BatchRowIterator, instead of passing only table names and then setting all other query info using custom methods. Hopefully offering this more familiar interface will make BatchRowIterator easier to use. Change-Id: I87f81ba693e0a74d414342fa5ffc2eac0bcfdf11
* add `use MediaWiki\Maintenance\Maintenance` to some maintenance classesNovem Linguae2024-11-121-0/+1
| | | | | | | A–F. Still need to do F–Z. Bug: T353458 Change-Id: Ieb4bad0658b9cddc9403c6a55ef3bd1245aa08ae
* Make $fname mandatory on private functionsUmherirrender2024-09-191-3/+3
| | | | | | | For a private function the $fname does not need to be optional, it should be easy to pass it always. Change-Id: Ifcddcd2479ae6f8bbf68210441c61ee7a45e1489
* maintenance: Add missing documentation to class propertiesUmherirrender2024-09-131-0/+2
| | | | | | | | | | Add doc-typehints to class properties found by the PropertyDocumentation sniff to improve the documentation. Once the sniff is enabled it avoids that new code is missing type declarations. This is focused on documentation and does not change code. Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
* Exclude boilerplate maintenance code from code coverage reportsDreamy Jazz2024-08-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Maintenance scripts in core have bolierplate code that is added before and after the class to allow directly running the maintenance script. * Running the maintenance script directly has been deprecated since 1.40, so this boilerplate code is only to support a now deprecated method of running maintenance scripts. * This code cannot also be marked as covered, due to PHPUnit not recognising code coverage for files. * Therefore, it is best to ignore this boilerplate code in code coverage reports as it cannot be marked as covered and also is for deprecated code. What: * Wrap the boilerplate code (requiring Maintenance.php and then later defining the maintenance script class and running if the maintenance script was called directly) with @codeCoverageIgnore comments. * Some files use a different boilerplate code, however, these should also be marked as ignored for coverage for the same reason that coverage is not properly reported for files. Bug: T371167 Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
* Fix casing of Mediawiki to MediaWikiReedy2024-01-291-2/+2
| | | | Change-Id: I0f266a034a99255b27fd96d82335d6e710a61f20
* maintenance: Migrate to expression buildersAmir Sarabadani2024-01-171-2/+2
| | | | | | | This was somehow left out Bug: T210206 Change-Id: I70851b5b99fa865dbfd629caf2c1866c85418350
* Remove redundant empty() constructs (3)Daimona Eaytoy2023-09-081-4/+4
| | | | | | | | | | | | | empty() only makes sense when the expression it checks is possibly undefined, otherwise it's equivalent to a truthiness check with the additional downside of suppressing errors when it's not wanted. Replace it with simple truthiness checks, using strict comparison when that seems to help with polymorphic variables. These were caught by a bespoke phan plugin. Change-Id: Ide262162553d2da7e5388d05e8731529c44591c1
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* maintenance: Switch simple calls of Database::select to SQBAmir Sarabadani2023-07-191-40/+16
| | | | | | | Done semi-automatically via a php parser written on top of ANTLR4. Bug: T311866 Change-Id: I33f5b6703c0aa9c80c907a21c2a770e30642edd3
* Use more narrow IReadableDatabase in BatchRowIteratorthiemowmde2023-05-191-31/+30
| | | | | | | | | | It's an iterator. It reads. This causes a nice chain-reaction where a lot more code (a lot in extensions) can be updated the same way. Note this doesn't affect the stability of this code because all old callers will continue to work with the more narrow type. Change-Id: Ib7e0287a480af641ce2c19e856c1fb90498f3eb8
* Use more narrow database interfaces in maintenance scriptsthiemowmde2023-02-271-2/+3
| | | | | | | | This makes this code easier to read and to maintain because it's more obvious why a DB connection is passed. For now this patrch focusses exclusively on private methods. Change-Id: Id60dc90b124f4cae1dfbede990f45e3c69491a25
* Merge "Reorg: Move category-related classes from includes/ to Category/"jenkins-bot2023-02-091-0/+2
|\
| * Reorg: Move category-related classes from includes/ to Category/Amir Sarabadani2023-02-091-0/+2
| | | | | | | | | | Bug: T321882 Change-Id: I0b86acfdeaa3a2a0a14b7763fd088122820bafdc
* | Remove unused arguments to private functionsUmherirrender2023-02-081-6/+5
|/ | | | | | Found by phan dead detection Change-Id: I93379b7b9a733206d0e53add04fcdb9478c58755
* Use MainConfigNames instead of string literals, #5Aryeh Gregor2022-04-271-1/+2
| | | | | | | This should be the last of the usages in core, although I'm sure a few are hiding somehow. Change-Id: I7bf0b24bf23d3efb4c56a891830bbfe67945e899
* Fix various documentation related to scalar typesUmherirrender2022-03-091-1/+1
| | | | | | Found by phan strict checks Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
* Explicit cast TS_UNIX to int for arithmetic operations and int argsUmherirrender2022-01-111-2/+2
| | | | | | | | When the called function has a doc of int, it should be cast to be explicit here. Also cast for arithmetic operations to be explicit about the number Change-Id: I905b78dfb66e66443e0e3203488bab5b548db543
* Use `rc_new_name_timestamp` index name unconditionallyAmmarpad2021-05-051-5/+1
| | | | | Bug: T276292 Change-Id: I93f8ce51dd1c2406d88015fcf6be9b044f424880
* Rename new_name_timestamp on recentchanges to rc_new_name_timestampAmir Sarabadani2021-03-011-6/+11
| | | | | | | To make it have a uniform prefix for index and column names Bug: T270033 Change-Id: I8eb600416913092bd5aeb70389bba6e8a54d1d57
* Merge "don't pass null page id to page related queries for category change ↵jenkins-bot2020-09-091-5/+7
|\ | | | | | | rdf dumps"
| * don't pass null page id to page related queries for category change rdf dumpsAriel T. Glenn2020-09-071-5/+7
| | | | | | | | | | Bug: T260232 Change-Id: Ia9b254cf1d561b10de7e9aae9765cb21ea83325f
* | maintenance: Make use of BatchRowIterator::setCallerReedy2020-09-051-19/+40
|/ | | | | Bug: T261014 Change-Id: I20858c486e79753a1aa62fa8cbf22afc4f59dba3
* Write category parent hierarchy when handling categorizationDavid Causse2020-07-311-17/+2
| | | | | | | | Since we do brute force update (DELETE ALL+INSERT ALL) of the parent categories we need to always write the parent category hierarchy. Bug: T246568 Change-Id: Id9c3282a97bf3fc3d5355cc08a0c9d833c72c9b2
* Fix PSR12.Properties.ConstantVisibility.NotFound in maintenance/Reedy2020-05-091-3/+3
| | | | Change-Id: Ib0f081f7b278fdd3f4083fc5020bcac97f6015b4
* Add string casts when using array_keys() with SQL query conditionsBrad Jorsch2019-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Until I70473280, integer literals were always quoted as strings, because the databases we support all have no problem with casting string-literals for comparisons and such. But it turned out that gave MySQL/MariaDB's planner problems in some queries, so we changed it to not quote actual PHP integers. But then we run into the fact that PHP associative arrays don't preserve the types of keys, it converts integer-like strings into actual integers. And when those are passed to the DB unquoted for comparison with a string-typed column, MySQL/MariaDB screws up the comparison while PostgreSQL simply throws an error. Sigh. This patch adds string casting to direct uses of array_keys() to supply values for such query conditions. It doesn't change uses where the field being compared is a numeric field. If anyone knows of a good way to find indirect uses of array_keys() for passing as $conds to IDatabase methods, please do so! Change-Id: Ie72ee33437d492904e1495b3f4ebb1fcf0118f49
* Add missing @param and @return to documentationUmherirrender2019-11-101-0/+1
| | | | Change-Id: Ibc5849cc8ea7e7c4eb30ded9c1cfa5f52187c377
* Use Maintenance::getConfig in some maintenance scriptsUmherirrender2019-09-011-6/+5
| | | | | | This avoid global state Change-Id: Id67d07597159a0bd2721a381775230c3cd1d5509
* Unsuppress more phan issues (part 5)Daimona Eaytoy2019-09-011-2/+4
| | | | | | Bug: T231636 Depends-On: I6e5fba7bd273219b1206559420b5bdb78734aa84 Change-Id: I50377746f01749b058c39fd8229f9d566224cc43
* Fix categories detele SPARQL clauseStanislav Malyshev2019-08-271-0/+2
| | | | | Bug: T228348 Change-Id: I87b3b5831e31dc619b5eefb7854d3223acd605fc
* Update PHPDoc types in several maintenance scripts and relatedThiemo Kreuz2019-03-071-1/+1
| | | | | | | | | | There is like a billion of these in our core codebase. I would love to update them all. But I don't have the time, at least not to do them all at once. TL;DR: It's an improvement. :-) Change-Id: I0a9c51bdcf0f261f971586bb8703f418324b0f98
* Normalize use of "INNER JOIN" to "JOIN" in database queriesAaron Schulz2019-03-061-1/+1
| | | | | | | The ANSI SQL default join type is INNER and this might save some line breaks here and there. Change-Id: Ibd39976f46ca3f9b71190d3b60b76ca085787a00
* Fix handling categorization changesStanislav Malyshev2018-08-141-9/+137
| | | | | | | | | Previously, we handled categorization changes using wrong assumptions - that rc_cur_id refers to the parent category. Instead, it refers to the child page. Change-Id: I40e886c3548ccca57db7ab83f14ec4dcd804cf2f Bug: T201216
* Use separate insert/delete statements to work around Blazegraph bugStanislav Malyshev2018-08-131-6/+31
| | | | | | | | Bug https://github.com/blazegraph/database/issues/100 happens on DELETE/INSERT but not on separate delete and insert, try to work around it Change-Id: Iba6a98dde6f4bea9051cd6dee91fb19db5eca10e Bug: T201217
* Use array_merge to merge indexed arrays in categoryChangesAsRdf.php.daniel2018-07-021-1/+1
| | | | | Bug: T198356 Change-Id: Ic29568ecfc26da7e6d8c9a875232bfa4e0f9f380
* Create update SPARQL for category changesStanislav Malyshev2018-04-201-0/+542
This script creates SPARQL UPDATE statements for changes in a given time period. These statements can be applied to an existing database to update it. See tests for examples of how the statements look like. Bug: T173774 Change-Id: I9867ad566c0619b55a48a011bd3c55321b1bfcff