User:LeucosticteBot/ChangeWikiaEngine.php: Difference between revisions

m
minor tweaks
No edit summary
m (minor tweaks)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This bot looks for pages that have a url with .wikia.com in them, and changes the wiki engine to wikia. It iterates over the list of pages contained in CategoryMembers.txt. See [[mw:Manual:Chris G's botclasses/AllCategoryMembersBot.php]] for details on generating that file.
This bot script looks for pages that have a url with <tt>.wikia.com</tt> in them, and changes the wiki engine to Wikia. It iterates over the list of pages contained in CategoryMembers.txt. See [[mw:Manual:Chris G's botclasses/AllCategoryMembersBot.php]] for details on generating that file.


<source lang="php">
<pre>
<?php
<?php
/*
/*
  * ChangeWikiaEngine.php
  * ChangeWikiaEngine.php
  * By Leucosticte, https://www.mediawiki.org/wiki/User:Leucosticte
  * By Leucosticte, https://www.MediaWiki.org/wiki/User:Leucosticte
  * GPL 2.0
  * GPL 2.0
  *
  *
  * This bot looks for pages that have a url with .wikia.com in them, and changes the wiki engine to
  * This bot looks for pages that have a url with .wikia.com in them, and changes the wiki engine to
  * wikia.
  * Wikia.
/*
/*


/* Setup my classes. */
/* Setup my classes. */
include( 'botclasses.php' );
include( 'botclasses.php' );
$wiki      = new wikipedia;
$wiki      = WikiIndex;
$wiki->url = "http://wikiindex.org/api.php";
$wiki->url = "https://WikiIndex.org/api.php";


/* All the login stuff. */
/* All the login stuff. */
Line 41: Line 41:
         // Poll to get wiki page content
         // Poll to get wiki page content
         $contents = $wiki->getpage ( $line );
         $contents = $wiki->getpage ( $line );
         // A template line with data will start with a |, e.g. |URL = wikiindex.org
         // A template line with data will start with a |, e.g. |URL = WikiIndex.org
         if ( $begin = strpos ( $contents, '|URL' ) ) {
         if ( $begin = strpos ( $contents, '|URL' ) ) {
             if ( $equals = strpos ( $contents, '=', $begin ) ) {
             if ( $equals = strpos ( $contents, '=', $begin ) ) {
Line 81: Line 81:
     }
     }
}
}
</source>
</pre>