sh 此脚本在子目录中安装WordPress

Posted

tags:

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

#!/bin/bash

# Installation:
  
# Install the script in one of the folders in your PATH. Make sure it has execute permissions (i.e. chmod +x wp-install-core-sub-dir).
  
#Usage:
  
# $ mkdir mysite
# $ cd mysite
# $ wp-install-core-sub-dir

# This is a simple script as an example, it could be improved by accepting parameters etc.

CORE_DIR=wp
DB_NAME=wpclitest
DB_USER=user
DB_PASS=pass

SITE_URL=http://wpclitest.dev/ 
SITE_TITLE='WordPress CLI Test Site'
SITE_USER=admin
SITE_PASS=password
SITE_EMAIL=your@email.com

# create the dir for the core files
mkdir $CORE_DIR
cd $CORE_DIR

# download WordPress files
wp core download
cd ../

# create the wp-config.php file
wp core config --dbname=$DB_NAME --dbuser=$DB_USER --dbpass=$DB_PASS --path=$CORE_DIR

# create the dabase
wp db create

# install WordPress (less than 5 mins)
wp core install --url=$SITE_URL --title="$SITE_TITLE" --admin_user=$SITE_USER --admin_password=$SITE_PASS --admin_email=$SITE_EMAIL --path=$CORE_DIR

# Copy (not move) index.php file to root
cp "$CORE_DIR/index.php" ./index.php

# Edit index.php to point to correct path of wp-blog-header.php
sed -i '' "s/\/wp-blog-header/\/$CORE_DIR\/wp-blog-header/g" index.php

# Update the siteurl in the database with sub directory path
wp option update siteurl $(wp option get siteurl)/$CORE_DIR

# Uncomment the below line if you want the config in root
#cp "$CORE_DIR/wp-config.php" ./wp-config.php

echo 'Install finished!'

以上是关于sh 此脚本在子目录中安装WordPress的主要内容,如果未能解决你的问题,请参考以下文章

sh 在Laravel Homestead中安装MSSQL的脚本(阅读评论)

sh 在Linux中安装JBoss Wildfly 10.x作为服务的脚本

wordpress中安装插件需要ftp服务怎么破

在wordpress中安装主题所需的连接信息

如何在ubuntu中安装pycharm

在 wordpress 中安装 jquery 插件?