Skip to Content

The day of stupidity

phaeronix's picture

I think everyone should know this, even if it gets people on my back for a while :P

Today morning was one of these days in which you wish you never woke up.

I was feeling very lazy, didn't want to do anything useful. Then I had a bright idea to update my avatar on eglug.org

Easy enough what could go wrong ? I prepared the image in the GIMP and opened my eglug user page, choose the picture and clicked save. or so I thought.

It seems that i clicked on delete by mistake. Then I didn't read the confirmation message assuming it is confirming the upload / overwrite of the avatar or something.

What followed were the most horrifying hours of my life ( well maybe not THE most , but definitely nerve racking ). My user was deleted, all my posts and comments were orphaned, effectively unpublished.

Thanks to the help of google , MSameer, abouyousef and diaa I was able to reverse the damage. It seems drupal just orphans content that was created by a deleted user. In drupal 4.7 the situation is worse because it assigns all orphaned content to user 0 ( anonymous ).

So all that was needed was an expert mysql insert, graciously provided by Msameer, to manually recreate the missing user. The information added by the insert was stored in the last backup I had. Then diaa reassigned me the user roles.

Lessons learned from this horror story :

  • always carefully read the message in front of you.
  • have recent backups.
  • have useful friends.
  • learn to use google.
  • learn to read the code.
  • Drupal is powerful, and flexible, but it can hurt you ( usually your fault ).
  • Revise your SQL every now and then, you never know when you will need it.

Also stand assured that I would have dealt with the manner in the same way if it was someone else.

I am off to the admin meeting now. I think I will write down minutes in this meeting.

Comments

MSameer's picture

Backups.

That's what I've been yelling about.

Alaa's picture

after you upgrade to 4.7

after you upgrade to 4.7 you might want to consider using orphaned_node module which allows you to pick the user who inherits orphaned nodes and comments (maybe create a special user ملجأ just for this).

Alaa


husband of the Grand Waragi Master

phaeronix's picture

idea

Maybe move deleted users to that shelter too, so they can be "resseructed". Also a deleted content would have the new owner assigned as a revision so on undleteing the user his content goes back to him. is this even remotely possible?

Alaa's picture

I don't know, that's why

I don't know, that's why we never delete users, we block them, only users who get deleted are spammers.

Alaa


husband of the Grand Waragi Master

MSameer's picture

Yes but a user can delet

Yes but a user can delet himself. This is the problem ?

phaeronix's picture

can a user without

can a user without privileges delete himself ?

MSameer's picture

AFAICT for 4.7 he can. I

AFAICT for 4.7 he can.

I had a look at the code but you can also review it.

Alaa's picture

much more useful to

much more useful to actually test it.

Alaa


husband of the Grand Waragi Master

Alaa's picture

nope an unprivileged user

nope an unprivileged user cannot delete herself. nd that applies to 4.7 too

Alaa


husband of the Grand Waragi Master

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Dr. Radut | blog