Skip to content

Commit 278da39

Browse files
committed
Dropped support for CRAWL_ERRORS. Code cleanup.
1 parent 87a3764 commit 278da39

File tree

1 file changed

+0
-126
lines changed

1 file changed

+0
-126
lines changed

src/Gwt/Client.php

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,6 @@ class Gwt_Client
8686
*/
8787
protected $_dateEnd;
8888

89-
/**
90-
* Downloaded files
91-
*
92-
* @deprecated
93-
* @var array
94-
*/
95-
public $_downloaded = array();
96-
97-
/**
98-
* Skipped tables
99-
*
100-
* @deprecated
101-
* @var array
102-
*/
103-
public $_skipped = array();
104-
10589
/**
10690
* After successful login will contain auth key
10791
*
@@ -143,7 +127,6 @@ public function getAllowedTableNames()
143127
return array(
144128
'TOP_PAGES',
145129
'TOP_QUERIES',
146-
'CRAWL_ERRORS',
147130
'CONTENT_ERRORS',
148131
'CONTENT_KEYWORDS',
149132
'INTERNAL_LINKS',
@@ -205,9 +188,6 @@ function ($item)
205188
public function getTableData($tableName)
206189
{
207190
switch ($tableName) {
208-
case 'CRAWL_ERRORS':
209-
$data = $this->downloadCSV_CrawlErrors($this->getWebsite());
210-
break;
211191
case 'CONTENT_ERRORS':
212192
case 'CONTENT_KEYWORDS':
213193
case 'INTERNAL_LINKS':
@@ -238,41 +218,6 @@ public function getTableData($tableName)
238218
return $data;
239219
}
240220

241-
/**
242-
* Get errors list
243-
*
244-
* @return array
245-
*/
246-
private function getErrTablesSort()
247-
{
248-
return array(
249-
0 => 'http',
250-
1 => 'not-found',
251-
2 => 'restricted-by-robotsTxt',
252-
3 => 'unreachable',
253-
4 => 'timeout',
254-
5 => 'not-followed',
255-
'kAppErrorSoft-404s' => 'soft404',
256-
'sitemap' => 'in-sitemaps',
257-
);
258-
}
259-
260-
/**
261-
* Get error types
262-
*
263-
* @return array
264-
*/
265-
private function getErrTableTypes()
266-
{
267-
return array(
268-
0 => 'web-crawl-errors',
269-
1 => 'mobile-wml-xhtml-errors',
270-
2 => 'mobile-chtml-errors',
271-
3 => 'mobile-operator-errors',
272-
4 => 'news-crawl-errors',
273-
);
274-
}
275-
276221
/**
277222
* Get options for given table
278223
*
@@ -462,27 +407,6 @@ public function addProcessor(Gwt_Processor_ProcessorInterface $processor)
462407
return $this;
463408
}
464409

465-
/**
466-
* Returns array of downloaded filenames.
467-
*
468-
* @return array Array of filenames that have been written to disk.
469-
*/
470-
public function getDownloadedFiles()
471-
{
472-
return $this->_downloaded;
473-
}
474-
475-
/**
476-
* Returns array of downloaded filenames.
477-
*
478-
* @return array Array of skipped tables (no data or was not able to save)
479-
* @deprecated
480-
*/
481-
public function getSkippedFiles()
482-
{
483-
return $this->_skipped;
484-
}
485-
486410
/**
487411
* Attempts to log into the specified Google account.
488412
*
@@ -652,56 +576,6 @@ private function downloadCSV_XTRA($site, $tableName, DateTime $dateStart, DateTi
652576
return $this->getData($url);
653577
}
654578

655-
/**
656-
* Downloads the Crawl Errors file based on the given URL.
657-
*
658-
* @todo Make separated crawl errors accessible
659-
* @param string $site Site URL available in GWT Account.
660-
* @param bool $separated Optional: If true, the method saves separated CSV files
661-
* for each error type. Default: Merge errors in one file.
662-
* @return $this
663-
*/
664-
private function downloadCSV_CrawlErrors($site, $separated = false)
665-
{
666-
$type_param = 'we';
667-
//$filename = parse_url($site, PHP_URL_HOST) . '-' . date('Ymd-His');
668-
if ($separated) {
669-
$data = array();
670-
foreach ($this->getErrTablesSort() as $sortid => $sortname) {
671-
foreach ($this->getErrTableTypes() as $typeid => $typename) {
672-
if ($typeid == 1) {
673-
$type_param = 'mx';
674-
} else if($typeid == 2) {
675-
$type_param = 'mc';
676-
} else {
677-
$type_param = 'we';
678-
}
679-
$uri = self::SERVICEURI . "crawl-errors?hl=en&siteUrl=$site&tid=$type_param";
680-
$token = $this->getToken($uri, 'x26');
681-
$finalName = "$savepath/CRAWL_ERRORS-$typename-$sortname-$filename.csv";
682-
$url = sprintf(
683-
self::SERVICEURI . 'crawl-errors-dl?hl=%s&siteUrl=%s&security_token=%s&type=%s&sort=%s',
684-
$this->getLanguage(), $site, $token, $typeid, $sortid
685-
);
686-
687-
// TODO: find a better solution - this one might require a lot of memory
688-
$data[$sortname][$typename] = $this->getData($url);
689-
}
690-
}
691-
692-
return $data;
693-
} else {
694-
$uri = self::SERVICEURI."crawl-errors?hl=en&siteUrl=$site&tid=$type_param";
695-
$token = $this->getToken($uri, 'x26');
696-
$url = sprintf(
697-
self::SERVICEURI.'crawl-errors-dl?hl=%s&siteUrl=%s&security_token=%s&type=0',
698-
$this->getLanguage(), $site, $token
699-
);
700-
701-
return $this->getData($url);
702-
}
703-
}
704-
705579
/**
706580
* Regular Expression to find the Security Token for a download file.
707581
*

0 commit comments

Comments
 (0)