sh WordPress安装为git子模块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh WordPress安装为git子模块相关的知识,希望对你有一定的参考价值。

# Create the basic site structure
# Web server points to public/ keeping configuration outside of webroot
$ mkdir site && cd site
$ mkdir conf/ public/

# Init repo
$ git init && git add . && git commit -m 'Init commit'

# Install WP as submodule to public/
$ git submodule add git://github.com/WordPress/WordPress.git public/wp-core

# Make copies of the WP elements we need as to not modify the submodule

# Copy wp-content/, index.php and the config file
$ cp -R public/wp-core/wp-content public
$ cp public/wp-core/index.php public
$ cp public/wp-core/wp-config-sample.php conf/wp-conf.php

# Make a new config file that points to the one outside of public/
$ echo "<?php"$'\n'$'\n'"require dirname(__DIR__) . '/conf/wp-conf.php';" > public/wp-config.php

# Now you should have a site structure that looks something like this:
├── conf
│   └── wp-conf.php
├── .git
├── .gitignore
├── .gitmodules
├── public
│   ├── index.php
│   ├── wp-config.php
│   ├── wp-content
│   └── wp-core
└── wp-cli.yml

# The YML file for wp-cli defines the path to the core
path: public/wp-core

# Good idea to commit the repo again
$ git add -A && git commit -m "Installed WordPress as submodule"

# Last step is to configure files

# Configure public/index.php by replacing path to file
$ sed -i 's/wp-blog-header.php/wp-core\/wp-blog-header.php/' public/index.php

# Configure conf/wp-config.php like normal
# Add the following constants

define( 'APP_ROOT', dirname(__DIR__) );
define( 'WP_HOME', 'http://siteurl.com' );
define( 'WP_SITEURL', WP_HOME . '/wp-core' );
define( 'WP_CONTENT_URL', WP_HOME . '/wp-content' );
define( 'WP_CONTENT_DIR', APP_ROOT . '/public/wp-content' );

以上是关于sh WordPress安装为git子模块的主要内容,如果未能解决你的问题,请参考以下文章

linux下将java程序安装为服务自启动

linux下将java程序安装为服务自启动

sh 将子模块添加到git项目

sh git子模块的模板命令

sh 删除git子模块但保留文件

sh 拉最新的所有Git子模块