bobbingwide / oik-lib

Shared library management for WordPress plugins
https://www.oik-plugins.com/oik-plugins/oik-lib-shared-library-management/
GNU General Public License v2.0
1 stars 0 forks source link

oik-lib should follow the fallback route if a registered library is not found #3

Open bobbingwide opened 8 years ago

bobbingwide commented 8 years ago

Problem statement

In one of my development environments ( qw/wp44 ), when testing the plugin update logic in oik-weight-zone-shipping-pro, I had deactivated all plugins except for oik-weight-zone-shipping-pro and the mu_plugins, which included oik-lib. When oik-lib used the require_lib() method to load the 'class-bobbcomp' library, since oik-weight-zone-shipping-pro had not registered the libraries that it has included in the libs folder, the library file was not 'found' so it wasn't loaded. The directory had however been identified using oik_lib_fallback().

Proposed solution

oik-lib should attempt to locate a library file using the fallback method. This is the technique that a plugin such as oik-weight-zone-shipping-pro, which does not have a dependency on oik, expects to be used.

Workaround

Deactivate the mu-plugins as well. One method is to rename the folder.

bobbingwide commented 7 years ago

There is a similar problem in WordPress Multisite when loading wp-admin on a secondary site, where the library file being loaded has not yet been registered. The fallback logic doesn't get invoked when the OIK_libs class is loaded.