LoginSignup
3
3

More than 5 years have passed since last update.

coreserverでwordmoveが動かない時の解決策

Last updated at Posted at 2014-11-17

VCCWで開発、更新・修正したあとに、wordmoveでポイっとデプロイするのが最近の私のWordPress開発のキモとなりつつあるのですが、coreserverではmysqldumpのパスが違うのか、wordmoveでmysqldumpの処理でコケます。
パスやら色々設定してもダメだったので、諦めてファイルを書き換えることで解決しました。

2015.06.06追記

最初にvagrant sshしたあと、シンボリックリンクを貼る必要があります。(which mysqlなどしてパスを取得後、サーバー側と合わせる)


cd /usr/local && sudo mkdir mysql && cd mysql && sudo mkdir bin && cd bin && sudo ln -s /usr/local/bin/mysqldump mysqldump && ln -s /usr/local/bin/mysql mysql

追記おわり

その後、ファイルを変更する必要がります。

修正箇所は


/usr/local/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/wordmove-1.2.0/lib/wordmove/deployer/base.rb

内の、188行目と199行目をサーバー(リモート)のパスに変更してあげるだけです。viなどで変更します。

      def mysql_dump_command(options, save_to_path)
        arguments = [ "mysqldump" ]
        arguments << "--host=#{options[:host]}" if options[:host].present?
        arguments << "--port=#{options[:port]}" if options[:port].present?
        arguments << "--user=#{options[:user]}" if options[:user].present?
        arguments << "--password=#{options[:password]}" if options[:password].present?
        arguments << "--default-character-set=#{options[:charset]}" if options[:charset].present?
        arguments << options[:name]
        Escape.shell_command(arguments) + " > #{save_to_path}"
      end

      def mysql_import_command(dump_path, options)
        arguments = [ "mysql" ]
        arguments << "--host=#{options[:host]}" if options[:host].present?
        arguments << "--port=#{options[:port]}" if options[:port].present?
        arguments << "--user=#{options[:user]}" if options[:user].present?
        arguments << "--password=#{options[:password]}" if options[:password].present?
        arguments << "--database=#{options[:name]}"
        Escape.shell_command(arguments) + " < #{dump_path}"
      end

これを

      def mysql_dump_command(options, save_to_path)
        arguments = [ "/usr/local/mysql/bin/mysqldump" ]
        arguments << "--host=#{options[:host]}" if options[:host].present?
        arguments << "--port=#{options[:port]}" if options[:port].present?
        arguments << "--user=#{options[:user]}" if options[:user].present?
        arguments << "--password=#{options[:password]}" if options[:password].present?
        arguments << "--default-character-set=#{options[:charset]}" if options[:charset].present?
        arguments << options[:name]
        Escape.shell_command(arguments) + " > #{save_to_path}"
      end

      def mysql_import_command(dump_path, options)
        arguments = [ "/usr/local/mysql/bin/mysql" ]
        arguments << "--host=#{options[:host]}" if options[:host].present?
        arguments << "--port=#{options[:port]}" if options[:port].present?
        arguments << "--user=#{options[:user]}" if options[:user].present?
        arguments << "--password=#{options[:password]}" if options[:password].present?
        arguments << "--database=#{options[:name]}"
        Escape.shell_command(arguments) + " < #{dump_path}"
      end

coreserverの場合はこうするだけ。

仮想環境なのでぶっ壊れても平気ですね!

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3