Updating ProcessLIst upon deleting a feed

Hi,

I'm trying to fix the issue that when deleting a feed, the 'Process list' column is not updated.
Under the delete function of feed_model.php, I am trying to add:

"//$userid from Redis else from session
if (!$this->redis) {
   $userid = $session['userid'];
}
$input_array = $this->input->get_inputs($userid);
foreach ($input_array as $input_key=>$input_value) {
   $inputid = $input_value->id;
   $process_list = $this->input->get_processlist($inputid); //get list using function in input_model.php
   $process_list_array[] = explode(",",$process_list); 
   foreach($process_list_array as $process_key=>$process_value) {
      $element[] = explode(":",$process_value);
      if ($element(1)=="$feedid") {
         unset($process_list_array[$process_key]);    
         $this->input->set_processlist($inputid,implode(",", $process_list_array));
         return true;
      }    
      unset($element);    
   }
   unset($process_list_array);
}"

Idea is to use the already existing 'get_processlist' and 'set_processlist' of input_model.php to accomplish this task.

However when including the input_model.php file in feed_model.php, I ran into an error as feed_model.php is already included in input_controller.php. How to make the relevant link to input_model.php from feed_model.php ?

Thanks

chaveiro's picture

Re: Updating ProcessLIst upon deleting a feed

Hi,

On the new XT8.5 version you have conditional processors that allow to write a simple program that affect the flow and execution order of the processlist items. Kind of assembly programming (if condition->skip next and goto).

If using the skip next process on a processlist, and the next processs is a log to feed that you delete later, you get a wrong behaviour on your processlist programmed logic.

My recommendation is that if you delete a feed then you must manualy review your process lists that used it as part of the task because conditions have changed.

How often you delete feeds anyway?

christophe_meyers's picture

Re: Updating ProcessLIst upon deleting a feed

Was just an aim to make the user experience smooth, as it seems like a silly bug to an outsider.
But am familiar with having to manually control the process lists.
Thanks for the tip nonetheless.

pb66's picture

Re: Updating ProcessLIst upon deleting a feed

I think you both make good points, It isn't clear to the average user what the implications of deleting an active feed are and the ease at which the feed can be deleted doesn't fit the potential results.

I have to agree with chaveiro, you cannot be automatically removing all the feed's references from the processlists. Deleting a feed in that way is definitely going to cause problems. 

The warning message that pops up when deleting a feed should really be expanded to at the very least, inform the user the processlists could be corrupted if the feed is deleted. Better still it shouldn't be possible to delete feeds that are still utilized, so maybe the delete action should actively list the inputs that still have the feed in it's processlist instead of deleting and ask for further "overriding" confirmation before it can be deleted.

Currently a much better method to use when "deleting" a feed is to just rename it eg "TO BE DELETED" with that feed now parked you are free to reuse the name etc, Only when you are sure the "TO BE DELETED" is no longer referenced or active should you permanently delete it (or not). I have recommended this practice many times as I once deleted the wrong feed by accident, totally my fault and the accidentally deleted feed was quite trivial, but as it appeared quite early in most of my processlists the result was I collected no data on 80% of my feeds for a week before I realized and deduced what had gone wrong.

Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.