Skip to content

Instantly share code, notes, and snippets.

@rmpel
Created July 9, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmpel/3009b8de49e122f52b143ca83ab22ace to your computer and use it in GitHub Desktop.
Save rmpel/3009b8de49e122f52b143ca83ab22ace to your computer and use it in GitHub Desktop.
Shellscript + PHP file for automatically ending looped Database query
<?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);
#!/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