aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/storage/trackBlobs.php
Commit message (Collapse)AuthorAgeFilesLines
* maintenance: Use type declaration on undocumented private functionsUmherirrender2025-03-311-2/+2
| | | | Change-Id: I2c1bc3b4e0ee782076ddaeae133672b730d345d9
* Replace a number of uses of class aliases with the real thingsJames D. Forrester2025-03-261-0/+1
| | | | | | | Found via disabling phan's alias support for a run (and ignoring wgLang's hard-coded state of being a \Language, alas). Change-Id: I4753bcd84d72d6de111fc7ffc5841fa417bf7333
* externalstore: cleanup ExternalStoreDB::getTable() and fix callersAaron Schulz2024-09-181-1/+3
| | | | | | | | | | | Remove unused $db parameter and make the $cluster required. Update the checkStorage.php callers to provide the cluster. Use the getTable() method in trackBlobs.php to avoid duplication. Mark this method as @internal to the class and /storage scripts. Change-Id: I888040a536a60e22e780900a59e4c34b6c468cdf
* maintenance: Add missing documentation to class propertiesUmherirrender2024-09-131-0/+6
| | | | | | | | | | 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
* maintenance: Use expression builder instead of raw sqlUmherirrender2024-07-221-1/+1
| | | | | Bug: T361023 Change-Id: Ieb229d8088cb1ff3f03e44f7ac99eb612f48bc7b
* rdbms: Create IReadableDatabase::andExpr() / ::orExpr()Umherirrender2024-07-111-2/+1
| | | | | | | | | | | | | | | | | | | | | Avoid the call to internal constructor of AndExpressionGroup and OrExpressionGroup by creating a factory function similiar as the IReadableDatabase::expr function for Expression objects. This is also a replacement for calls to ISQLPlatform::makeList with LIST_AND or LIST_OR argument to reduce passing sql as string to the query builders. Created two functions to allow the return type to be set for both expression group to allow further calls of ->and() or ->or() on the returned object. Depending on the length of the array argument to makeList() it is sometimes hard to see if the list gets converted to AND or OR, having the operator in the function name makes it easier to read, so two functions are helpful in this case as well. Bug: T358961 Change-Id: Ica29689cbd0b111b099bb09b20845f85ae4c3376
* rdbms: Remove IReadableDatabase::getReplicaPos()Amir Sarabadani2024-04-301-2/+1
| | | | | | | Completely unused. Bug: T363839 Change-Id: I041ab5ce57ef116076dcc07b2035b5336ceff032
* maintenance: storage: Fix multiple property declaration phpcs errorsTaavi Väänänen2024-04-211-1/+2
| | | | Change-Id: I74302c9b2818e02d7d5e67a728558ced5e8f0181
* maintenance: Replace unnecessary uses of LBFactory and LoadBalancerBartosz Dziewoński2024-01-231-4/+2
| | | | | | | | | | * Change `$services->getDBLoadBalancerFactory()->waitForReplication()` to `$this->waitForReplication()` * Change various complicated expressions to `$this->getReplicaDB()` and `$this->getPrimaryDB()` * Remove unused variables Change-Id: Ia857be54938a32bb6288dcdf695a35cd38761c3c
* maintenance: Introduce getReplicaDB() and getPrimaryDB()Amir Sarabadani2024-01-181-8/+8
| | | | | | | | | | | | And start using them instead of wfGetDB(), LB/LBF connection methods or worse, $this->getDB(). $this->getDB() reuses the database object regardless of whether you're calling a replica or primary, leading to returning a replica on a primary and other way around. Bug: T330641 Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81
* maintenance: Migrate to expression buildersAmir Sarabadani2024-01-171-2/+2
| | | | | | | This was somehow left out Bug: T210206 Change-Id: I70851b5b99fa865dbfd629caf2c1866c85418350
* Migrate remaining Database::insert calls to InsertQueryBuilderAmir Sarabadani2023-12-221-4/+16
| | | | | | | | | Tests are not checked. There is nothing left as far I can check. Bug: T353219 Change-Id: I1d58397118c7ab1110b9d7cf400c59c4bff7378c
* Use thousands separators in selected integer literalsTim Starling2023-12-121-1/+1
| | | | | | | | | | For readability. Allowed since PHP 7.4. I searched for integer literals of 6 or more digits, and also changed some nearby smaller numbers for consistency. Bug: T353205 Change-Id: I8518e04889ba8fd52e0f9476a74f8e3e1454b678
* maintenance: Migrate $db->buildLike() to expression builderAmir Sarabadani2023-11-061-8/+21
| | | | | Bug: T210206 Change-Id: Ie7bf3701fa9d51a43167ce7ec0c1f30bc090296b
* maintenance: Migrate another batch to SelectQueryBuilderAmir Sarabadani2023-09-211-7/+11
| | | | | | | Around fifty-ish. Found becuase of fixed MigrateSelect. Bug: T344971 Change-Id: If85428d5a033822bfd8ee1f6ab730863bfad55bd
* maintenance: Migrate some Database::select() calls to SQBAmir Sarabadani2023-09-151-17/+12
| | | | | | | | | | | Done semi-automatically via migrateselect[1]. The script only accepted ascii chars until I found out and fixed it and now I can run it in more places. [1] https://gitlab.wikimedia.org/ladsgroup/migrateselect Bug: T344971 Change-Id: I83b6c424c62a517a0ab3635b64488ea53fd88bab
* maintenance: Begin using `Maintenance::getServiceContainer()`Derick Alangi2023-09-041-5/+4
| | | | | | | | | | | Maintenance class provides a method for getting a fresh reference of the MW services container instance. Let's make use of these in maintenance scripts now that we have it. NOTE: There are still some static methods like in refreshLinks.php that makes use of services that we can't use this method for now. Change-Id: Idba744057577896fc97c9ecf4724db27542bf01c
* Simplify WHERE conditions with field IS NULLUmherirrender2023-07-241-1/+1
| | | | | | Reduce raw sql fragments on simple compares Change-Id: I3f2340dfdbf5197cc22546911e6c5653dc5a6269
* maintenance: Switch simple calls of Database::select to SQBAmir Sarabadani2023-07-191-18/+24
| | | | | | | Done semi-automatically via a php parser written on top of ANTLR4. Bug: T311866 Change-Id: I33f5b6703c0aa9c80c907a21c2a770e30642edd3
* Make some storage scripts use Maintenance classdaniel2023-06-141-18/+20
| | | | | | | CommandLineInc is deprecated. This allows the scripts to be executed from MaintenanceRunner. Change-Id: I180605ea5cb47783670b28a6f01d98f0398c705d
* Make use of ?:, ?? and ??= operators in mostly trivial casesthiemowmde2022-12-051-4/+1
| | | | | | | | | | The motivation is to make the code less confusing. I hope this is the case. ?? is an older PHP 7.0 feature. ??= was added in PHP 7.4, which we can finally use. Change-Id: Id807affa52bd1151a74c064623b41d950a389560
* Remove unused local variablesUmherirrender2022-09-191-4/+0
| | | | | | | Various variables are left from ealier refactor are now unused and can be removed to make the code easier to read Change-Id: Id51770af1f08e85c7e7a02234a2cd2ab5b47ee7a
* IDatabase: Rename masterPosWait to primaryPosWaitJames D. Forrester2021-09-021-1/+1
| | | | | | | Hard-deprecating immediately as no known users in git outside of mainteance scripts. Bug: T282894 Change-Id: I072f3d93a9598df719f76f635bfd477737097ad9
* Same code style and formatting for exists-style SQL queriesThiemo Kreuz2021-08-121-1/+1
| | | | | | | | | | | | | | | | Queries that query a value "1" are expected to return either that "1" (possibly as a string), or false. It's safe to simply cast this to bool and use it as it is. Queries for COUNT(*) are expected to return that number, possibly as a string. It's not possible for such a query to return false. And even if, casting to 0 is fine. I found an existing code style where the table name and the "1" are on the same line as the selectField() method name, and applied it to all similar queries. Change-Id: I9453196281871c03ef03f653f43762eb9284342f
* ILoadBalancer and IDatabase: Rename getMasterPos to getPrimaryPosJames D. Forrester2021-08-021-1/+1
| | | | | Bug: T282894 Change-Id: I30a600335af735a13a6ad2d3df56a5f17e05bfab
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-4/+4
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* build: Enable phan-taint-check-plugin and suppress issuesUmherirrender2020-12-301-2/+0
| | | | | | | | | | | | | | | | | | Taint check checks for possible security issues by tracking html escaping and more by using phan. This slows done the phan-job a bit and requires more ram Keep the DoubleEscaped issues out to make reviewer easier Adds suppression for false positives Adds taint-annotation to help taint-check Removes suppression for code phan now understand better by the tracking of keys in taint-check Fix some small issues by adding int cast or htmlspecialchars calls Bug: T216348 Bug: T268920 Change-Id: I849ac4f120fd15b483e8939d4db45c98dc351259
* Suppress taint-check issues in maintenance scripts/cli contextUmherirrender2020-12-071-6/+8
| | | | | | | | all places detected as SecurityCheck-XSS by mediawiki/phan-taint-check-plugin 3.1.0 Bug: T216348 Change-Id: Ib4c8295ad95c2c605fd2f0791e73322f747a00af
* maintenance: Move commandLine from .inc to .phpJames D. Forrester2020-09-281-1/+1
| | | | | | | … and fix the name to match the class. Bug: T184782 Change-Id: Id3d0d0a6b3f2da6316d18eb57804c5a2b697108b
* Pass function name to database functions (maintenance scripts)Umherirrender2020-06-071-4/+4
| | | | | | Useful for logging Change-Id: I79fe037abcd74f56c935abc118d706bef0198124
* Replace wfWaitForSlaves() with LBFactory::waitForReplication()Reedy2020-05-021-4/+5
| | | | Change-Id: I337147d61e2ec686a8672d0340dff4b6783f78cd
* Remove compat code for pre-MCR schema.daniel2020-03-241-18/+9
| | | | | | | | NOTE: This was manually tested to ensure it does not break updates, see T242764. Bug: T198557 Change-Id: I1d9f5465018bae10124514bc38169e23e0e613e6
* Pass 1 always as string to IDatabase::select and friendsUmherirrender2020-01-111-1/+1
| | | | | | Column names or other sql fragments are strings, not integer Change-Id: I7950b6e7ce4fa3b97c8b8ed55c8d7d0119eaac7e
* Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-101-1/+1
| | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* Set method visibility on maintenance scriptsUmherirrender2019-11-161-8/+8
| | | | Change-Id: I44c82fbe65e1d002803ce065df6563f06dd39cd4
* Set public for override of Maintenance functionsUmherirrender2019-10-091-1/+1
| | | | | | | | | | | | The following function are set to public in the parent class and cannot have another visibility in subclasses Maintenance::__construct Maintenance::execute Maintenance::getDbType Maintenance::validateParamsAndArgs Maintenance::setDB Change-Id: I0cd6514642d479aca20f1221bf673b0713c21631
* Convert maintenance scripts to LoadBalancer::getMaintenanceConnectionRef()Aaron Schulz2019-08-021-4/+4
| | | | Change-Id: I8944a052f51a1941ad3b76a40fc9c46d1363c426
* Remove references to field rev_text_idBill Pirkle2019-04-221-11/+34
| | | | | | | | Field rev_text_id is being retired as part of MCR Schema Migration. Remove references to this field from maintenance scripts. Bug: T198341 Change-Id: I43ab93c44cbd0a2a2479baf848f50348e1e4762b
* Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenientBartosz Dziewoński2018-05-301-1/+1
| | | | | | | | | | | | | | Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
* Drop archive.ar_text and ar_flagsBrad Jorsch2018-04-031-19/+0
| | | | | | | | | | This should have been done long ago. Now it is being done. This also changes ar_text_id to NOT NULL, since it should never be null anymore, and DEFAULT 0 in preparation for MCR stopping writing it. Bug: T33223 Change-Id: I18f1c740b7537c7dc3cfeba9b241d0a9f31caa34
* Merge "Replace wfGetLBFactory"jenkins-bot2018-03-091-1/+3
|\
| * Replace wfGetLBFactoryUmherirrender2018-02-271-1/+3
| | | | | | | | | | | | @deprecated since 1.27 Change-Id: I11a7253cebe525948a55cebee183e6de128fdc39
* | Pass '' instead of false for the $conds parameter in select calls.daniel2018-03-021-3/+3
|/ | | | | | | | | Per documentation on IDatabase, $conds must be a string or an array. Passing false for conds is confusing, since it's unclear whether this should match everything or nothing. Bug: T188314 Change-Id: I8be1ac4cbdaafc41aadc2a658be8a99b754b0268
* Move DB errors to Rdbms namespaceAaron Schulz2017-04-151-0/+2
| | | | Change-Id: I463bd86123501abc68fdb78b4cda6110f7af2549
* maintenance: Replace implicit Bugzilla bug numbers with Phab onesJames D. Forrester2017-02-211-2/+2
| | | | | | | | | It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345" except where it doesn't, so let's just standardise on the real numbers. This includes renaming fixBug20757.php to fixT22757.php for similar consistency. Change-Id: If81a590d658fbd82c20c54ac47dfdc8856745ca3
* Rename DB_SLAVE constant to DB_REPLICAAaron Schulz2016-09-051-5/+5
| | | | | | | | | This is more consistent with LoadBalancer, modern, and inclusive of master/master mysql, NDB cluster, and MariaDB galera cluster. The old constant is an alias now. Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
* Change "slave" => "replica DB" in /maintenanceAaron Schulz2016-09-061-1/+1
| | | | Change-Id: Ibd3d617901130378a935402326cd4eefbb382c9e
* Convert all array() syntax to []Kunal Mehta2016-02-171-30/+30
| | | | | | | | | | 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
* Update formatting in maintenance/ (4/4)Siebrand Mazeland2014-04-231-0/+3
| | | | Change-Id: I6b58d014a4bfd6600e4e6f80188fdcfce18482ca