Skip to content

Commit

Permalink
Return paths for all plugins not only active to detect database chang…
Browse files Browse the repository at this point in the history
…es while activating plugin
  • Loading branch information
mkreckovic committed Feb 13, 2018
1 parent 44b5474 commit 6ce8409
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions plugins/versionpress/.versionpress/hooks.php
Expand Up @@ -426,7 +426,7 @@
/** @var DbSchemaInfo $dbSchema */
$dbSchema = $versionPressContainer->resolve(VersionPressServices::DB_SCHEMA);
$tableSchemaStorage = $versionPressContainer->resolve(VersionPressServices::TABLE_SCHEMA_STORAGE);
$dbSchema->refreshDbSchema(PluginDefinitionDiscovery::getPathsForActivePlugins('schema.yml'));
$dbSchema->refreshDbSchema(PluginDefinitionDiscovery::getPathsForPlugins('schema.yml'));

vp_update_table_ddl_scripts($dbSchema, $tableSchemaStorage);

Expand All @@ -443,7 +443,7 @@
/** @var DbSchemaInfo $dbSchema */
$dbSchema = $versionPressContainer->resolve(VersionPressServices::DB_SCHEMA);
$tableSchemaStorage = $versionPressContainer->resolve(VersionPressServices::TABLE_SCHEMA_STORAGE);
$dbSchema->refreshDbSchema(PluginDefinitionDiscovery::getPathsForActivePlugins('schema.yml'));
$dbSchema->refreshDbSchema(PluginDefinitionDiscovery::getPathsForPlugins('schema.yml'));

vp_update_table_ddl_scripts($dbSchema, $tableSchemaStorage);

Expand Down Expand Up @@ -492,7 +492,7 @@

$dbSchema = $versionPressContainer->resolve(VersionPressServices::DB_SCHEMA);
$tableSchemaStorage = $versionPressContainer->resolve(VersionPressServices::TABLE_SCHEMA_STORAGE);
$dbSchema->refreshDbSchema(PluginDefinitionDiscovery::getPathsForActivePlugins('schema.yml'));
$dbSchema->refreshDbSchema(PluginDefinitionDiscovery::getPathsForPlugins('schema.yml'));

vp_update_table_ddl_scripts($dbSchema, $tableSchemaStorage);

Expand Down
Expand Up @@ -24,13 +24,13 @@ public static function getPathForPlugin($pluginSlug, $definitionFile)
return null;
}

public static function getPathsForActivePlugins($definitionFile)
public static function getPathsForPlugins($definitionFile)
{
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

$plugins = get_option('active_plugins');
$plugins = array_keys(get_plugins());

foreach ($plugins as $pluginFile) {
$pluginSlug = dirname($pluginFile);
Expand Down
6 changes: 3 additions & 3 deletions plugins/versionpress/src/DI/DIContainer.php
Expand Up @@ -92,7 +92,7 @@ public static function getConfiguredInstance()
$dic->register(VersionPressServices::DB_SCHEMA, function () {
global $table_prefix, $wp_db_version;
return new DbSchemaInfo(
PluginDefinitionDiscovery::getPathsForActivePlugins('schema.yml'),
PluginDefinitionDiscovery::getPathsForPlugins('schema.yml'),
$table_prefix,
$wp_db_version
);
Expand All @@ -107,7 +107,7 @@ public static function getConfiguredInstance()
});

$dic->register(VersionPressServices::ACTIONSINFO_PROVIDER_ACTIVE_PLUGINS, function () {
return new ActionsInfoProvider(PluginDefinitionDiscovery::getPathsForActivePlugins('actions.yml'));
return new ActionsInfoProvider(PluginDefinitionDiscovery::getPathsForPlugins('actions.yml'));
});

$dic->register(VersionPressServices::CHANGEINFO_FACTORY, function () use ($dic) {
Expand Down Expand Up @@ -208,7 +208,7 @@ public static function getConfiguredInstance()
});

$dic->register(VersionPressServices::SHORTCODES_INFO, function () {
return new ShortcodesInfo(PluginDefinitionDiscovery::getPathsForActivePlugins('shortcodes.yml'));
return new ShortcodesInfo(PluginDefinitionDiscovery::getPathsForPlugins('shortcodes.yml'));
});

$dic->register(VersionPressServices::SQL_QUERY_PARSER, function () use ($dic) {
Expand Down

0 comments on commit 6ce8409

Please sign in to comment.