There are several locations where the class hierarchy results in duplicate code. Because PHP doesn't support multiple inheritance this becomes more cumbersome than it ought to be. One option would be to use Traits to make shared code more.. shared.

An example would be the database integration for both the source and destination classes. Right now, because of the class architecture, there are copies of get_table_names(), lock_tables(), and others in both backup_migrate_destination_db and backup_migrate_source_db with the exact same code. Using a trait this could be simplified so that there would be e.g. backup_migrate_trait_db that had these methods, and the trait would be added to both of the classes - same results, but only one copy of the methods.

One obvious problem with this idea is that it would bump the module's requirements to PHP 5.4.

CommentFileSizeAuthor
#3 backup_migrate-n2704333-3.patch66.35 KBdamienmckenna

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Might do this in 2019..

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new66.35 KB

First steps - moving the database (and MySQL) methods into shared traits.

damienmckenna’s picture

Thinking through it, if this is committed it would need to be in a v4 branch due to the clear drop in backwards compatibility. Given the life left in Drupal 7 I'm not sure it's worth doing it.

ivnish’s picture

Status: Needs review » Closed (outdated)

Drupal 7 is EOL. This issue will be closed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.