Fix query for versions. develop
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 30 Oct 2019 12:48:53 +0000 (08:48 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 30 Oct 2019 12:48:53 +0000 (08:48 -0400)
Don't return if dev or prod version is '-'.

models/admin/ajax/pluginListSites.php

index 5b4072f..cc6f526 100644 (file)
@@ -92,22 +92,22 @@ class GlmMembersAdmin_ajax_pluginListSites extends GlmDataSites
                 if ( $server['production'] ) {
                     $whereParts[] = "T.prod_server = " . $server['id'];
                     $whereParts[] = "T.active";
-                    $whereParts[] = "T.id IN (
-                        SELECT site
-                          FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
-                         WHERE prod_version != ''
-                           AND prod_version IS NOT NULL
-                           AND prod_version != '-'
-                    )";
+                    // $whereParts[] = "T.id IN (
+                    //     SELECT site
+                    //       FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
+                    //      WHERE prod_version != ''
+                    //        AND prod_version IS NOT NULL
+                    //        AND prod_version != '-'
+                    // )";
                 } else {
                     $whereParts[] = "T.dev_server = " . $server['id'];
-                    $whereParts[] = "T.id IN (
-                        SELECT site
-                          FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
-                         WHERE dev_version != ''
-                           AND dev_version IS NOT NULL
-                           AND dev_version != '-'
-                    )";
+                    // $whereParts[] = "T.id IN (
+                    //     SELECT site
+                    //       FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
+                    //      WHERE dev_version != ''
+                    //        AND dev_version IS NOT NULL
+                    //        AND dev_version != '-'
+                    // )";
                 }
             } else {
                 die( 'no server given' );
@@ -127,10 +127,19 @@ class GlmMembersAdmin_ajax_pluginListSites extends GlmDataSites
                 ARRAY_A
             );
             if ( $plugin ) {
-                $whereParts[] = "T.id IN (
-                    SELECT site
-                     FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
-                    WHERE plugin = " . $plugin['id'] . ")";
+                if ( $server['production'] ) {
+                    $whereParts[] = "T.id IN (
+                        SELECT site
+                         FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
+                        WHERE plugin = " . $plugin['id'] . "
+                          AND prod_version != '-')";
+                } else {
+                    $whereParts[] = "T.id IN (
+                        SELECT site
+                         FROM " . GLM_MEMBERS_PLUGINS_PLUGIN_DB_PREFIX . "site_plugins
+                        WHERE plugin = " . $plugin['id'] . "
+                          AND dev_version != '-')";
+                }
             }
         }