diff --git a/Changelog b/Changelog index 3c764691a..6dd27934c 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,6 @@ 2017-06-27 DariusIII + * Chg: Update install procedure and insertion of zero value into auto_increment id fields for categories + (fixes problem with wrong id of OTHER root category) and user_roles, no need to load mysql-data.sql file anymore * Mrg: Merge PR #150 by Nightah - Fix TravisCI builds 2017-06-26 DariusIII * Chg: Move getAll function to AdultMovies class diff --git a/_install/install_nntmux.php b/_install/install_nntmux.php index 3244bfb68..096ebe42b 100644 --- a/_install/install_nntmux.php +++ b/_install/install_nntmux.php @@ -98,11 +98,6 @@ if (!$error) { try { $DbSetup->processSQLFile(); // Setup default schema - $DbSetup->processSQLFile( // Process any custom stuff. - [ - 'filepath' => NN_RES . 'db' . DS . 'schema' . DS . 'mysql-data.sql' - ] - ); $DbSetup->loadTables(); // Load default data files } catch (\PDOException $err) { $error = true; diff --git a/nntmux/db/DbUpdate.php b/nntmux/db/DbUpdate.php index 4d71acfd0..f6e918df6 100755 --- a/nntmux/db/DbUpdate.php +++ b/nntmux/db/DbUpdate.php @@ -126,6 +126,14 @@ class DbUpdate if (Utility::isWin()) { $file = str_replace("\\", '\/', $file); } + $this->pdo->exec("SET @@session.sql_mode = + CASE WHEN @@session.sql_mode NOT LIKE '%NO_AUTO_VALUE_ON_ZERO%' + THEN CASE WHEN LENGTH(@@session.sql_mode)>0 + THEN CONCAT_WS(',',@@session.sql_mode,'NO_AUTO_VALUE_ON_ZERO') + ELSE 'NO_AUTO_VALUE_ON_ZERO' + END + ELSE @@session.sql_mode + END;"); $this->pdo->queryExec(sprintf($sql, $file, $table, $fields)); if ($table !== 'settings') { $success = $this->pdo->query(sprintf('SELECT COUNT(id) AS num FROM %s', $table)); diff --git a/resources/db/schema/data/10-categories.tsv b/resources/db/schema/data/10-categories.tsv index 9a536c651..c13cc5936 100755 --- a/resources/db/schema/data/10-categories.tsv +++ b/resources/db/schema/data/10-categories.tsv @@ -1,11 +1,12 @@ id, title, parentid -1000 Console \N -2000 Movies \N -3000 Audio \N -4000 PC \N -5000 TV \N -6000 XXX \N -7000 Books \N +0 Other +1000 Console +2000 Movies +3000 Audio +4000 PC +5000 TV +6000 XXX +7000 Books 0010 Misc 0000 0020 Hashed 0000 1010 NDS 1000 diff --git a/resources/db/schema/data/10-user_roles.tsv b/resources/db/schema/data/10-user_roles.tsv new file mode 100644 index 000000000..51aa406a5 --- /dev/null +++ b/resources/db/schema/data/10-user_roles.tsv @@ -0,0 +1,7 @@ +id, name, apirequests, downloadrequests, defaultinvites, isdefault, canpreview +0 Guest 0 0 0 0 0 0 +1 User 10 10 1 1 0 0 +2 Admin 1000 1000 1000 0 1 0 +3 Disabled 0 0 0 0 0 0 +4 Moderator 1000 1000 1000 0 1 0 +5 Friend 100 100 5 0 1 0