Wikia

WoWWiki

KitanBot/Completed Tasks/Elinks-Quest

Talk0
100,525pages on
this wiki

< User:KitanBot | Completed Tasks

Overview Edit

Completed: 2007/04/09
Run Time: 1.5 hours
Page Count: ~380 pages


Task Edit

There was a Bot Request to deprecate {{elinksquest}} for {{elinks-quest}}. After some discussion on IRC it was determined that {{elinks}} would not be used but that == External links == {{elinks-quest|id}} would be used.

Issues Edit

  • Bot Connection Issue -- The first run the bot had a connection issue after 80 updates. Changed the connection limit and restarted the bot.
  • Data Issue -- After checking ~50 updates the only issue was in the case that someone had put {{elinksquest|?|id}} which the bot replaced with, {{Elinks-quest|?}}


Algorithm Edit

namespace WikiUpdateAlgorithmElinksQuest
{
    public class WikiUpdateAlgorithmElinksQuest : IWikiUpdaterAlgorithm
    {
        public string UpdateWiki(string CurrentWiki)
        {
            //Objects Required
            string SearchWiki = CurrentWiki.ToLower();
            StringBuilder Current = new StringBuilder(CurrentWiki);
            Dictionary<string, string> Replacements = new Dictionary<string, string>();

            //Primatives
            string Template = "{{elinksquest";
            int Position;
            int EndPosition;
            bool Continue;
            int StartQuestNumPos;
            int EndQuestNumPos;
            string QuestNum;

            Position = 0;
            Continue = true;

            while (Continue)
            {
                Position = SearchWiki.IndexOf(Template, Position);
                EndPosition = 0;
                
                if (Position >= 0)
                {
                    EndPosition = SearchWiki.IndexOf("}}", Position);

                    if (EndPosition > 0)
                    {
                        StartQuestNumPos = SearchWiki.IndexOf("|", Position);

                        if (SearchWiki.IndexOf("|", StartQuestNumPos + 1) < SearchWiki.IndexOf("}}", StartQuestNumPos))
                        {
                            QuestNum = SearchWiki.Substring(StartQuestNumPos + 1, SearchWiki.IndexOf("|", StartQuestNumPos + 1) - StartQuestNumPos - 1);
                        }
                        else
                        {
                            QuestNum = SearchWiki.Substring(StartQuestNumPos + 1, SearchWiki.IndexOf("}}", StartQuestNumPos) - StartQuestNumPos - 1);
                        }

                        Replacements.Add(CurrentWiki.Substring(Position, EndPosition + 2 - Position), "== External links ==\n{{Elinks-quest|" + QuestNum + "}}");

                    }
                    Position = EndPosition;
                }
                else
                {
                    Continue = false;
                }
            }

            foreach (KeyValuePair<string, string> Replacement in Replacements)
            {
                Current.Replace(Replacement.Key, Replacement.Value);
            }

            return Current.ToString();
        }
        /// <summary>
        /// Summary of the update
        /// </summary>
        /// <returns>String</returns>
        public string UpdateSummary()
        {
            return "Updates pages from {{elinksquest}} to {{elinks-quest}}.";
        }
    }
}

Around Wikia's network

Random Wiki