LEFT JOIN ' . TOPICS_TABLE . ' t
		ON m.topic_id = t.topic_id
	LEFT JOIN ' . POSTS_TABLE . ' p
		ON t.topic_first_post_id = p.post_id
	WHERE mod_last_checked < ' . (time() - $update_freq) . '
		AND t.topic_approved = 1';
/*$sql = 'SELECT m.*
	FROM ' . MODS_TABLE . ' m
	WHERE mod_last_checked < ' . (time() - $update_freq);*/
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result))
{
	try
	{
		$mod = new mod_pack($row['mod_db_id']);
	}
	catch(ModException $e)
	{
		continue;
	}
	
	try
	{
		$mod->get_pack_details();
		
		// Update MOD if needed
		if (version_compare($row['mod_version'], $mod->data['version'], '<'))
		{
			$mod->get_archive();
			
Esempio n. 2
0
			{
				if ($mode == 'add')
				{
					list(, $mod_data['mod_db_id']) = $match;
					
					$sql = 'SELECT mod_id FROM ' . MODS_TABLE . ' WHERE mod_db_id = ' . $mod_data['mod_db_id'];
					$result = $db->sql_query($sql);
					
					if ($db->sql_fetchrow($result))
					{
						// Not the proper way but this is the most simple solution
						throw new ModException(array('MOD_EXISTS'));
					}
				}
					
				$mod = new mod_pack($mod_data['mod_db_id']);
				$mod->get_pack_details();
				$mod->get_archive();
				
				// Move localisation pack to its place since we have now the filename
				if(isset($file) && !sizeof($file->error))
				{
					rename($file->filename, $phpbb_root_path . $config['mods_tmp_dir_path'] . '/localisations/' . $mod->filename . '.zip');
				}
				
				$mod->merge_packs((bool) sizeof($error));
			}
			catch(ModException $e)
			{
				$error += $e->getErrors();
			}