diff --git a/SETUP/MediaWiki_extensions/hospitalExtensions.php b/SETUP/MediaWiki_extensions/hospitalExtensions.php index df4c77066..5eb526c88 100644 --- a/SETUP/MediaWiki_extensions/hospitalExtensions.php +++ b/SETUP/MediaWiki_extensions/hospitalExtensions.php @@ -73,7 +73,5 @@ function listHospitalProjects($input, $argv) $output .= "\n"; $output .= "\n"; } - - mysqli_free_result($result); return $output; } diff --git a/SETUP/document_database.php b/SETUP/document_database.php index 626cf4e8b..c99fc411b 100755 --- a/SETUP/document_database.php +++ b/SETUP/document_database.php @@ -243,8 +243,6 @@ function query_columns_for_table(string $table_name): array } $rows = mysqli_fetch_all($result, MYSQLI_ASSOC); - mysqli_free_result($result); - return $rows; } diff --git a/SETUP/tests/unittests/phpunit_test_helpers.inc b/SETUP/tests/unittests/phpunit_test_helpers.inc index f4be8dc8a..cab934cb0 100644 --- a/SETUP/tests/unittests/phpunit_test_helpers.inc +++ b/SETUP/tests/unittests/phpunit_test_helpers.inc @@ -106,8 +106,6 @@ function create_test_image_source(string $image_source): void if (!$result) { throw new Exception(sprintf("Unable to create test image source %s", $image_source)); } - } else { - mysqli_free_result($result); } } diff --git a/pinc/CharSuites.inc b/pinc/CharSuites.inc index 05e98d0b0..a1532fa4f 100644 --- a/pinc/CharSuites.inc +++ b/pinc/CharSuites.inc @@ -187,7 +187,6 @@ class CharSuites while ($row = mysqli_fetch_assoc($result)) { $charsuites[] = CharSuites::get($row["name"]); } - mysqli_free_result($result); return $charsuites; } diff --git a/pinc/JsonStorage.inc b/pinc/JsonStorage.inc index 5453ff596..c3bc7e3f6 100644 --- a/pinc/JsonStorage.inc +++ b/pinc/JsonStorage.inc @@ -69,7 +69,6 @@ class JsonStorage while ($row = mysqli_fetch_assoc($result)) { $value = $row['value']; } - mysqli_free_result($result); return $value; } diff --git a/pinc/NonactivatedUser.inc b/pinc/NonactivatedUser.inc index f6ca88091..ec5fb65ae 100644 --- a/pinc/NonactivatedUser.inc +++ b/pinc/NonactivatedUser.inc @@ -136,8 +136,6 @@ class NonactivatedUser ) ); } - - mysqli_free_result($result); } public function save(): void diff --git a/pinc/Project.inc b/pinc/Project.inc index 356bacd2f..a66fcddf5 100644 --- a/pinc/Project.inc +++ b/pinc/Project.inc @@ -905,7 +905,6 @@ class Project while ($row = mysqli_fetch_assoc($result)) { $projectids[] = $row['projectid']; } - mysqli_free_result($result); return $projectids; } @@ -1013,7 +1012,6 @@ class Project while ($row = mysqli_fetch_assoc($result)) { $charsuites[] = CharSuites::get($row["charsuite_name"]); } - mysqli_free_result($result); return $charsuites; } @@ -1247,8 +1245,6 @@ class Project while ($row = mysqli_fetch_assoc($res)) { $states[] = $row["state"]; } - mysqli_free_result($res); - return $states; } @@ -2154,7 +2150,6 @@ function load_image_sources(): array while ($row = mysqli_fetch_assoc($result)) { $image_sources[(string)$row['code_name']] = $row; } - mysqli_free_result($result); return $image_sources; } diff --git a/pinc/RandomRule.inc b/pinc/RandomRule.inc index ac0b0988f..c3d595f56 100644 --- a/pinc/RandomRule.inc +++ b/pinc/RandomRule.inc @@ -79,7 +79,6 @@ class RandomRule $result = DPDatabase::query($sql); $row = mysqli_fetch_assoc($result); - mysqli_free_result($result); if (!$row) { return null; } @@ -106,7 +105,6 @@ class RandomRule ); $result = DPDatabase::query($sql); $row = mysqli_fetch_assoc($result); - mysqli_free_result($result); if (!$row) { return null; } @@ -138,7 +136,6 @@ class RandomRule while ($row = mysqli_fetch_assoc($result)) { $rules[] = new RandomRule($row["id"]); } - mysqli_free_result($result); return $rules; } @@ -168,7 +165,6 @@ class RandomRule 'count' => $row['count'], ]; } - mysqli_free_result($result); return $summary; } diff --git a/pinc/Settings.inc b/pinc/Settings.inc index 35b0e35d4..f13fff789 100644 --- a/pinc/Settings.inc +++ b/pinc/Settings.inc @@ -46,7 +46,6 @@ class Settings while ($row = mysqli_fetch_assoc($result)) { $this->_load_value($row['setting'], $row['value']); } - mysqli_free_result($result); } public function UserName(): string @@ -306,8 +305,6 @@ class Settings while ($row = mysqli_fetch_assoc($result)) { $usernames[] = $row['username']; } - mysqli_free_result($result); - return $usernames; } } diff --git a/pinc/TallyBoard.inc b/pinc/TallyBoard.inc index 8aa1929d7..d7f556429 100644 --- a/pinc/TallyBoard.inc +++ b/pinc/TallyBoard.inc @@ -325,7 +325,6 @@ class TallyBoard $r++; } - mysqli_free_result($result); // we need to pull the same data from the users table but with a // current_tally of 0 to populate $neighbors @@ -342,7 +341,6 @@ class TallyBoard ); $result = DPDatabase::query($sql); $row = mysqli_fetch_assoc($result); - mysqli_free_result($result); $rank = $ranker->next($row["current_tally"]); $row["current_rank"] = $rank; $neighbors[0] = $row; diff --git a/pinc/Team.inc b/pinc/Team.inc index 17e5d1e48..fbeca4a20 100644 --- a/pinc/Team.inc +++ b/pinc/Team.inc @@ -34,7 +34,6 @@ class Team $result = DPDatabase::query($sql); [$count] = mysqli_fetch_row($result); - mysqli_free_result($result); return $count; } } diff --git a/pinc/User.inc b/pinc/User.inc index 9c0cfa7ea..2f835f5fa 100644 --- a/pinc/User.inc +++ b/pinc/User.inc @@ -291,8 +291,6 @@ class User ) ); } - - mysqli_free_result($result); } public function save(): void @@ -316,7 +314,6 @@ class User while ($row = mysqli_fetch_assoc($result)) { $teams[] = $row["t_id"]; } - mysqli_free_result($result); return $teams; } @@ -536,8 +533,6 @@ class User $is_valid = true; } } - - mysqli_free_result($result); return $is_valid; } diff --git a/pinc/UserProfile.inc b/pinc/UserProfile.inc index fc874163d..c407f5c38 100644 --- a/pinc/UserProfile.inc +++ b/pinc/UserProfile.inc @@ -104,8 +104,6 @@ class UserProfile ); } $this->table_row = mysqli_fetch_assoc($result); - - mysqli_free_result($result); } public function save(): void @@ -184,7 +182,6 @@ class UserProfile while ($row = mysqli_fetch_assoc($result)) { $profiles[] = new UserProfile((int)$row["id"]); } - mysqli_free_result($result); return $profiles; } } diff --git a/pinc/UserSuggestions.inc b/pinc/UserSuggestions.inc index 92f9f9359..d924ab2d1 100644 --- a/pinc/UserSuggestions.inc +++ b/pinc/UserSuggestions.inc @@ -443,7 +443,6 @@ class UserSuggestions while ([$count, $value] = mysqli_fetch_row($result)) { $field_counts[$value] = $count; } - mysqli_free_result($result); return $field_counts; } } diff --git a/pinc/forum_interface_phpbb3.inc b/pinc/forum_interface_phpbb3.inc index 7fabded82..0f13514bd 100644 --- a/pinc/forum_interface_phpbb3.inc +++ b/pinc/forum_interface_phpbb3.inc @@ -444,8 +444,6 @@ function get_forum_user_id(string $username): ?int $res = DPDatabase::query($query); $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - if (!$row) { return null; } @@ -473,8 +471,6 @@ function get_forum_rank_title(int $rank): ?string $res = DPDatabase::query($query); $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - return $row["rank_title"] ?? null; } @@ -628,8 +624,6 @@ function get_number_of_unread_messages(string $username): ?int $res = DPDatabase::query($query); [$num_messages] = mysqli_fetch_row($res); - mysqli_free_result($res); - return $num_messages; } @@ -650,9 +644,6 @@ function does_topic_exist(int $topic_id): bool $res = DPDatabase::query($query); $exists = (mysqli_num_rows($res) > 0); - - mysqli_free_result($res); - return $exists; } @@ -676,8 +667,6 @@ function get_last_post_time_in_topic(int $topic_id): ?int $res = DPDatabase::query($query); $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - return $row["max_post_time"] ?? null; } @@ -713,8 +702,6 @@ function get_topic_details(int $topic_id): ?array $res = DPDatabase::query($query); $row = mysqli_fetch_assoc($res); - mysqli_free_result($res); - return $row; } diff --git a/pinc/graph_data.inc b/pinc/graph_data.inc index 493a001fe..c031456de 100644 --- a/pinc/graph_data.inc +++ b/pinc/graph_data.inc @@ -776,7 +776,6 @@ function get_round_backlog_stats(array $interested_phases): array while ($result = mysqli_fetch_assoc($res)) { $stats[$phase] = $result["num_pages"] ?? 0; // SELECT SUM() WHERE 0; returns NULL } - mysqli_free_result($res); } // Pop off any trailing phases that have no pages. diff --git a/pinc/showavailablebooks.inc b/pinc/showavailablebooks.inc index b0738dd95..2830e4b9c 100644 --- a/pinc/showavailablebooks.inc +++ b/pinc/showavailablebooks.inc @@ -588,9 +588,6 @@ function show_project_listing( } echo ""; - - // Free the search results. - mysqli_free_result($result); } // ----------------------------------------------------------------------------- diff --git a/pinc/wordcheck_engine.inc b/pinc/wordcheck_engine.inc index f74e193e3..30053a76e 100644 --- a/pinc/wordcheck_engine.inc +++ b/pinc/wordcheck_engine.inc @@ -735,9 +735,6 @@ function count_wordcheck_suggestion_events(string $projectid, int $start_time = $res = DPDatabase::query($sql); $row = mysqli_fetch_assoc($res); - - mysqli_free_result($res); - return $row["numevents"]; } @@ -771,9 +768,6 @@ function load_wordcheck_events(string $projectid, int $start_time = 0): array $eventArray[] = [$time, $round, $page, $proofer, $words]; } - - mysqli_free_result($res); - return $eventArray; } @@ -796,9 +790,6 @@ function load_project_good_word_suggestions_flat(string $projectid, int $start_t while ([$suggestions] = mysqli_fetch_row($res)) { $words = array_merge($words, explode("\n", $suggestions)); } - - mysqli_free_result($res); - return $words; } diff --git a/tasks.php b/tasks.php index efdc1688b..745fef63d 100644 --- a/tasks.php +++ b/tasks.php @@ -1266,7 +1266,6 @@ function load_task(int $tid, bool $is_assoc = true) } else { $task = mysqli_fetch_object($result); } - mysqli_free_result($result); return $task; } diff --git a/tools/project_manager/edit_project_word_lists.php b/tools/project_manager/edit_project_word_lists.php index b90189a46..fdc0ba0ec 100644 --- a/tools/project_manager/edit_project_word_lists.php +++ b/tools/project_manager/edit_project_word_lists.php @@ -440,9 +440,6 @@ public function number_of_pages_in_round(?Round $round): int $res = DPDatabase::query($sql); $count = mysqli_fetch_row($res); - - mysqli_free_result($res); - return $count[0]; } } diff --git a/tools/project_manager/show_image_sources.php b/tools/project_manager/show_image_sources.php index 083f8bdae..4d2b1e478 100644 --- a/tools/project_manager/show_image_sources.php +++ b/tools/project_manager/show_image_sources.php @@ -289,6 +289,5 @@ function load_image_source_stats(): array while ($row = mysqli_fetch_assoc($result)) { $stats[(string)$row['image_source']] = $row; } - mysqli_free_result($result); return $stats; } diff --git a/tools/project_manager/show_project_wordcheck_usage.php b/tools/project_manager/show_project_wordcheck_usage.php index 4d51da03f..36612bb55 100644 --- a/tools/project_manager/show_project_wordcheck_usage.php +++ b/tools/project_manager/show_project_wordcheck_usage.php @@ -139,8 +139,6 @@ echo "\n"; } -mysqli_free_result($res); - ?> = $wordInstances) { echo "

" . _("More instances were found; please choose how many to show from the drop-down.") . "

"; diff --git a/tools/proofers/review_work.php b/tools/proofers/review_work.php index d087b2949..f1b3030de 100644 --- a/tools/proofers/review_work.php +++ b/tools/proofers/review_work.php @@ -437,7 +437,6 @@ function _echo_round_select(array $rounds, ?Round $selected_round): void while ([$image] = mysqli_fetch_row($result)) { $diffLinkString .= "$image "; } - mysqli_free_result($result); } // not sure why the pages that have been saved in the review round diff --git a/tools/site_admin/show_common_words_from_project_word_lists.php b/tools/site_admin/show_common_words_from_project_word_lists.php index 88c1d56e7..39b0a9198 100644 --- a/tools/site_admin/show_common_words_from_project_word_lists.php +++ b/tools/site_admin/show_common_words_from_project_word_lists.php @@ -58,7 +58,6 @@ $option_value = urlencode($language); echo ""; } - mysqli_free_result($res); echo ""; echo ""; echo "";