PHP 中的详细文档修订控制

发布于 2024-08-15 04:48:30 字数 518 浏览 6 评论 0原文

如果我有一个允许用户更改文档的 PHP 应用程序,那么对每个文档实施修订跟踪的最佳方法是什么?我希望每个修订版的存储都可以像 svn 和其他 SCM 那样对代码进行 deltified(即仅保存所做的更改)。我非常简单地知道它是如何工作的,但是当我开始考虑实现它时,我有点困惑。

首先也是最重要的,我想知道是否有一个图书馆可以帮助我解决这个问题,所以我不必完全推出自己的图书馆。

我想知道:我应该只保留原始文档的全文,然后只保存更改,还是应该保留最新文档的全文,每次修改时,将差异保存为其中之一较旧的修订版?

如果是前者,那么当我想抓取一个页面显示在网站上时,我是否必须从头开始,然后根据修订版本递归更新数据,直到达到当前版本?一旦有很多修改,这不是会变得非常缓慢吗?

如何在 PHP 中进行 diff/patch 类型的操作,以使页面的删除和重建更容易?

当他们编辑页面时,锁定页面是否值得?或者让页面进入“冲突状态”并进行冲突解决操作——让两个用户同时修改同一页面,如果他们正在修改不同的部分,等等——我正在疯狂地思考这将是多么困难。啊!

If I have a PHP application which allows users to make changes to documents, what is the best way to implement revision tracking for each document? I want the storage of each revision to be deltified (i.e. only save the changes that were made) like svn and other SCMs do with code. I know on a very simple level how it works, but when I start to think about implementing it, I get a little confused.

First and foremost, I am wondering if there is a library out there that can help me with this, so I don't have to completely roll my own.

And I am wondering: should I keep the full text of only the original document, and then only save the changes, or should I keep the full text of the latest document, and each time it is modified, save the differences as one of the older revisions?

If the former, then when I want to grab a page to be shown on the site, do I have to start at the beginning, and then recursively update the data based on the revisions, until I reach the current version? Won't this be painfully slow once there are many revisions?

How can I do diff/patch type operations in PHP to make the deltifying and reconstructing of the pages easier?

Would it be worth it to have locks on the pages when they're editing them? Or let pages get into 'states of conflict' and have conflict resolution operations -- let two users modify the same page simultaneously if they're modifying different parts, etc -- I'm going crazy thinking about how hard this will be. Ahh!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

骷髅 2024-08-22 04:48:30

这个上一个问题可能会有所帮助。

This previous SO question might help.

耳根太软 2024-08-22 04:48:30

Why don't you use a subversion server? You can access the client from the console using exec() or similar. It is really not worth implementing something like that from scratch unless this you are writing a revisioning software.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文