Created
July 9, 2018 14:51
-
-
Save rmpel/3009b8de49e122f52b143ca83ab22ace to your computer and use it in GitHub Desktop.
Shellscript + PHP file for automatically ending looped Database query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'some-bootstrap.php'; // perhaps wp-load.php | |
global $db; // perhaps $wpdb | |
$count = $db->query("DELETE FROM sometable WHERE somefield = 'somevalue' LIMIT 100"); // should return affected rows count | |
die($count); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
while ! php long-running-query.php ; do sleep 1; echo -n .; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment