{ $mod->get_archive(); // If the filename has been changed, change it for localisation pack too if ($mod->filename != $row['mod_filename'] && file_exists($phpbb_root_path . $config['mods_loc_store_path'] . $row['mod_filename'] . '.zip')) { rename($phpbb_root_path . $config['mods_loc_store_path'] . $row['mod_filename'] . '.zip', $phpbb_root_path . $config['mods_loc_store_path'] . $mod->filename . '.zip'); } // Move localisation pack to the temp directory where the mod class is looking for it if (file_exists($phpbb_root_path . $config['mods_loc_store_path'] . $mod->filename . '.zip')) { copy($phpbb_root_path . $config['mods_loc_store_path'] . $mod->filename . '.zip', $phpbb_root_path . $config['mods_tmp_dir_path'] . 'localisations/' . $mod->filename . '.zip'); } $mod->merge_packs(); $row['mod_old_version'] = $row['mod_version']; $row['mod_en_title'] = $mod->data['title']; $row['mod_md5'] = $mod->data['md5']; $row['mod_version'] = $mod->data['version']; $row['mod_author_id'] = $mod->data['author']['id']; $row['mod_author_name'] = $mod->data['author']['name']; $row['mod_size'] = $mod->data['size']; $row['mod_filename'] = $mod->filename; // Update our MOD database $sql_ary = array( 'mod_filename' => $row['mod_filename'], 'mod_en_title' => $row['mod_en_title'],
// 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(); } if (empty($error)) { // Store localisation pack if (file_exists($phpbb_root_path . $config['mods_loc_store_path'] . $mod->filename . '.zip')) { unlink($phpbb_root_path . $config['mods_loc_store_path'] . $mod->filename . '.zip'); } copy($phpbb_root_path . $config['mods_tmp_dir_path'] . 'localisations/' . $mod->filename . '.zip', $phpbb_root_path . $config['mods_loc_store_path'] . $mod->filename . '.zip'); }