diff --git a/web/clitools/mustool.php b/web/clitools/mustool.php index 1ee36af..370d7ae 100755 --- a/web/clitools/mustool.php +++ b/web/clitools/mustool.php @@ -219,16 +219,13 @@ if ($opts['revive']) { if ($opts['shuffle']) { eecho('randomizing values in «RPos» column...'.N,1); - $res=myq($link,'SELECT ID FROM Instances'); + $res=myq($link,'SELECT ID FROM Instances ORDER BY RAND()'); $i=0; while ($row=mysqli_fetch_assoc($res)) { + myq($link,"UPDATE Instances SET RPos={$i} WHERE ID={$row['ID']}"); $i++; - $buf[$row['ID']]=$i; } - shuffle($buf); - foreach ($buf as $key=>$val) - myq($link,'UPDATE Instances SET RPos='.$val.' WHERE ID='.$key); - eecho('done! Affected rows: '.count($buf).'.'.N,1); + eecho("done! Affected rows: {$i}.\n",1); } if ($opts['updstats']) {