20 $userId = Yii::app()->user->id;
23 $rcArray[] = Yii::app()->getRequest()->getPost(
'recrawlDate');
25 if (is_array($rcArray[0])) {
26 if (($rcArray[0][
'date'] ==
'') && ($rcArray[0][
'time'] ==
'')) {
28 } elseif (($rcArray[0][
'date'] !=
'') && ($rcArray[0][
'time'] !=
'')) {
29 $recrawlDate = $rcArray[0][
'date'] .
' ' . $rcArray[0][
'time'];
30 $recrawlDate =
'"' . date(
'Y-m-d H:i:s', strtotime($recrawlDate)) .
'"';
31 } elseif (($rcArray[0][
'date'] ==
'') || ($rcArray[0][
'time'] ==
'')) {
32 Yii::app()->user->setFlash(
'notification',
'Please, specify both date and time for "Recrawl date" !');
36 $recrawlDate = $rcArray[0];
39 if ($updateType == 1) {
43 } elseif ($updateType == 0) {
50 "description" => Yii::app()->getRequest()->getPost(
'description'),
53 "filters" => $filtersArr,
54 "httpTimeout" => Yii::app()->getRequest()->getPost(
'httpTimeout'),
57 "maxErrors" => Yii::app()->getRequest()->getPost(
'maxErrors'),
58 "maxResourceSize" => Yii::app()->getRequest()->getPost(
'maxResourceSize'),
59 "maxResources" => Yii::app()->getRequest()->getPost(
'maxResources'),
60 "maxURLs" => Yii::app()->getRequest()->getPost(
'maxURLs'),
61 "priority" => Yii::app()->getRequest()->getPost(
'priority'),
62 "properties" => $propsArr,
63 "requestDelay" => Yii::app()->getRequest()->getPost(
'requestDelay'),
65 "state" => Yii::app()->getRequest()->getPost(
'state'),
67 "tcDateProcess" =>
'',
69 "updateType" => $updateType,
70 "urlType" => Yii::app()->getRequest()->getPost(
'urlType'),
73 "processingDelay" => Yii::app()->getRequest()->getPost(
'processingDelay'),
76 "avgSpeedCounter" => null,
77 "maxURLsFromPage" => Yii::app()->getRequest()->getPost(
'maxURLsFromPage'),
79 "recrawlPeriod" => Yii::app()->getRequest()->getPost(
'recrawlPeriod'),
80 "recrawlDate" => $recrawlDate,
81 "collectedURLs" => null,
82 "fetchType" => Yii::app()->getRequest()->getPost(
'fetchType'),
83 "criterions" => $criterions
86 foreach (
$json as $key => $value) {
94 $reqFile = tempnam(Yii::app()->getBasePath() .
'/json_temp',
'');
95 $request = fopen($reqFile,
"w");
96 fwrite($request,
$json);
101 $UsersSitesRights->setRightsSingleRecord(
114 $id = Yii::app()->getRequest()->getPost(
'id');
119 $id = md5(Yii::app()->user->id .
$urls[0]);
126 $rootUrls = Yii::app()->getRequest()->getPost(
'rootUrls');
127 $rootUrls = str_replace(
"\r",
'', $rootUrls);
128 $rootUrls = explode(
"\n", $rootUrls);
129 foreach ($rootUrls as $item) {
131 $urlsArray[] = $item;
139 $state = Yii::app()->getRequest()->getPost(
'fstate');
140 $action = Yii::app()->getRequest()->getPost(
'faction');
141 $stage = Yii::app()->getRequest()->getPost(
'fstage');
142 $opCode = Yii::app()->getRequest()->getPost(
'fopCode');
143 $subject = Yii::app()->getRequest()->getPost(
'fsubject');
144 $groupId = Yii::app()->getRequest()->getPost(
'fgroupId');
145 $type = Yii::app()->getRequest()->getPost(
'ftype');
146 $mode = Yii::app()->getRequest()->getPost(
'fmode');
147 $pattern = Yii::app()->getRequest()->getPost(
'fpattern');
148 $siteId = Yii::app()->getRequest()->getPost(
'id');
150 for (
$i = 0;
$i < count($state);
$i++) {
152 'state' => $state[
$i],
153 'action' => $action[$i],
154 'stage' => $stage[$i],
155 'opCode' => $opCode[$i],
156 'subject' => $subject[$i],
157 'groupId' => $groupId[$i],
159 'pattern' => $pattern[$i],
171 foreach ($_POST as $k => $v) {
172 if (preg_match(
"/^n_/", (
string)$k))
174 if (preg_match(
"/^v_/", (
string)$k))
177 $props = array_combine($propsn, $propsv);
183 $api = Yii::app()->params[
'api'];
184 $path = Yii::app()->getBasePath() .
'/shell/';
185 $cmd =
"sh " . $path .
"rnd_site_update.sh $api $reqFile";
186 $json = shell_exec($cmd);
189 Yii::app()->user->setFlash(
'error2', $this->operation .
' WARNING: ' . $error);
193 Yii::app()->user->setFlash(
'success2', $this->operation .
': SUCCESS');
201 $list = parse_ini_file(Yii::app()->basePath.
'/config/descriptions.ini',
true);
207 if (!is_array($in)) {
210 foreach ($in as $k=>$v) {