User tests: Successful: Unsuccessful:
Com_redirect will quickly gather hundreds if not thousands of links if enabled (with gather urls option).
Currently the only way to remove them is to manually select them and use the delete button on the toolbar which is a real pain when you have more than a few hundred.
This PR adds a new toolbar button "Purge Unpublished" which when selected will delete all links that are not published.
To test make sure you enable that the Redirect Plugin is enabled and the option 'Collect URLs' is enabled. Generate some fake urls on the front end. Check to make sure they are displayed in the admin as unpublished links. Press the button and voila they are gone.
(Please be gentle this is my first PR that effects the full MVC triad)
Status | New | ⇒ | Pending |
Labels |
Added:
?
?
|
Labels |
Added:
?
|
Category | ⇒ | Administration Language & Strings |
Rel_Number | 0 | ⇒ | 6962 |
Relation Type | ⇒ | Pull Request for | |
Easy | No | ⇒ | Yes |
I tested out your code... a nice and welcomed feature if you ask me. I did notice a few things though...
To be perfectly honest I didnt even know you could have a status of anything other than enabled/disabled as com_redirects list view really doesnt follow the same behaviour as other components.
My personal view is that it should probably only remove unpublished/disabled links which means that the query needs changing and not the strings - I guess it depends on what others think.
My personal view is that it should probably only remove unpublished/disabled links which means that the query needs changing and not the strings
I agree with that as well.
I then would suggest updating the models/links.php query delete line to be...
$query->delete('#__redirect_links')->where($db->qn('published') . '= 0');
didn't thought about it but a "anything = 0" is much more better
Should also be faster I think. At least in theory.
Whatever you decide I will update just let me know
On 30 July 2015 at 18:41, Thomas Hunziker notifications@github.com wrote:
Should also be faster I think. At least in theory.
—
Reply to this email directly or view it on GitHub
#7586 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
$query->delete('#__redirect_links')->where($db->qn('published') . '= 0');
is correct if it should only delete unpublished items. Which I think is the most useful behavior.
I have updated the query as suggested
Milestone |
Added: |
I think we can improve the code a bit. Instead of store the message in the model and use it in controller (via _message property), the purge method in model should only return true or false. Then the purge method in controller can check and return value of the model and display the corresponding message.
@joomdonation perhaps but this code is written exactly the same way as similar functionality already in the core
I have just tested it successfully! Very nice feature.
I also tested, that "archived" links are not deleted with the new Purge Button.
1) Enabled Redirect Plugin and "Collect URLs"
2) Opened Frontend and created fake URLs
3) Marked some of them in the Redirect Plugin as "archived"
4) Clicked on the Button "Purge Unpublished"
5) Only the "unpublished" links were deleted
@brianteeman I made a PR brianteeman#15 to show how the code should look like. I think it's better then the original code (not sure where you see that code in Joomla core but I guess there is not much code like that). Hope the maintainer who check this PR will decide what code to use.
You can find it in com_installer, com_joomlaupdate
On 26 August 2015 at 15:49, Tuan Pham Ngoc notifications@github.com wrote:
@brianteeman https://github.com/brianteeman I made a PR brianteeman#15
brianteeman#15 to show how the code
should look like. I think it's better then the original code (not sure
where you see that code in Joomla core but I guess there is not much code
like that). Hope the maintainer who check this PR will decide what code to
use.—
Reply to this email directly or view it on GitHub
#7586 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
I tested the purge like @kathastaden. It was successfull and worked like expected
I've merged the contribution from @joomdonation - I guess it needs retesting now
It works. Great job. Thanks.
Status | Pending | ⇒ | Ready to Commit |
Works great thanks @brianteeman moving to RTC based on the lest testing.
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-10-24 07:23:54 |
Closed_By | ⇒ | roland-d |
Labels |
Removed:
?
|
code doesn't looks bad, the query should be changed to