Image to Post - cron upload

This commit is contained in:
Matthew Barbour 2020-10-26 10:28:12 -05:00
parent b4169821ed
commit ba982e4451
2 changed files with 8 additions and 8 deletions

View File

@ -419,10 +419,10 @@ class CronUploader extends Extension
if ($corrupt) { if ($corrupt) {
// Move to corrupt dir // Move to corrupt dir
$newDir = join_path($this->get_failed_dir(), $output_subdir, $relativeDir); $newDir = join_path($this->get_failed_dir(), $output_subdir, $relativeDir);
$info = "ERROR: Image was not uploaded. "; $info = "ERROR: Post was not uploaded. ";
} else { } else {
$newDir = join_path($this->get_uploaded_dir(), $output_subdir, $relativeDir); $newDir = join_path($this->get_uploaded_dir(), $output_subdir, $relativeDir);
$info = "Image successfully uploaded. "; $info = "Post successfully uploaded. ";
} }
$newDir = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $newDir); $newDir = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $newDir);
@ -434,7 +434,7 @@ class CronUploader extends Extension
// move file to correct dir // move file to correct dir
rename($path, $newFile); rename($path, $newFile);
$this->log_message(SCORE_LOG_INFO, $info . "Image \"$filename\" moved from queue to \"$newDir\"."); $this->log_message(SCORE_LOG_INFO, $info . "Post \"$filename\" moved from queue to \"$newDir\".");
} }
/** /**
@ -462,14 +462,14 @@ class CronUploader extends Extension
// Generate info message // Generate info message
if ($event->image_id == -1) { if ($event->image_id == -1) {
if(array_key_exists("mime",$event->metadata)) { if (array_key_exists("mime", $event->metadata)) {
throw new UploadException("File type not recognised (".$event->metadata["mime"]."). Filename: {$filename}"); throw new UploadException("File type not recognised (".$event->metadata["mime"]."). Filename: {$filename}");
} }
throw new UploadException("File type not recognised. Filename: {$filename}"); throw new UploadException("File type not recognised. Filename: {$filename}");
} elseif ($event->merged === true) { } elseif ($event->merged === true) {
$infomsg = "Image merged. ID: {$event->image_id} - Filename: {$filename}"; $infomsg = "Post merged. ID: {$event->image_id} - Filename: {$filename}";
} else { } else {
$infomsg = "Image uploaded. ID: {$event->image_id} - Filename: {$filename}"; $infomsg = "Post uploaded. ID: {$event->image_id} - Filename: {$filename}";
} }
$this->log_message(SCORE_LOG_INFO, $infomsg); $this->log_message(SCORE_LOG_INFO, $infomsg);
@ -511,7 +511,7 @@ class CronUploader extends Extension
$base = $this->get_queue_dir(); $base = $this->get_queue_dir();
if (!is_dir($base)) { if (!is_dir($base)) {
$this->log_message(SCORE_LOG_WARNING, "Image Queue Directory could not be found at \"$base\"."); $this->log_message(SCORE_LOG_WARNING, "Post Queue Directory could not be found at \"$base\".");
return; return;
} }

View File

@ -54,7 +54,7 @@ class CronUploaderTheme extends Themelet
<li>Create a cron job or something else that can open a url on specified times. <li>Create a cron job or something else that can open a url on specified times.
<br/>cron is a service that runs commands over and over again on a a schedule. You can set up cron (or any similar tool) to run the command above to trigger the import on whatever schedule you desire. <br/>cron is a service that runs commands over and over again on a a schedule. You can set up cron (or any similar tool) to run the command above to trigger the import on whatever schedule you desire.
<br />If you're not sure how to do this, you can give the command to your web host and you can ask them to create the cron job for you. <br />If you're not sure how to do this, you can give the command to your web host and you can ask them to create the cron job for you.
<br />When you create the cron job, you choose when to upload new images.</li> <br />When you create the cron job, you choose when to upload new posts.</li>
</ol>"; </ol>";