Skip to content

Commit

Permalink
[Batch] Change State: pass only affected items to table and event (jo…
Browse files Browse the repository at this point in the history
…omla#22851)

* Publish only affected pks

* Publish only affected pks

* Code style
  • Loading branch information
dneukirchen authored and mbabker committed Nov 5, 2018
1 parent f3a23da commit efd10de
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/src/MVC/Model/AdminModel.php
Expand Up @@ -1061,9 +1061,23 @@ public function publish(&$pks, $value = 1)

return false;
}

// Prune items that are already at the given state
if ($table->get($table->getColumnAlias('published'), $value) == $value)
{
unset($pks[$i]);

continue;
}
}
}

// Check if there are items to change
if (!count($pks))
{
return true;
}

// Attempt to change the state of the records.
if (!$table->publish($pks, $value, $user->get('id')))
{
Expand Down

0 comments on commit efd10de

Please sign in to comment.