@@ -210,42 +210,31 @@ function main($id, $mode)
210210 'L_PROGRESS ' => $ user ->lang ['RS_SYNC_STEP_POST_AUTHOR ' ],
211211 ));
212212
213- while (still_on_time () && $ start <= $ this ->max_rep_id )
214- {
215- $ sql_array = array (
216- 'SELECT ' => 'r.rep_id, r.rep_to, p.poster_id ' ,
217- 'FROM ' => array (REPUTATIONS_TABLE => 'r ' ),
218- 'LEFT_JOIN ' => array (
219- array (
220- 'FROM ' => array (POSTS_TABLE => 'p ' ),
221- 'ON ' => 'r.post_id = p.post_id ' ,
222- ),
213+ $ sql_array = array (
214+ 'SELECT ' => 'r.rep_id, r.rep_to, p.poster_id ' ,
215+ 'FROM ' => array (REPUTATIONS_TABLE => 'r ' ),
216+ 'LEFT_JOIN ' => array (
217+ array (
218+ 'FROM ' => array (POSTS_TABLE => 'p ' ),
219+ 'ON ' => 'r.post_id = p.post_id ' ,
223220 ),
224- 'WHERE ' => 'r.post_id != 0 AND (r.action = 1 OR r.action = 5) AND r.rep_to >= ' . ($ start + 1 ) . ' AND r.rep_to <= ' . ($ start + $ this ->step ),
225- );
226- $ sql = $ db ->sql_build_query ('SELECT ' , $ sql_array );
227- $ result = $ db ->sql_query ($ sql );
221+ ),
222+ 'WHERE ' => 'r.post_id != 0 AND (r.action = 1 OR r.action = 5) ' ,
223+ );
224+ $ sql = $ db ->sql_build_query ('SELECT ' , $ sql_array );
225+ $ result = $ db ->sql_query ($ sql );
228226
229- while ($ row = $ db ->sql_fetchrow ($ result ))
227+ while ($ row = $ db ->sql_fetchrow ($ result ))
228+ {
229+ if ($ row ['rep_to ' ] != $ row ['poster_id ' ])
230230 {
231- if ($ row ['rep_to ' ] != $ row ['poster_id ' ])
232- {
233- $ sql = 'UPDATE ' . REPUTATIONS_TABLE . "
234- SET rep_to = {$ row ['poster_id ' ]}
235- WHERE rep_id = {$ row ['rep_id ' ]}" ;
236- $ db ->sql_query ($ sql );
237- }
231+ $ sql = 'UPDATE ' . REPUTATIONS_TABLE . "
232+ SET rep_to = {$ row ['poster_id ' ]}
233+ WHERE rep_id = {$ row ['rep_id ' ]}" ;
234+ $ db ->sql_query ($ sql );
238235 }
239- $ db ->sql_freeresult ($ result );
240-
241- $ start += $ this ->step ;
242- }
243-
244- if ($ start <= $ this ->max_rep_id )
245- {
246- meta_refresh (1 , append_sid ($ this ->u_action . '&action=resync&start= ' . $ start ));
247- return ;
248236 }
237+ $ db ->sql_freeresult ($ result );
249238
250239 set_config ('rs_sync_step ' , 5 , true );
251240 meta_refresh (3 , append_sid ($ this ->u_action . '&action=resync ' ));
0 commit comments