Exemple #1
0
 /**
  * Terminate execution of web site in case of Database error.
  * @return void Website execution is terminated. Errors are logged and sent
  * via Email. User is redirected to error page if possible.
  */
 private function KillDB()
 {
     // Log Database Error
     $date = date('m/d/Y G:iA');
     $message_log = "### MySQL Error - {$date}\n\n";
     $message_log .= "Error:\n" . $this->Error() . "\n\n";
     $message_log .= "Query: " . $this->last_query . "\n\n";
     App::Log(DB_ERR_LOG, $message_log);
     // Send Notification
     $subject = 'Site Error Encountered ' . $date;
     $message_alert = "An error was encountered on the website\n\n";
     $message_alert .= "Date: " . $date . "\n\n";
     $message_alert .= "Error:\n" . $this->Error() . "\n\n";
     $message_alert .= "Query:\n" . $this->last_query;
     App::Alert($subject, $message_alert);
     if (!headers_sent()) {
         header("Location: " . HOST . "/system-error/");
     } else {
         echo '<script>top.location = "' . HOST . '/system-error/";</script>';
     }
     exit;
 }
Exemple #2
0
    $video->Update($data);
    Plugin::Trigger('encode.update');
    // Activate video
    $video->Approve('activate');
    /////////////////////////////////////////////////////////////
    //                         STEP 8                          //
    //                        Clean up                         //
    /////////////////////////////////////////////////////////////
    try {
        // Debug Log
        $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Deleting raw video...') : null;
        ### Delete raw videos & pre-faststart files
        Filesystem::Open();
        Filesystem::Delete($raw_video);
        Filesystem::Delete($mobile_temp);
        ### Delete encoding log files
        if ($config->debug_conversion) {
            App::Log(CONVERSION_LOG, "Video ID: {$video->video_id}, has completed processing!\n");
        } else {
            Filesystem::Delete($debug_log);
        }
    } catch (Exception $e) {
        App::Alert('Error During Video Encoding', $e->getMessage());
        App::Log(CONVERSION_LOG, $e->getMessage());
    }
    Plugin::Trigger('encode.complete');
} catch (Exception $e) {
    App::Alert('Error During Video Encoding', $e->getMessage());
    App::Log(CONVERSION_LOG, $e->getMessage());
    exit;
}