| [ Index ] |
PHP Cross Reference of MyBB 1.8.40 |
[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 /** 12 * Upgrade Script: 1.4.2 or 1.4.3 13 */ 14 15 16 $upgrade_detail = array( 17 "revert_all_templates" => 0, 18 "revert_all_themes" => 0, 19 "revert_all_settings" => 0 20 ); 21 22 function upgrade14_dbchanges() 23 { 24 global $db, $output, $mybb; 25 26 $output->print_header("Performing Queries"); 27 28 echo "<p>Performing necessary upgrade queries..</p>"; 29 flush(); 30 31 // TODO: Need to check for PostgreSQL / SQLite support 32 33 if($db->field_exists('codepress', "adminoptions")) 34 { 35 $db->write_query("ALTER TABLE ".TABLE_PREFIX."adminoptions DROP codepress;"); 36 } 37 38 if($db->type == "pgsql") 39 { 40 $db->write_query("ALTER TABLE ".TABLE_PREFIX."adminoptions ADD codepress int NOT NULL default '1' AFTER cpstyle"); 41 } 42 else 43 { 44 $db->write_query("ALTER TABLE ".TABLE_PREFIX."adminoptions ADD codepress int(1) NOT NULL default '1' AFTER cpstyle"); 45 } 46 47 if($db->type != "sqlite") 48 { 49 $longregip_index = $db->index_exists("users", "longregip"); 50 $longlastip_index = $db->index_exists("users", "longlastip"); 51 52 if($longlastip_index == true) 53 { 54 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP KEY longlastip"); 55 } 56 57 if($longregip_index == true) 58 { 59 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP KEY longregip"); 60 } 61 62 $longipaddress_index = $db->index_exists("posts", "longipaddress"); 63 if($longipaddress_index == true) 64 { 65 $db->write_query("ALTER TABLE ".TABLE_PREFIX."posts DROP KEY longipaddress"); 66 } 67 } 68 69 if($db->field_exists('loginattempts', "sessions")) 70 { 71 $db->write_query("ALTER TABLE ".TABLE_PREFIX."sessions DROP loginattempts;"); 72 } 73 74 if($db->field_exists('loginattempts', "users")) 75 { 76 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP loginattempts;"); 77 } 78 79 if($db->type == "pgsql") 80 { 81 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD loginattempts smallint NOT NULL default '1';"); 82 } 83 else 84 { 85 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD loginattempts tinyint(2) NOT NULL default '1';"); 86 } 87 88 if($db->field_exists('failedlogin', "sessions")) 89 { 90 $db->write_query("ALTER TABLE ".TABLE_PREFIX."sessions DROP failedlogin;"); 91 } 92 93 if($db->field_exists('failedlogin', "users")) 94 { 95 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP failedlogin;"); 96 } 97 98 if($db->type == "pgsql") 99 { 100 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD failedlogin bigint NOT NULL default '0';"); 101 } 102 else 103 { 104 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD failedlogin bigint(30) NOT NULL default '0';"); 105 } 106 107 if($db->type == "mysql" || $db->type == "mysqli") 108 { 109 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD INDEX longregip (longregip)"); 110 $db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD INDEX longlastip (longlastip)"); 111 } 112 113 if($db->type == "sqlite") 114 { 115 // Because SQLite 2 nor 3 allows changing a column with a primary key constraint we have to completely rebuild the entire table 116 // *sigh* This is the 21st century, right? 117 $query = $db->simple_select("datacache"); 118 while($datacache = $db->fetch_array($query)) 119 { 120 $temp_datacache[$datacache['title']] = array('title' => $db->escape_string($datacache['title']), 'cache' => $db->escape_string($datacache['cache'])); 121 } 122 123 $db->write_query("DROP TABLE ".TABLE_PREFIX."datacache"); 124 125 $db->write_query("CREATE TABLE ".TABLE_PREFIX."datacache ( 126 title varchar(50) NOT NULL default '' PRIMARY KEY, 127 cache mediumTEXT NOT NULL 128 );"); 129 130 reset($temp_datacache); 131 foreach($temp_datacache as $data) 132 { 133 $db->insert_query("datacache", $data); 134 } 135 } 136 else if($db->type == "pgsql") 137 { 138 if(!$db->index_exists("datacache", "title")) 139 { 140 $db->write_query("ALTER TABLE ".TABLE_PREFIX."datacache ADD PRIMARY KEY (title)"); 141 } 142 } 143 144 $contents .= "Click next to continue with the upgrade process.</p>"; 145 $output->print_contents($contents); 146 $output->print_footer("14_dbchanges1"); 147 } 148 149 function upgrade14_dbchanges1() 150 { 151 global $db, $output; 152 153 $output->print_header("Performing Queries"); 154 155 echo "<p>Performing necessary upgrade queries..</p>"; 156 flush(); 157 158 if($db->type == "mysql" || $db->type == "mysqli") 159 { 160 $db->write_query("ALTER TABLE ".TABLE_PREFIX."posts ADD INDEX longipaddress (longipaddress)"); 161 } 162 163 $contents .= "Click next to continue with the upgrade process.</p>"; 164 $output->print_contents($contents); 165 $output->print_footer("14_dbchanges2"); 166 } 167 168 function upgrade14_dbchanges2() 169 { 170 global $db, $output; 171 172 $output->print_header("Cleaning up old Settings & Groups"); 173 174 echo "<p>Performing necessary upgrade queries..</p>"; 175 flush(); 176 177 $db->delete_query("settinggroups", "name='banning' AND isdefault='0'", 1); 178 179 $db->delete_query("settings", "name='bannedusernames'", 1); 180 $db->delete_query("settings", "name='bannedips'", 1); 181 $db->delete_query("settings", "name='bannedemails'", 1); 182 $db->delete_query("settings", "name='publiceventcolor'", 1); 183 $db->delete_query("settings", "name='privateeventcolor'", 1); 184 $db->delete_query("settings", "name='cssmedium'", 1); 185 186 $db->delete_query("templates", "title='usercp_options_timezoneselect' AND sid != '-1'"); 187 $db->delete_query("templates", "title='moderation_reports' AND sid != '-1'"); 188 $db->delete_query("templates", "title='moderation_reports_report' AND sid != '-1'"); 189 $db->delete_query("templates", "title='moderation_reports_multipage' AND sid != '-1'"); 190 $db->delete_query("templates", "title='moderation_allreports' AND sid != '-1'"); 191 $db->delete_query("templates", "title='showthread_ratingdisplay' AND sid != '-1'"); 192 $db->delete_query("templates", "title='moderation_getip_adminoptions' AND sid != '-1'"); 193 $db->delete_query("templates", "title='calendar_eventbit_public' AND sid != '-1'"); 194 $db->delete_query("templates", "title='calendar_daybit_today' AND sid != '-1'"); 195 $db->delete_query("templates", "title='calendar_daybit' AND sid != '-1'"); 196 $db->delete_query("templates", "title='online_iplookup' AND sid != '-1'"); 197 $db->delete_query("templates", "title='online_iplookup_adminoptions' AND sid != '-1'"); 198 $db->delete_query("templates", "title='online_row_ip' AND sid != '-1'"); 199 $db->delete_query("templates", "title='calendar_eventbit_dates' AND sid != '-1'"); 200 $db->delete_query("templates", "title='calendar_eventbit_dates_recurring' AND sid != '-1'"); 201 $db->delete_query("templates", "title='calendar_eventbit_times' AND sid != '-1'"); 202 $db->delete_query("templates", "title='calendar_editevent_normal' AND sid != '-1'"); 203 $db->delete_query("templates", "title='calendar_editevent_recurring' AND sid != '-1'"); 204 205 $db->update_query("helpdocs", array('document' => $db->escape_string("MyBB makes use of cookies to store your login information if you are registered, and your last visit if you are not. 206 <br /><br />Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. 207 <br /><br />Cookies on this forum also track the specific topics you have read and when you last read them. 208 <br /><br />To clear all cookies set by this forum, you can click <a href=\"misc.php?action=clearcookies&key={1}\">here</a>.")), "hid='3'", 1); 209 210 $contents .= "Click next to continue with the upgrade process.</p>"; 211 $output->print_contents($contents); 212 $output->print_footer("14_done"); 213 } 214
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| 2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |