Skip to content

Commit

Permalink
Legacy installables: ensure installable type is handled correctly
Browse files Browse the repository at this point in the history
The legacy installables app needs to use `module` internally, but the
new installables app uses `extension`. We attempted to handle this in
2e516a7, but accidentally were modifying the `$slug` of the installable
instead. We also didn't correctly ensure that the installable objects
were still constructed with `module`, because that is what they expect.

See #404, 2e516a7
  • Loading branch information
JDGrimes committed Sep 12, 2017
1 parent 63f2ff6 commit 7903d53
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/classes/installables.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public static function register( $type, $slug, $data ) {
/** @var WordPoints_Installables_App $installables */
$installables = wordpoints_apps()->get_sub_app( 'installables' );
$installables->register(
$type
, 'module' === $slug ? 'extension' : $slug
'module' === $type ? 'extension' : $type
, $slug
, 'WordPoints_Installables::installer_loader'
, $data['version']
, ! empty( $data['network_wide'] )
Expand Down Expand Up @@ -263,6 +263,11 @@ public static function wpmu_new_blog( $blog_id ) {
* @return WordPoints_InstallableI The installable object.
*/
public static function installer_loader( $type, $slug ) {

if ( 'extension' === $type ) {
$type = 'module';
}

return new WordPoints_Installable_Legacy(
$type
, $slug
Expand Down

0 comments on commit 7903d53

Please sign in to comment.