cameronterry / dark-matter

A highly opinionated domain mapping plugin for WordPress Networks
Other
12 stars 2 forks source link

3.0.0: Domain Mapping conversion to PSR-4 #103

Closed cameronterry closed 1 year ago

cameronterry commented 1 year ago

This PR converts the PHP side of Dark Matter to use the PSR-4 autoloader that is being introduced in 3.0.0.

It will change all the files and the filenames, hopefully in a manner that allows us to retain the Github history / blame records from the old to new.

Backward Compatibility Breakages

Custom functionality using DM_Domain type

DM_Domain, which is an object representation of the domain table record, has now been moved and renamed to \DarkMatter\DomainMapping\Data\Domain\.

All properties are still the same. However any hook usage, such as darkmatter_domain_updated, which has a type check on DM_Domain will now fail.

External mapping/unmapping

The old DM_URL class has now been split into two; Processor\Mapping and Helper. This so there is a separation of concerns regarding the logic which is handling the mapping of various URLs on filters (Processor) and the actual mechanism for replacing the URL between primary and admin domains or vice versa (Helper).

This means the old technique that some codebases may reference will no longer work:

$dm_url = DM_URL::instance();
$dm_url->unmap( 'example.test' );

This will now be:

\DarkMatter\DomainMapping\Helper::instance()->unmap( 'example.test' );