VersionPress-WordPress符合版本控制

With the increasing popularity of version control, most developers are now accustomed to its capabilities. We have tried to extend the use of version control beyond the management of source code — like managing database dumps and designs. Therefore, it is not a surprise that the last few years have seen the application of version control to WordPress too.

随着版本控制的日益普及,大多数开发人员现在已经习惯了其功能。 我们试图将版本控制的使用范围扩展到源代码管理之外,例如管理数据库转储和设计。 因此,最近几年看到版本控制在WordPress上的应用也就不足为奇了。

Earlier this year, I published a post on Revisr, a Git plugin for WordPress. Revisr enabled you to initialize a Git repository within your WordPress source code, and also include database dumps in your backups.

今年早些时候,我 WordPress的Git插件Revisr上发表了一篇文章 。 Revisr使您能够在WordPress源代码中初始化Git存储库,并在备份中包括数据库转储。

Revisr is a great tool, but it’s not fit for everyone. You need to have the basic understanding of Git to be able to use the plugin seamlessly. Also, I believe that it would be difficult for beginners to handle remotes to move their backups to the cloud.

Revisr是一个很棒的工具,但并不适合所有人。 您需要对Git有基本的了解,才能无缝使用插件。 另外,我相信对于初学者来说,处理远程将备份转移到云上将很困难。

This article focuses on VersionPress, another plugin that we’ve previously touched on that tries to apply version control to a WordPress project. Although VersionPress uses Git, there is no mention of Git, as long as you have installed the requirements. It tracks every action that you perform on the WordPress admin panel, enabling you to undo every change, or roll back to the state of that change. One thing that struck me the most was the simplicity of the plugin — there are no unnecessary settings to divide your attention.

本文重点介绍VersionPress ,这是我们之前接触过的另一个插件,试图将版本控制应用于WordPress项目。 尽管VersionPress使用Git ,但只要您已安装要求,就不会提及Git。 它跟踪您在WordPress管理面板上执行的每个操作,从而使您可以撤消每个更改,或回滚到该更改的状态。 最让我印象深刻的一件事是该插件的简单性-没有不必要的设置可以吸引您的注意力。

In my examples, I’ll be using the 1.0-RC3 version of the plugin. Download the plugin, install and activate it. After activation, a new item appears on the left panel. Clicking it takes you to the second step of activation, where the plugin needs to perform a few actions before tracking changes in your WordPress site.

在我的示例中,我将使用该插件的1.0-RC3版本。 下载插件,安装并激活它。 激活后,新项目将出现在左侧面板上。 单击它即可进入激活的第二步,在该步骤中,插件需要执行一些操作才能跟踪WordPress网站中的更改。

VersionPress Requirements

Second step of activation.

激活的第二步。

跟踪整个站点的更改 (Track changes to the whole site)

Let us now explore what VersionPress is capable of. Let us create and publish a new post — “Test Post 1” and see how VersionPress records our actions.

现在让我们探索VersionPress的功能。 让我们创建并发布一个新帖子-“ Test Post 1”,并查看VersionPress如何记录我们的操作。

VersionPress Welcome

Status after creating a post.

创建帖子后的状态。

VersionPress correctly notes that a draft for the post was first created, and then it was published. We will go through undo and roll back in the next section.

VersionPress正确地指出,该帖子的草稿首先被创建,然后被发布。 我们将进行撤消并在下一部分中回滚。

Let us now change a few settings and see what how VersionPress records them.

现在让我们更改一些设置,看看VersionPress如何记录它们。

VersionPress Status

Status after changing settings.

更改设置后的状态。

It is interesting to note that while changing multiple settings, VersionPress only reports one change in the message next to the change. We will get back to this issue later, when we dig into the working of the plugin.

有趣的是,在更改多项设置时,VersionPress仅在更改旁边的消息中报告一项更改。 当我们深入研究插件的工作原理时,我们将回到后面的问题。

Next, we install a plugin and check the changes as reported by VersionPress to make sure it records each change.

接下来,我们安装一个插件并检查VersionPress报告的更改,以确保它记录了每个更改。

VersionPress Update

时光倒流 (Turn Back Time)

As discussed earlier, VersionPress allows you to perform two actions —

如前所述,VersionPress允许您执行两个操作-

  • Revert specific changes without affecting new changes

    还原特定更改而不影响新更改
  • Rollback to the state after a change

    更改后回滚到状态

Let us first undo the settings change in the previous part.

让我们首先撤消上一部分中的设置更改。

Undo in VersionPress

It is worthy to note that although the message showed a single change, an undo affected all the changes I made to the settings.

值得注意的是,尽管该消息仅显示了一个更改,但是撤消操作会影响我对设置所做的所有更改。

