Skip to content
Snippets Groups Projects
Commit d778cf99 authored by megachriz's avatar megachriz Committed by Megachriz
Browse files

Issue #2867189 by MegaChriz: Added a method to FeedsSource to unlock a feed.

parent 183f384c
No related branches found
No related tags found
No related merge requests found
......@@ -252,17 +252,13 @@ function feeds_unlock_tab_form($form, &$form_state, FeedsImporter $importer = NU
* Form submit handler. Resets all feeds state.
*/
function feeds_unlock_tab_form_submit($form, &$form_state) {
drupal_set_message(t('Import Unlocked'));
$form_state['redirect'] = $form['#redirect'];
$feed_nid = empty($form['#feed_nid']) ? 0 : $form['#feed_nid'];
$importer_id = $form['#importer_id'];
//Is there a more API-friendly way to set the state?
db_update('feeds_source')
->condition('id', $importer_id)
->condition('feed_nid', $feed_nid)
->fields(array('state' => FALSE))
->execute();
feeds_source($importer_id, $feed_nid)
->unlock();
drupal_set_message(t('Importer unlocked.'));
}
/**
......
......@@ -625,6 +625,15 @@ class FeedsSource extends FeedsConfigurable {
return $this->importer->processor->itemCount($this);
}
/**
* Unlocks a feed.
*/
public function unlock() {
$this->clearStates();
$this->save();
$this->releaseLock();
}
/**
* Save configuration.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment