forked from sendtogeo/Seo-Panel
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathcron.php
More file actions
144 lines (121 loc) · 5.51 KB
/
Copy pathcron.php
File metadata and controls
144 lines (121 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
/***************************************************************************
* Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.org) *
* sendtogeo@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
if(!empty($_SERVER['REQUEST_METHOD'])){
# to section to generate report from admin area
include_once("includes/sp-load.php");
checkAdminLoggedIn();
include_once(SP_CTRLPATH."/cron.ctrl.php");
include_once(SP_CTRLPATH."/moz.ctrl.php");
$controller = New CronController();
$controller->timeStamp = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$controller->set('spTextTools', $controller->getLanguageTexts('seotools', $_SESSION['lang_code']));
$controller->set('spTextPanel', $controller->getLanguageTexts('panel', $_SESSION['lang_code']));
$controller->spTextKeyword = $controller->getLanguageTexts('keyword', $_SESSION['lang_code']);
$controller->set('spTextKeyword', $controller->spTextKeyword);
if($_SERVER['REQUEST_METHOD'] == 'POST'){
switch($_POST['sec']){
case "generate":
$controller->executeReportGenerationScript($_POST);
break;
}
}else{
switch($_GET['sec']){
case "generate":
$controller->routeCronJob($_GET['website_id'], $_GET['repTools']);
if (defined('SP_DFS_API_LOGIN') && !empty(SP_DFS_API_LOGIN)) {
echo "<br>=== Processing pending DataForSEO tasks ===<br>";
include_once(SP_CTRLPATH."/dataforseo.ctrl.php");
$dfsCtrler = new DataForSEOController();
$dfsCtrler->processPendingDFSTasks(true);
echo "<br>=== DataForSEO tasks processing completed ===<br>";
}
break;
case "croncommand":
$controller->showCronCommand();
break;
default:
$controller->showReportGenerationManager();
break;
}
}
}else{
# the section for generate reports using system cron job
include_once("includes/sp-load.php");
include_once(SP_CTRLPATH."/cron.ctrl.php");
include_once(SP_CTRLPATH."/report.ctrl.php");
include_once(SP_CTRLPATH."/searchengine.ctrl.php");
include_once(SP_CTRLPATH."/keyword.ctrl.php");
include_once(SP_CTRLPATH."/moz.ctrl.php");
include_once(SP_CTRLPATH."/webmaster.ctrl.php");
include_once(SP_CTRLPATH."/social_media.ctrl.php");
include_once(SP_CTRLPATH."/review_manager.ctrl.php");
include_once(SP_CTRLPATH."/analytics.ctrl.php");
include_once(SP_CTRLPATH."/information.ctrl.php");
$controller = New CronController();
$controller->timeStamp = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$includeList = array();
$userList = array();
// check whether user is passed with script as argument
if (isset($argv[1])) {
$userId = intval($argv[1]);
if ($userId > 0) {
$userCtrler = new UserController();
$userInfo = $userCtrler->__getUserInfo($userId);
$userList[] = $userInfo;
}
// check whether seo tools id passed with the script as second argument
if (!empty($argv[2])) {
$includeList[] = intval($argv[2]);
}
}
// call cronjob function
echo "\n\n=== Cron job execution started on - " . date("Y-m-d H:i:s") . " ===\n";
// sync search engines
$seCtrler = new SearchEngineController();
$ret_sync = $seCtrler->doSyncSearchEngines(true, true);
echo $ret_sync['result'] . "\n";
// check system alerts
$alertCtrler = new AlertController();
$ret_sync = $alertCtrler->updateSystemAlerts();
echo $ret_sync['result'] . "\n";
// check SP API connection
include_once(SP_CTRLPATH . "/information.ctrl.php");
$ret_spapi = $alertCtrler->updateSpApiAlerts();
echo $ret_spapi['result'] . "\n";
$controller->executeCron($includeList, $userList);
echo "\n=== Cron job execution completed on - " . date("Y-m-d H:i:s") . " ===\n\n";
// delete crawl logs before 2 months
include_once(SP_CTRLPATH."/crawllog.ctrl.php");
$crawlLog = new CrawlLogController();
$crawlLog->clearCrawlLog(SP_CRAWL_LOG_CLEAR_TIME);
echo "Clearing crawl logs before " . SP_CRAWL_LOG_CLEAR_TIME . " days\n";
$crawlLog->clearMaillLog(SP_CRAWL_LOG_CLEAR_TIME);
echo "Clearing mail logs before " . SP_CRAWL_LOG_CLEAR_TIME . " days\n";
// Process pending DataForSEO tasks
if (defined('SP_DFS_API_LOGIN') && !empty(SP_DFS_API_LOGIN)) {
echo "\n=== Processing pending DataForSEO tasks ===\n";
include_once(SP_CTRLPATH."/dataforseo.ctrl.php");
$dfsCtrler = new DataForSEOController();
$dfsCtrler->processPendingDFSTasks(true);
echo "=== DataForSEO tasks processing completed ===\n";
}
}
?>