Jump to content

Module: Process Changelog


teppo

Recommended Posts

I'm having a similar issue as @ceberlin when uploading a CSV file to import pages

Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) (Zeile 1325 in wire/core/WireDatabaseBackup.php)

(I started there: https://processwire.com/talk/topic/26256-allowed-memory-size-of-268435456-bytes-exhausted-tried-to-allocate-4096-bytes-zeile-1325-in-wirecorewiredatabasebackupphp/ which brought me here.)

 

Is there any way to fix this issue other than deactivating/uninstalling the module?

Link to comment
Share on other sites

  • 3 months later...

And I forgot to ask about the "filtering results by edited field" feature. I see it being mentioned in the changelog but how can one use it? I need to deal with a relatively small log, but still too long for clicking around so it shoud work in my case, I guess. I also wonder why we can't see the edited field's name listed in the "What" column. Currently, I have to click on "more" just to see what was edited, but the What column would have a lot of room for this bit of information on my 2k monitor, and even on my laptop screen there is enough room for field names.

Link to comment
Share on other sites

Hello @teppo, me again :)

Ok, instead of asking I should peek under the hood:

On 2/14/2022 at 9:53 PM, szabesz said:

And I forgot to ask about the "filtering results by edited field" feature.

So yeah, we just need to manually edit the query string. Still, my client should be able to do it too, but she will never edit a query string for sure. That is just too alien to her. So could you please add it as a configurable option to the module settings page? The site in question has no extensive log but changes are made weeks and months apart, and my client would like to track them this way. I tested it manually and adding "field" makes no difference for us.

Regarding the RSS link leading to 404, I still have no idea what to check. Maybe you have?

On 2/14/2022 at 9:53 PM, szabesz said:

I also wonder why we can't see the edited field's name listed in the "What" column. Currently, I have to click on "more" just to see what was edited, but the What column would have a lot of room for this bit of information on my 2k monitor, and even on my laptop screen there is enough room for field names.

As for the above, it would be easier and "safer" to ass an "open all/collapse all" button somewhere so that all "more/less" event can be performed in one go. What do you think?

And one more question: have you ever used Changelog and ProDafts alongside? Do they work together? We are planning to purchase ProDafts but it would be great to know how these modules can be useful when run on the same site.

For example, Changelog should only record ProDafts changes published by ProDafts and not "temporary: changes not yet published by ProDafts. This is because as long as we work with drafts, ProDafts shows the changes anyway, but as son as those changes are published, Changelog track what fields were published, therefore actually changed. I hope it makes sense.

Link to comment
Share on other sites

Hey @szabesz,

Sorry for the delayed answer, busy week here ?

On 2/14/2022 at 10:13 PM, szabesz said:

For some reason, on a site running Changelog the public RSS gets redirected to PW's 404 page. Any I idea how I should troubleshoot this? I do not know where to look.

Public RSS feed is rendered by ProcessChangelogRSS module, which hooks into ProcessPageView::pageNotFound. If you can, you could...

a) check if the module gets called properly (by adding some debug code to init() method),

b) check if the hook gets triggered — in which case we could rule out any config setting or key related issues —, and

c) if not, make sure that code in templates or some other module is not preventing the hook from working (URL segments being enabled on the home template is potential culprit, because 404 needs to be triggered in specific way or hooks no longer work as expected).

Of course it could be an issue with the module as well, but it did work last time I used it... which was a while ago ?

2 hours ago, szabesz said:

So yeah, we just need to manually edit the query string. Still, my client should be able to do it too, and she will never edit a query string for sure. That is just too alien to her. So could you please add it as a configurable option to the module settings page?

If I recall correctly, I added this as a sort of "power user feature", so that while it can be used, it's intentionally somewhat obscure. This is in part because the data structure for Process Changelog is really quite awful for that sort of query.

Anyway, I'll look into this (https://github.com/teppokoivula/ProcessChangelog/issues/33?

2 hours ago, szabesz said:

"open all/collapse all" button somewhere so that all "more/less" event can be performed in one go

Makes sense to me. I'll look into this as well (https://github.com/teppokoivula/ProcessChangelog/issues/34).

2 hours ago, szabesz said:

And one more question: have you ever used Changelog and ProDafts alongside? Do they work together? We are planning to purchase ProDafts but it would be great to know how these modules can be useful when run on the same site.

