Selaa lähdekoodia

Avoiding $db->num_rows() in include/cache.php

Visman 7 vuotta sitten
vanhempi
commit
b4116b872a
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      include/cache.php

+ 2 - 3
include/cache.php

@@ -145,12 +145,11 @@ function generate_censoring_cache()
 	global $db;
 
 	$result = $db->query('SELECT search_for, replace_with FROM '.$db->prefix.'censoring') or error('Unable to fetch censoring list', __FILE__, __LINE__, $db->error());
-	$num_words = $db->num_rows($result);
 
 	$search_for = $replace_with = array();
-	for ($i = 0; $i < $num_words; $i++)
+	for ($i = 0; $row = $db->fetch_row($result); $i++)
 	{
-		list($search_for[$i], $replace_with[$i]) = $db->fetch_row($result);
+		list($search_for[$i], $replace_with[$i]) = $row;
 		$search_for[$i] = '%(?<=[^\p{L}\p{N}])('.str_replace('\*', '[\p{L}\p{N}]*?', preg_quote($search_for[$i], '%')).')(?=[^\p{L}\p{N}])%iu';
 	}