Update deactive part for removing cron schedules
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 15 Sep 2016 17:41:53 +0000 (13:41 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 15 Sep 2016 17:41:53 +0000 (13:41 -0400)
Need to do the wpdb way of getting the feed_import list instead of using
the data abstract way. Data abstract way is not available when the main
member db plugin is deactivated and will cause an error when trying to
run.

deactivate.php

index 74ef441..ebb97e3 100644 (file)
@@ -30,7 +30,6 @@ if (!defined('ABSPATH')) {
     die("Please do not call this code directly!");
 }
 
-require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataFeedImport.php';
 /*
  * This class performs all necessary additional work when this
  * plugin is deactivated.
@@ -76,11 +75,14 @@ class glmMembersEventsPluginDeactivate
     {
         // clear the cron schedule for this plugin
         wp_clear_scheduled_hook( GLM_MEMBERS_EVENTS_PLUGIN_CRON_EVENT );
-        $importFeeds = new GlmDataFeedImport( $this->wpdb, $this->config );
-        $import_feeds = $importFeeds->getList();
+        $import_feeds = $this->wpdb->get_results(
+            "SELECT id
+               FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "feed_import",
+            ARRAY_A
+        );
         if ( $import_feeds ) {
-            foreach ( $import_feeds as $key => &$feed ) {
-                // check the next run time
+            foreach ( $import_feeds as $key => $feed ) {
+                // clear the scheduled hook for this feed_import id
                 wp_clear_scheduled_hook( GLM_MEMBERS_EVENTS_PLUGIN_CRON_EVENT, array( (int)$feed['id'] ) );
             }
         }