|null $log_entries
*/
public function display_documentation(
bool $running,
array $queue_dirinfo,
array $uploaded_dirinfo,
array $failed_dirinfo,
string $cron_cmd,
string $cron_url,
?array $log_entries
): void {
global $page, $config, $user_config;
$info_html = "";
$page->set_title("Cron Uploader");
$page->set_heading("Cron Uploader");
if (!$config->get_bool(UserConfig::ENABLE_API_KEYS)) {
$info_html .= "THIS EXTENSION REQUIRES USER API KEYS TO BE ENABLED IN BOARD ADMIN ";
}
$info_html .= "Information
" . ($running ? "
Cron upload is currently running
" : "") . "
Directory
Files
Size (MB)
Directory Path
Queue
{$queue_dirinfo['total_files']}
{$queue_dirinfo['total_mb']}
{$queue_dirinfo['path']}
Uploaded
{$uploaded_dirinfo['total_files']}
{$uploaded_dirinfo['total_mb']}
{$uploaded_dirinfo['path']}
Failed
{$failed_dirinfo['total_files']}
{$failed_dirinfo['total_mb']}
{$failed_dirinfo['path']}
Cron Command:
Create a cron job with the command above.
Read the documentation if you're not sure what to do.
URL:
";
$install_html = "
This cron uploader is fairly easy to use but has to be configured first.
Install & activate this plugin.
Go to the Board Config and change any settings to match your preference.
Copy the cron command above.
Create a cron job or something else that can open a url on specified times.
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.
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.
When you create the cron job, you choose when to upload new posts.
";
$max_time = intval(ini_get('max_execution_time')) * .8;
$usage_html = "Upload your images you want to be uploaded to the queue directory using your FTP client or other means.
({$queue_dirinfo['path']})
Any sub-folders will be turned into tags.
If the file name matches \"## - tag1 tag2.png\" the tags will be used.
If both are found, they will all be used.
The character \";\" will be changed into \":\" in any tags.
You can inherit categories by creating a folder that ends with \";\". For instance category;\\tag1 would result in the tag category:tag1. This allows creating a category folder, then creating many subfolders that will use that category.
The cron uploader works by importing files from the queue folder whenever this url is visited:
$cron_url
If an import is already running, another cannot start until it is done.
Each time it runs it will import for up to ".number_format($max_time)." seconds. This is controlled by the PHP max execution time.
Uploaded images will be moved to the 'uploaded' directory into a subfolder named after the time the import started. It's recommended that you remove everything out of this directory from time to time. If you have admin controls enabled, this can be done from Board Admin.
If you enable the db logging extension, you can view the log output on this screen. Otherwise the log will be written to a file at ".$user_config->get_string(CronUploaderConfig::DIR).DIRECTORY_SEPARATOR."uploads.log
";
$block = new Block("Cron Uploader", $info_html, "main", 10);
$block_install = new Block("Setup Guide", $install_html, "main", 30);
$block_usage = new Block("Usage Guide", $usage_html, "main", 20);
$page->add_block($block);
$page->add_block($block_install);
$page->add_block($block_usage);
if (!empty($log_entries)) {
$log_html = "
";
foreach ($log_entries as $entry) {
$log_html .= "
";
$html .= make_form(make_link("admin/cron_uploader_clear_queue"), onsubmit: "return confirm('Are you sure you want to delete everything in the queue folder?');")
."
"
."
";
$html .= make_form(make_link("admin/cron_uploader_clear_uploaded"), onsubmit: "return confirm('Are you sure you want to delete everything in the uploaded folder?');")
."
"
."
";
$html .= make_form(make_link("admin/cron_uploader_clear_failed"), onsubmit: "return confirm('Are you sure you want to delete everything in the failed folder?');")
."