[ Index ] |
PHP Cross Reference of MyBB 1.8.30 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.8 4 * Copyright 2014 MyBB Group, All Rights Reserved 5 * 6 * Website: http://www.mybb.com 7 * License: http://www.mybb.com/about/license 8 * 9 */ 10 11 function task_checktables($task) 12 { 13 global $db, $mybb, $lang, $plugins; 14 15 // Sorry SQLite, you don't have a decent way of checking if the table is corrupted or not. 16 if($db->type == "sqlite") 17 { 18 return; 19 } 20 21 @set_time_limit(0); 22 23 $ok = array( 24 "The storage engine for the table doesn't support check", 25 "Table is already up to date", 26 "OK" 27 ); 28 29 $comma = ""; 30 $tables_list = ""; 31 $repaired = array(); 32 $setting_done = false; 33 34 $tables = $db->list_tables($mybb->config['database']['database'], $mybb->config['database']['table_prefix']); 35 foreach($tables as $key => $table) 36 { 37 $tables_list .= "{$comma}{$table} "; 38 $comma = ","; 39 } 40 41 if($tables_list) 42 { 43 $query = $db->query("CHECK TABLE {$tables_list}CHANGED;"); 44 while($table = $db->fetch_array($query)) 45 { 46 if(!in_array($table['Msg_text'], $ok)) 47 { 48 if($table['Table'] != $mybb->config['database']['database'].".".TABLE_PREFIX."settings" && $setting_done != true) 49 { 50 $boardclosed = $mybb->settings['boardclosed']; 51 $boardclosed_reason = $mybb->settings['boardclosed_reason']; 52 53 $db->update_query("settings", array('value' => 1), "name='boardclosed'", 1); 54 $db->update_query("settings", array('value' => $db->escape_string($lang->error_database_repair)), "name='boardclosed_reason'", 1); 55 rebuild_settings(); 56 57 $setting_done = true; 58 } 59 60 $db->query("REPAIR TABLE {$table['Table']}"); 61 $repaired[] = $table['Table']; 62 } 63 } 64 65 if($setting_done == true) 66 { 67 $db->update_query("settings", array('value' => (int)$boardclosed), "name='boardclosed'", 1); 68 $db->update_query("settings", array('value' => $db->escape_string($boardclosed_reason)), "name='boardclosed_reason'", 1); 69 70 rebuild_settings(); 71 } 72 73 } 74 75 if(is_object($plugins)) 76 { 77 $plugins->run_hooks('task_checktables', $task); 78 } 79 80 if(!empty($repaired)) 81 { 82 add_task_log($task, $lang->sprintf($lang->task_checktables_ran_found, implode(', ', $repaired))); 83 } 84 else 85 { 86 add_task_log($task, $lang->task_checktables_ran); 87 } 88 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |