Backup versions of content when creating an article, how to implement? (PHP, MySql)?

0 like 0 dislike
7 views
For example in WordPress there is such a thing
20100917-qcqt-19kb.jpg


That is, each article has multiple versions stored after a certain interval with rollback on each of them. Please tell me how this is properly implemented with PHP and MySQl! Thank you
by | 7 views

5 Answers

0 like 0 dislike
targz + cron
by
0 like 0 dislike
Socor is a feature of the system and not PHP+MySQL (though I think it screwed you.)
My website will very + base:
\r
1. tar-cvzf /_mybackups/NAME_www.tgz /home/NAME/public_html /home/NAME/includes — those directories which I need to turn off in the files
\r
2. mysqldump -h localhost -u LOGIN: PASSWORD -d DATABASE > /_mybackups/db_service.sql — remove the dump from the base
\r
3. tar-cvzf /_mybackups/db_service.tgz /_mybackups/db_service.the sql database archive
\r
4. rm /_mybackups/db_service.sql. dump
\r
Thus at the output of the archive database and website
\r
about the crown (Cron) Google — there is nothing complicated. And this is my Kron 4 jobs that you yourself would put what you need frequency. if necessary, you can do versioning by date. to programmirovat don't need anything — just set it and you always have archive that
by
0 like 0 dislike
Most likely there is the structure of the database enables this behavior: when you save the data not update in database are replaced and a new row is added.
\r
The simplest structure with minimal number of required fields looks like this:
— article_id (non-unique)
timestamp
— content
\r
Accordingly when you save the add a new row with the same ID, but more fresh timestampa. During selection — take the most recent (queries with grouping, any additional field being updated with a flag to pefomance).
by
0 like 0 dislike
And somehow, I'm sure that there are simply saved diffs are.
So take wordpress and see how they are stored.
by
0 like 0 dislike
Keep the article in Subversion
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
1,120 users