continue; } foreach ($entity['labels'] as $label) { $labels[] = $label['value']; } } $gCachedWikidataLabels[$id] = $labels; return $labels; } $bot = new wikipedia($gImportAPIURL); if (count($gImportPageList) > 0) { $members = $gImportPageList; } elseif ($gImportCategoryName == '') { $members = $bot->whatusethetemplate($gImportTemplateName); } else { $members = $bot->categorymembers("Category:" . $gImportCategoryName, true); } $members = array_unique($members); foreach ($members as $i => $member) { // Get rid of pages not in the main namespace - categories, // templates, etc. if (strpos($member, ':') !== false) { unset($members[$i]); } } sort($members); $file_handle = fopen($gImportFileName, "w"); $headerRow = array_keys($gImportFields); fputcsv($file_handle, $headerRow); fclose($file_handle); // Why is this necessary? Who knows.
* Developers (add your self here if you worked on the code): * James Hare - [[User:Harej]] - Wrote everything **/ ini_set("display_errors", 1); error_reporting(E_ALL ^ E_NOTICE); $botuser = '******'; require_once 'botclasses.php'; // Botclasses.php was written by User:Chris_G and is available under the GNU General Public License require_once 'harejpass.php'; echo "Logging in..."; $objwiki = new wikipedia(); $objwiki->login($botuser, $botpass); echo " done.\n"; $relists = array("M" => "", "O" => "", "B" => "", "S" => "", "W" => "", "G" => "", "T" => "", "F" => "", "P" => "", "I" => "", "?" => "", "U" => ""); echo "Checking category members..."; $transcludes = $objwiki->categorymembers("Category:Relisted AfD debates"); echo " done.\n"; for ($i = 0; $i < count($transcludes); $i++) { preg_match("/(Wikipedia:Articles for deletion)\\/(?!Log)/", $transcludes[$i], $m); echo "Retrieving {$transcludes[$i]} contents... \n"; $contents = $objwiki->getpage($transcludes[$i]); if ($m[0] != "") { preg_match("/Please do not modify it/", $contents, $p); if ($p[0] != "") { $contents = str_replace("{{#ifeq:{{FULLPAGENAME}}|" . $transcludes[$i] . "|[[Category:Relisted AfD debates|{{SUBPAGENAME}}]]|}}", "", $contents); // backwards compatibility $contents = str_replace("{{#ifeq:{{BASEPAGENAME}}|Articles for deletion|[[Category:Relisted AfD debates|{{SUBPAGENAME}}]]|}}", "", $contents); // backwards compatibility $contents = str_replace("[[Category:Relisted AfD debates|{{SUBPAGENAME}}]]", "", $contents); $objwiki->edit($transcludes[$i], $contents, "Removing Category:Relisted AfD debates", true, true); } else {