summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--feeds.module21
-rw-r--r--includes/FeedsImporter.inc4
-rw-r--r--includes/FeedsSource.inc5
-rw-r--r--plugins/FeedsHTTPFetcher.inc5
-rw-r--r--plugins/FeedsNodeProcessor.inc29
5 files changed, 27 insertions, 37 deletions
diff --git a/feeds.module b/feeds.module
index cbd40e1..6c0142c 100644
--- a/feeds.module
+++ b/feeds.module
@@ -30,8 +30,11 @@ function feeds_cron() {
if ($importers = feeds_reschedule()) {
foreach ($importers as $id) {
feeds_importer($id)->schedule();
- $result = db_query("SELECT feed_nid FROM {feeds_source} WHERE id = '%s'", $id);
- while ($row = db_fetch_object($result)) {
+ $rows = db_select('feeds_source')
+ ->fields('feed_nid')
+ ->condition('id', $id)
+ ->execute();
+ foreach ($rows as $row) {
feeds_source($id, $row->feed_nid)->schedule();
}
}
@@ -396,7 +399,7 @@ function feeds_nodeapi(&$node, $op, $form) {
function _feeds_nodeapi_node_processor($node, $op) {
switch ($op) {
case 'load':
- if ($result = db_fetch_object(db_query("SELECT imported, guid, url, feed_nid FROM {feeds_node_item} WHERE nid = %d", $node->nid))) {
+ if ($result = db_query("SELECT imported, guid, url, feed_nid FROM {feeds_node_item} WHERE nid = :nid", array(':nid' => $node->nid))->fetch()) {
$node->feeds_node_item = $result;
}
break;
@@ -414,7 +417,9 @@ function _feeds_nodeapi_node_processor($node, $op) {
break;
case 'delete':
if (isset($node->feeds_node_item)) {
- db_query("DELETE FROM {feeds_node_item} WHERE nid = %d", $node->nid);
+ db_delete('feeds_node_item')
+ ->condition('nid', $node->nid)
+ ->execute();
}
break;
}
@@ -427,11 +432,15 @@ function feeds_taxonomy($op = NULL, $type = NULL, $term = NULL) {
if ($type =='term' && $term['tid']) {
switch ($op) {
case 'delete':
- db_query("DELETE FROM {feeds_term_item} WHERE tid = %d", $term['tid']);
+ db_delete('feeds_term_item')
+ ->condition('tid', $term['tid'])
+ ->execute();
break;
case 'update':
if (isset($term['importer_id'])) {
- db_query("DELETE FROM {feeds_term_item} WHERE tid = %d", $term['tid']);
+ db_delete('feeds_term_item')
+ ->condition('tid', $term['tid'])
+ ->execute();
}
case 'insert':
if (isset($term['importer_id'])) {
diff --git a/includes/FeedsImporter.inc b/includes/FeedsImporter.inc
index 57d0e01..f868496 100644
--- a/includes/FeedsImporter.inc
+++ b/includes/FeedsImporter.inc
@@ -129,7 +129,9 @@ class FeedsImporter extends FeedsConfigurable {
* from database, does not delete configuration itself.
*/
public function delete() {
- db_query("DELETE FROM {feeds_importer} WHERE id = '%s'", $this->id);
+ db_delete('feeds_importer')
+ ->condition('id', $this->id)
+ ->execute();
$job = array(
'callback' => 'feeds_importer_expire',
'type' => $this->id,
diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc
index b6f2a89..eff59e0 100644
--- a/includes/FeedsSource.inc
+++ b/includes/FeedsSource.inc
@@ -276,7 +276,10 @@ class FeedsSource extends FeedsConfigurable {
foreach ($this->importer->plugin_types as $type) {
$this->importer->$type->sourceDelete($this);
}
- db_query("DELETE FROM {feeds_source} WHERE id = '%s' AND feed_nid = %d", $this->id, $this->feed_nid);
+ db_delete('feeds_source')
+ ->condition('id', $this->id)
+ ->condition('feed_nid', $this->feed_nid)
+ ->execute();
// Remove from schedule.
$job = array(
'callback' => 'feeds_source_import',
diff --git a/plugins/FeedsHTTPFetcher.inc b/plugins/FeedsHTTPFetcher.inc
index 46b7111..f17aaff 100644
--- a/plugins/FeedsHTTPFetcher.inc
+++ b/plugins/FeedsHTTPFetcher.inc
@@ -258,7 +258,10 @@ class PuSHSubscription implements PuSHSubscriptionInterface {
* Delete a subscription.
*/
public function delete() {
- db_query("DELETE FROM {feeds_push_subscriptions} WHERE domain = '%s' AND subscriber_id = %d", $this->domain, $this->subscriber_id);
+ db_delete('feeds_push_subscriptions')
+ ->condition('domain', $this->domain)
+ ->condition('subscriber_id', $this->subscriber_id)
+ ->execute();
}
}
diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc
index 7b09570..7cfc481 100644
--- a/plugins/FeedsNodeProcessor.inc
+++ b/plugins/FeedsNodeProcessor.inc
@@ -91,7 +91,7 @@ class FeedsNodeProcessor extends FeedsProcessor {
}
$result = db_query_range("SELECT nid FROM {feeds_node_item} WHERE id = '%s' AND feed_nid = %d", $source->id, $source->feed_nid, 0, variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE));
while ($node = db_fetch_object($result)) {
- _feeds_node_delete($node->nid);
+ node_delete($node->nid);
$batch->deleted++;
}
if (db_result(db_query_range("SELECT nid FROM {feeds_node_item} WHERE id = '%s' AND feed_nid = %d", $source->id, $source->feed_nid, 0, 1))) {
@@ -406,30 +406,3 @@ class FeedsNodeProcessor extends FeedsProcessor {
return '';
}
}
-
-/**
- * Copy of node_delete() that circumvents node_access().
- *
- * Used for batch deletion.
- */
-function _feeds_node_delete($nid) {
-
- $node = node_load($nid);
-
- db_query("DELETE FROM {node} WHERE nid = %d", $node->nid);
- db_query("DELETE FROM {node_revisions} WHERE nid = %d", $node->nid);
-
- // Call the node-specific callback (if any):
- node_invoke($node, 'delete');
- node_invoke_nodeapi($node, 'delete');
-
- // Clear the page and block caches.
- cache_clear_all();
-
- // Remove this node from the search index if needed.
- if (function_exists('search_wipe')) {
- search_wipe($node->nid, 'node');
- }
- watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title));
- drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_types('name', $node), '%title' => $node->title)));
-}