<?php
// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: allocate.php 66102 2018-04-19 18:05:08Z luciash $

function prefs_allocate_list()
{
	$prefs = [
		'unified_rebuild' => ['label' => tr('Search index rebuild'), 'memory' => true, 'time' => true],
		'tracker_export_items' => ['label' => tr('Tracker item export'), 'memory' => true, 'time' => true],
		'tracker_clear_items' => ['label' => tr('Tracker clear'), 'memory' => false, 'time' => true],
		'print_pdf' => ['label' => tr('Printing to PDF'), 'memory' => true, 'time' => true],
	];

	$out = [];
	foreach ($prefs as $name => $info) {
		if ($info['memory']) {
			$out['allocate_memory_' . $name] = [
				'name' => tr('%0 memory limit', $info['label']),
				'description' => tr('Temporarily adjust the memory limit to use during %0. Depending on the volume of data, some large operations require more memory. Increasing it locally, per operation, allows to keep a lower memory limit globally. Keep in mind that memory usage is still limited to what is available on the server.', $info['label']),
				'help' => 'Memory+Limit',
				'type' => 'text',
				'default' => '',
				'shorthint' => tr('for example: 256M'),
				'size' => 8,
			];
		}

		if ($info['time']) {
			$out['allocate_time_' . $name] = [
				'name' => tr('%0 time limit', $info['label']),
				'description' => tr('Temporarily adjust the time limit to use during %0. Depending on the volume of data, some requests may take longer. Increase the time limit locally to resolve the issue. Use reasonable values.', $info['label']),
				'help' => 'Time+Limit',
				'type' => 'text',
				'default' => '',
				'units' => tr('seconds'),
				'size' => 8,
			];
		}
	}

	return $out;
}
