[ Index ] |
PHP Cross Reference of MyBB 1.8.38 |
[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.8.6 13 */ 14 15 $upgrade_detail = array( 16 "revert_all_templates" => 0, 17 "revert_all_themes" => 0, 18 "revert_all_settings" => 0 19 ); 20 21 @set_time_limit(0); 22 23 function upgrade35_dbchanges() 24 { 25 global $db, $output; 26 27 $output->print_header("Updating Database"); 28 echo "<p>Performing necessary upgrade queries...</p>"; 29 flush(); 30 31 if($db->field_exists('subscriptionkey', 'threadsubscriptions')) 32 { 33 $db->drop_column("threadsubscriptions", "subscriptionkey"); 34 } 35 36 if($db->type != 'pgsql') 37 { 38 $db->modify_column('adminsessions', 'useragent', "varchar(200) NOT NULL default ''"); 39 $db->modify_column('sessions', 'useragent', "varchar(200) NOT NULL default ''"); 40 } 41 else 42 { 43 $db->modify_column('adminsessions', 'useragent', "varchar(200)", "set", "''"); 44 $db->modify_column('sessions', 'useragent', "varchar(200)", "set", "''"); 45 } 46 47 // Remove "Are You a Human" captcha 48 $db->update_query('settings', array('value' => '1'), "name='captchaimage' AND value='3'"); 49 $db->delete_query('settings', "name IN ('ayahpublisherkey', 'ayahscoringkey')"); 50 $db->delete_query('templates', "title IN ('member_register_regimage_ayah', 'post_captcha_ayah')"); 51 52 global $footer_extra; 53 $footer_extra = "<script type=\"text/javascript\">$(function() { var button = $('.submit_button'); if(button) { button.val('Automatically Redirecting...'); button.prop('disabled', true); button.css('color', '#aaa'); button.css('border-color', '#aaa'); document.forms[0].submit(); } });</script>"; 54 55 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 56 $output->print_footer("35_dbchanges2"); 57 } 58 59 function upgrade35_dbchanges2() 60 { 61 global $db, $output; 62 63 $output->print_header("Updating Database"); 64 echo "<p>Performing necessary optimization queries...</p>"; 65 flush(); 66 67 switch($db->type) 68 { 69 // PostgreSQL and SQLite do not support unsigned ints 70 case "pgsql": 71 $db->modify_column("buddyrequests", "uid", "int", "set", "'0'"); 72 $db->modify_column("buddyrequests", "touid", "int", "set", "'0'"); 73 $db->modify_column("buddyrequests", "date", "int", "set", "'0'"); 74 break; 75 case "sqlite": 76 $db->modify_column("threadratings", "rating", "tinyint(1) NOT NULL default '0'"); 77 $db->modify_column("buddyrequests", "uid", "int NOT NULL default '0'"); 78 $db->modify_column("buddyrequests", "touid", "int NOT NULL default '0'"); 79 $db->modify_column("buddyrequests", "date", "int NOT NULL default '0'"); 80 break; 81 default: 82 $db->modify_column("adminviews", "perpage", "smallint(4) unsigned NOT NULL default '0'"); 83 $db->modify_column("attachments", "filesize", "int(10) unsigned NOT NULL default '0'"); 84 $db->modify_column("attachtypes", "maxsize", "int(15) unsigned NOT NULL default '0'"); 85 $db->modify_column("banned", "olddisplaygroup", "int unsigned NOT NULL default '0'"); 86 $db->modify_column("buddyrequests", "uid", "int unsigned NOT NULL default '0'"); 87 $db->modify_column("buddyrequests", "touid", "int unsigned NOT NULL default '0'"); 88 $db->modify_column("buddyrequests", "date", "int unsigned NOT NULL default '0'"); 89 $db->modify_column("calendars", "eventlimit", "smallint(3) unsigned NOT NULL default '0'"); 90 $db->modify_column("massemails", "perpage", "smallint(4) unsigned NOT NULL default '50'"); 91 $db->modify_column("promotions", "posts", "int unsigned NOT NULL default '0'"); 92 $db->modify_column("promotions", "threads", "int unsigned NOT NULL default '0'"); 93 $db->modify_column("promotions", "registered", "int unsigned NOT NULL default '0'"); 94 $db->modify_column("promotions", "online", "int unsigned NOT NULL default '0'"); 95 $db->modify_column("promotions", "referrals", "int unsigned NOT NULL default '0'"); 96 $db->modify_column("promotions", "warnings", "int unsigned NOT NULL default '0'"); 97 $db->modify_column("sessions", "location1", "int(10) unsigned NOT NULL default '0'"); 98 $db->modify_column("sessions", "location2", "int(10) unsigned NOT NULL default '0'"); 99 $db->modify_column("threadratings", "rating", "tinyint(1) unsigned NOT NULL default '0'"); 100 $db->modify_column("threads", "views", "int(100) unsigned NOT NULL default '0'"); 101 $db->modify_column("threads", "replies", "int(100) unsigned NOT NULL default '0'"); 102 break; 103 } 104 105 global $footer_extra; 106 $footer_extra = "<script type=\"text/javascript\">$(function() { var button = $('.submit_button'); if(button) { button.val('Automatically Redirecting...'); button.prop('disabled', true); button.css('color', '#aaa'); button.css('border-color', '#aaa'); document.forms[0].submit(); } });</script>"; 107 108 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 109 $output->print_footer("35_dbchanges3"); 110 } 111 112 function upgrade35_dbchanges3() 113 { 114 global $db, $output; 115 116 $output->print_header("Updating Database"); 117 echo "<p>Performing necessary optimization queries...</p>"; 118 flush(); 119 120 switch($db->type) 121 { 122 // PostgreSQL and SQLite do not support unsigned ints 123 case "sqlite": 124 $db->modify_column("usergroups", "type", "tinyint(1) NOT NULL default '2'"); 125 $db->modify_column("users", "loginattempts", "smallint(2) NOT NULL default '1'"); 126 break; 127 case "mysql": 128 case "mysqli": 129 $db->modify_column("usergroups", "type", "tinyint(1) unsigned NOT NULL default '2'"); 130 $db->modify_column("usergroups", "stars", "smallint(4) unsigned NOT NULL default '0'"); 131 $db->modify_column("usergroups", "pmquota", "int(3) unsigned NOT NULL default '0'"); 132 $db->modify_column("usergroups", "maxpmrecipients", "int(4) unsigned NOT NULL default '5'"); 133 $db->modify_column("usergroups", "maxemails", "int(3) unsigned NOT NULL default '5'"); 134 $db->modify_column("usergroups", "emailfloodtime", "int(3) unsigned NOT NULL default '5'"); 135 $db->modify_column("usergroups", "maxwarningsday", "int(3) unsigned NOT NULL default '3'"); 136 $db->modify_column("usergroups", "edittimelimit", "int(4) unsigned NOT NULL default '0'"); 137 $db->modify_column("usergroups", "maxposts", "int(4) unsigned NOT NULL default '0'"); 138 $db->modify_column("users", "postnum", "int(10) unsigned NOT NULL default '0'"); 139 $db->modify_column("users", "threadnum", "int(10) unsigned NOT NULL default '0'"); 140 $db->modify_column("users", "ppp", "smallint(6) unsigned NOT NULL default '0'"); 141 $db->modify_column("users", "tpp", "smallint(6) unsigned NOT NULL default '0'"); 142 $db->modify_column("users", "daysprune", "smallint(6) unsigned NOT NULL default '0'"); 143 $db->modify_column("users", "totalpms", "int(10) unsigned NOT NULL default '0'"); 144 $db->modify_column("users", "unreadpms", "int(10) unsigned NOT NULL default '0'"); 145 $db->modify_column("users", "warningpoints", "int(3) unsigned NOT NULL default '0'"); 146 $db->modify_column("users", "loginattempts", "smallint(2) unsigned NOT NULL default '1'"); 147 $db->modify_column("usertitles", "stars", "smallint(4) unsigned NOT NULL default '0'"); 148 $db->modify_column("warninglevels", "percentage", "smallint(3) unsigned NOT NULL default '0'"); 149 break; 150 } 151 152 global $footer_extra; 153 $footer_extra = "<script type=\"text/javascript\">$(function() { var button = $('.submit_button'); if(button) { button.val('Automatically Redirecting...'); button.prop('disabled', true); button.css('color', '#aaa'); button.css('border-color', '#aaa'); document.forms[0].submit(); } });</script>"; 154 155 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 156 $output->print_footer("35_dbchanges4"); 157 } 158 159 function upgrade35_dbchanges4() 160 { 161 global $mybb, $output; 162 163 $output->print_header("Adding index files"); 164 echo "<p>Adding index files to attachment directories...</p>"; 165 flush(); 166 167 $uploadspath_abs = mk_path_abs($mybb->settings['uploadspath']); 168 $dir = @opendir($uploadspath_abs); 169 if($dir) 170 { 171 while(($file = @readdir($dir)) !== false) 172 { 173 $filename = "{$uploadspath_abs}/{$file}"; 174 $indexfile = "{$filename}/index.html"; 175 176 if(preg_match('#^[0-9]{6}$#', $file) && @is_dir($filename) && @is_writable($filename) && !file_exists($indexfile)) 177 { 178 $index = @fopen($indexfile, 'w'); 179 @fwrite($index, "<html>\n<head>\n<title></title>\n</head>\n<body>\n \n</body>\n</html>"); 180 @fclose($index); 181 } 182 } 183 184 @closedir($dir); 185 } 186 187 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 188 $output->print_footer("35_done"); 189 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |