// Automod testing time $details = ''; $html_results = $bbcode_results = array(); $sql = 'SELECT row_id, phpbb_version_branch, phpbb_version_revision FROM ' . TITANIA_REVISIONS_PHPBB_TABLE . ' WHERE revision_id = ' . $revision->revision_id; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $version_string = $row['phpbb_version_branch'][0] . '.' . $row['phpbb_version_branch'][1] . '.' . $row['phpbb_version_revision']; $phpbb_path = $contrib_tools->automod_phpbb_files($version_string); if ($phpbb_path === false) { $error = array_merge($error, $contrib_tools->error); continue; } phpbb::$template->assign_vars(array('PHPBB_VERSION' => $version_string, 'TEST_ID' => $row['row_id'])); $html_result = $bbcode_result = ''; $installed = $contrib_tools->automod($phpbb_path, $details, $html_result, $bbcode_result); $html_results[] = $html_result; $bbcode_results[] = $bbcode_result; } phpbb::$db->sql_freeresult($result); $html_results = implode('<br /><br />', $html_results); $bbcode_results = implode("\n\n", $bbcode_results); // Update the queue with the results $queue = $revision->get_queue(); $queue->automod_results = $bbcode_results; $queue->submit(); phpbb::$template->assign_var('AUTOMOD_RESULTS', $html_results); // Remove our temp files $contrib_tools->remove_temp_files(); break; // Translation validation
WHERE row_id = ' . $row['row_id']; phpbb::$db->sql_query($sql); $new_dir_name = $row['contrib_name_clean'] . '_' . preg_replace('#[^0-9a-z]#', '_', strtolower($row['revision_version'])); $version = $row['phpbb_version_branch'][0] . '.' . $row['phpbb_version_branch'][1] . '.' . $row['phpbb_version_revision']; $zip = titania::$config->upload_path . utf8_basename($row['attachment_directory']) . '/' . utf8_basename($row['physical_filename']); $details = $results = $bbcode_results = ''; $contrib_tools = new titania_contrib_tools($zip, $new_dir_name); $package_root = $contrib_tools->find_root(); $contrib_tools->restore_root($package_root); if (sizeof($contrib_tools->error)) { continue; } if (!($phpbb_path = $contrib_tools->automod_phpbb_files($version))) { continue; } if ($contrib_tools->automod($phpbb_path, $details, $results, $bbcode_results)) { $sql_ary = array('revision_id' => $row['revision_id'], 'contrib_id' => $row['contrib_id'], 'phpbb_version_branch' => $row['phpbb_version_branch'], 'phpbb_version_revision' => get_real_revision_version($row['phpbb_version_revision']), 'revision_validated' => $row['revision_status'] == TITANIA_REVISION_APPROVED ? true : false); phpbb::$db->sql_query('INSERT INTO ' . TITANIA_REVISIONS_PHPBB_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } $contrib_tools->remove_temp_files(); unset($contrib_tools); } phpbb::$db->sql_freeresult($result); } // Unloading cache and closing db after having done the dirty work. if ($use_shutdown_function) { register_shutdown_function('garbage_collection'); } else { garbage_collection(); } exit;
public function automod_test(&$contrib, &$revision, &$revision_attachment, &$contrib_tools, $download_package) { $new_dir_name = $contrib->contrib_name_clean . '_' . preg_replace('#[^0-9a-z]#', '_', strtolower($revision->revision_version)); // Start up the machine $contrib_tools = new titania_contrib_tools($contrib_tools->original_zip, $new_dir_name); // Automod testing time $details = ''; $error = $html_results = $bbcode_results = array(); $sql = 'SELECT row_id, phpbb_version_branch, phpbb_version_revision FROM ' . TITANIA_REVISIONS_PHPBB_TABLE . ' WHERE revision_id = ' . $revision->revision_id; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $version_string = $row['phpbb_version_branch'][0] . '.' . $row['phpbb_version_branch'][1] . '.' . $row['phpbb_version_revision']; $phpbb_path = $contrib_tools->automod_phpbb_files($version_string); if ($phpbb_path === false) { $error = array_merge($error, $contrib_tools->error); continue; } phpbb::$template->assign_vars(array('PHPBB_VERSION' => $version_string, 'TEST_ID' => $row['row_id'])); $html_result = $bbcode_result = ''; $installed = $contrib_tools->automod($phpbb_path, $details, $html_result, $bbcode_result); $html_results[] = $html_result; $bbcode_results[] = $bbcode_result; } phpbb::$db->sql_freeresult($result); if (is_array($details)) { $revision->install_time = $details['INSTALLATION_TIME']; switch ($details['INSTALLATION_LEVEL']) { case 'easy': $revision->install_level = 1; break; case 'intermediate': $revision->install_level = 2; break; case 'advanced': $revision->install_level = 3; break; } $revision->submit(); } $html_results = implode('<br /><br />', $html_results); $bbcode_results = implode("\n\n", $bbcode_results); // Update the queue with the results $queue = $revision->get_queue(); $queue->automod_results = $bbcode_results; $queue->submit(); phpbb::$template->assign_var('AUTOMOD_RESULTS', $html_results); // Remove our temp files $contrib_tools->remove_temp_files(); return array('error' => $error); }