| ... | ... |
@@ -42,6 +42,11 @@ if($confirm == "yes") {
|
| 42 | 42 |
dbquery("UPDATE `".TABLEPREFIX."fanfiction_panels` SET panel_order = '12' WHERE panel_name = 'modules'");
|
| 43 | 43 |
dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels`(`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_hidden`, `panel_type`, `panel_order`) VALUES( 'convert', 'Archive Conversion', '', '1', '0', 'A', '11')");
|
| 44 | 44 |
} |
| 45 |
+ $field_info = dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_chapters LIKE 'storytext'"));
|
|
| 46 |
+ if (strtolower($field_info['Type']) != 'mediumtext') |
|
| 47 |
+ {
|
|
| 48 |
+ dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_chapters` MODIFY `storytext` MEDIUMTEXT NULL");
|
|
| 49 |
+ } |
|
| 45 | 50 |
// initial UTF-8 conversion |
| 46 | 51 |
dbquery("ALTER DATABASE $dbname DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
|
| 47 | 52 |
dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorfields ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_bin;");
|
| ... | ... |
@@ -42,6 +42,11 @@ if($confirm == "yes") {
|
| 42 | 42 |
dbquery("UPDATE `".TABLEPREFIX."fanfiction_panels` SET panel_order = '12' WHERE panel_name = 'modules'");
|
| 43 | 43 |
dbquery("INSERT INTO `".TABLEPREFIX."fanfiction_panels`(`panel_name`, `panel_title`, `panel_url`, `panel_level`, `panel_hidden`, `panel_type`, `panel_order`) VALUES( 'convert', 'Archive Conversion', '', '1', '0', 'A', '11')");
|
| 44 | 44 |
} |
| 45 |
+ $field_info = dbassoc(dbquery("SHOW COLUMNS FROM ".TABLEPREFIX."fanfiction_chapters LIKE 'storytext'"));
|
|
| 46 |
+ if (strtolower($field_info['Type']) != 'mediumtext') |
|
| 47 |
+ {
|
|
| 48 |
+ dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_chapters` MODIFY `storytext` MEDIUMTEXT NULL");
|
|
| 49 |
+ } |
|
| 45 | 50 |
// initial UTF-8 conversion |
| 46 | 51 |
dbquery("ALTER DATABASE $dbname DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
|
| 47 | 52 |
dbquery("ALTER TABLE ".TABLEPREFIX."fanfiction_authorfields ENGINE=INNODB, DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_0900_bin;");
|
| ... | ... |
@@ -56,7 +56,7 @@ CREATE TABLE `fanfiction_settings` ( |
| 56 | 56 |
`disablepopups` tinyint(1) NOT NULL default '0', |
| 57 | 57 |
`agestatement` tinyint(1) NOT NULL default '0', |
| 58 | 58 |
`words` text, |
| 59 |
- `version` varchar(10) NOT NULL default '3.5.9', |
|
| 59 |
+ `version` varchar(10) NOT NULL default '0.9.3', |
|
| 60 | 60 |
`smtp_host` varchar(200) default NULL, |
| 61 | 61 |
`smtp_username` varchar(50) default NULL, |
| 62 | 62 |
`smtp_password` varchar(50) default NULL, |
| ... | ... |
@@ -122,7 +122,7 @@ CREATE TABLE `fanfiction_chapters` ( |
| 122 | 122 |
`title` varchar(250) NOT NULL default '', |
| 123 | 123 |
`inorder` int(11) NOT NULL default '0', |
| 124 | 124 |
`notes` text NOT NULL, |
| 125 |
- `storytext` text NOT NULL, |
|
| 125 |
+ `storytext` mediumtext NOT NULL, |
|
| 126 | 126 |
`endnotes` text, |
| 127 | 127 |
`validated` tinyint(4) NOT NULL default '0', |
| 128 | 128 |
`wordcount` int(11) NOT NULL default '0', |
| ... | ... |
@@ -166,7 +166,7 @@ CREATE TABLE `fanfiction_characters` ( |
| 166 | 166 |
CREATE TABLE `fanfiction_classes` ( |
| 167 | 167 |
`class_id` int(11) NOT NULL auto_increment, |
| 168 | 168 |
`class_type` int(11) NOT NULL default '0', |
| 169 |
- `class_name` varchar(100) NOT NULL default '' COLLATE utf8mb4_unicode_ci, |
|
| 169 |
+ `class_name` varchar(100) NOT NULL default '', |
|
| 170 | 170 |
PRIMARY KEY (`class_id`), |
| 171 | 171 |
KEY `byname` (`class_type`,`class_name`,`class_id`) |
| 172 | 172 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; |
| ... | ... |
@@ -179,8 +179,8 @@ CREATE TABLE `fanfiction_classes` ( |
| 179 | 179 |
|
| 180 | 180 |
CREATE TABLE `fanfiction_classtypes` ( |
| 181 | 181 |
`classtype_id` int(11) NOT NULL auto_increment, |
| 182 |
- `classtype_name` varchar(50) NOT NULL default '' COLLATE utf8mb4_unicode_ci, |
|
| 183 |
- `classtype_title` varchar(50) NOT NULL default '' COLLATE utf8mb4_unicode_ci, |
|
| 182 |
+ `classtype_name` varchar(50) NOT NULL default '', |
|
| 183 |
+ `classtype_title` varchar(50) NOT NULL default '', |
|
| 184 | 184 |
PRIMARY KEY (`classtype_id`), |
| 185 | 185 |
UNIQUE KEY `classtype_name` (`classtype_name`) |
| 186 | 186 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; |
| ... | ... |
@@ -583,7 +583,7 @@ switch ($_GET['step']) |
| 583 | 583 |
`title` varchar(250) NOT NULL default '', |
| 584 | 584 |
`inorder` int(11) NOT NULL default '0', |
| 585 | 585 |
`notes` text NULL, |
| 586 |
- `storytext` text NULL, |
|
| 586 |
+ `storytext` mediumtext NULL, |
|
| 587 | 587 |
`endnotes` text NULL, |
| 588 | 588 |
`validated` char(1) NOT NULL default '0', |
| 589 | 589 |
`wordcount` int(11) NOT NULL default '0', |
| ... | ... |
@@ -68,6 +68,7 @@ else {
|
| 68 | 68 |
$set_356 = do_version_check_356(); |
| 69 | 69 |
$set_359 = do_version_check_359(); |
| 70 | 70 |
$set_090 = do_version_check_090(); |
| 71 |
+ $set_093 = do_version_check_093(); |
|
| 71 | 72 |
$set_generic = do_version_check_generic(); |
| 72 | 73 |
|
| 73 | 74 |
if ($set_356) |
| ... | ... |
@@ -99,6 +100,17 @@ else {
|
| 99 | 100 |
} |
| 100 | 101 |
} |
| 101 | 102 |
|
| 103 |
+ else if ($set_093) {
|
|
| 104 |
+ $set_093 = do_version_check_093(); |
|
| 105 |
+ |
|
| 106 |
+ if ($set_093) |
|
| 107 |
+ {
|
|
| 108 |
+ $output .= write_message("Table <b>" . $set_093 . "</b> needs an update.");
|
|
| 109 |
+ dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET version = '0.9.2' WHERE sitekey = '" . SITEKEY . "'");
|
|
| 110 |
+ $settings['version'] = '0.9.2'; |
|
| 111 |
+ } |
|
| 112 |
+ } |
|
| 113 |
+ |
|
| 102 | 114 |
else if ($set_generic) {
|
| 103 | 115 |
$set_generic = do_version_check_generic(); |
| 104 | 116 |
|
| ... | ... |
@@ -162,8 +174,8 @@ if ($oldVersion[0] == 3 && ($oldVersion[1] < 5 || $oldVersion[2] < 6)) //3.5.5 |
| 162 | 174 |
), |
| 163 | 175 |
); |
| 164 | 176 |
|
| 165 |
- // Tables where IP address field needs updating to accommodate IPV6 |
|
| 166 |
- // Set to varchar(45) - just in case something uses the IPV4 subnet (see http://en.wikipedia.org/wiki/IPV6#Notation) |
|
| 177 |
+ // Tables where datetime/timestamp field needs updating to int |
|
| 178 |
+ // Set to int(10) - for storing Unix timestamp |
|
| 167 | 179 |
foreach ($date_upgrade as $tmp) |
| 168 | 180 |
{
|
| 169 | 181 |
|
| ... | ... |
@@ -392,7 +404,69 @@ elseif ($oldVersion[0] == 3 && $oldVersion[1] == 5 && $oldVersion[2] < 10) // 3 |
| 392 | 404 |
// else $output .= write_message("Are you ready to update? <a href='update.php?confirm=yes'>"._YES."</a> "._OR." <a href='update.php?confirm=no'>"._NO."</a>");
|
| 393 | 405 |
//} |
| 394 | 406 |
|
| 395 |
-elseif ($oldVersion[0] == 0 && $oldVersion[1] == 9 && ($oldVersion[2] == 0 || $oldVersion[2] < 10)) // Mod 0.9.0 -> Mod 0.9.1 (and further within 0.9.x) |
|
| 407 |
+elseif ($oldVersion[0] == 0 && $oldVersion[1] == 9 && $oldVersion[2] < 2) // Mod 0.9.[0,1] -> Mod 0.9.2 |
|
| 408 |
+{
|
|
| 409 |
+ $set_generic = do_version_check_generic(); |
|
| 410 |
+ if (!$set_generic) {
|
|
| 411 |
+ $update = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET version = '".$version."' WHERE sitekey = '".SITEKEY."'");
|
|
| 412 |
+ if ($update) $output .= write_message("No database changes required; eFiction 3 Mod Version bumped to ".$version."! " ._ACTIONSUCCESSFUL);
|
|
| 413 |
+ } |
|
| 414 |
+ |
|
| 415 |
+} |
|
| 416 |
+ |
|
| 417 |
+elseif ($oldVersion[0] == 0 && $oldVersion[1] == 9 && $oldVersion[2] < 3) // Mod 0.9.[0,1,2] -> Mod 0.9.3 |
|
| 418 |
+{
|
|
| 419 |
+ if ($confirm == "yes") |
|
| 420 |
+ {
|
|
| 421 |
+ if ($oldVersion[0] == 0 && $oldVersion[1] == 9 && $oldVersion[2] < 3) |
|
| 422 |
+ {
|
|
| 423 |
+ // List of DB tables (key) and field (value) which need changing text from text to mediumtext |
|
| 424 |
+ $text_upgrade = array( |
|
| 425 |
+ 'fanfiction_chapters' => 'storytext' |
|
| 426 |
+ ); |
|
| 427 |
+ |
|
| 428 |
+ foreach ($text_upgrade as $t => $f) |
|
| 429 |
+ {
|
|
| 430 |
+ if (isTable($t)) |
|
| 431 |
+ {
|
|
| 432 |
+ |
|
| 433 |
+ // Check for table - might add some core plugin tables in here |
|
| 434 |
+ if ($field_info = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . $t . " LIKE '{$f}'")))
|
|
| 435 |
+ {
|
|
| 436 |
+ if (strtolower($field_info['Type']) != 'mediumtext') |
|
| 437 |
+ {
|
|
| 438 |
+ |
|
| 439 |
+ dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_chapters` MODIFY `storytext` MEDIUMTEXT NULL");
|
|
| 440 |
+ |
|
| 441 |
+ } |
|
| 442 |
+ } |
|
| 443 |
+ } |
|
| 444 |
+ } |
|
| 445 |
+ } |
|
| 446 |
+ |
|
| 447 |
+ $set_093 = false; |
|
| 448 |
+ $set_093 = do_version_check_093(); |
|
| 449 |
+ if($set_093) {
|
|
| 450 |
+ $output .= write_error(_ERROR); |
|
| 451 |
+ } |
|
| 452 |
+ else {
|
|
| 453 |
+ $update = dbquery("UPDATE " . $settingsprefix . "fanfiction_settings SET version = '" . $version . "' WHERE sitekey = '" . SITEKEY . "'");
|
|
| 454 |
+ if ($update) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 455 |
+ } |
|
| 456 |
+ } |
|
| 457 |
+ else if ($confirm == "no") |
|
| 458 |
+ {
|
|
| 459 |
+ $output .= write_message(_ACTIONCANCELLED); |
|
| 460 |
+ } |
|
| 461 |
+ else |
|
| 462 |
+ {
|
|
| 463 |
+ if ($oldVersion[0] == 0 && $oldVersion[1] == 9 && $oldVersion[2] < 3) |
|
| 464 |
+ $output .= write_message(_CONFIRMUPDATE . "<br /> <a href='update.php?confirm=yes'>" . _YES . "</a> " . _OR . " <a href='update.php?confirm=no'>" . _NO . "</a>"); |
|
| 465 |
+ else $output .= write_message("Are you ready to update? <a href='update.php?confirm=yes'>" . _YES . "</a> " . _OR . " <a href='update.php?confirm=no'>" . _NO . "</a>");
|
|
| 466 |
+ } |
|
| 467 |
+} |
|
| 468 |
+ |
|
| 469 |
+elseif ($oldVersion[0] == 0 && $oldVersion[1] == 9 && $oldVersion[2] < 10) // Mod 0.9.3 -> Mod 0.9.4 (and further within 0.9.x) |
|
| 396 | 470 |
{
|
| 397 | 471 |
$set_generic = do_version_check_generic(); |
| 398 | 472 |
if (!$set_generic) {
|
| ... | ... |
@@ -498,7 +572,7 @@ function do_version_check_356() |
| 498 | 572 |
|
| 499 | 573 |
if (strtolower($field_info['Type']) != 'varbinary(16)') |
| 500 | 574 |
{
|
| 501 |
- $check_356 = $t . " - field: " . $f;; |
|
| 575 |
+ $check_356 = $t . " - field: " . $f; |
|
| 502 | 576 |
|
| 503 | 577 |
return $check_356; |
| 504 | 578 |
} |
| ... | ... |
@@ -545,6 +619,40 @@ function do_version_check_090() |
| 545 | 619 |
return $check_090; |
| 546 | 620 |
} |
| 547 | 621 |
|
| 622 |
+function do_version_check_093() |
|
| 623 |
+{
|
|
| 624 |
+ $check_093 = false; |
|
| 625 |
+ |
|
| 626 |
+ // List of DB tables (key) and field (value) which need changing text from text to mediumtext |
|
| 627 |
+ $text_upgrade = array( |
|
| 628 |
+ 'fanfiction_chapters' => 'storytext' |
|
| 629 |
+ ); |
|
| 630 |
+ |
|
| 631 |
+ foreach ($text_upgrade as $t => $f) |
|
| 632 |
+ {
|
|
| 633 |
+ |
|
| 634 |
+ if (isTable($t)) |
|
| 635 |
+ {
|
|
| 636 |
+ // Check for table - might add some core plugin tables in here |
|
| 637 |
+ if ($field_info = dbassoc(dbquery("SHOW COLUMNS FROM " . TABLEPREFIX . $t ." LIKE '{$f}'")) )
|
|
| 638 |
+ {
|
|
| 639 |
+ |
|
| 640 |
+ |
|
| 641 |
+ if (strtolower($field_info['Type']) != 'mediumtext') |
|
| 642 |
+ {
|
|
| 643 |
+ $check_093 = $t . " - field: " . $f; |
|
| 644 |
+ |
|
| 645 |
+ return $check_093; |
|
| 646 |
+ } |
|
| 647 |
+ } |
|
| 648 |
+ |
|
| 649 |
+ } |
|
| 650 |
+ |
|
| 651 |
+ } |
|
| 652 |
+ |
|
| 653 |
+ return $check_093; |
|
| 654 |
+} |
|
| 655 |
+ |
|
| 548 | 656 |
function do_version_check_generic() |
| 549 | 657 |
{
|
| 550 | 658 |
$check_generic = false; |