Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

core: track deleted resources for "410 Gone" #450

Closed
mworrell opened this Issue Nov 7, 2012 · 11 comments

Comments

Projects
None yet
4 participants
Owner

mworrell commented Nov 7, 2012

We might want to track which resources are deleted, as we can then generate a correct 410 Gone or 301 Permanent Redirect status when such a resource is accessed.

I propose to add the following table to the core:

% Table: rsc_gone
% Tracks deleted or moved resources, adding "410 gone" support
% Also contains new id or new url for 301 moved permanently replies.
% mod_backup is needed to recover a deleted resource's content.

"CREATE TABLE rsc_gone (
    id bigint not null,
    location_id bigint,
    location_uri character varying(250),
    version int not null,
    uri character varying(250),
    name character varying(80),
    page_path character varying(80),
    is_authoritative boolean NOT NULL DEFAULT true,
    creator_id bigint,
    modifier_id bigint,
    created timestamp with time zone NOT NULL DEFAULT now(),
    modified timestamp with time zone NOT NULL DEFAULT now(),
    CONSTRAINT persistent_pkey PRIMARY KEY (id)
)",
"CREATE INDEX rsc_gone_name ON rsc_gone(name)",
"CREATE INDEX rsc_gone_page_path ON rsc_gone(page_path)",
"CREATE INDEX rsc_gone_modified ON rsc_gone(modified)",

Does somebody misses anything?

@mworrell mworrell was assigned Nov 7, 2012

Owner

arjan commented Nov 7, 2012

what are creator / modifer id?
Maybe we need also a deletor id?

Owner

mworrell commented Nov 7, 2012

Those are the original creator id and the modifier is the last modifier, who is also the deleter.

As in "WHO deleted MY content???"

Owner

kaos commented Nov 7, 2012

Wouldn't it be easier with one additional flag in the rsc table indicating a deleted resource?
That would also make it easier to restore. Or is it a bad idea if there's going to be a lot of tombstones?
(either way, there's going to be a way to get rid of the tombstone as well, right?)

Owner

mworrell commented Nov 7, 2012

I like to leave this graveyard out of the rsc table.

I think adding a is_deleted flag to the rsc table is good to mark resources as "deleted but not yet removed", think of a trash can. In that way you can easily add user interfaces to manage those resources.

In another CMS we added extra "publish states" for that: unpublished, published, deleted.

Owner

mmzeeman commented Nov 8, 2012

Nice. What does location_id do?

Owner

mworrell commented Nov 8, 2012

That is "location" as in "location header".

Meant for redirects, when a new old id is replaced by a new id.

Maybe "replacement_id" might be better.

Owner

kaos commented Nov 8, 2012

Just tossin' in a few more suggestions (I too didn't find location_id very clear):
redirect_to_id
target_id
new_id (I like this one, since that is the term you use in the comment above the table)
see_id
refer_to_id

not saying that all of them are good, or even better than replacement_id (just brainstorming)... 🎃

Owner

mworrell commented Nov 8, 2012

I also like "new_id", let's settle on that one!

BTW nice smiley

@mworrell mworrell closed this in 5eee99c Nov 8, 2012

Owner

arjan commented Nov 8, 2012

Sorry to be a PITA... but can you document this feature and the new model as well?
Now that we have docs in the repo let's try to keep them up to date.

@arjan arjan reopened this Nov 8, 2012

Owner

kaos commented Nov 8, 2012

👍

@mworrell mworrell closed this in b772507 Nov 8, 2012

Owner

kaos commented Nov 8, 2012

💯 :)

@rpip rpip pushed a commit to rpip/zotonic that referenced this issue Aug 12, 2013

@mworrell mworrell deps: New webzmachine (for 410 support). Issue #450 bf2c401

@rpip rpip pushed a commit to rpip/zotonic that referenced this issue Aug 12, 2013

@mworrell mworrell docs: added documentation about rsc_gone model. Fixes #450 0495cbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment