MSI を使用した完全な Windows Server サイト インストールの一部として、C# で Drush を使用して Drupal サイト インストールを実行しようとしています。私が使用している Drush コマンドは次のとおりです。
C:\ProgramData\Drush\Drush.bat -y si application_name --db-url=sqlsrv://admin_name:password(local)\SQLEXPRESS:/database_name --account-name=admin --account-mail=name@test.com --account-pass=Password1234 --site-mail="admin@company.com" --site-name="Site Name" install_configure_form.site_default_country=GB install_configure_form.date_default_timezone="Europe/London"
これは、作業ディレクトリ (inetpub\application_name) で cmd.exe から実行すると完全に機能します。
この問題は、インストール中に上記をコードに入れて実行すると、常に次のエラーが発生する (毎回異なるファイル名で発生する) 場合に発生します。
C:\ProgramData\Drush\lib\druFD63.tmp.gz を解凍できません
コマンドの実行に使用される C# コードは次のとおりです。
public static ActionResult Drush_Configuration(Session session)
{
string strArgs = "-y si application_name --db-url=sqlsrv://admin_name:password(local)\SQLEXPRESS:/database_name --account-name=admin --account-mail=name@test.com --account-pass=Password1234 --site-mail="admin@company.com" --site-name="Site Name" install_configure_form.site_default_country=GB install_configure_form.date_default_timezone="Europe/London";
string strExeCmd = @"C:\ProgramData\Drush\Drush.bat ";
strExeCmd = strExeCmd + strArgs;
string strLocation = @"C:\inetpub\application_name";
session.Log("Starting Drush Configuration");
session.Log("Command line is: " + strExeCmd + " " + strArgs);
int exitCode;
ProcessStartInfo processInfo;
Process process;
try
{
processInfo = new ProcessStartInfo("cmd.exe", "/c " + strExeCmd);
processInfo.WorkingDirectory = strLocation;
processInfo.WindowStyle = ProcessWindowStyle.Normal;
processInfo.CreateNoWindow = true;
processInfo.UseShellExecute = false;
// *** Redirect the output ***
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
process = Process.Start(processInfo);
process.WaitForExit();
// *** Read the streams ***
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
exitCode = process.ExitCode;
session.Log("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output));
session.Log("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error));
session.Log("ExitCode: " + exitCode.ToString(), "ExecuteCommand");
process.Close();
}
catch (Exception e)
{
session.Log("Error: " + e);
return ActionResult.Failure;
}
session.Log("Drush Configuration completed successfully");
return ActionResult.Success;
}
上記のように、これは常に「解凍できません」というエラーになります。
C# を使用して Drush で Site-Install を実行したことのある人はいますか? この方法で実行すると失敗する理由を知っている人はいますか?
ご意見やアドバイスをいただければ幸いです。
Drush-5.8-2012-12-10-Installer-v1.0.20、Drupal 7、および Windows Server 2008 R2 x64 を使用しています。