BASH安装WordPress,无需访问wp-admin / install.php

前端之家收集整理的这篇文章主要介绍了BASH安装WordPress,无需访问wp-admin / install.php前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我写了这个创建文件夹的小BASH脚本,解压缩wordpress并为站点创建数据库.

最后一步实际上是安装wordpress,这通常涉及将浏览器指向install.PHP并在GUI中填写表单.

我想从BASH shell执行此操作,但无法弄清楚如何调用wp_install()并将其传递给它所需的参数:

-admin_email
-admin_password
-weblog_title
-用户名

(install.PHP中的第85行)

这是一个类似的问题,but in python

#!/bin/bash

#ask for the site name
echo "Site Name:"
read name
# make site directory under splogs
mkdir /var/www/splogs/$name
dirname="/var/www/splogs/$name"
#import wordpress from dropBox
cp -r  ~/DropBox/Web/Resources/wordpress/Core $dirname
cd $dirname
#unwrap the double wrap
mv Core/* ./ 
rm -r Core
mv wp-config-sample.PHP wp-config.php 
sed -i 's/database_name_here/'$name'/g' ./wp-config.php
sed -i 's/username_here/root/g' ./wp-config.php
sed -i 's/password_here/mypassword/g' ./wp-config.php
cp -r ~/DropBox/Web/Resources/wordpress/Themes/responsive $dirname/wp-content/t$
cd $dirname

CMD="create database $name"
MysqL -uroot -pmypass -e "$CMD"

如何更改脚本以自动运行安装程序而无需打开浏览器?

查看 wp-cli,基于 Drush的Drupal.
wp core install --url=url --title=site-title [--admin_name=username] --admin_email=email --admin_password=password

所有命令:

wp core [download|config|install|install_network|version|update|update_db]
wp db [create|drop|optimize|repair|connect|cli|query|export|import]
wp eval-file
wp eval
wp export [validate_arguments]
wp generate [posts|users]
wp home
wp option [add|update|delete|get]
wp plugin [activate|deactivate|toggle|path|update|uninstall|delete|status|install]
wp post-Meta [get|delete|add|update]
wp post [create|update|delete]
wp theme [activate|path|delete|status|install|update]
wp transient [get|set|delete|type]
wp user-Meta [get|delete|add|update]
wp user [list|delete|create|update]

猜你在找的Bash相关文章