Currently MidCOM provides quite a few testing and migration scripts for various purposes. The scripts all follow their own usage logic and are spread around exec directories of MidCOM core and components themselves.
Instead of this, we need a proper framework in which Midgard, MidCOM and components can provide testing and migration classes that can be collected and presented in a centralized user interface.
The new testing and migration framework must be written so that it can be run in three different situations:
- From command line before MidCOM or Midgard is upgraded to see possible trouble spots
- From the new "Midgard installer" PHP script that will run under plain Apache before Midgard databases are initialized
- From MidCOM itself to do system testing
The classes should be implemented using an interface like this:
interface midgard_test
{
// Check whether this test can be run at all, for example some tests require Midgard connection to be present so QB can be run. Returns boolean
public function can_test();
// Run the test. Returns one of states: MIDGARD_TEST_OK, MIDGARD_TEST_FAIL, MIDGARD_TEST
public function test($verbose = false);
// Check whether this test can perform automatic upgrade or data format conversion, returns boolean
public function can_upgrade();
// Perform automatic upgrade or data format conversion, return boolean
public function upgrade();
}
Some examples of files that should be replaced with this new framework:
- midcom/exec/config-test.php
- midcom/exec/convert_legacy_metadata.php (which actually needs to be upgraded to do the 2.6 -> 2.8 conversion)
- midcom/exec/convert_legacy_topics.php