User:LeucosticteBot/ChangeWikiaEngine.php: Difference between revisions

m
minor tweaks
m (Zhuyifei1999 moved page WikiIndex:ChangeWikiaEngine.php to User:LeucosticteBot/ChangeWikiaEngine.php: Belong to user)
m (minor tweaks)
 
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.


<pre>
<pre>
Line 5: Line 5:
/*
/*
  * 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 ) ) {