Using new form of delinstbyuid function; removed references to New column
This commit is contained in:
parent
835e02c171
commit
cd16eabce5
1 changed files with 7 additions and 10 deletions
|
@ -40,7 +40,7 @@ $help='mustool.php
|
|||
First it returns a list of Instances records matching “condition”, then
|
||||
lets you choose whether you want to delete them and all records referencing
|
||||
them in other tables.
|
||||
Example: mustool.php deleteinstswhere "New=0 AND Dead=1"
|
||||
Example: mustool.php deleteinstswhere "Dead=1"
|
||||
shuffle
|
||||
Randomizes instances list (values in «RPos» column).
|
||||
updstats
|
||||
|
@ -115,12 +115,6 @@ catch (Exception $error) { mexit('could not set «utf8mb4» charset for MySQL: '
|
|||
// for php versions < 8
|
||||
if ($res===false) mexit('could not set MySQL charset: '.mysqli_errno($link).': '.mysqli_error($link).'.'.N,1,true);
|
||||
|
||||
/*if ($opts['setold']) {
|
||||
echo('Setting «New=0» for instances which are no longer new ... ');
|
||||
myq($link,'UPDATE Instances SET New=0 WHERE '.time().'-FirstSeen > '.$opts['setold_new_period']);
|
||||
echo('done! Affected rows: '.mysqli_affected_rows($link).'.'.N);
|
||||
}*/
|
||||
|
||||
if ($opts['deleteinstswhere']) {
|
||||
$res=myq($link,'SELECT ID, URI FROM Instances WHERE '.$opts['deleteinstswhereconds']);
|
||||
$buf=[];
|
||||
|
@ -135,9 +129,8 @@ if ($opts['deleteinstswhere']) {
|
|||
foreach ($buf as $row) {
|
||||
$i++;
|
||||
echo('Deleting Instances record with ID = '.$row['ID'].' and URI = «'.$row['URI'].'», and all references to it ('.$i.'/'.$cbuf.', '.round(100/$cbuf*$i,2).'%) ...'.N);
|
||||
$res=delinstbyid($link,$row['ID']);
|
||||
foreach ($res['log'] as $loge) echo($loge.N);
|
||||
if (!$res['ok']) mexit('Error trying to delete Instances record with ID='.$row['ID'].'; see the log above for more info.'.N);
|
||||
$res=delinstbyid($link,$row['ID'],'eecho',N);
|
||||
if (!$res) mexit('Error trying to delete Instances record with ID='.$row['ID'].'; see the log above for more info.'.N);
|
||||
if ($i<$cbuf) echo('---'.N);
|
||||
}
|
||||
}
|
||||
|
@ -289,4 +282,8 @@ function mexit($msg,$code) {
|
|||
exit($code);
|
||||
}
|
||||
|
||||
function eecho($msg) {
|
||||
echo($msg);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue