Prime Mover 1.3.5 includes important bug fixes as part of the usual 2 weeks maintenance release cycle.
- Fixed: Errors due to PHP Archive Library conflict.
- Fixed: Errors due to WP Config Transformer library conflict.
- Fixed: Errors due to PHP MySQLDump Library conflict.
- Usability: Added licensing guide on account details page.
- Usability: Added licensing guide on license key activation dialog.
Change details – The problem
Prime Mover uses composer auto-loader to load third party libraries. These libraries are used in important processes. For example, for dumping database, handling config changes and for archiving/extracting files. These libraries are pretty stable, reliable and is considered industry standard. However due to the fact that these libraries can also be used by other plugins – this is where the problem starts.
For example, when using composer auto-loading – it will load the library once its found as determined by its namespace. Say plugin A and plugin B both use MySQLDump library. However plugin B uses MySQLDump Library version 3.0 while plugin A uses version 1. Let’s assume there are tons of differences between version 1.0 and version 2.0 and that they are backward incompatible.
If both plugins are activated in the site, composer will load only version 1.0 if Plugin A is the first plugin to be loaded. So even though plugin B requires version 3.0, version 1.0 of the library is actually loaded. Things like this cause tons of issues, unpredictable errors and other inconsistencies. The end result will be numerous bugs 🙂
Other notable issues caused by this problem is the error “Fatal error: Cannot declare class WPConfigTransformer, because the name is already in use“. It is because some plugins are not using auto-loading but uses this library in the PHP require statements that is always loaded in runtime. This results to fatal error to any other activated plugins that also uses WPConfigTransformer library. It is because if the class will be loaded again via auto-loader, it is not possible because it is being loaded already.
The solution – scoped namespace
The best solution to the problem above is scoped name-spacing. This works by providing the library a unique namespace such that it is only used by Prime Mover. The end result is that when the process asks for MySQLDump library (as illustrated previously) – it is guaranteed to always use version 3.0 since it is name spaced uniquely.
Other libraries can never interfere the backup/migration processes because Prime Mover libraries are isolated from other plugins.
This is all made possible, thanks for PHP Scoper library.
Prime Mover added a help guide link when a PRO user encounter issues activating license key. The usual reasons will be corrupted Freemius user data that is always fixed by resetting the license. This guide is now added in the account page and license key activation dialog.
The next step would be scoped namespace the libraries used by the PRO version as well. Version 1.3.5 fixes the issue found in the free version since it is the most commonly used. Version 1.3.6 (released approximately 2 weeks from now) will scoped namespace third party libraries used by the PRO versions.