예제 #1
0
 public void UpdateEDD()
 {
     //avoid dd attacks killing server
     if (!HttpContext.Current.Request.IsLocal)
     {
         return;
     }
     DefectPlan.UpdateEDD();
 }
예제 #2
0
    public static void SendVersionAlarm()
    {
        string details = "";
        string version = "";
        Git    git     = new Git(Settings.CurrentSettings.TEMPGIT);

        foreach (var f in git.GetTopCommit().EnumFiles())
        {
            if (f.Name.ToLower().Contains("changelog.txt"))
            {
                foreach (var d in f.Diff)
                {
                    if (d.StartsWith("+"))
                    {
                        string line = d.Substring(1).Replace("<", "&lt;").Replace(">", "&gt;").Trim();
                        if (line.StartsWith("=="))
                        {
                            version = line.Replace("=", "").Trim();
                        }
                        else
                        {
                            if (line.StartsWith("TT"))
                            {
                                if (line.EndsWith("@nolog", StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }
                                Match m = Regex.Match(line, "TT[0-9]+");
                                if (m.Success)
                                {
                                    string ttid = m.Value.Replace("TT", "");
                                    line = string.Format("<a href='{0}{1}{2}'>{3}</a>", Settings.CurrentSettings.GLOBALSITEURL, StaticSettings.DefectUrl, ttid, line.Substring(0, Math.Min(line.Length, 120)));
                                    int id;
                                    if (Defect.GetIDbyTT(int.Parse(ttid), out id))
                                    {
                                        DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.versionIncluded, CurrentContext.TTUSERID, version, -1, -1, null);
                                    }
                                }
                            }
                            details += line + Environment.NewLine;
                        }
                    }
                }
            }
        }
        details = details.Trim();
        if (!string.IsNullOrEmpty(details))
        {
            SendAlarm(string.Format("📢<a href='{3}versionchanges.aspx'>{0}</a> has been setup.{1}List of changes:{1}{2}{1}The build will be started as soon as possible." + $"👤:{CurrentContext.UserLogin()}", version, Environment.NewLine, details, Settings.CurrentSettings.GLOBALSITEURL));
        }
        DefectPlan.UpdateEDD();
    }