Commit 5e724fcc authored by mh's avatar mh
Browse files

fix path issues within sudo

parent 451aec94
......@@ -62,12 +62,13 @@ def upgrade_wordpress(wd)
# to ensure that we can run the upgrade
log "Starting to upgrade wordpress in #{wd}"
with_tempfile do |tf|
FileUtils.chown(options['run_user'], options['group'], tf)
sudo(run_user_uid,group_gid) do
cmd("find #{shellescape(path)} -user #{options['run_user']} -type d > #{tf}")
cmd("find #{shellescape(path)} -user #{options['run_user']} -type f >> #{tf}")
cmd("find #{shellescape(wd)} -user #{options['run_user']} -type d > #{tf}")
cmd("find #{shellescape(wd)} -user #{options['run_user']} -type f >> #{tf}")
end
on_filelist(File.read(tf),run_user_uid) do |p|
FileUtils.chown( options['sftp_user'], options['group'], p)
FileUtils.chown(options['sftp_user'], options['group'], p)
end
end
......@@ -78,6 +79,7 @@ def upgrade_wordpress(wd)
cmd("#{cmd_prefix}/usr/local/bin/upgrade_wordpress #{shellescape(wd)}")
end
log "Upgrading Wordpress in #{wd} finished."
return true
rescue => e
log "Error while upgrading wordpress in #{wd}: #{e.message}"
return false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment