Skip to content
Permalink
Browse files

Some fixes for board creation

  • Loading branch information...
OtakuMegane committed Jul 18, 2019
1 parent 7c975ac commit 493673ddb57a12df599900544b230c76d1608569
Showing with 12 additions and 9 deletions.
  1. +5 −5 board_files/include/Admin/AdminBoards.php
  2. +7 −4 board_files/include/Setup/Setup.php
@@ -73,8 +73,6 @@ public function add($user)
}
$board_id = $_POST['new_board_id'];
$domain = new \Nelliel\DomainBoard($board_id, $this->database);
$db_prefix = $domain->id();
$prepared = $this->database->prepare('SELECT 1 FROM "' . BOARD_DATA_TABLE . '" WHERE "board_id" = ?');
$result = $this->database->executePreparedFetch($prepared, [$board_id], PDO::FETCH_COLUMN);
@@ -83,12 +81,14 @@ public function add($user)
nel_derp(240, _gettext('There is already a board with the ID ' . $board_id . '.'));
}
$db_prefix = '_' . $board_id;
$prepared = $this->database->prepare(
'INSERT INTO "' . BOARD_DATA_TABLE . '" ("board_id", "db_prefix") VALUES (?, ?)');
$this->database->executePrepared($prepared, [$domain->id(), $db_prefix]);
$this->database->executePrepared($prepared, [$board_id, $db_prefix]);
$setup = new \Nelliel\Setup\Setup();
$setup->createBoardTables($domain->id());
$setup->createBoardDirectories($domain->id());
$setup->createBoardTables($board_id);
$setup->createBoardDirectories($board_id);
$domain = new \Nelliel\DomainBoard($board_id, $this->database);
$regen = new \Nelliel\Regen();
if (USE_INTERNAL_CACHE)
@@ -162,6 +162,13 @@ public function createBoardTables($board_id)
{
$database = nel_database();
$sql_helpers = new SQLHelpers($database);
// Domain and such doesn't function without config table
$config_table = new TableBoardConfig($database, $sql_helpers);
$config_table->tableName('_' . $board_id . '_config');
$config_table->setup();
$config_table->copyFrom(BOARD_DEFAULTS_TABLE);
$domain = new \Nelliel\DomainBoard($board_id, nel_database());
$references = $domain->reference();
$threads_table = new TableThreads($database, $sql_helpers);
@@ -179,10 +186,6 @@ public function createBoardTables($board_id)
$content_table->createTable(['posts_table' => $domain->reference('posts_table')]);
$content_table->tableName($domain->reference('archive_content_table'));
$content_table->createTable(['posts_table' => $domain->reference('archive_posts_table')]);
$content_table = new TableBoardConfig($database, $sql_helpers);
$content_table->tableName($domain->reference('config_table'));
$content_table->setup();
$content_table->copyFrom(BOARD_DEFAULTS_TABLE);
}
public function createBoardDirectories($board_id)

0 comments on commit 493673d

Please sign in to comment.
You can’t perform that action at this time.