This adds a way to take any connection to the wiki database and
allow it to be used for unit tests.
This is needed to test code that requires two independent DB
connections, to the same database or to a different wiki's database.
Change-Id: I0b84a0c4d174cbde830786028ee7568c4ea9fb5d
This introduces MediaWikiTestCase::getSchemaOverrides, which can be overwritten
to return information about which tables are going to be altered, and which SQL
files should be used to set up the target schema. This allows tests for a class
that interacts with the database can have a subclass for each supported database
schema.
NOTE: this has only been tested with MySQL.
Bug: T180705
Change-Id: I7a4071072d802a82ecf7d16fbf8882ff8c79287f
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.
This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".
Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
In PostgresSQL
a) Temp tables are automatically deleted upon end of session
b) Same temp table name hides existing table for current session
It is not necessary to consider 'postgres' during dropping of table.
I guess similar logic for Oracle but I could not verify.
It seems that no one use Oracle for MediaWiki.
Bug: T113445
Change-Id: I37b5483a6e9abe5cda0d4dfc103c287641f277a7
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.
Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
This is useful when IMaintainableDatabase methods are needed
for foreign wiki connections to things like external store.
Also:
* Set visibility for ExternalStoreDB methods.
* Cleaned up various type hints and comments.
Change-Id: Ie35b1ff21032cc4e78912dc499486da23aeba041
* Cleanup setDomainPrefix() methods to handle existing LBs/DBs.
* This also makes it set just the prefix as the prefix rather
than as the whole domain.
* Fix regression from 789a54a5f1 where "read" mode of
tablePrefix()/dbSchema() still set the field.
* Make getConnectionRef() always have the domain set.
* Add a check in openConnection() for explicit local
connections, treating $domain as false and avoiding
openForeignConnection().
Bug: T145840
Change-Id: Idf392bd9992a215c4fa3bddf275562f3916596aa
The former extends the later with MW-specific logic.
Also removed a wf* method call from ChronologyProtector.
Change-Id: I325f59b7467ab9c2137731d1ce69816f5a020f03
* Inject wfWikiID() and MWExceptionHandler into LoadBalancer.
* Factor out LBFactory duplication into baseLoadBalancerParams().
* Remove $wgDBtype hack. Presumably, sites with others DBs would
not have multiple servers configured if does not work anyway.
* Make use of injected TransactionProfiler rather than calling
Profiler::instance()->getTransactionProfiler().
* Avoid use of trivial wfSplitWikiID() function.
* Make DBConnRef enforce its arguments more strongly and
optimize getWiki() to avoid causing a connection attempt.
* Avoid deprecated method call in LBFactory::destroyInstance().
Change-Id: If134b62d4f48cd68cb48ccbe149e72f12aa26819
Due to the way prefixes are handled, this doesn't work properly.
Make it quit early to prevent confusion. I don't think there's
many people who need shared table support, so I don't know if
its worth the effort to actually fix.
Bug: 65654
Change-Id: I6cd701998fc9066d8c7a4fc86d93a4282cc7f9bd
Also removed true as second parameter to it from CloneDatabase.php
since it is the default value of that parameter.
Change-Id: I727ebae2bd4df0e26019985ce8c7ce73381c5642
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.
Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
* CloneDatabase - already droping tables in internal function, removed duplicate action
* DatabaseOracle - stopped ignoring "temporary" parameter
* added two parameters to phpunit (use-normal-tables & reuse-db), default actions stay the same
* with reuse-db oracle phpunit test run on oracle down to 1m 20s ;)
It is now duplicateTableStructure() duty to addIdentifierQuotes() them.
Fixed bug for mysql < 4.1 where the new name would be quoted twice.
Always quote identifier in Oracle, doing otherwise seems a bug (can someone confirm?)
The table to drop is the NEW one, the one that is going to be recreated.
Sure, the prefix was changed, which means that we need just the table base.
The r79314 behavior was to perform the following:
DROP /* CloneDatabase::cloneTableStructure */ TABLE IF EXISTS `archive`
CREATE /* DatabaseMysql::duplicateTableStructure */ TEMPORARY TABLE `unittest_archive` (LIKE `archive`)
Luckily, it failed there as it didn't find the table it had just dropped.