diff --git a/.gitignore b/.gitignore index a0aa1d6..94711da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,109 @@ -################################################################################ -# This .gitignore file was automatically created by Microsoft(R) Visual Studio. -################################################################################ - -/MpMigrate.Core/obj/Debug -/MpMigrate.Test/obj/Debug -/MpMigrate/bin/Release -/MpMigrate.Data/obj/Release +# Build Folders (you can keep bin if you'd like, to store dlls and pdbs) +[Bb]in/ +[Oo]bj/ + +# mstest test results +TestResults + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.log +*.vspscc +*.vssscc +.builds + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper* + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Publish Web Output +*.Publish.xml + +# NuGet Packages Directory +packages + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +[Bb]in +[Oo]bj +TestResults +[Tt]est[Rr]esult* +*.Cache +ClientBin +[Ss]tyle[Cc]op.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +_UpgradeReport_Files/ +UpgradeLog*.XML + +*.exe +*.msi +*.zip +*.msu \ No newline at end of file diff --git a/MpImport.v11.suo b/MpImport.v11.suo index b0ae677..3f9615c 100644 Binary files a/MpImport.v11.suo and b/MpImport.v11.suo differ diff --git a/MpMigrate.Core/MigrateManager.cs b/MpMigrate.Core/MigrateManager.cs index 1466ab1..659bdb4 100644 --- a/MpMigrate.Core/MigrateManager.cs +++ b/MpMigrate.Core/MigrateManager.cs @@ -18,6 +18,7 @@ public enum PanelTypes Plesk_11, Plesk_12, Plesk_10, + Plesk_10x, MaestroPanel, Entrenix, Helm, @@ -423,6 +424,9 @@ private void LoadVariations() variationList.Add(new Tuple (PanelTypes.Plesk_10, DatabaseProviders.MYSQL, new Plesk_10_MySql(), new Plesk_10_Discover())); + variationList.Add(new Tuple + (PanelTypes.Plesk_10x, DatabaseProviders.MYSQL, new Plesk_10X_MySql(), new Plesk_10_Discover())); + variationList.Add(new Tuple (PanelTypes.Entrenix, DatabaseProviders.ACCESS, new Entrenix_Access(), new Entrenix_Discover())); @@ -443,6 +447,8 @@ private void LoadVariations() variationList.Add(new Tuple (PanelTypes.Plesk_82, DatabaseProviders.OLEDB_ACCESS, new Plesk_82_Access(), new Plesk_86_Discover())); + + } private void SetSourceDatabaseAutomatically(IDiscovery discover) diff --git a/MpMigrate.Data/Dal/Plesk_10X_MySql.cs b/MpMigrate.Data/Dal/Plesk_10X_MySql.cs new file mode 100644 index 0000000..70994e8 --- /dev/null +++ b/MpMigrate.Data/Dal/Plesk_10X_MySql.cs @@ -0,0 +1,620 @@ +namespace MpMigrate.Data.Dal +{ + using MpMigrate.Data.Entity; + using MySql.Data.MySqlClient; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + + public class Plesk_10X_MySql : DboFactory + { + private string connectionString; + + public override List GetDomains() + { + var tmp = new List(); + + var securePassword = SecurePasswords(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT + domains.id, + domains.name, + domains.name AS fp_adm, + accounts.password, + clients.login, + accounts.password as DomainPass, + domains.status AS STATUS, + Limits.value AS expiration, + domains.htype + FROM domains + LEFT JOIN hosting ON hosting.dom_id = domains.id + LEFT JOIN sys_users ON hosting.sys_user_id = sys_users.id + LEFT JOIN accounts ON accounts.id = sys_users.account_id + LEFT JOIN clients ON clients.id = domains.cl_id + LEFT JOIN Limits ON domains.Limits_id = Limits.id AND Limits.limit_name = 'expiration' ORDER BY domains.name", _conn)) + { + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new Domain(); + _d.Id = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "id")); + _d.Name = DataExtensions.GetColumnValue(_read, "name").ToLower(); + _d.ClientName = DataExtensions.GetColumnValue(_read, "login"); + _d.DomainPassword = securePassword ? DataHelper.GetPassword() : DataExtensions.GetColumnValue(_read, "DomainPass"); + _d.Username = DataExtensions.GetColumnValue(_read, "fp_adm"); + _d.Password = securePassword ? DataHelper.GetPassword() : DataExtensions.GetColumnValue(_read, "password"); + _d.Status = Convert.ToInt64(DataExtensions.GetColumnValue(_read, "STATUS")); + _d.Expiration = DateTime.Now.AddYears(1); + + var hostingType = DataExtensions.GetColumnValue(_read, "htype"); + _d.isForwarding = (hostingType == "std_fwd" || hostingType == "frm_fwd"); + + if (_d.isForwarding) + { + var frw = GetForwarding(_d.Name); + _d.ForwardUrl = frw.ForwardUrl; + } + + _d.Aliases = GetDomainAliases(_d.Name); + _d.Databases = GetDatabases(_d.Name); + _d.Limits = GetDomainLimits(_d.Name); + _d.Subdomains = GetSubdomains(_d.Name); + _d.Zone = GetDnsZone(_d.Name); + _d.Emails = GetEmails(_d.Name); + + tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return tmp; + } + + public override List GetEmails(string domainName) + { + var securePassword = SecurePasswords(); + + var _tmp = new List(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT + mail.mail_name, domains.name, + accounts.password, domains.status, + mail.redirect, mail.redir_addr, mail.mbox_quota + FROM domains + LEFT OUTER JOIN mail ON mail.dom_id = domains.id + LEFT OUTER JOIN accounts ON accounts.id = mail.account_id + WHERE + (mail.mail_name <> '') AND (domains.name = @NAME)", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new Email(); + _d.Name = DataExtensions.GetColumnValue(_read, "mail_name").ToLower(); + _d.DomainName = DataExtensions.GetColumnValue(_read, "name").ToLower(); + _d.Password = securePassword ? DataHelper.GetPassword() : DataExtensions.GetColumnValue(_read, "password"); + _d.Redirect = DataExtensions.GetColumnValue(_read, "redirect"); + _d.RedirectedEmail = DataExtensions.GetColumnValue(_read, "redir_addr"); + + var mboxQuota = Convert.ToDouble(DataExtensions.GetColumnValue(_read, "mbox_quota")); + if (mboxQuota > 0) + _d.Quota = Math.Round(((mboxQuota / 1024) / 1024), 0); + else + _d.Quota = -1; + + _tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override HostLimit GetDomainLimits(string domainName) + { + var _tmp_limits = new List(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT L.limit_name, L.value FROM domains D LEFT JOIN Limits L ON L.id = D.limits_id WHERE D.name = @NAME", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new LimitRow(); + _d.Name = DataExtensions.GetColumnValue(_read, "limit_name"); + + var arrayValue = DataExtensions.GetColumnValue(_read, "value"); + var LimitValue = arrayValue != null ? Convert.ToInt64(Encoding.ASCII.GetString(arrayValue)) : -1; + + if (_d.Name == "disk_space" || _d.Name == "max_traffic" || _d.Name == "mbox_quota" + || _d.Name == "mssql_dbase_space" || _d.Name == "mysql_dbase_space" + || _d.Name == "max_traffic_soft" || _d.Name == "disk_space_soft") + { + _d.Value = (int)((LimitValue / 1024) / 1024); + } + else if (_d.Name == "expiration") + { + + } + else + { + if(LimitValue > int.MaxValue) + throw new InvalidCastException(_d.Name +": "+ LimitValue.ToString()); + + _d.Value = Convert.ToInt32(LimitValue); + } + + _tmp_limits.Add(_d); + } + } + } + _conn.Close(); + } + + return new HostLimit(_tmp_limits); + } + + public override DnsZone GetDnsZone(string domainName) + { + var _tmp = new DnsZone(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT dns_zone.* FROM dns_zone + LEFT JOIN domains ON dns_zone.name = domains.name WHERE domains.name = @NAME", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + _tmp.Name = DataExtensions.GetColumnValue(_read, "name").ToLower(); + _tmp.mininum = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "minimum")); + _tmp.refresh = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "refresh")); + _tmp.retry = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "retry")); + _tmp.expire = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "expire")); + + var serial = DataExtensions.GetColumnValue(_read, "serial"); + _tmp.serial = Convert.ToInt32(serial); + + _tmp.ttl = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "ttl")); + _tmp.Email = DataExtensions.GetColumnValue(_read, "email"); + } + } + } + _conn.Close(); + } + + _tmp.Records = GetZoneRecords(domainName); + + return _tmp; + } + + public override List GetZoneRecords(string domainName) + { + var _tmp = new List(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT dns_recs.* FROM dns_zone + LEFT JOIN dns_recs ON dns_recs.dns_zone_id = dns_zone.id + WHERE dns_zone.name = @NAME AND dns_recs.type <> 'PTR'", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new DnsZoneRecord(); + + var hostName = DataExtensions.GetColumnValue(_read, "host"); + + if (hostName == domainName || hostName == String.Format("{0}.", domainName)) + _d.name = "@"; + else + _d.name = hostName.Split('.').FirstOrDefault().ToLower(); + + + _d.type = DataExtensions.GetColumnValue(_read, "type"); + _d.value = DataExtensions.GetColumnValue(_read, "val").ToLower(); + + var pri = 0; + + var options = DataExtensions.GetColumnValue(_read, "opt"); + + if (int.TryParse(options, out pri)) + _d.priority = pri; + else + _d.priority = 0; + + + _tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override Forwarding GetForwarding(string domainName) + { + var _tmp = new Forwarding(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT D.name, F.redirect FROM domains D JOIN forwarding F ON F.dom_id = D.Id WHERE D.name = @NAME", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + _tmp.Name = DataExtensions.GetColumnValue(_read, "name"); + _tmp.ForwardUrl = DataExtensions.GetColumnValue(_read, "redirect"); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override List GetDomainAliases(string domainName) + { + var _tmp = new List(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT domainaliases.name as alias, domains.name AS domain, domainaliases.status + FROM domainaliases + INNER JOIN domains ON domainaliases.dom_id = domains.id + WHERE domainaliases.status = 0 AND domains.name = @NAME", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new DomainAlias(); + _d.Domain = DataExtensions.GetColumnValue(_read, "domain"); + _d.Alias = DataExtensions.GetColumnValue(_read, "alias"); + _d.Status = Convert.ToInt64(DataExtensions.GetColumnValue(_read, "status")); + + _tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override List GetDatabases(string domainName) + { + var _tmp = new List(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT data_bases.id as db_id, domains.name AS domain, data_bases.name, data_bases.type, + data_bases.db_server_id + FROM data_bases LEFT OUTER JOIN + domains ON domains.id = data_bases.dom_id LEFT OUTER JOIN + db_users ON db_users.id = data_bases.default_user_id + WHERE (domains.name = @NAME)", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new Database(); + _d.Id = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "db_id")); + _d.Name = DataExtensions.GetColumnValue(_read, "name"); + _d.Domain = DataExtensions.GetColumnValue(_read, "domain"); + _d.DbType = DataExtensions.GetColumnValue(_read, "type"); + _d.ServerId = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "db_server_id")); + _d.Users = GetDatabaseUsers(_d.Id); + + _tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override List GetDatabaseUsers(int database_id) + { + var _tmp = new List(); + var securePassword = SecurePasswords(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT db_users.login, accounts.password FROM db_users LEFT JOIN accounts ON db_users.account_id = accounts.id WHERE db_users.db_id = @ID", _conn)) + { + _cmd.Parameters.AddWithValue("@ID", database_id); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new DatabaseUser(); + _d.Username = DataExtensions.GetColumnValue(_read, "login"); + _d.Password = securePassword ? DataHelper.GetPassword() : DataExtensions.GetColumnValue(_read, "password"); + + _tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override List GetSubdomains(string domainName) + { + var _tmp = new List(); + var securePassword = SecurePasswords(); + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT + subdomains.name, + domains.name AS domain, + sys_users.login, + accounts.password + FROM accounts RIGHT OUTER JOIN + sys_users ON accounts.id = sys_users.account_id RIGHT OUTER JOIN + subdomains ON sys_users.id = subdomains.sys_user_id LEFT OUTER JOIN + domains ON subdomains.dom_id = domains.id + WHERE domains.name = @NAME", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", domainName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new Subdomain(); + _d.Domain = DataExtensions.GetColumnValue(_read, "domain"); + _d.Login = DataExtensions.GetColumnValue(_read, "login"); + _d.Password = securePassword ? DataHelper.GetPassword() : DataExtensions.GetColumnValue(_read, "password"); + _d.Name = DataExtensions.GetColumnValue(_read, "name"); + _d.UserType = ""; + + _tmp.Add(_d); + } + } + } + _conn.Close(); + } + + return _tmp; + } + + public override List GetResellers() + { + var tmp = new List(); + var securePassword = SecurePasswords(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT C.id, cname, pname, login, accounts.password, phone, fax, email, address, city, state, pcode, country + FROM clients C LEFT JOIN accounts ON accounts.id = C.account_id WHERE C.`type`='reseller' OR C.`type`='client'", _conn)) + { + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var res = new Reseller(); + res.Id = Convert.ToInt32(DataExtensions.GetColumnValue(_read, "id")); + res.Address1 = DataExtensions.GetColumnValue(_read, "address"); + res.City = DataExtensions.GetColumnValue(_read, "city"); + res.Country = DataExtensions.GetColumnValue(_read, "country"); + res.fax = DataExtensions.GetColumnValue(_read, "fax"); + res.Phone = DataExtensions.GetColumnValue(_read, "phone"); + res.PostalCode = DataExtensions.GetColumnValue(_read, "pcode"); + res.Province = DataExtensions.GetColumnValue(_read, "country"); + + res.FirstName = DataExtensions.GetColumnValue(_read, "pname"); + + res.Password = securePassword ? DataHelper.GetPassword() : DataExtensions.GetColumnValue(_read, "password"); + res.Username = DataExtensions.GetColumnValue(_read, "login"); + res.Email = DataExtensions.GetColumnValue(_read, "email"); + res.Organization = DataExtensions.GetColumnValue(_read, "cname"); + + res.Limits = ResellerLimits(res.Username); + + tmp.Add(res); + } + } + } + _conn.Close(); + } + + return tmp; + } + + public override PanelStats GetPanelStats() + { + var pstats = new PanelStats(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + + #region Disk Space + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT CAST(SUM(httpdocs) AS SIGNED) as httpdocs, + CAST((SUM(dbases)) AS SIGNED) as totaldbsize, + CAST(SUM(mailboxes) AS SIGNED) as totalmailboxsize, + CAST(SUM(subdomains) AS SIGNED) as subdomainsize + FROM disk_usage", _conn)) + { + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + //form MySQL 4 + if (_read["httpdocs"] is System.Int64) + pstats.TotalDomainDiskSpace = Convert.ToDecimal(DataExtensions.GetColumnValue(_read, "httpdocs")); + else + pstats.TotalDomainDiskSpace = DataExtensions.GetColumnValue(_read, "httpdocs"); + + if (_read["totaldbsize"] is System.Int64) + pstats.TotalDatabaseDiskSpace = Convert.ToDecimal(DataExtensions.GetColumnValue(_read, "totaldbsize")); + else + pstats.TotalDatabaseDiskSpace = DataExtensions.GetColumnValue(_read, "totaldbsize"); + + if (_read["totalmailboxsize"] is System.Int64) + pstats.TotalEmailDiskSpace = Convert.ToDecimal(DataExtensions.GetColumnValue(_read, "totalmailboxsize")); + else + pstats.TotalEmailDiskSpace = DataExtensions.GetColumnValue(_read, "totalmailboxsize"); + + if (_read["subdomainsize"] is System.Int64) + pstats.TotalSubdomainDiskSpace = Convert.ToDecimal(DataExtensions.GetColumnValue(_read, "subdomainsize")); + else + pstats.TotalSubdomainDiskSpace = DataExtensions.GetColumnValue(_read, "subdomainsize"); + } + } + } + #endregion + + #region Count + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT + (SELECT COUNT(*) FROM domains) as domaincount, + (SELECT COUNT(*) FROM mail) as mailcount, + (SELECT COUNT(*) FROM clients) as resellercount, + (SELECT COUNT(*) FROM data_bases) as databasecount, + (SELECT COUNT(*) FROM domainaliases) as aliascount, + (SELECT COUNT(*) FROM subdomains) as subdomaincount", _conn)) + { + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + pstats.TotalDomainCount = DataExtensions.GetColumnValue(_read, "domaincount"); + pstats.TotalEmailCount = DataExtensions.GetColumnValue(_read, "mailcount"); + pstats.TotalResellerCount = DataExtensions.GetColumnValue(_read, "resellercount"); + pstats.TotalDatabaseCount = DataExtensions.GetColumnValue(_read, "databasecount"); + pstats.TotalDomainAliasCount = DataExtensions.GetColumnValue(_read, "aliascount"); + pstats.TotalSubdomainCount = DataExtensions.GetColumnValue(_read, "subdomaincount"); + } + } + } + #endregion + + _conn.Close(); + } + + return pstats; + } + + public override HostLimit ResellerLimits(string clientName) + { + var _tmp_limits = new List(); + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT L.limit_name, L.value FROM clients C LEFT JOIN Limits L ON L.id = C.limits_id WHERE C.login = @NAME", _conn)) + { + _cmd.Parameters.AddWithValue("@NAME", clientName); + + using (MySqlDataReader _read = _cmd.ExecuteReader()) + { + while (_read.Read()) + { + var _d = new LimitRow(); + _d.Name = DataExtensions.GetColumnValue(_read, "limit_name"); + + var limitObj = DataExtensions.GetColumnValue(_read, "value"); + var LimitValue = limitObj != null ? Convert.ToInt64(Encoding.ASCII.GetString(limitObj)) : -1; + + if (_d.Name == "disk_space" || _d.Name == "max_traffic" || _d.Name == "mbox_quota" + || _d.Name == "mssql_dbase_space" || _d.Name == "mysql_dbase_space" + || _d.Name == "max_traffic_soft" || _d.Name == "disk_space_soft") + { + _d.Value = (int)((LimitValue / 1024) / 1024); + } + else + { + _d.Value = Convert.ToInt32(LimitValue); + } + + _tmp_limits.Add(_d); + + } + } + } + _conn.Close(); + } + + return new HostLimit(_tmp_limits); + } + + public override void LoadConnectionString(string connectionString) + { + this.connectionString = connectionString; + } + + public override bool SecurePasswords() + { + var securePass = false; + + using (MySqlConnection _conn = new MySqlConnection(connectionString)) + { + _conn.Open(); + using (MySqlCommand _cmd = new MySqlCommand(@"SELECT val FROM misc WHERE param = 'secure_passwords'", _conn)) + { + var secure_passwords = _cmd.ExecuteScalar(); + + if (secure_passwords != null) + bool.TryParse(secure_passwords.ToString(), out securePass); + } + _conn.Close(); + } + + return securePass; + } + } +} diff --git a/MpMigrate.Data/MpMigrate.Data.csproj b/MpMigrate.Data/MpMigrate.Data.csproj index afb8918..31aa776 100644 --- a/MpMigrate.Data/MpMigrate.Data.csproj +++ b/MpMigrate.Data/MpMigrate.Data.csproj @@ -58,6 +58,7 @@ + diff --git a/MpMigrate/Main.Designer.cs b/MpMigrate/Main.Designer.cs index 7ebe217..2152048 100644 --- a/MpMigrate/Main.Designer.cs +++ b/MpMigrate/Main.Designer.cs @@ -1065,6 +1065,7 @@ private void InitializeComponent() "Plesk 12.x", "Plesk 11.x", "Plesk 10.x", + "Plesk 10.x.x", "Plesk 9.x", "Plesk 8.2", "Plesk 8.x", diff --git a/MpMigrate/Main.cs b/MpMigrate/Main.cs index 198735b..66a5ea0 100644 --- a/MpMigrate/Main.cs +++ b/MpMigrate/Main.cs @@ -118,6 +118,9 @@ private PanelTypes SetSourcePanelType() case "Plesk 10.x": ptype = PanelTypes.Plesk_10; break; + case "Plesk 10.x.x": + ptype = PanelTypes.Plesk_10x; + break; case "Plesk 9.x": ptype = PanelTypes.Plesk_95; break; @@ -237,6 +240,9 @@ private void SelectSourcePanel(PanelTypes paneltype) case PanelTypes.Plesk_10: comboSourcePanel.SelectedIndex = comboSourcePanel.FindStringExact("Plesk 10.x"); break; + case PanelTypes.Plesk_10x: + comboSourcePanel.SelectedIndex = comboSourcePanel.FindStringExact("Plesk 10.x.x"); + break; case PanelTypes.Entrenix: comboSourcePanel.SelectedIndex = comboSourcePanel.FindStringExact("Entrenix"); break;