For example, Changelog should only record ProDafts changes published by ProDafts and not "temporary: changes not yet published by ProDafts. This is because as long as we work with drafts, ProDafts shows the changes anyway, but as son as those changes are published, Changelog track what fields were published, therefore actually changed. I hope it makes sense.

That's a quick one: I've never used this combination. In fact I don't think I've ever used ProDrafts, apart from some quick tests way, way back.

If changes made while ProDrafts are made to pages, they'll get logged. If it has a custom data storage or if it prevents hooks from running, then they won't be logged. I don't have a test setup for this at hand, so can't confrim this easily.

There's a hookable method — ProcessChangelogHooks::shouldLogPageEvent($page, $field, $operation) — which you could likely use to prevent Process Changelog from logging such events, at least assuming that there's something about the Page or Field (alone, or in combination with session data, etc.) that makes such edits identificable.

In other words I'm pretty sure that this is doable, but it may well require custom hook. Let me know if you try this, and perhaps I can help with getting that setup up and running. Though, again, I've zero experience with ProDrafts, so... ?

  • Like 1
Link to comment
Share on other sites

Thanks Teppo, all your answers are very helpful!

I will track my feature request at GitHub, thanks for creating them. BTW, did you know that there is a Discussion feature of GitHub so that requests and ideas do not have to "pollute" the "issues"? Maybe you like remembering request by using issues, I do not know, I just wanted to point out this possibility.

Regarding ProDafts, thanks for the hints, first me and my client need to discuss if she can make use of ProDafts in the first place, and if so, then I can at least tell her that I will probably be able to setup the two modules in a way that can support their workflow.

As for the Public RSS feed, I will look into it today following your tips, thanks for that too! (Sidenote: on other sites the feed works fine, only this one and only site which fails for some reason.)

Link to comment
Share on other sites

16 minutes ago, szabesz said:

I will track my feature request at GitHub, thanks for creating them. BTW, did you know that there is a Discussion feature of GitHub so that requests and ideas do not have to "pollute" the "issues"? Maybe you like remembering request by using issues, I do not know, I just wanted to point out this possibility.

Heard of it, but not tried it. For now I think I'd rather keep issues and requests in one place, and discussions here at the forum. Definitely something to keep in mind though ?

  • Like 1
Link to comment
Share on other sites

4 hours ago, teppo said:

b) check if the hook gets triggered — in which case we could rule out any config setting or key related issues —, and

$this->input->get is empty in init()so the hook never gets added. What should I check next?

Link to comment
Share on other sites

5 hours ago, teppo said:

c) if not, make sure that code in templates or some other module is not preventing the hook from working (URL segments being enabled on the home template is potential culprit, because 404 needs to be triggered in specific way or hooks no longer work as expected).

Wait, this might be the issue, I go and check it....

Link to comment
Share on other sites

19 minutes ago, szabesz said:

Wait, this might be the issue, I go and check it....

Yes, that was the issue. Some time ago I added some a template code based "sort url" logic to the home page using URL segments, so that was it when the RSS feed stopped working.

Now I am wondering how else I should go about implementing "short urls", something like this: example.com/xyz-promotion

Do you think that I can use this https://github.com/apeisa/ProcessRedirects/releases for such a thing? I've never seen/used this module before, that's why I'm asking.

Link to comment
Share on other sites

  • 1 year later...

@teppo It's me again :)

I wonder if you could somehow make it possible to optionally log more data in "$details" via hooking into the process, by more data I mean some filed values that has been changed.

if (!empty($fields_edited)) $details['Fields edited'] = implode(", ", $fields_edited);

https://github.com/teppokoivula/ProcessChangelog/blob/49c35bb65ae5642401df062168fa6f4a69dfbf75/ProcessChangelogHooks.module#L595

My use case is that such a feature could make it possible to do detailed debugging. If I could store some additional key data change, then I could reproduce what exactly happened, so that I can replicate the exact issue.

 

Of course, I could just put logging all the data I need in my on code, but having your module do that instead would make an integrated solution.

Link to comment
Share on other sites

@szabesz, this should be possible with the latest version of the module. There's a new hookable method ProcessChangelogHooks::getPageEventDetails:

