if (empty($wgCityId)) { die("Error: Invalid wiki id."); } $range = isset($options['range']) ? intval($options['range']) : 1000; $fromUserId = isset($options['from_userid']) ? intval($options['from_userid']) : 0; $toUserId = isset($options['to_userid']) ? intval($options['to_userid']) : 0; $cleanupCondition = "date(user_registration) < curdate() - interval 30 day"; $reminderCondition = "date(user_registration) = curdate() - interval 7 day"; // remove old temp user if (isset($options['cleanup'])) { removeOldTempUser($fromUserId, $toUserId, $range, $cleanupCondition); } // send reminder for all wikis if (isset($options['reminder'])) { // get list of wikis $wikis = getWikis($reminderCondition); // send reminder for each wiki foreach ($wikis as $wikiId) { $cmd = "SERVER_ID={$wikiId} php {$IP}/extensions/wikia/UserLogin/maintenance.php --conf={$wgWikiaLocalSettingsPath} --wiki_reminder"; $result = wfShellExec($cmd, $retval); if ($retval) { echo "Error code {$retval}: {$result} \n"; } else { echo "{$result} \n"; } } echo "Reminder emails sent for " . count($wikis) . " wikis.\n"; } // send reminder for current wiki if (isset($options['wiki_reminder'])) { sendReminder($fromUserId, $toUserId, $range, $reminderCondition);
echo "WikiId {$wgCityId}: " . sizeof($users) . " of total {$cnt} confirmation reminder emails sent.\n"; wfProfileOut(__METHOD__); } // ------------------------------------------- Main ------------------------------------------------- ini_set("include_path", dirname(__FILE__) . "/../../../maintenance/"); require_once "commandLine.inc"; if (isset($options['help']) || !(isset($options['cleanup']) || isset($options['reminder']) || isset($options['wiki_reminder']))) { die("Usage: php maintenance.php [--cleanup] [--reminder] [--wiki_reminder] [--help]\n\t\t--reminder\t\t\tsend reminder (user's registered date = 7 days ago) for ALL wikis\n\t\t--wiki_reminder\t\tsend reminder for CURRENT wiki only\n\t\t--help\t\t\t\tyou are reading it right now\n\n"); } if (empty($wgCityId)) { die("Error: Invalid wiki id."); } // send reminder for all wikis if (isset($options['reminder'])) { // get list of wikis $wikis = getWikis(); // send reminder for each wiki foreach ($wikis as $wikiId) { $cmd = "SERVER_ID={$wikiId} php {$IP}/extensions/wikia/UserLogin/maintenance.php --conf={$wgWikiaLocalSettingsPath} --wiki_reminder"; echo "Command: {$cmd}\n"; $result = wfShellExec($cmd, $retval); if ($retval) { echo "Error code {$retval}: {$result} \n"; } else { echo "{$result} \n"; } } echo "Reminder emails sent for " . count($wikis) . " wikis.\n"; } // send reminder for current wiki if (isset($options['wiki_reminder'])) {