if (mysqli_connect_errno()) { echo "Connection Failed: " . mysqli_connect_errno(); die; } echo "Connecting to replica\n"; $replica_mycnf = parse_ini_file("/data/project/legobot/replica.my.cnf"); $replica_username = $replica_mycnf['user']; $replica_password = $replica_mycnf['password']; $enwikidb = new mysqli('enwiki.labsdb', $replica_username, $replica_password, 'enwiki_p'); if (mysqli_connect_errno()) { echo "Connection Failed: " . mysqli_connect_errno(); die; } $rfcid_list = array(); // Step 1: Check for transclusions $transclusions = $wiki->getTransclusions("Template:Rfc"); foreach ($transclusions as $page) { $rfcid = null; // Get the page content $page = $wiki->page($page); $content = $page->content(); if (!$page->exists()) { $deleteId = $rfcdb->prepare("DELETE FROM `rfc` WHERE `rfc_page`=?;"); $deleteId->bind_param("s", $page); $deleteId->execute(); $deleteId->close(); continue; } // Syntax Correction. RFC templates with common errors are corrected and then saved on the wiki. preg_match_all("/(\\{{2}\\s?Rfc(tag)?\\s?[^}]*\\}{2}(\n|,| )*){2,}/i", $content, $fixes); foreach ($fixes[0] as $fix) {