Closed arthurkazaryants closed 5 years ago
anybody here?
Since I'm not familiar with modDbRegister I do not understand why the second reason your giving is an issue? If you just pass the topic id to the clear method it will clear the messages for the given topic ID as long as modDbRegisterMessage has been changed to registry.db.modDbRegisterMessage.
@artimarkov Why can't you just pass a topic ID? Is this method called from somewhere where it will always pass the topic name instead of the ID?
I've done some tests and below clears all messages with topic id 4 (after fixing the object name first):
$modx->registry->food->clear(4);
@sdrenth yes, we don't use ID. We always calling methods with topic name. Example:
$modx->registry->cartRegistry->send(
'/user_cart/', // <— topic name here
array($session_id => $cart_data),
array('ttl' => 259200)
);
Summary
Register "clear" method doesn't work because of two reasons
package: modx subpackage: registry file: /core/model/modx/registry/moddbregister.class.php class: modDbRegister method: clear (line 72)
First reason: $this->modx->removeCollection throws error. collection name should be replaced:
Second reason: $topic argument can't be passed to remove collection directly. We have to get topic ID first.
Below is candidate to replace whole method:
Environment
MODX Revolution 2.5.4