$wire->addHookAfter('ProcessChangelogHooks::getPageEventDetails', function(HookEvent $event) {

    // getPageEventDetails can return null to prevent saving duplicate entries
    if ($event->return === null) return;

	$event->return = array_merge($event->return, [
		'Custom key' => 'Custom value',
	]);
});

 

  • Like 1
Link to comment
Share on other sites

On 2/18/2022 at 10:26 PM, szabesz said:

Yes, that was the issue. Some time ago I added some a template code based "sort url" logic to the home page using URL segments, so that was it when the RSS feed stopped working.

Now I am wondering how else I should go about implementing "short urls", something like this: example.com/xyz-promotion

Do you think that I can use this https://github.com/apeisa/ProcessRedirects/releases for such a thing? I've never seen/used this module before, that's why I'm asking.

I'm assuming that this problem was resolved already? Just in case: sounds like your home page wasn't throwing Wire404Exception "properly", e.g. providing Wire404Exception::codeFunction as the second argument or by calling wire404() ?

  • Like 1
Link to comment
Share on other sites

On 8/16/2023 at 10:50 AM, teppo said:

There's a new hookable method ProcessChangelogHooks::getPageEventDetails:

$wire->addHookAfter('ProcessChangelogHooks::getPageEventDetails', function(HookEvent $event) {

    // getPageEventDetails can return null to prevent saving duplicate entries
    if ($event->return === null) return;

	$event->return = array_merge($event->return, [
		'Custom key' => 'Custom value',
	]);
});

I should have checked first if there is new version of the module or not, I was banging on open doors... Thanks anyway, the new hookable method is very useful, and not just because I can now save custom data but because I can also skip logging saves performed by hooks only (by setting $event->return to null when a field is only changed by a hook and not by a person).

  • Like 1
Link to comment
Share on other sites

On 8/16/2023 at 10:55 AM, teppo said:

I'm assuming that this problem was resolved already?

Yes, I refactored my code by using URL hooks which is much cleaner anyway.

On 8/16/2023 at 10:55 AM, teppo said:

Just in case: sounds like your home page wasn't throwing Wire404Exception "properly", e.g. providing Wire404Exception::codeFunction as the second argument or by calling wire404()

Maybe. I could dig up the old code to take a look at it but the issue is not important anymore.

Thanks for you support!

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

Hi,
In readme it said that it have an automatic cleanup (I do have Lazy cron installed). How I can verify if it works (or in fact why it doesn't)? The list is growing and it doesn't seems to be deleted since I installed the module 3 years ago!
Thanks
Mel

Link to comment
Share on other sites

  • 7 months later...
On 2/18/2022 at 4:58 PM, teppo said:

Makes sense to me. I'll look into this as well (https://github.com/teppokoivula/ProcessChangelog/issues/34).

Finally got around to implementing this (open/collapse all toggle). Other suggestion, querying by changed field via GUI, is still waiting — though I think I might as well add that one too, just behind an "advanced" toggle in the module config ?

On 12/29/2023 at 10:39 PM, mel47 said:

Hi,
In readme it said that it have an automatic cleanup (I do have Lazy cron installed). How I can verify if it works (or in fact why it doesn't)? The list is growing and it doesn't seems to be deleted since I installed the module 3 years ago!
Thanks
Mel

Have you configured max age for data storage in Process Changelog Hooks module config? If yes, it should "just work".

There is also a "prune data now" toggle that you can use to clean data based on the configured max age setting, but the module should also trigger this check once a day via LazyCron. If that doesn't work, it sounds like there could be some sort of issue on the site, though it's a little difficult to say what; anyway, I'd probably start by making sure that Lazy Cron works for something (e.g. via custom hook).

Link to comment
Share on other sites

On 2/18/2022 at 4:58 PM, teppo said:

This (GUI for querying results by field name) is now available. The "field" filter is disabled by default, but can be enabled via module config screen. Stored data may contain removed fields, so free form input is required, but a simple datalist HTML element seemed to work nicely for providing suggestions based on currently existing fields:

image.png.ae40916330249e05498006e4fa525a88.png

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
1 minute ago, MichaMichaMicha said:

Doesn't seem like the changes made using PageFrontEdit are tracked. Is there a chance this can be added?

Well, i'm using PageFrontEdit to edit repeater fields, so that might also have to do with it.
Doing something like this:
 

<div edit="{$block->id}.body,block_type" id="text-{$block->id}" class="prose">
    {$block->body|noescape}</div>
</div>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...