Overview :

The Save Redirect On Delete module gives the functionality for saving redirects after deletion of entity(supported by pathauto module) having some url alias.
Problem:

  1. Created alias for an entity (say a node) and now node/nid is rendered by "abc" (alias for that node)
  2. When the node is deleted, the alias is deleted as well
  3. In the meantime search engines had indexed that link and you have also bookmarked it
  4. Now when they come to the site it shows Page Not found which is not good

Solution:

  • Add a redirect of abc to a pre-defined page for every Entity (say there is a view for every content type) , "abc" will now have an redirect say "events", and it will never show a page not found

Requirements :

Project Page
https://drupal.org/sandbox/gauravgoyal/2155137

Git Repository :
Use this command to clone this project
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/gauravgoyal/2155137.git save_redirect_on_delete

Other Reviews :

Comments

PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

fernly’s picture

Status: Needs review » Needs work

Hi gaurav.goyal,

Manual review:

  1. save_redirect_on_delete.admin.inc line 9: this is not an implementation of hook_form
  2. save_redirect_on_delete.admin.inc line 11: the parameters are superfluous. You are creating a new admin form so they can be deleted.
  3. save_redirect_on_delete.install line 45: I'm guessing you are not really deleting all pathauto variables. Perhaps a typo in the comment line?
gaurav.goyal’s picture

Hi lennartvv,

Thanks for your reviews (I didnt knew about second point, thnks a lot...:) ).

All points are fixed now.

gaurav.goyal’s picture

Status: Needs work » Needs review
sanchiz’s picture

Status: Needs review » Reviewed & tested by the community

Hi gaurav.goyal,

Results of manual review:
1) 46:save_redirect_on_delete.admin.inc - maybe need to use !itemlabel instead @itemlabel, because I see markup as plain text for taxonomy.
<em class="placeholder">Tags</em>

In general looks great. Thank you!

akshat.khariwal’s picture

Hi Gaurav,

Did a manual review. its a great module.
Noticed just two problems
1. the one which sanchez has conveyed in the last comment.
2. In the function save_redirect_on_delete_save_entity_redirect($type, $entity) on line 120 in save_redirect_on_delete.module, the call to save_redirect_on_delete_path_pattern($entity, $type) must be after you check that alias is not empty. It makes extraneous calls to database.

Cheers!!

akshat.khariwal’s picture

Status: Reviewed & tested by the community » Needs work
gaurav.goyal’s picture

Status: Needs work » Needs review

@sanchiz, @akshat.khariwal

Thanks for pointing out those issues, Issues fixed.

dahousecat’s picture

Just found this thread after having done a review on this thread - why are there 2?

Assuming this is the same project I've given some feedback here about an endless redirection loop after saving a node with a alias that already exists.

mraichelson’s picture

@dahousecat: This issue is in the project applications queue (which is the right place for a project application), the other appears to be in the project's sandbox issue queue (which is a fine place for getting feedback but won't get you approved as a project).

I'm thinking this is probably the "correct" one and the other should be considered the "duplicate".

dahousecat’s picture

Status: Needs review » Needs work

Need a check to prevent endless redirect loop when saving a node with an alias that already exists.

gaurav.goyal’s picture

Guys, Thanks for the reviews..!!

@dahousecat : Thanks for identifying this issue, previously code was written to prevent endless redirect loop but somehow it stopped working, although now it is fixed. Now while creating url alias, redirect for same is checked and if redirect exists then redirect is deleted.

@mraichelson : Yes, this is the correct issue, and the other one is marked duplicated.

gaurav.goyal’s picture

Status: Needs work » Needs review
dahousecat’s picture

Status: Needs review » Needs work

Hi gaurav.goyal,

I can confirm the issue with the endless redirect is fixed :)

I did however find these 3 issues:

  • Could not get it to redirect to my custom URL after visiting a deleted users url alias.
  • After deleting a taxonomy term I got the error message: Notice: Undefined variable: variable in save_redirect_on_delete_path_pattern() (line 78 of /var/www/test/htdocs/sites/all/modules/save_redirect_on_delete/save_redirect_on_delete.module).
  • When I visited the deleted taxonomy terms url alias I did not get redirected.
gaurav.goyal’s picture

Status: Needs work » Needs review

Hi dahousecat,

Thanks for the quick review. Undefined variable bug is fixed now, Can u please review once to confirm.

Thanks.

dahousecat’s picture

Status: Needs review » Needs work

Hi gaurav.goyal,

I can confirm I'm now getting redirected successfully after deleting users, taxonomy terms and nodes. Also the undefined variable bug is fixed.

From a useability point of view I think the module is there :)

There are a few errors on the pareview report but they all look like quick wins.

Fix them and I'll be happy to give you RTBC status.

gaurav.goyal’s picture

@dahousecat,

All Errors given by PAreview are fixed..:)

gaurav.goyal’s picture

Status: Needs work » Needs review
dahousecat’s picture

Status: Needs review » Reviewed & tested by the community

All looks good to me.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Review of the 7.x-1.x branch:

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/save_redirect_on_delete.install
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     5 | ERROR | Doc comment short description must start with a capital letter
    --------------------------------------------------------------------------------
    
    FILE: /home/klausi/pareview_temp/save_redirect_on_delete.module
    --------------------------------------------------------------------------------
    FOUND 7 ERRORS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
       4 | ERROR | Doc comment short description must start with a capital letter
      59 | ERROR | Type hint "array" missing for $path
      97 | ERROR | Type hint "array" missing for $path
     121 | ERROR | Type hint "unknown" missing for $path
     137 | ERROR | Type hint "unknown" missing for $source
     137 | ERROR | Type hint "unknown" missing for $dest
     182 | ERROR | Type hint "unknown" missing for $alias
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. save_redirect_on_delete_install(): No need to set variables upon installation as you can make use of default values with variable_get() anyway.
  2. save_redirect_on_delete_install(): do not juggle with module weights as that is unreliable. Use hook_module_implements_alter() instead if you need to run before/after a specific hook of another module.
  3. save_redirect_on_delete_install(): all variables defined by your module should be prefixed with your module's name to avoid name clashes.
  4. save_redirect_on_delete_path_pattern(): $variable will be undefined if neither case in the switch() is executed. I guess then you must not create any redirect?
  5. "unknown" is not a valid data type in the doc blocks, see https://drupal.org/node/1354#types

But that are not critical application blockers, so ...

Thanks for your contribution, gaurav.goyal!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.