Project

General

Profile

« Previous | Next » 

Revision 10ef2b55

Added by Renato Botelho almost 8 years ago

Move workaround used to enable pkg metadata update cronjob to a generic mechanism

View differences:

src/etc/inc/upgrade_config.inc
5067 5067
 */
5068 5068
function additional_config_upgrade() {
5069 5069
	global $config;
5070

  
5071
	if (!is_array($config['system']['already_run_config_upgrade'])) {
5072
		$config['system']['already_run_config_upgrade'] = array();
5073
	}
5074
	$already_run =& $config['system']['already_run_config_upgrade'];
5075

  
5076
	/* Copy of upgrade_168_to_169() from 2.4 */
5077
	if (!isset($already_run['upgrade_168_to_169'])) {
5078
		$command = '/usr/bin/nice -n20 /etc/rc.update_pkg_metadata';
5079

  
5080
		$found = false;
5081
		if (is_array($config['cron']['item'])) {
5082
			foreach ($config['cron']['item'] as $entry) {
5083
				if ($entry['command'] == $command) {
5084
					$found = true;
5085
					break;
5086
				}
5087
			}
5088
		}
5089

  
5090
		if (!$found) {
5091
			$config['cron']['item'][] = array(
5092
				'minute' => '1',
5093
				'hour' => '0',
5094
				'mday' => '*',
5095
				'month' => '*',
5096
				'wday' => '*',
5097
				'who' => 'root',
5098
				'command' => $command
5099
			);
5100
		}
5101

  
5102
		$already_run['upgrade_168_to_169'] = true;
5103
	}
5104

  
5070 5105
}
5071 5106

  
5072 5107
?>
src/etc/rc.bootup
331 331
	system_webgui_start();
332 332
}
333 333

  
334
/* Workaround to add pkg metadata update cronjob on 2.3 */
335
if (!isset($config['cron']['rc_update_pkg_metadata'])) {
336
	$command = '/usr/bin/nice -n20 /etc/rc.update_pkg_metadata';
337

  
338
	$found = false;
339
	if (is_array($config['cron']['item'])) {
340
		foreach ($config['cron']['item'] as $entry) {
341
			if ($entry['command'] == $command) {
342
				$found = true;
343
				break;
344
			}
345
		}
346
	}
347

  
348
	if (!$found) {
349
		$config['cron']['item'][] = array(
350
			'minute' => '1',
351
			'hour' => '0',
352
			'mday' => '*',
353
			'month' => '*',
354
			'wday' => '*',
355
			'who' => 'root',
356
			'command' => $command
357
		);
358
	}
359

  
360
	$config['cron']['rc_update_pkg_metadata'] = true;
361
	write_config("Registered rc.update_pkg_metadata cronjob");
362
}
363

  
364 334
/* configure cron service */
365 335
echo "Configuring CRON...";
366 336
configure_cron();

Also available in: Unified diff