title: Mass edit pages on MediaWiki site
body: <p>I have an extension code that runs the hooks 
  <code>$wgHooks['ParserFirstCallInit'][] = 'AdsSetup'; $wgHooks['EditPage::showEditForm:initial'][] = 'CheckHasTag';</code>
  when you click edit on a page it will check the page using javascript for certain text, if it isn't there is adds a <code>&lt;Tag&gt;</code>.</p>
  
  <p>Then you save the page and the tag is there. 
  I have over <strong>1,000 pages</strong> on my site. I don't want to have to click edit on each page to run the extension. Is there a way to mass edit the pages to run the extension?</p>
  
  <p>I only want to run it on pages with the <code>namespace = 'main'</code> and I would like to exclude some pages. </p>
  
  <p>This is my extension code: </p>
  
  <pre><code>&lt;?php
  
    $wgHooks['ParserFirstCallInit'][] = 'AdsSetup';
    $wgHooks['EditPage::showEditForm:initial'][] = 'CheckHasTag';
  
  function AdsSetup( &amp;$parser ) {
      $parser-&gt;setHook( 'ads', 'AdsRender' );   return true;}
  
  function AdsRender( $input, $args, $parser, $frame ) {
  
  $output = '&lt;div id="googlead"&gt;&lt;script type="text/javascript"&gt;
  google_ad_client = "xxx";
  google_ad_width = 300;  google_ad_height = 250;
  &lt;/script&gt;
  &lt;script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
  &lt;/script&gt;&lt;/div&gt;';
  return array( $output, "markerType" =&gt; 'nowiki' );
    }
    // check if content has &lt;googleAds1&gt; tag
    function CheckHasTag($editPage){
  global $wgOut;
  $wgOut-&gt;addScript('&lt;script type="text/javascript"&gt;
  var editTextboxText = document.getElementById("wpTextbox1").value;
                  var searchFor = "googleAds1";
                  var searchResult = editTextboxText.search(searchFor);
          console.log("Testing console12");       
                  if(searchResult == -1){
                  var a = editTextboxText;
                  var b = "\n&lt;ads media=googleAds1 /&gt;\n";
                  var findP = "\n"; 
                  var p = editTextboxText.search(findP);
                  var position = p;
      document.getElementById("wpTextbox1").value = a.substring(0, position) + b +  a.substring(position);
    } &lt;/script&gt;');    return true; }
  </code></pre>
  
  <p>How do I run the extension without having to edit each page individually?</p>