if (!$step) { $step = 0; $db->query("DELETE FROM pw_elements WHERE type='hotfavor'"); } $total = count($arr_forumkeys); for ($i = 0; $i < 5; $i++) { if ($step < $total) { $fourmid = $arr_forumkeys[$step]; !$forum[$fourmid] && adminmsg('undefined_action'); $step++; if ($forum[$fourmid]['type'] == 'category') { continue; } else { $arr_posts = array(); $arr_posts = $getinfo->hotfavor($fourmid, $db_sortnum); $arr_posts = arr_unique($arr_posts); foreach ($arr_posts as $key => $value) { $arr_posts[$key]['type'] = 'hotfavor'; } if ($arr_posts) { $sql = "REPLACE INTO pw_elements(id,mark,value,type) VALUES" . S::sqlMulti($arr_posts, false); $db->update($sql); } } } else { break; } } if ($step < $total) { adminmsg('updatecache_total_step', "{$basename}&action=update&type=hotfavor&step={$step}"); }
public function testUnique() { $input = [1, 2, 3, 3, 4, 1, 5]; $this->assertEquals([1, 2, 3, 4, 5], array_values(arr_unique($input))); }