You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
946 B
22 lines
946 B
<?php
|
|
/**
|
|
* This script kills all queries to which the Chamilo database user has access
|
|
* through processlist.
|
|
* Use only when you have an impossible situation with an urgent need to
|
|
* restart or stop the database, and it just won't stop because it want to
|
|
* finish queries first, and these queries are waiting for a lock on a table
|
|
* that seems to never free itself.
|
|
* In this case, disable the exit(); line below, run this script and then you
|
|
* should be able to quickly restart your database.
|
|
*/
|
|
die('Remove the "die()" statement on line '.__LINE__.' to execute this script'.PHP_EOL);
|
|
require_once __DIR__.'/../../public/main/inc/global.inc.php';
|
|
$result = Database::query("SHOW FULL PROCESSLIST");
|
|
while ($row=Database::fetch_array($result)) {
|
|
$process_id=$row["Id"];
|
|
if ($row["Time"] > 200 ) {
|
|
$sql="KILL $process_id";
|
|
Database::query($sql);
|
|
}
|
|
}
|
|
echo "All queries by this user have been killed".PHP_EOL;
|
|
|