diff --git a/composer.json b/composer.json index 8f3267e..de5e62a 100755 --- a/composer.json +++ b/composer.json @@ -13,15 +13,5 @@ "railsphp/willpaginate": "dev-master", "railsphp/actsasversioned": "dev-master", "michelf/php-markdown": "1.3.*" - }, - "autoload": { - "psr-0": { - "ApplicationInstaller\\": "install/" - } - }, - "scripts": { - "post-install-cmd": [ - "ApplicationInstaller\\CompileAssets::compile" - ] } -} \ No newline at end of file +} diff --git a/db/seeds.php b/db/seeds.php index a4abe2d..5fc4109 100755 --- a/db/seeds.php +++ b/db/seeds.php @@ -1,2 +1,39 @@ executeSql($query); +} + +/** + * Job tasks rows + */ +JobTask::create([ + 'task_type' => 'external_data_search', + 'data_as_json' => '{}', + 'status' => 'pending', + 'repeat_count' => -1 +]); +JobTask::create([ + 'task_type' => "upload_batch_posts", + 'data_as_json' => '{}', + 'status' => "pending", + 'repeat_count' => -1 +]); +JobTask::create([ + 'task_type' => "periodic_maintenance", + 'data_as_json' => '{}', + 'status' => "pending", + 'repeat_count' => -1 +]); diff --git a/install.php b/install.php new file mode 100755 index 0000000..2052100 --- /dev/null +++ b/install.php @@ -0,0 +1,130 @@ +put(); +$c->put("====================", $txColor, $bgColor); +$c->put(" MyImouto installer ", $txColor, $bgColor); +$c->put("====================", $txColor, $bgColor); +$c->put(); + + +/** + * Get data for admin account + */ +$c->put("Admin account", null, Color::BLUE); +$c->put("Please enter a name and password for the admin account."); +$c->write("Note: ", Color::RED); +$c->put("the password will be shown."); +list($adminName, $adminPass) = getAdminData($c); + + +/** + * Database + */ +$c->put("Database", null, Color::BLUE); + +# Install database +$c->write("Creating tables......"); +$migrator->loadSchema(); +$c->put('done'); + +# Run migrations +$c->write("Running migrations..."); +$migrator->run(); +$c->put('done'); + +# Run seeds +$c->write("Seeding.............."); +$migrator->runSeeds(); +$c->put('done'); + +# Create user in database +$c->write("Creating admin account..."); +Rails\ActiveRecord\ActiveRecord::connection()->executeSql( + 'INSERT INTO users (created_at, name, password_hash, level, show_advanced_editing) VALUES (?, ?, ?, ?, ?)', + date('Y-m-d H:i:s'), $adminName, User::sha1($adminPass), 50, 1 +); +Rails\ActiveRecord\ActiveRecord::connection()->executeSql( + 'INSERT INTO user_blacklisted_tags VALUES (?, ?)', + 1, implode("\r\n", CONFIG()->default_blacklists) +); +$c->put("done"); + + +/** + * Compile assets + */ +$c->put("\n"); +$c->put("Compiling assets", null, Color::BLUE); + +# Set console to assets +Rails::assets()->setConsole($c); + +# Compile files +Rails::assets()->compileAll(); + + +/** + * Create /public/data folders + */ +$c->put("\n"); +$c->write("Creating /public/data folders..."); +$dataPath = Rails::publicPath() . '/data'; +$dirs = [ + 'avatars', + 'image', + 'import', + 'jpeg', + 'preview', + 'sample' +]; +if (!is_dir($dataPath)) { + mkdir($dataPath); +} +foreach ($dirs as $dir) { + $path = $dataPath . '/' . $dir; + if (!is_dir($path)) { + mkdir($path); + } +} +$c->put("done"); + + +/** + * Finish + */ +$c->put(); +$c->put("Installation finished.", Color::GREEN); +$c->put("You may delete this install.php file."); +$c->put(); + + +function getAdminData($c) +{ + $adminName = $c->input("Account name: "); + $adminPass = $c->input("Password: "); + + if ($c->confirm("Is the information correct? (y/n) ")) { + return [$adminName, $adminPass]; + } else { + $c->put(); + return getAdminData($c); + } +} diff --git a/install/ApplicationInstaller/Action/Base.php b/install/ApplicationInstaller/Action/Base.php deleted file mode 100755 index 9bc8e30..0000000 --- a/install/ApplicationInstaller/Action/Base.php +++ /dev/null @@ -1,17 +0,0 @@ -adminName = $adminName; - $this->adminPassword = $adminPassword; - } - - public function commit() - { - $this->createTables(); - $this->insertData(); - $this->setLoginCookies(); - $this->createPublicDataDirs(); - $this->renameIndex(); - } - - private function createTables() - { - $queries = require $this->root() . '/structure.php'; - - foreach ($queries as $query) { - ActiveRecord::connection()->executeSql($query); - if ($err = ActiveRecord::lastError()) { - throw new Exception\RuntimeException( - "Error when creating tables.\nQuery:\n$query\nError info:\n" . var_export($err, true) - ); - } - } - } - - private function insertData() - { - - # Create admin user - ActiveRecord::connection()->executeSql( - 'INSERT INTO users (created_at, name, password_hash, level, show_advanced_editing) VALUES (?, ?, ?, ?, ?)', - date('Y-m-d H:i:s'), $this->adminName, User::sha1($this->adminPassword), 50, 1 - ); - - ActiveRecord::connection()->executeSql( - 'INSERT INTO user_blacklisted_tags VALUES (?, ?)', - 1, implode("\r\n", CONFIG()->default_blacklists) - ); - - # Queries for table_data - $queries = [ - 'INSERT INTO `table_data` VALUES (\'posts\', 0)', - 'INSERT INTO `table_data` VALUES (\'users\', 1)', - 'INSERT INTO `table_data` VALUES (\'non-explicit_posts\', 0)' - ]; - foreach ($queries as $query) { - ActiveRecord::connection()->executeSql($query); - } - - # Create JobTasks - JobTask::create([ - 'task_type' => 'external_data_search', - 'data_as_json' => '{}', - 'status' => 'pending', - 'repeat_count' => -1 - ]); - JobTask::create([ - 'task_type' => "upload_batch_posts", - 'data_as_json' => '{}', - 'status' => "pending", - 'repeat_count' => -1 - ]); - JobTask::create([ - 'task_type' => "periodic_maintenance", - 'data_as_json' => '{}', - 'status' => "pending", - 'repeat_count' => -1 - ]); - } - - private function setLoginCookies() - { - setcookie('login', $this->adminName, time() + 31556926, '/'); - setcookie('pass_hash', User::sha1($this->adminPassword), time() + 31556926, '/'); - } - - private function createPublicDataDirs() - { - $dataPath = \Rails::publicPath() . '/data'; - - $dirs = [ - 'avatars', - 'export', - 'image', - 'import', - 'jpeg', - 'preview', - 'sample' - ]; - - if (!is_dir($dataPath)) { - mkdir($dataPath); - } - - foreach ($dirs as $dir) { - $path = $dataPath . '/' . $dir; - - if (!is_dir($path)) { - mkdir($path); - } - } - } -} diff --git a/install/ApplicationInstaller/Action/Update.php b/install/ApplicationInstaller/Action/Update.php deleted file mode 100755 index d2f79e5..0000000 --- a/install/ApplicationInstaller/Action/Update.php +++ /dev/null @@ -1,258 +0,0 @@ -executeQueries(); - $this->createHistory(); - $this->renameIndex(); - } - - private function executeQueries() - { - $queries = [ - "ALTER TABLE `table_data` CHANGE `name` `name` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL", - "UPDATE `table_data` SET `name` = 'non-explicit-posts' WHERE `table_data`.`name` = 'non-explici' LIMIT 1", - - # Post tag histories table - "CREATE TABLE `post_tag_histories` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `post_id` int(11) NOT NULL, - `tags` text NOT NULL, - `user_id` int(11) NOT NULL, - `ip_addr` varchar(39) NOT NULL, - `created_at` datetime NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8", - - "CREATE TABLE `histories` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `created_at` DATETIME NOT NULL, - `user_id` int(11) DEFAULT NULL, - `group_by_id` int(11) NOT NULL, - `group_by_table` varchar(12) NOT NULL, - `aux_as_json` text DEFAULT NULL, - PRIMARY KEY (`id`) - ) ENGINE=InnoDB", - - "CREATE TABLE `history_changes` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `column_name` char(24) NOT NULL, - `remote_id` bigint(20) NOT NULL, - `table_name` char(24) NOT NULL, - `value` text, - `history_id` bigint(20) unsigned NOT NULL, - `previous_id` bigint(20) DEFAULT NULL, - `value_index` text NOT NULL, - PRIMARY KEY (`id`), - KEY `previous_id` (`previous_id`) - ) ENGINE=InnoDB", - - "ALTER TABLE history_changes ADD CONSTRAINT fk_history_changes__history_id FOREIGN KEY (history_id) REFERENCES histories(id) ON DELETE CASCADE", - - "ALTER TABLE `pools_posts` ADD `active` BOOLEAN NOT NULL DEFAULT '1'", - - "ALTER TABLE post_tag_histories ADD CONSTRAINT fk_post_tag_histories__post_id FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE", - - "ALTER TABLE `pools` CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL", - - 'DROP TRIGGER IF EXISTS `pools_posts_update_trg`', - 'CREATE TRIGGER `pools_posts_update_trg` BEFORE UPDATE ON `pools_posts` - FOR EACH ROW BEGIN - IF (OLD.active <> NEW.active) THEN - IF (NEW.active) THEN - UPDATE pools SET post_count = post_count + 1 WHERE id = NEW.pool_id; - ELSE - UPDATE pools SET post_count = post_count - 1 WHERE id = NEW.pool_id; - END IF; - END IF; - END', - - # cached tags queries - "ALTER TABLE `posts` ADD `cached_tags` TEXT NOT NULL DEFAULT '' AFTER `source`", - - "UPDATE posts SET cached_tags = ( - SELECT GROUP_CONCAT(t.name SEPARATOR ' ') - FROM posts_tags pt - JOIN tags t ON pt.tag_id = t.id - WHERE - pt.post_id = posts.id - GROUP BY pt.post_id - )", - - "UPDATE posts SET cached_tags = 'tagme' WHERE cached_tags = ''", - - # Reset note versions table, which might already be empty. - "DELETE FROM note_versions", - "ALTER TABLE note_versions AUTO_INCREMENT = 1", - "INSERT INTO note_versions (SELECT 0, NOW(), NOW(), x, y, width, height, body, version, ip_addr, is_active, id, post_id, user_id FROM notes)" - ]; - - foreach ($queries as $query) { - ActiveRecord::connection()->executeSql($query); - } - } - - private function createHistory() - { - $user = User::where('level = ?', CONFIG()->user_levels['Admin'])->first(); - if (!$user) { - $user = User::order('id ASC')->first(); - } - - foreach (Tag::all() as $tag) { - $history = History::create([ - 'group_by_id' => $tag->id, - 'group_by_table' => 'tags', - 'user_id' => $user->id - ]); - - $attrs = [ - 'remote_id' => $tag->id, - 'table_name' => 'tags', - 'history_id' => $history->id - ]; - - HistoryChange::create(array_merge([ - 'column_name' => 'tag_type', - 'value' => $tag->tag_type - ], $attrs)); - - if ($tag->is_ambiguous) - HistoryChange::create(array_merge([ - 'column_name' => 'is_ambiguous', - 'value' => 1, - ], $attrs)); - } - - foreach (PoolPost::all() as $pp) { - $history = History::create([ - 'group_by_id' => $pp->pool->id, - 'group_by_table' => 'pools', - 'user_id' => $pp->post->user_id - ]); - - $attrs = [ - 'remote_id' => $pp->id, - 'table_name' => 'pools_posts', - 'history_id' => $history->id - ]; - - HistoryChange::create(array_merge([ - 'column_name' => 'sequence', - 'value' => $pp->sequence - ], $attrs)); - - HistoryChange::create(array_merge([ - 'column_name' => 'active', - 'value' => true - ], $attrs)); - } - - foreach (Pool::all() as $pool) { - $history = History::create([ - 'group_by_id' => $pool->id, - 'group_by_table' => 'pools', - 'user_id' => $pool->user_id - ]); - - $attrs = [ - 'remote_id' => $pool->id, - 'table_name' => 'pools', - 'history_id' => $history->id - ]; - - HistoryChange::create(array_merge([ - 'column_name' => 'name', - 'value' => $pool->name - ], $attrs)); - - if ($pool->description) - HistoryChange::create(array_merge([ - 'column_name' => 'description', - 'value' => $pool->description - ], $attrs)); - - if (!$pool->is_public) - HistoryChange::create(array_merge([ - 'column_name' => 'is_public', - 'value' => false - ], $attrs)); - - if (!$pool->is_active) - HistoryChange::create(array_merge([ - 'column_name' => 'is_active', - 'value' => false - ], $attrs)); - } - - $n = new Moebooru\Versioning\Versioning(); - $n->import_note_history(); - - foreach (Post::all() as $post) { - $history = History::create([ - 'group_by_id' => $post->id, - 'group_by_table' => 'posts', - 'user_id' => $post->user->id - ]); - - $attrs = [ - 'remote_id' => $post->id, - 'table_name' => 'posts', - 'history_id' => $history->id - ]; - - if ($post->source) - HistoryChange::create(array_merge([ - 'column_name' => 'source', - 'value' => $post->source, - ], $attrs)); - - HistoryChange::create(array_merge([ - 'column_name' => 'cached_tags', - 'value' => $post->cached_tags - ], $attrs)); - - HistoryChange::create(array_merge([ - 'column_name' => 'rating', - 'value' => $post->rating, - ], $attrs)); - - if (!$post->is_shown_in_index) - HistoryChange::create(array_merge([ - 'column_name' => 'is_shown_in_index', - 'value' => 0, - ], $attrs)); - - if ($post->is_rating_locked) - HistoryChange::create(array_merge([ - 'column_name' => 'is_rating_locked', - 'value' => true, - ], $attrs)); - - if ($post->is_note_locked) - HistoryChange::create(array_merge([ - 'column_name' => 'is_note_locked', - 'value' => true, - ], $attrs)); - - if ($post->parent_id) - HistoryChange::create(array_merge([ - 'column_name' => 'parent_id', - 'value' => $post->parent_id, - ], $attrs)); - } - } -} diff --git a/install/ApplicationInstaller/Base.php b/install/ApplicationInstaller/Base.php deleted file mode 100755 index 75e99b4..0000000 --- a/install/ApplicationInstaller/Base.php +++ /dev/null @@ -1,46 +0,0 @@ -addPath(dirname(__DIR__)); - self::$instance = new Installer(); - } - - protected function root() - { - return dirname(__DIR__); - } - - protected function request() - { - return Rails::application()->dispatcher()->request(); - } - - protected function refreshPage() - { - $urlFor = new Rails\Routing\UrlFor('root'); - header('Location: ' . $urlFor->url()); - } - - protected function step() - { - return self::$step; - } -} diff --git a/install/ApplicationInstaller/CompileAssets.php b/install/ApplicationInstaller/CompileAssets.php deleted file mode 100755 index 9b0d524..0000000 --- a/install/ApplicationInstaller/CompileAssets.php +++ /dev/null @@ -1,45 +0,0 @@ -getIO()); - - # Warn about compiling - $console->write("[Compiling assets]"); - - # Set console to assets - Rails::assets()->setConsole($console); - - # Compile files - Rails::assets()->compileAll(); - - # Delete temporary config file. - unlink($target); - } -} diff --git a/install/ApplicationInstaller/Console.php b/install/ApplicationInstaller/Console.php deleted file mode 100755 index 983e9a5..0000000 --- a/install/ApplicationInstaller/Console.php +++ /dev/null @@ -1,20 +0,0 @@ -io = $io; - } - - public function write($message, $n = 1) - { - $this->io->write($message . str_repeat("\n", $n)); - } -} diff --git a/install/ApplicationInstaller/Exception/ExceptionInterface.php b/install/ApplicationInstaller/Exception/ExceptionInterface.php deleted file mode 100755 index 277a95c..0000000 --- a/install/ApplicationInstaller/Exception/ExceptionInterface.php +++ /dev/null @@ -1,6 +0,0 @@ -loadConfig(); - - if ($this->request()->path() == '/') { - if (!$this->validateSafeIps()) { - # Client not allowed - if ($this->dataDirExists()) { - # Updating message - $this->renderMessage(self::$PLEASE_WAIT_MESSAGE); - } else { - # Installing message - $this->renderMessage(sprintf(self::$ACCESS_DENIED_MESSAGE, $_SERVER['REMOTE_ADDR'])); - } - } else { - # Client allowed; serve forms/commit actions - try { - # To make things nice, check write permissions - # on some paths. - $this->checkWriteablePaths(); - - if ($this->request()->isGet()) { - # Serve forms - if ($this->dataDirExists()) { - # Update form - $this->renderUpdateForm(); - } else { - # Install form - $this->renderInstallForm(); - } - } else { - # Commit actions - if ($this->dataDirExists()) { - # Update - $this->commitUpdate(); - } else { - # Install - $this->commitInstall(); - } - } - } catch (Exception\ExceptionInterface $e) { - $this->renderMessage($e->getMessage()); - } - } - } else { - # Load application and let it serve the request. - $appClass = get_class(Rails::application()); - $appClass::dispatchRequest(); - } - } - - protected function checkWriteablePaths() - { - $paths = [ - '/log', - '/tmp', - '/public' - ]; - - foreach ($paths as $path) { - $fullpath = Rails::root() . $path; - if (!is_writable($fullpath)) { - throw new Exception\RuntimeException( - sprintf('File or path "%s" is not writeable; please make sure you have permissions', $fullpath) - ); - } - } - } - - protected function commitInstall() - { - $action = new Action\Install($_POST['admin_name'], $_POST['admin_password']); - $action->commit(); - setcookie('notice', "Installation completed", time() + 10, '/'); - header('Location: /post'); - } - - protected function commitUpdate() - { - $action = new Action\Update(); - $action->commit(); - setcookie('notice', "Upgrade completed", time() + 10, '/'); - header('Location: /history'); - } - - protected function renderInstallForm() - { - $this->renderForm('install'); - } - - protected function renderUpdateForm() - { - $this->renderForm('update', ['newVersion' => $this->newVersion]); - } - - protected function renderForm($name, array $locals = []) - { - $file = $this->root() . '/views/' . $name . '.php'; - - $template = new Rails\ActionView\Template(['file' => $file], ['layout' => $this->layoutFile()], $locals); - $template->renderContent(); - echo $template->content(); - } - - protected function renderMessage($message) - { - $template = new Rails\ActionView\Template(['lambda' => function() use ($message) { - echo $this->contentTag('div', $message, ['style' => 'text-align: center;margin-top: 85px;']); - }], ['layout' => $this->layoutFile()]); - $template->renderContent(); - echo $template->content(); - } - - protected function installDatabase() - { - $installer = new DatabaseInstaller(); - try { - $installer->install(); - } catch (\Exception $e) { - $this->renderError($e->getMessage()); - } - } - - protected function installApp() - { - $installer = new AppInstaller(); - try { - $installer->install(); - } catch (\Exception $e) { - $this->renderError($e->getMessage()); - } - } - - private function layoutFile() - { - return $this->root() . '/views/layout.php'; - } - - private function dataDirExists() - { - return is_dir(Rails::publicPath() . '/data'); - } - - private function validateSafeIps() - { - return in_array($_SERVER['REMOTE_ADDR'], $this->config['safe_ips']); - } - - private function loadConfig() - { - $this->config = require __DIR__ . '/../config.php'; - } -} diff --git a/install/config.php b/install/config.php deleted file mode 100755 index 88ed58d..0000000 --- a/install/config.php +++ /dev/null @@ -1,7 +0,0 @@ - [ - '127.0.0.1', - '::1', - ] -]; diff --git a/install/structure.php b/install/structure.php deleted file mode 100755 index 1b90c08..0000000 --- a/install/structure.php +++ /dev/null @@ -1,521 +0,0 @@ - 'CREATE TABLE IF NOT EXISTS `artists` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `alias_id` int(11) DEFAULT NULL, - `group_id` int(11) DEFAULT NULL, - `name` varchar(128) NOT NULL, - `updated_at` datetime NOT NULL, - `updater_id` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `fk_artists__updater_id` (`updater_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 1 => 'CREATE TABLE IF NOT EXISTS `artists_urls` ( - `artist_id` int(11) NOT NULL, - `url` varchar(256) NOT NULL, - `normalized_url` varchar(256) NOT NULL, - KEY `artist_id` (`artist_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 2 => 'CREATE TABLE IF NOT EXISTS `bans` ( - `user_id` int(11) NOT NULL, - `reason` text NOT NULL, - `expires_at` datetime NOT NULL, - `banned_by` int(11) NOT NULL, - `old_level` int(11) NOT NULL, - KEY `user_id` (`user_id`), - KEY `fk_bans__banned_by` (`banned_by`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 3 => 'CREATE TABLE IF NOT EXISTS `batch_uploads` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, - `ip` varchar(15) NOT NULL, - `url` varchar(512) NOT NULL, - `tags` text NOT NULL, - `active` tinyint(1) NOT NULL DEFAULT \'0\', - `status` varchar(32) NOT NULL DEFAULT \'pending\', - `created_at` datetime DEFAULT NULL, - `data_as_json` text NOT NULL, - PRIMARY KEY (`id`), - KEY `fk_batch_uploads__user_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 4 => 'CREATE TABLE IF NOT EXISTS `comments` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `post_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `ip_addr` varchar(16) NOT NULL, - `created_at` datetime DEFAULT \'0000-00-00 00:00:00\', - `body` text NOT NULL, - `updated_at` datetime NOT NULL, - `is_spam` tinyint(1) NOT NULL DEFAULT \'0\', - PRIMARY KEY (`id`), - KEY `fk_comments__user_id` (`user_id`), - KEY `fk_comments__post_id` (`post_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 5 => 'CREATE TABLE IF NOT EXISTS `dmails` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `from_id` int(11) NOT NULL, - `to_id` int(11) NOT NULL, - `title` text NOT NULL, - `body` text NOT NULL, - `created_at` datetime DEFAULT NULL, - `has_seen` tinyint(1) NOT NULL DEFAULT \'0\', - `parent_id` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `from_id` (`from_id`,`to_id`), - KEY `fk_dmails__to_id` (`to_id`), - KEY `fk_dmails__parent_id` (`parent_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 6 => 'CREATE TABLE IF NOT EXISTS `favorites` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `post_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - PRIMARY KEY (`id`), - UNIQUE KEY `post_id__user_id` (`post_id`,`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 7 => 'CREATE TABLE IF NOT EXISTS `flagged_post_details` ( - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `post_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `reason` varchar(512) NOT NULL, - `is_resolved` tinyint(1) NOT NULL DEFAULT \'0\', - KEY `post_id` (`post_id`), - KEY `fk_flag_post_details__user_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 8 => 'CREATE TABLE IF NOT EXISTS `forum_posts` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - `title` text NOT NULL, - `body` text NOT NULL, - `creator_id` int(11) NOT NULL, - `parent_id` int(11) DEFAULT NULL, - `last_updated_by` int(11) DEFAULT NULL, - `is_sticky` tinyint(1) NOT NULL DEFAULT \'0\', - `response_count` int(11) NOT NULL DEFAULT \'0\', - `is_locked` tinyint(1) NOT NULL DEFAULT \'0\', - `text_search_index` text, - PRIMARY KEY (`id`), - KEY `fk_forum_posts__creator_id` (`creator_id`), - KEY `fk_forum_posts__last_updated_by` (`last_updated_by`), - KEY `fk_forum_posts__parent_id` (`parent_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 9 => 'CREATE TABLE IF NOT EXISTS `histories` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL, - `user_id` int(11) DEFAULT NULL, - `group_by_id` int(11) NOT NULL, - `group_by_table` varchar(12) NOT NULL, - `aux_as_json` text, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 10 => 'CREATE TABLE IF NOT EXISTS `history_changes` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `column_name` char(24) NOT NULL, - `remote_id` bigint(20) NOT NULL, - `table_name` char(24) NOT NULL, - `value` text, - `history_id` bigint(20) unsigned NOT NULL, - `previous_id` bigint(20) DEFAULT NULL, - `value_index` text NOT NULL, - PRIMARY KEY (`id`), - KEY `previous_id` (`previous_id`), - KEY `fk_history_changes__history_id` (`history_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 11 => 'CREATE TABLE IF NOT EXISTS `ip_bans` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `expires_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `ip_addr` varchar(15) NOT NULL, - `reason` text NOT NULL, - `banned_by` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `fk_ip_bans__banned_by` (`banned_by`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 12 => 'CREATE TABLE IF NOT EXISTS `job_tasks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `task_type` varchar(64) NOT NULL, - `data_as_json` text, - `status` varchar(64) NOT NULL, - `status_message` text, - `repeat_count` int(11) NOT NULL DEFAULT \'0\', - `created_at` datetime DEFAULT NULL, - `updated_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 13 => 'CREATE TABLE IF NOT EXISTS `notes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `updated_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `user_id` int(11) NOT NULL, - `x` int(11) NOT NULL, - `y` int(11) NOT NULL, - `width` int(11) NOT NULL, - `height` int(11) NOT NULL, - `ip_addr` varchar(64) NOT NULL, - `version` int(11) NOT NULL DEFAULT \'1\', - `is_active` tinyint(1) NOT NULL DEFAULT \'1\', - `post_id` int(11) NOT NULL, - `body` text NOT NULL, - PRIMARY KEY (`id`), - KEY `post_id` (`post_id`), - KEY `user_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 14 => 'CREATE TABLE IF NOT EXISTS `note_versions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `updated_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `x` int(11) NOT NULL, - `y` int(11) NOT NULL, - `width` int(11) NOT NULL, - `height` int(11) NOT NULL, - `body` text NOT NULL, - `version` int(11) NOT NULL, - `ip_addr` varchar(64) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT \'1\', - `note_id` int(11) NOT NULL, - `post_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `user_id` (`user_id`), - KEY `fk_note_versions__note_id` (`note_id`), - KEY `fk_note_versions__post_id` (`post_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 15 => 'CREATE TABLE IF NOT EXISTS `pools` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(128) NOT NULL, - `description` text NOT NULL, - `user_id` int(11) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT \'1\', - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `updated_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `post_count` int(3) NOT NULL DEFAULT \'0\', - `is_public` binary(1) NOT NULL DEFAULT \'1\', - PRIMARY KEY (`id`), - UNIQUE KEY `pool_name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 16 => 'CREATE TABLE IF NOT EXISTS `pools_posts` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `post_id` int(11) NOT NULL, - `pool_id` int(11) NOT NULL, - `sequence` varchar(16) NOT NULL, - `next_post_id` int(11) DEFAULT NULL, - `prev_post_id` int(11) DEFAULT NULL, - `active` tinyint(1) NOT NULL DEFAULT \'1\', - PRIMARY KEY (`id`), - KEY `post_id` (`post_id`), - KEY `fk_pools_posts__next_post_id` (`next_post_id`), - KEY `fk_pools_posts__prev_post_id` (`prev_post_id`), - KEY `fk_pools_posts__pool_id` (`pool_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 17 => 'DROP TRIGGER IF EXISTS `pools_posts_insert_trg`', - 18 => 'CREATE TRIGGER `pools_posts_insert_trg` BEFORE INSERT ON `pools_posts` - FOR EACH ROW BEGIN - UPDATE pools SET post_count = post_count + 1 WHERE id = NEW.pool_id; -END', - 19 => 'DROP TRIGGER IF EXISTS `pools_posts_update_trg`', - 20 => 'CREATE TRIGGER `pools_posts_update_trg` BEFORE UPDATE ON `pools_posts` - FOR EACH ROW BEGIN - IF (OLD.active <> NEW.active) THEN - IF (NEW.active) THEN - UPDATE pools SET post_count = post_count + 1 WHERE id = NEW.pool_id; - ELSE - UPDATE pools SET post_count = post_count - 1 WHERE id = NEW.pool_id; - END IF; - END IF; - END', - - -'DROP TRIGGER IF EXISTS `pools_posts_delete_trg`', - 25 => 'CREATE TRIGGER `pools_posts_delete_trg` BEFORE DELETE ON `pools_posts` - FOR EACH ROW BEGIN - UPDATE pools SET post_count = post_count - 1 WHERE id = OLD.pool_id; -END', - 26 => 'CREATE TABLE IF NOT EXISTS `posts` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `user_id` int(11) DEFAULT NULL, - `ip_addr` varchar(64) NOT NULL, - `file_size` int(11) NOT NULL, - `md5` varchar(32) NOT NULL, - `last_commented_at` datetime DEFAULT NULL, - `file_ext` varchar(4) NOT NULL, - `last_noted_at` datetime DEFAULT NULL, - `source` varchar(249) DEFAULT NULL, - `cached_tags` text NOT NULL, - `width` int(11) NOT NULL, - `height` int(11) NOT NULL, - `created_at` datetime NOT NULL, - `rating` char(1) NOT NULL DEFAULT \'q\', - `preview_width` int(3) NOT NULL, - `preview_height` int(3) NOT NULL, - `actual_preview_width` int(3) NOT NULL, - `actual_preview_height` int(3) NOT NULL, - `score` int(3) NOT NULL DEFAULT \'0\', - `is_shown_in_index` tinyint(1) NOT NULL DEFAULT \'1\', - `is_held` tinyint(1) NOT NULL DEFAULT \'0\', - `has_children` tinyint(1) NOT NULL DEFAULT \'0\', - `status` enum(\'deleted\',\'flagged\',\'pending\',\'active\') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT \'active\', - `is_rating_locked` tinyint(1) NOT NULL DEFAULT \'0\', - `is_note_locked` tinyint(1) NOT NULL DEFAULT \'0\', - `parent_id` int(11) DEFAULT NULL, - `sample_width` int(5) DEFAULT NULL, - `sample_height` int(5) DEFAULT NULL, - `sample_size` int(11) DEFAULT NULL, - `index_timestamp` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `jpeg_width` int(11) DEFAULT NULL, - `jpeg_height` int(11) DEFAULT NULL, - `jpeg_size` int(11) DEFAULT NULL, - `random` int(11) NOT NULL, - `approver_id` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `md5` (`md5`), - KEY `fk_posts__parent_id` (`parent_id`), - KEY `posts__approver_id` (`approver_id`), - KEY `fk_posts__user_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 27 => 'DROP TRIGGER IF EXISTS `trg_posts__insert`', - 28 => 'CREATE TRIGGER `trg_posts__insert` AFTER INSERT ON `posts` - FOR EACH ROW BEGIN - UPDATE table_data SET row_count = row_count + 1 WHERE name = \'posts\'; -END', - 29 => 'DROP TRIGGER IF EXISTS `trg_posts__delete`', - 30 => 'CREATE TRIGGER `trg_posts__delete` AFTER DELETE ON `posts` - FOR EACH ROW BEGIN - UPDATE table_data SET row_count = row_count - 1 WHERE name = \'posts\'; -END', - 31 => 'CREATE TABLE IF NOT EXISTS `posts_tags` ( - `post_id` int(11) NOT NULL, - `tag_id` int(11) NOT NULL, - UNIQUE KEY `post_id` (`post_id`,`tag_id`), - KEY `fk_posts_tags__post_id` (`post_id`), - KEY `fk_posts_tags__tag_id` (`tag_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 32 => 'DROP TRIGGER IF EXISTS `trg_posts_tags__insert`', - 33 => 'CREATE TRIGGER `trg_posts_tags__insert` AFTER INSERT ON `posts_tags` - FOR EACH ROW BEGIN - UPDATE tags SET post_count = post_count + 1 WHERE tags.id = NEW.tag_id; -END', - 34 => 'DROP TRIGGER IF EXISTS `trg_posts_tags__delete`', - 35 => 'CREATE TRIGGER `trg_posts_tags__delete` AFTER DELETE ON `posts_tags` - FOR EACH ROW BEGIN - UPDATE tags SET post_count = post_count - 1 WHERE tags.id = OLD.tag_id; -END', - 36 => 'CREATE TABLE IF NOT EXISTS `post_tag_histories` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `post_id` int(11) NOT NULL, - `tags` text NOT NULL, - `user_id` int(11) NOT NULL, - `ip_addr` varchar(39) NOT NULL, - `created_at` datetime NOT NULL, - PRIMARY KEY (`id`), - KEY `fk_post_tag_histories__post_id` (`post_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 37 => 'CREATE TABLE IF NOT EXISTS `post_votes` ( - `post_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - `score` int(1) DEFAULT \'0\', - `updated_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - UNIQUE KEY `post_id` (`post_id`,`user_id`), - KEY `score` (`score`), - KEY `fk_user_id__users_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 38 => 'CREATE TABLE IF NOT EXISTS `table_data` ( - `name` varchar(32) NOT NULL, - `row_count` int(11) NOT NULL DEFAULT \'0\', - KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 39 => 'CREATE TABLE IF NOT EXISTS `tags` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `post_count` int(11) NOT NULL DEFAULT \'0\', - `cached_related` text, - `cached_related_expires_on` datetime DEFAULT NULL, - `tag_type` smallint(6) NOT NULL, - `is_ambiguous` tinyint(1) NOT NULL DEFAULT \'0\', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 40 => 'CREATE TABLE IF NOT EXISTS `tag_aliases` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(64) NOT NULL, - `alias_id` int(11) NOT NULL, - `is_pending` tinyint(1) NOT NULL DEFAULT \'0\', - `reason` varchar(128) DEFAULT NULL, - `creator_id` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `alias_unique` (`name`,`alias_id`), - KEY `name` (`name`), - KEY `fk_tag_aliases__alias_id` (`alias_id`), - KEY `fk_tag_aliases__creator_id` (`creator_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 41 => 'CREATE TABLE IF NOT EXISTS `tag_implications` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `predicate_id` int(11) NOT NULL, - `consequent_id` int(11) NOT NULL, - `is_pending` tinyint(1) NOT NULL DEFAULT \'0\', - `reason` varchar(128) DEFAULT NULL, - `creator_id` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `predicate_id__consequent_id` (`predicate_id`,`consequent_id`), - KEY `fk_tag_implications__consequent_id` (`consequent_id`), - KEY `fk_tag_implications__creator_id` (`creator_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 42 => 'CREATE TABLE IF NOT EXISTS `tag_subscriptions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, - `tag_query` text CHARACTER SET latin1 NOT NULL, - `cached_post_ids` text CHARACTER SET latin1 NOT NULL, - `name` varchar(32) CHARACTER SET latin1 NOT NULL, - `is_visible_on_profile` tinyint(1) NOT NULL DEFAULT \'1\', - PRIMARY KEY (`id`), - KEY `user_id` (`user_id`), - KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 43 => 'CREATE TABLE IF NOT EXISTS `users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(32) NOT NULL, - `password_hash` varchar(40) DEFAULT NULL, - `created_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `level` int(11) NOT NULL DEFAULT \'20\', - `email` varchar(249) DEFAULT NULL, - `avatar_post_id` int(11) DEFAULT NULL, - `avatar_width` double DEFAULT NULL, - `avatar_height` double DEFAULT NULL, - `avatar_top` double DEFAULT NULL, - `avatar_bottom` double DEFAULT NULL, - `avatar_left` double DEFAULT NULL, - `avatar_right` double DEFAULT NULL, - `avatar_timestamp` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `my_tags` text, - `invite_count` int(11) NOT NULL DEFAULT \'0\', - `invited_by` int(11) DEFAULT NULL, - `show_samples` tinyint(1) NOT NULL DEFAULT \'1\', - `show_advanced_editing` tinyint(1) NOT NULL DEFAULT \'0\', - `pool_browse_mode` tinyint(1) NOT NULL DEFAULT \'0\', - `use_browser` tinyint(1) NOT NULL DEFAULT \'0\', - `always_resize_images` tinyint(1) NOT NULL DEFAULT \'0\', - `last_logged_in_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `last_forum_topic_read_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `last_comment_read_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `last_deleted_post_seen_at` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', - `language` text, - `secondary_languages` text, - `receive_dmails` tinyint(1) NOT NULL DEFAULT \'1\', - `has_mail` tinyint(1) NOT NULL DEFAULT \'0\', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`), - KEY `fk_users__avatar_post_id` (`avatar_post_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 44 => 'CREATE TABLE IF NOT EXISTS `user_blacklisted_tags` ( - `user_id` int(11) NOT NULL, - `tags` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, - UNIQUE KEY `user_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 45 => 'CREATE TABLE IF NOT EXISTS `user_records` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, - `reported_by` int(11) NOT NULL, - `created_at` datetime NOT NULL, - `is_positive` tinyint(1) NOT NULL DEFAULT \'1\', - `body` text NOT NULL, - PRIMARY KEY (`id`), - KEY `fk_user_records__user_id` (`user_id`), - KEY `fk_user_records__reported_by` (`reported_by`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 46 => 'CREATE TABLE IF NOT EXISTS `wiki_pages` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - `version` int(11) NOT NULL DEFAULT \'1\', - `title` varchar(64) NOT NULL, - `body` text NOT NULL, - `user_id` int(11) DEFAULT NULL, - `ip_addr` varchar(15) NOT NULL, - `is_locked` tinyint(1) NOT NULL DEFAULT \'0\', - `text_search_index` text NOT NULL, - PRIMARY KEY (`id`), - KEY `user_id` (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 47 => 'CREATE TABLE IF NOT EXISTS `wiki_page_versions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - `version` int(11) NOT NULL DEFAULT \'1\', - `title` varchar(64) NOT NULL, - `body` text NOT NULL, - `user_id` int(11) DEFAULT NULL, - `ip_addr` varchar(15) NOT NULL, - `wiki_page_id` int(11) NOT NULL, - `is_locked` tinyint(1) NOT NULL DEFAULT \'0\', - `text_search_index` text NOT NULL, - PRIMARY KEY (`id`), - KEY `user_id` (`user_id`), - KEY `fk_wiki_page_versions__wiki_page` (`wiki_page_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8', - 48 => 'ALTER TABLE `artists` - ADD CONSTRAINT `fk_artists__updater_id` FOREIGN KEY (`updater_id`) REFERENCES `users` (`id`) ON DELETE SET NULL', - 49 => 'ALTER TABLE `artists_urls` - ADD CONSTRAINT `fk_artists_urls__artist_id` FOREIGN KEY (`artist_id`) REFERENCES `artists` (`id`) ON DELETE CASCADE', - 50 => 'ALTER TABLE `bans` - ADD CONSTRAINT `fk_bans__banned_by` FOREIGN KEY (`banned_by`) REFERENCES `users` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_bans__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 51 => 'ALTER TABLE `batch_uploads` - ADD CONSTRAINT `fk_batch_uploads__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 52 => 'ALTER TABLE `comments` - ADD CONSTRAINT `fk_comments__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_comments__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 53 => 'ALTER TABLE `dmails` - ADD CONSTRAINT `fk_dmails__from_id` FOREIGN KEY (`from_id`) REFERENCES `users` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_dmails__parent_id` FOREIGN KEY (`parent_id`) REFERENCES `dmails` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_dmails__to_id` FOREIGN KEY (`to_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 54 => 'ALTER TABLE `flagged_post_details` - ADD CONSTRAINT `fk_flag_post_details__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), - ADD CONSTRAINT `fk_flag_post_det__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE', - 55 => 'ALTER TABLE `forum_posts` - ADD CONSTRAINT `fk_forum_posts__creator_id` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_forum_posts__last_updated_by` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL, - ADD CONSTRAINT `fk_forum_posts__parent_id` FOREIGN KEY (`parent_id`) REFERENCES `forum_posts` (`id`) ON DELETE CASCADE', - 56 => 'ALTER TABLE `history_changes` - ADD CONSTRAINT `fk_history_changes__history_id` FOREIGN KEY (`history_id`) REFERENCES `histories` (`id`) ON DELETE CASCADE', - 57 => 'ALTER TABLE `ip_bans` - ADD CONSTRAINT `fk_ip_bans__banned_by` FOREIGN KEY (`banned_by`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 58 => 'ALTER TABLE `notes` - ADD CONSTRAINT `fk_notes__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE', - 59 => 'ALTER TABLE `note_versions` - ADD CONSTRAINT `fk_note_versions__note_id` FOREIGN KEY (`note_id`) REFERENCES `notes` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_note_versions__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE', - 60 => 'ALTER TABLE `pools_posts` - ADD CONSTRAINT `fk_pools_posts__next_post_id` FOREIGN KEY (`next_post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL, - ADD CONSTRAINT `fk_pools_posts__pool_id` FOREIGN KEY (`pool_id`) REFERENCES `pools` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_pools_posts__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_pools_posts__prev_post_id` FOREIGN KEY (`prev_post_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL', - 61 => 'ALTER TABLE `posts` - ADD CONSTRAINT `fk_parent_id__posts_id` FOREIGN KEY (`parent_id`) REFERENCES `posts` (`id`) ON DELETE SET NULL, - ADD CONSTRAINT `fk_posts__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL, - ADD CONSTRAINT `posts__approver_id` FOREIGN KEY (`approver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL', - 62 => 'ALTER TABLE `posts_tags` - ADD CONSTRAINT `fk_posts_tags__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_posts_tags__tag_id` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE', - 63 => 'ALTER TABLE `post_tag_histories` - ADD CONSTRAINT `fk_post_tag_histories__post_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE', - 64 => 'ALTER TABLE `post_votes` - ADD CONSTRAINT `fk_post_id__posts_id` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_user_id__users_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 65 => 'ALTER TABLE `tag_aliases` - ADD CONSTRAINT `fk_tag_aliases__alias_id` FOREIGN KEY (`alias_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_tag_aliases__creator_id` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 66 => 'ALTER TABLE `tag_implications` - ADD CONSTRAINT `fk_consequent_id` FOREIGN KEY (`consequent_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_tag_implications__consequent_id` FOREIGN KEY (`consequent_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_tag_implications__creator_id` FOREIGN KEY (`creator_id`) REFERENCES `users` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_tag_implications__predicate_id` FOREIGN KEY (`predicate_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE', - 67 => 'ALTER TABLE `user_blacklisted_tags` - ADD CONSTRAINT `fk_user_bl_tags__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 68 => 'ALTER TABLE `user_records` - ADD CONSTRAINT `fk_user_records__reported_by` FOREIGN KEY (`reported_by`) REFERENCES `users` (`id`) ON DELETE CASCADE, - ADD CONSTRAINT `fk_user_records__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE', - 69 => 'ALTER TABLE `wiki_pages` - ADD CONSTRAINT `fk_wiki_pages__user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL', - 70 => 'ALTER TABLE `wiki_page_versions` - ADD CONSTRAINT `fk_wiki_page_versions__wiki_page` FOREIGN KEY (`wiki_page_id`) REFERENCES `wiki_pages` (`id`) ON DELETE CASCADE', -); diff --git a/install/views/install.php b/install/views/install.php deleted file mode 100755 index 6ed02cb..0000000 --- a/install/views/install.php +++ /dev/null @@ -1,177 +0,0 @@ - - - -
PHP.ini directives
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameCurrent valueRecommended min. value
memory_limit128M+
post_max_size6M
upload_max_filesize5M
GD2Must be enabled
PDOMust be enabled
ImagickRecommended
cURLShould be enabled
- -
-
- -
Admin account
-
- - - - - - - - - - - - - - - - - - - - - - -
Name
Password
Confirm password
- -

Only enable if you have problems when creating the database.

-
- - -
-
- - diff --git a/install/views/layout.php b/install/views/layout.php deleted file mode 100755 index 352474c..0000000 --- a/install/views/layout.php +++ /dev/null @@ -1,25 +0,0 @@ - - - - <?= CONFIG()->app_name ?> - - - - - - - - -
-

app_name ?>

- content() ?> -
- - diff --git a/install/views/update.php b/install/views/update.php deleted file mode 100755 index 6986b55..0000000 --- a/install/views/update.php +++ /dev/null @@ -1,12 +0,0 @@ -
-
-
Update to version newVersion ?>
-
-
-
- -

-

(To show the installation form, the public/data folder must not exist)

-
-

-
diff --git a/public/index b/public/index deleted file mode 100755 index 7535848..0000000 --- a/public/index +++ /dev/null @@ -1,3 +0,0 @@ -dispatch(); +