1

I had one of my feeds freeze up and I can't unlock it. I did some searching and found a function for adding an unlock tab form this page:

http://drupalcontrib.org/api/drupal/contributions!feeds!feeds.pages.inc/function/feeds_unlock_tab_form/7

<?php
function feeds_unlock_tab_form($form, &$form_state, $importer_id, $node = NULL) {
  if (empty($node)) {
    $source = feeds_source($importer_id);
    $form['#redirect'] = 'import/' . $source->id;
  }
  else {
    $importer_id = feeds_get_importer_id($node->type);
    $source = feeds_source($importer_id, $node->nid);
    $form['#redirect'] = 'node/' . $source->feed_nid;
  }
  // Form cannot pass on source object.
 $form['#importer_id'] = $source->id;
 $form['#feed_nid'] = $source->feed_nid;
 $form['source_status'] = array(
   '#type' => 'fieldset', 
   '#title' => t('Status'), 
   '#tree' => TRUE, 
   '#value' => feeds_source_status($source),
 );
 $form = confirm_form($form, t('Unlock this importer?'), $form['#redirect'], '', t('Delete'), t('Cancel'), 'confirm feeds update');
 if ($source->progressImporting() == FEEDS_BATCH_COMPLETE && $source->progressClearing() == FEEDS_BATCH_COMPLETE) {
   $form['source_locked'] = array(
     '#type' => 'markup', 
     '#title' => t('Not Locked'), 
     '#tree' => TRUE, 
     '#markup' => t('This importer is not locked, therefore it cannot be unlocked.'),
   );
   $form['actions']['submit']['#disabled'] = TRUE;
   $form['actions']['submit']['#value'] = t('Unlock (disabled)');
 }
 else {
   $form['actions']['submit']['#value'] = t('Unlock');
 }
 return $form;
} ?>

File

contributions/feeds/feeds.pages.inc, line 202 Menu callbacks, form callbacks and helpers.

So I know it goes in the feeds.pages.inc but not sure how to implement this. Can someone please point me in the right direction, thanks!

1
  • Well, nothing seemed to work so I cloned the original import and then deleted it. This seems to work. – Brian Aug 17 '12 at 18:10
0

You don't implement that function, it is already implemented by the feeds module.

feeds_menu() adds a menu item that calls that function.

It uses a custom access control function feeds_access(), which gives access to certain feeds actions based on your website's permission settings.

So if you don't have access to unlock a feed then it is likely that you need to give your role permissions to unlock the feed or else have the "administer feeds" permission or be user 1.

0

The easiest way to do this is to execute the following query for the importer that's "stuck", using PHPMyAdmin for example:

UPDATE feeds_source SET state='b:0;', fetcher_result='b:0;';

That's it.

0

Feeds get locked because of an incomplete import. To unlock, that import needs to be either canceled or completed. If you're not seeing those options, you don't have the proper permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.