Similarly, let us rollback to a plugin install stage.

同样,让我们​​回退到插件安装阶段。

Rollback Example in VersionPress

Another important part to note is that VersionPress only records changes that are made to your database or source code. It can not ascertain whether the process of undo or rollback can break the site. For instance, on activation of the jetpack plugin above, you can see a specific table change too. Rollback or Undo of one can affect the plugin, which is why you should be careful while performing these changes.

要注意的另一个重要部分是VersionPress仅记录对数据库或源代码进行的更改。 无法确定撤消或回滚过程是否可以破坏站点。 例如,在激活上面的jetpack插件时,您也可以看到特定的表更改。 回滚或撤消某个操作可能会影响插件,这就是为什么在执行这些更改时要小心的原因。

检查Git状态 (Check the Git Status)

This is an optional section and you should proceed only if you are familiar with Git, a popular version control solution.

这是可选部分,只有在熟悉流行的版本控制解决方案Git时,才应继续进行操作。

On navigating to the root folder of your WordPress project, you would find that VersionPress has initialized a Git repository. You can check the commits that have been created by running the following command —

导航到WordPress项目的根文件夹时,您会发现VersionPress已初始化Git存储库。 您可以通过运行以下命令来检查已创建的提交:

git status

If you notice carefully, you can see that revert commits are created when you undo a change rather than removing commits.

如果您仔细地注意到,您会看到撤消更改而不是删除提交时创建了恢复提交。

VersionPress Git Status

Also, if you decide to work on the Git repository through the terminal or a GUI client, the custom commits that you create are picked up in the VersionPress log and you can perform undo or roll back operations on them.

另外,如果您决定通过终端或GUI客户端在Git存储库上工作,则您创建的自定义提交将在VersionPress日志中提取,并且您可以对它们执行撤消或回滚操作。

Git Messages

插件的数据库结构 (Database structure of plugin)

If you notice the database schema, there is only one table created by VersionPress — vp_id. This is to link different elements with the same IDs in WordPress like a post, page or a comment, which are treated the same way by VersionPress.

如果您注意到数据库模式,则VersionPress仅创建一个表— vp_id 。 这是为了将WordPress中具有相同ID的不同元素(如帖子,页面或评论)链接在一起,VersionPress对这些元素的处理方式相同。

VersionPress Database

故障排除 (Troubleshooting)

This project is fairly new and there is a high probability of errors. If you find an error, click on the gear on top right and send a bug report to the developers.

该项目是一个相当新的项目,出错的可能性很高。 如果发现错误,请单击右上角的齿轮,然后将错误报告发送给开发人员。

Troubleshooting VersionPress

最后的想法 (Final Thoughts)

We’ve now covered the workings of VersionPress in detail. The developers are soon going to add new features, one of which is to introduce the ability to create backups of your whole project. Separate functionality of database backups is not needed as every change in the database is recorded by VersionPress and you can easily revert them back. Another feature that would be great to have, is the ability to sync the changes in the local repository with the cloud through a remote (although currently, it can be achieved by adding a remote and pushing the changes manually).

现在,我们详细介绍了VersionPress的工作原理。 开发人员将很快添加新功能,其中之一就是引入创建整个项目的备份的功能。 不需要单独的数据库备份功能,因为VersionPress记录了数据库中的每个更改,您可以轻松地将其还原。 另一个很棒的功能是能够通过远程将本地存储库中的更改与云同步的功能(尽管当前,可以通过添加远程并手动推送更改来实现)。

There are also certain issues that might be raised with the use of this plugin in the future. Let us take the example of sporting news site Sportskeeda, which thrives on thousands of contributions from the community daily. Facebook has concluded that Git becomes slower with such a huge number of commits. It would be interesting to see how VersionPress will handle such drawbacks of Git — when Git itself takes up a huge amount of space and multiple people are accessing the site at the same time.

将来使用此插件还会引发某些问题。 让我们以体育新闻网站Sportskeeda为例,该网站每天都获得社区成千上万的贡献。 Facebook得出的结论是,由于提交数量如此之多,Git变得越来越慢。 有趣的是,VersionPress将如何处理Git的此类缺陷-当Git本身占用大量空间并且多个人同时访问该站点时。

I would like to conclude by congratulating the developers on coming up with a wonderful product, which simplifies a complex problem for the masses. If you would like to test the plugin, feel free to get in touch with the VersionPress developers here.

最后,我要祝贺开发人员推出了一款出色的产品,它为大众简化了一个复杂的问题。 如果您想测试该插件,请随时与VersionPress开发人员联系

翻译自: https://www.sitepoint.com/versionpress-wordpress-meets-version-control/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值