コード例 #1
0
ファイル: SushiService.php プロジェクト: veggiematts/usage
 public function saveLogAndExit($reportLayout = NULL, $txtFile = NULL, $success = FALSE)
 {
     //First, delete any preexisting Failured records, these shouldn't be needed/interesting after this.
     $this->log("Cleaning up prior failed import logs....");
     $this->getPublisherOrPlatform->removeFailedSushiImports;
     if (!$txtFile) {
         $txtFile = strtotime("now") . '.txt';
     }
     $logFileLocation = 'logs/' . $txtFile;
     $this->log("Log File Name: {$logFileLocation}");
     if ($success) {
         $this->logStatus("Finished processing " . $this->getServiceProvider . ": {$reportLayout}.");
     }
     //save the actual log file
     $fp = fopen(BASE_DIR . $logFileLocation, 'w');
     fwrite($fp, implode("\n", $this->detailLog));
     fclose($fp);
     //save to import log!!
     $importLog = new ImportLog();
     $importLog->loginID = "sushi";
     $importLog->layoutCode = $reportLayout;
     $importLog->fileName = 'archive/' . $txtFile;
     $importLog->archiveFileURL = 'archive/' . $txtFile;
     $importLog->logFileURL = $logFileLocation;
     $importLog->details = implode("<br />", $this->statusLog);
     try {
         $importLog->save();
         $importLogID = $importLog->primaryKey;
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     $importLogPlatformLink = new ImportLogPlatformLink();
     $importLogPlatformLink->importLogID = $importLogID;
     $importLogPlatformLink->platformID = $this->platformID;
     try {
         $importLogPlatformLink->save();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     if (!$success) {
         throw new Exception(implode("\n", $this->detailLog));
     }
 }
コード例 #2
0
ファイル: uploadComplete.php プロジェクト: pontifechs/usage
    $importLog->archiveFileURL = 'archive/' . $uploadedFilename;
    $importLog->details = $rownumber . _(" titles processed.") . $logSummary;
}
$importLog->loginID = $user->loginID;
$importLog->layoutCode = $layoutCode;
$importLog->logFileURL = $logfile;
try {
    $importLog->save();
    $importLogID = $importLog->primaryKey;
} catch (Exception $e) {
    echo $e->getMessage();
}
//only get unique platforms
$platformArray = array_unique($platformArray, SORT_REGULAR);
foreach ($platformArray as $platformID) {
    $importLogPlatformLink = new ImportLogPlatformLink();
    $importLogPlatformLink->importLogID = $importLogID;
    $importLogPlatformLink->platformID = $platformID;
    try {
        $importLogPlatformLink->save();
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
?>


<table class="headerTable">
<tr><td>
<div class="headerText"><?php 
echo _("Status");