Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. include("autoload.inc");
  4.  
  5. $link = Database::connectLocal();
  6.  
  7. $digits = explode(",",$_SERVER['argv'][1]);
  8.  
  9. print_r($digits);
  10.  
  11. $result = $link->query("SHOW TABLES in pluginlongterm");
  12.  
  13. while ($row = $result->fetchObject()) {
  14. $table = $row->Tables_in_pluginlongterm;
  15.  
  16. $filename = "/data/mysql/pluginlongterm/$table.MYI";
  17.  
  18.  
  19. if (!file_exists($filename) || !is_link($filename)) continue;
  20.  
  21. $target = readlink($filename);
  22. if (file_exists($target)) continue;
  23.  
  24. if (!preg_match('#d(\d+)#',$table,$device)) continue;
  25.  
  26. $digit = $device[1][1];
  27. var_dump($digit);
  28. if (!in_array($digit,$digits)) continue;
  29.  
  30. echo "fixing table $table\n";
  31. $link->query("REPAIR TABLE pluginlongterm.$table USE_FRM");
  32.  
  33. if ($link->error()) exit($link->error());
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement