Ejemplo n.º 1
0
 public static function save2Db($fileId)
 {
     try {
         $tableObj = Model::factory(self::$_table);
         $tableObj->create();
         $tableObj->fileId = $fileId;
         $tableObj->save();
     } catch (Exception $ex) {
         AppLog::exceptionLog($ex);
     }
 }
Ejemplo n.º 2
0
 public static function saveLink2DB($canonicalUrl, $domain, $crawledPageId)
 {
     //nu inseram acelasi link de 2 ori
     if (Model::factory(self::$_table)->where('canonicalUrl', $canonicalUrl)->find_one()) {
         return;
     }
     try {
         $tableObj = Model::factory(self::$_table)->create();
         $tableObj->canonicalUrl = $canonicalUrl;
         $tableObj->domain = $domain;
         $tableObj->crawledPageId = $crawledPageId;
         $tableObj->save();
         return $tableObj->id;
     } catch (Exception $ex) {
         AppLog::exceptionLog($ex);
     }
     return null;
 }
Ejemplo n.º 3
0
 public static function savePage2DB($url, $httpStatus, $rawPage, $parsedText, $rawPagePath, $parsedTextPath, $timestamp)
 {
     @mkdir(dirname($rawPagePath), 0777, true);
     @mkdir(dirname($parsedTextPath), 0777, true);
     file_put_contents($rawPagePath, $rawPage);
     file_put_contents($parsedTextPath, $parsedText);
     try {
         $tableObj = Model::factory(self::$_table)->create();
         $tableObj->timestamp = $timestamp;
         $tableObj->url = $url;
         $tableObj->httpStatus = $httpStatus;
         $tableObj->rawPagePath = $rawPagePath;
         $tableObj->parsedTextPath = $parsedTextPath;
         $tableObj->save();
         return $tableObj->id;
     } catch (Exception $ex) {
         AppLog::exceptionLog($ex);
     }
     return null;
 }