duanla8800 2015-11-20 08:59
浏览 41

Composer / WordPress:应该或不应该提交wp-content目录

So I recently started to use Composer with WordPress based on this tutorial.

This is my composer.json file:

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "wordpress",
                "type": "webroot",
                "version": "4.3",
                "dist": {
                    "type": "zip",
                    "url": "https://github.com/WordPress/WordPress/archive/4.3.zip"
                },
                "require" : {
                    "fancyguy/webroot-installer": "1.0.0"
                }
            }
        }
    ],
    "require": {
        "wordpress": "4.*",
        "fancyguy/webroot-installer": "1.0.0"
    },
    "extra": {
        "webroot-dir": "public/wp",
        "webroot-package": "wordpress"
    }
}

It worked fine, I got this folder structure:

enter image description here

As it was mentioned in the tutorial, I copied index.php, wp-config.php and the wp-content directory outside the wp directory and replaced the paths.

Everything worked perfect until this point:

Regarding housekeeping with your source code management tool. You’d want to ignore the composer.phar file and public/wp directory. Everything else can be committed and pushed.

So it seems like that besides the public/wp folder, everything can be committed and pushed. (including wp-content folder)

Here is the thing that I don't understand. We must commit/push the wp-content directory because it has a different location that it use to have, but in the same time this wp-content folder contains the plugins and themes folder in which our plugins and themes will be added using composer which should not be committed/pushed right ?.

The plugins and themes will be added on the development enviroment also using composer, so we must not commit them, but they are in the wp-content directory which should be committed ?

In another similar tutorial the wp-content is set into the .gitignore file, meaning that it should not be commited/pushed. But If it's like this, who will move (and how) the wp-content outside wp directory on the development enviroment.

Can somebody clarify this aspect please?

  • 写回答

2条回答 默认 最新

  • duan2891 2015-11-23 09:22
    关注

    The idea is: anything generated should not be versioned.

    who will move (and how) the wp-content outside wp directory on the development environment.

    That is a deployment issue, part of release management.
    That means a post-receive hook on the server side would be in charge of generating the right content based on the newly pushed sources, and move/copy the wp-content folder, once its content has been refreshed.

    The general point is: one generally differentiates versioning from deployment. Moving content is something done at deployment, during release management, for instance by a hook which will move the right resources to the right place.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line