<?php // example: SERVER_ID=5915 php maintenance/wikia/GoogleWebmasterToolsSync/list_users.php --conf /usr/wikia/docroot/wiki.factory/LocalSettings.php require_once __DIR__ . "/common.php"; GWTLogHelper::notice(__FILE__ . " script starts."); try { $userRepository = new GWTUserRepository(); $users = $userRepository->all(); foreach ($users as $i => $u) { echo "[ id = " . $u->getId() . " ] " . $u->getEmail() . " " . $u->getCount() . "\n"; } } catch (Exception $ex) { GWTLogHelper::error(__FILE__ . " script failed.", $ex); }
/** * @param $xml * @throws GWTException */ private function put_sitemap($xml) { $request = MWHttpRequest::factory($this->make_sitemaps_uri(), array('postData' => $xml, 'method' => 'POST')); $request->setHeader('Content-type', 'application/atom+xml'); $request->setHeader('Content-length', strval(strlen($xml))); $request->setHeader('Authorization', 'GoogleLogin auth=' . $this->mAuth); $status = $request->execute(); if ($status->isOK()) { $text = $request->getContent(); GWTLogHelper::debug($text); } else { throw new GWTException("Non 200 response.\n" . "\n" . "message:" . $status->getMessage() . "\n" . $request->getContent()); } }
public static function setLogPath($logPath) { self::$logPath = $logPath; }