Closed (fixed)
Project:
Redirect
Version:
8.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Nov 2017 at 10:27 UTC
Updated:
23 Dec 2021 at 21:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
arrubiu commentedComment #3
abaier commentedI would also be interested how I could clear the list to start logging from scratch. A while after the launch we added some redirect patterns, so many of the logged entries should be obsolete now.
Thanks for any help!
Comment #4
arrubiu commentedI made this with a "simple" query, removing records from the table, but a "button" could be useful.
Comment #5
berdirYes, patches that add a button somewhere that executes a truncate query would be great. Maybe on the settings form as we already have a form there.
Comment #6
rajeshwari10 commentedHi,
I have added a Reset button in the existing Settings Form. On clicking the same will truncate all the 404 data from the database.
Adding the patch. Please Review.
Thanks
Comment #7
rajeshwari10 commentedSorry, Removed the unwanted Use statement.
Thanks
Comment #8
berdirThe value must use to t() to be translatable. It should also explain more clearly what it does, e.g. "Clear all 404 log entries".
Submit callbacks don't return anything, there is no need for that.
Also, all functions must be prefixed with the module name and as a submit function, should have a submit suffix, e.g. redirect_404_reset_submit()
Comment #9
pifagorComment #10
pifagorSorry, work patch
Comment #11
pifagorComment #12
mpp commented@berdir, I noticed we still do a lot of hook_form_FORM_ID_alter(), it would be nice if there was a more object oriented way to alter form objects. Would it be an option to extend the
RedirectSettingsFormand alter the route to the extended one? Or is this a bad idea as something else may have changed it before?@pifagor #11, I'd use just one capital here and resetting has two t's:
Comment #13
berdirform alter is fine here. Altering the route is way more complex and only one module can do that. This is a common pattern to add additional settings to forms provided by other modules.
Comment #14
berdirLets add some test coverage for this, shouldn't be complicated, in the existing tests after testing the UI, press the button and then check that the empty message is displayed.
Comment #18
grevil commentedI added appropriate Tests for the "Clear all 404 log entries" button as suggested by @Berdir in #14 See MR above
Until this is commited you can use:
https://git.drupalcode.org/project/redirect/-/merge_requests/4.patch
as patch.
Comment #19
anybodyUpdated the MR to also contain the patch by @pifagor from #11. RTBC +1 from my perspective, well done @pifagor & @Grevil! :)
Comment #20
anybodyLet's bring this to a successful end :) Please review finally, I guess it's ready for takeoff.
Comment #21
petr illekHi,
I tested the patch and it is working as expected.
I was looking for such thing for a long time.
Can we make a new release?
Comment #22
anybodyThank you @Petr Illek so let's finally RTBC this issue.
Comment #24
berdirThanks, committed.