From af668099b54dc2385d52b6bcc1209ac5f5965e3c Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 10 Oct 2019 09:43:55 -0400 Subject: [PATCH] Updating dashboard Add list of plugins with latest_version and how many prod and dev sites need to be updated. --- classes/data/dataPlugins.php | 24 ++++++++++++++++++++---- models/admin/plugins/index.php | 2 +- views/admin/plugins/index.html | 28 ++++++++++++++++------------ 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/classes/data/dataPlugins.php b/classes/data/dataPlugins.php index d41257b..421c380 100644 --- a/classes/data/dataPlugins.php +++ b/classes/data/dataPlugins.php @@ -73,7 +73,7 @@ class GlmDataPlugins extends GlmDataAbstract */ public $fields = false; - public $postOldVersions = false; + public $postStats = false; /** * Constructor @@ -169,15 +169,31 @@ class GlmDataPlugins extends GlmDataAbstract */ public function entryPostProcessing($r, $a) { - if ( $this->postOldVersions ) { + if ( $this->postStats ) { // Get sites that have old versions of this plugin. + $r['oldProdVersions'] = $this->wpdb->get_results( + $this->wpdb->prepare( + "SELECT S.name + FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "sites S + LEFT OUTER JOIN " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins SP ON (S.id = SP.site) + WHERE SP.plugin = %d + AND prod_version != %s + AND prod_version != '-'", + $r['id'], + $r['latest_version'] + ), + ARRAY_A + ); $r['oldDevVersions'] = $this->wpdb->get_results( $this->wpdb->prepare( "SELECT S.name FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "sites S LEFT OUTER JOIN " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins SP ON (S.id = SP.site) - WHERE SP.plugin = %d", - $r['id'] + WHERE SP.plugin = %d + AND dev_version != %s + AND dev_version != '-'", + $r['id'], + $r['latest_version'] ), ARRAY_A ); diff --git a/models/admin/plugins/index.php b/models/admin/plugins/index.php index 1302784..55d8b71 100644 --- a/models/admin/plugins/index.php +++ b/models/admin/plugins/index.php @@ -131,7 +131,7 @@ class GlmMembersAdmin_plugins_index // extends GlmDataEmailMessages // Get list of Plugins. // For this list display sites that need an update. - // $Plugins->postOldVersions = true; + $Plugins->postStats = true; $plugins = $Plugins->getResults( array( 'order' => 'T.name' ) ); // echo '
$plugins: ' . print_r( $plugins, true ) . '
'; diff --git a/views/admin/plugins/index.html b/views/admin/plugins/index.html index 7b59e93..f0e5dc9 100644 --- a/views/admin/plugins/index.html +++ b/views/admin/plugins/index.html @@ -14,17 +14,21 @@ -
-
-
-
-
-
-
-
-
-
-
-
+ + + + + + + + {foreach $plugins as $plugin} + + + + + + + {/foreach} +
PluginLatest VersionProd Sites needing updatesDev Sites needing updates
{$plugin.name}{$plugin.latest_version}{count($plugin.oldProdVersions)}{count($plugin.oldDevVersions)}
{include file='admin/footer.html'} -- 2.17.1