Exemple #1
0
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *   
 *  Developers (add yourself here if you worked on the code):
 *    Kunal Mehta - [[User:Legoktm]]  - Minor fix to run on Tool Labs
 *    Chris Grant - [[User:Chris G]]  - Completely rewrote the code
 *    James Hare  - [[User:Harej]]    - Wrote the orignial bot
 **/
ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
$botuser = '******';
require_once 'botclasses.php';
require_once 'new_mediawiki.php';
require_once 'harejpass.php';
$wiki = new mediawiki($botuser, $botpass);
$RFC_categories = array("bio", "hist", "econ", "sci", "lang", "media", "pol", "reli", "soc", "style", "policy", "proj", "tech", "prop", "unsorted", "all");
$toolserver_mycnf = parse_ini_file("/data/project/legobot/replica.my.cnf");
$toolserver_username = $toolserver_mycnf['user'];
$toolserver_password = $toolserver_mycnf['password'];
$rfcdb = new mysqli('tools-db', $toolserver_username, $toolserver_password, 's51043__legobot');
if (mysqli_connect_errno()) {
    echo "Connection Failed: " . mysqli_connect_errno();
    die;
}
$new_time = array();
foreach ($RFC_categories as $cat) {
    $frsquery = $rfcdb->prepare("SELECT frs_userid,frs_username,frsl_limit FROM frs_user JOIN frs_limits \n\t\t\t\t     ON frs_userid=frsl_userid WHERE frs_disqualified=0 AND frsl_category=?;");
    $frsquery->bind_param("s", $cat);
    $frsquery->execute();
    $frsquery->bind_result($frs_userid, $frs_username, $frsl_limit);
Exemple #2
0
    {
        return time() - $this->starttime() >= 691200;
    }
    public function result()
    {
        return $this->result;
    }
}
ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
$botuser = '******';
require_once 'botclasses.php';
require_once 'new_mediawiki.php';
require_once 'harejpass.php';
echo "Logging in...";
$wiki = new mediawiki($botuser, $botpass);
echo " done.\n";
echo "Retrieving MFD contents... ";
$page = $wiki->page("Wikipedia:Miscellany for deletion");
$mfdpage = $page->content();
preg_match_all("/\\{\\{(Wikipedia:Miscellany for deletion\\/(?!Front matter)(.*?)*)\\}\\}/i", $mfdpage, $m);
$container = new mfd_container();
// Loop through each MFD
foreach ($m[1] as $title) {
    $mfd = new mfd($title);
    $container->add($mfd);
    if ($mfd->isArchive()) {
        $origmonth = $mfd->starttime("F");
        $origyear = $mfd->starttime("Y");
        $archive = $wiki->page("Wikipedia:Miscellany for deletion/Archived debates/" . $origmonth . " " . $origyear);
        if (!$archive->exists()) {
Exemple #3
0
    $rfcSelect->execute();
    $rfcSelect->bind_result($return);
    $rfcSelect->fetch();
    $rfcSelect->close();
    if ($return > 0) {
        generateRfcId($tries);
    } else {
        return $tempid;
    }
}
$botuser = '******';
//require_once 'database.inc';
require_once 'botclasses.php';
require_once 'new_mediawiki.php';
require_once 'harejpass.php';
$wiki = new mediawiki($botuser, $botpass);
// Definitions
$RFC_categories = array("bio", "hist", "econ", "sci", "lang", "media", "pol", "reli", "soc", "style", "policy", "proj", "tech", "prop", "unsorted");
$listings = array();
// Crappy hack for edit summaries
$all_expired = array();
$RFC_submissions = array();
$RFC_dashboard = array();
$RFC_listofentries = array();
foreach ($RFC_categories as $cat) {
    $RFC_submissions[$cat] = "<noinclude>\n{{rfclistintro}}\n</noinclude>\n";
    $RFC_dashboard[$cat] = "";
    $RFC_listofentries[$cat] = array();
}
// This specific exception was provided for upon request of WikiProject Philosophy.
$RFC_submissions["reli"] = "'''The following discussions are requested to have community-wide attention:'''\n{{Philosophy/Nav}}\n\n";
Exemple #4
0
                $continue = '&rawcontinue=&apfrom=' . urldecode($x['query-continue']['allpages']['apfrom']);
            } else {
                break;
            }
        }
        $content = $wiki->getpage('Wikipedia:' . $page . $number);
        if (strlen($content) > 75000) {
            $number++;
        }
        return 'Wikipedia:' . $page . $number;
    }
}
/* Connect to the database */
$toolserver_mycnf = parse_ini_file("/data/project/legobot/replica.my.cnf");
$toolserver_username = $toolserver_mycnf['user'];
$toolserver_password = $toolserver_mycnf['password'];
$db_enwiki = new database('enwiki.labsdb', $toolserver_username, $toolserver_password, 'enwiki_p');
$db_central = new database('centralauth.labsdb', $toolserver_username, $toolserver_password, 'centralauth_p');
require_once 'botclasses.php';
require_once 'new_mediawiki.php';
$user = '******';
require_once 'harejpass.php';
$wiki = new mediawiki($user, $botpass);
$metawiki = new mediawiki($user, $botpass, 'https://meta.wikimedia.org/w/api.php');
$page = trim(strtolower($wiki->getpage("User:{$user}/clerk")));
if ($page == 'true') {
    $chu = new chu('Wikipedia:Changing username/Simple', true);
} else {
    $chu = new chu('Wikipedia:Changing username/Simple', false);
}
//$sul = new chu('Wikipedia:Changing username/SUL',false);
Exemple #5
0
 /**
  * Add a new section to the page
  * @param $heading string
  * @param $content string
  * @param bool $minor
  * @param bool $bot
  * @param bool $retry
  * @return mixed
  */
 public function addSection($heading, $content, $minor = false, $bot = true, $retry = true)
 {
     echo "Adding Section \"{$heading}\" to [[" . $this->title . "]]\n";
     $post = array('title' => $this->title, 'text' => $content, 'md5' => md5($content), 'sectiontitle' => $heading, 'section' => 'new', 'token' => $this->wiki->getedittoken(), 'basetimestamp' => $this->ecTimestamp);
     if ($minor) {
         $post['minor'] = true;
     }
     if ($bot) {
         $post['bot'] = true;
     }
     $x = $this->wiki->query(array('action' => 'edit'), $post);
     if ($x['error']['code'] == 'badtoken' && $retry) {
         $this->wiki->getedittoken(true);
         return $this->addSection($heading, $content, $minor, $bot, false);
     }
     $this->getContent();
     return $x;
 }
 /**
  *
  */
 function get_wikipedia($wp, $lemma, $idx, &$rows)
 {
     global $is_offline;
     if ($is_offline) {
         return;
     }
     $mw = new mediawiki($wp);
     $pages = $mw->get_page_info($lemma);
     $i = 0;
     if (!is_array($pages)) {
         return;
     }
     foreach ($pages as $key => $page) {
         if ($page['status'] == 1) {
             // UIDs
             $uids = '';
             foreach ($idx[$key] as $uid) {
                 $uids .= $uids ? ', ' : '';
                 $uids .= $rows[$uid]['glo_uid'];
             }
             // english wikipedia
             $query = sprintf('UPDATE glossary SET wp%3$s = %1$s WHERE glo_uid IN (%2$s);', $this->db->quote($page['to']), $uids, $wp);
             $this->db->exec($query);
             foreach ($idx[$key] as $uid) {
                 $rows[$uid]['wp' . $wp] = $page['to'];
             }
         }
         $i++;
     }
 }
Exemple #7
0
                $template['args'][$args] .= $cont . $char;
            }
            $cont = '';
        } elseif ($template_level > 1) {
            $cont .= $char;
            $code .= $char;
        }
    }
    return $templates;
}
echo "Logging in...";
$wiki = new extendedWikiBot();
$wiki->login($botuser, $botpass);
echo " done.\n";
require_once 'new_mediawiki.php';
$wiki2 = new mediawiki($botuser, $botpass);
$http = new http();
/* Connect to the database */
echo "Retrieving database login credentials...";
$toolserver_mycnf = parse_ini_file("/data/project/legobot/replica.my.cnf");
$toolserver_username = $toolserver_mycnf['user'];
$toolserver_password = $toolserver_mycnf['password'];
unset($toolserver_mycnf);
echo " done.\n";
echo "Logging into database...";
try {
    $mysql = new PDO("mysql:host=tools-db;dbname={$databasename}", $toolserver_username, $toolserver_password);
} catch (PDOException $e) {
    echo "Cannot connect to database.\n";
    die;
}