Пример #1
0
<?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);
}
Пример #2
0
 /**
  * @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());
     }
 }
Пример #3
0
 public static function setLogPath($logPath)
 {
     self::$logPath = $logPath;
 }