Change MySQL backup path
This commit is contained in:
@@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
- Improved SSL certificate error messages by displaying domain IP and server IP
|
- Improved SSL certificate error messages by displaying domain IP and server IP
|
||||||
- Version check before updating WordOps with `wo update` is now directly handled by `wo`
|
- Version check before updating WordOps with `wo update` is now directly handled by `wo`
|
||||||
- Refactored WordOps download function with python3-requests
|
- Refactored WordOps download function with python3-requests
|
||||||
|
- MySQL backup path changed to `/var/lib/wo-backup/mysql`
|
||||||
|
|
||||||
#### Fixed
|
#### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ class WOCleanController(CementBaseController):
|
|||||||
try:
|
try:
|
||||||
Log.info(self, "Cleaning opcache")
|
Log.info(self, "Cleaning opcache")
|
||||||
opgui = requests.get(
|
opgui = requests.get(
|
||||||
"https://127.0.0.1:22222/cache/opcache/opgui.php?reset=1")
|
"https://127.0.0.1:22222/cache/opcache/opgui.php?reset=1",
|
||||||
|
verify=False)
|
||||||
if opgui.status_code != '200':
|
if opgui.status_code != '200':
|
||||||
Log.warn(self, 'Cleaning opcache failed')
|
Log.warn(self, 'Cleaning opcache failed')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -126,12 +126,12 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.wpcli:
|
if pargs.wpcli:
|
||||||
if os.path.isfile('/usr/local/bin/wp'):
|
if os.path.isfile('/usr/local/bin/wp'):
|
||||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
packages = packages + [[
|
||||||
"releases/download/v{0}/"
|
"https://github.com/wp-cli/wp-cli/"
|
||||||
"wp-cli-{0}.phar"
|
"releases/download/v{0}/"
|
||||||
"".format(WOVar.wo_wp_cli),
|
"wp-cli-{0}.phar".format(WOVar.wo_wp_cli),
|
||||||
"/usr/local/bin/wp",
|
"/usr/local/bin/wp",
|
||||||
"WP-CLI"]]
|
"WP-CLI"]]
|
||||||
else:
|
else:
|
||||||
Log.info(self, "WPCLI is not installed with WordOps")
|
Log.info(self, "WPCLI is not installed with WordOps")
|
||||||
|
|
||||||
@@ -168,9 +168,10 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.composer:
|
if pargs.composer:
|
||||||
if os.path.isfile('/usr/local/bin/composer'):
|
if os.path.isfile('/usr/local/bin/composer'):
|
||||||
packages = packages + [["https://getcomposer.org/installer",
|
packages = packages + [[
|
||||||
"/var/lib/wo/tmp/composer-install",
|
"https://getcomposer.org/installer",
|
||||||
"Composer"]]
|
"/var/lib/wo/tmp/composer-install",
|
||||||
|
"Composer"]]
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Composer isn't installed")
|
Log.info(self, "Composer isn't installed")
|
||||||
|
|
||||||
|
|||||||
@@ -344,9 +344,9 @@ class WOFileUtils():
|
|||||||
continue
|
continue
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def writein(self, path, content):
|
def textwrite(self, path, content):
|
||||||
"""
|
"""
|
||||||
Write content in path
|
Write content into a file
|
||||||
"""
|
"""
|
||||||
Log.debug(self, "Writing content in {0}".format(path))
|
Log.debug(self, "Writing content in {0}".format(path))
|
||||||
try:
|
try:
|
||||||
@@ -356,3 +356,16 @@ class WOFileUtils():
|
|||||||
except IOError as e:
|
except IOError as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "Unable to write content in {0}".format(path))
|
Log.error(self, "Unable to write content in {0}".format(path))
|
||||||
|
|
||||||
|
def textappend(self, path, content):
|
||||||
|
"""
|
||||||
|
Append content to a file
|
||||||
|
"""
|
||||||
|
Log.debug(self, "Writing content in {0}".format(path))
|
||||||
|
try:
|
||||||
|
with open("{0}".format(path),
|
||||||
|
encoding='utf-8', mode='a') as final_file:
|
||||||
|
final_file.write('{0}'.format(content))
|
||||||
|
except IOError as e:
|
||||||
|
Log.debug(self, "{0}".format(e))
|
||||||
|
Log.error(self, "Unable to write content in {0}".format(path))
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class WOMysql():
|
|||||||
# Get login details from /etc/mysql/conf.d/my.cnf
|
# Get login details from /etc/mysql/conf.d/my.cnf
|
||||||
# & Execute MySQL query
|
# & Execute MySQL query
|
||||||
connection = WOMysql.connect(self)
|
connection = WOMysql.connect(self)
|
||||||
log and Log.debug(self, "Exceuting MySQL Statement : {0}"
|
log and Log.debug(self, "Executing MySQL Statement : {0}"
|
||||||
.format(statement))
|
.format(statement))
|
||||||
try:
|
try:
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
@@ -93,12 +93,12 @@ class WOMysql():
|
|||||||
import subprocess
|
import subprocess
|
||||||
try:
|
try:
|
||||||
Log.info(self, "Backing up database at location: "
|
Log.info(self, "Backing up database at location: "
|
||||||
"/var/wo-mysqlbackup")
|
"/var/lib/wo-backup/mysql")
|
||||||
# Setup Nginx common directory
|
# Setup Nginx common directory
|
||||||
if not os.path.exists('/var/wo-mysqlbackup'):
|
if not os.path.exists('/var/lib/wo-backup/mysql'):
|
||||||
Log.debug(self, 'Creating directory'
|
Log.debug(self, 'Creating directory'
|
||||||
'/var/wo-mysqlbackup')
|
'/var/lib/wo-backup/mysql')
|
||||||
os.makedirs('/var/wo-mysqlbackup')
|
os.makedirs('/var/lib/wo-backup/mysql')
|
||||||
|
|
||||||
db = subprocess.check_output(["/usr/bin/mysql "
|
db = subprocess.check_output(["/usr/bin/mysql "
|
||||||
"-Bse \'show databases\'"],
|
"-Bse \'show databases\'"],
|
||||||
@@ -114,7 +114,7 @@ class WOMysql():
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, shell=True)
|
stderr=subprocess.PIPE, shell=True)
|
||||||
p2 = subprocess.Popen("/usr/bin/pigz -c > "
|
p2 = subprocess.Popen("/usr/bin/pigz -c > "
|
||||||
"/var/wo-mysqlbackup/{0}{1}.sql.gz"
|
"/var/lib/wo-backup/mysql/{0}{1}.sql.gz"
|
||||||
.format(dbs, WOVar.wo_date),
|
.format(dbs, WOVar.wo_date),
|
||||||
stdin=p1.stdout,
|
stdin=p1.stdout,
|
||||||
shell=True)
|
shell=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user