def populate(bulk_data, test_data, posts, topics, force, initdb): """Creates the necessary tables and groups for FlaskBB.""" if force: click.secho("[+] Recreating database...", fg="cyan") db.drop_all() # do not initialize the db if -i is passed if not initdb: create_latest_db() if initdb: click.secho("[+] Initializing database...", fg="cyan") create_latest_db() run_plugin_migrations() if test_data: click.secho("[+] Adding some test data...", fg="cyan") create_test_data() if bulk_data: timer = time.time() topic_count, post_count = insert_bulk_data(int(topics), int(posts)) elapsed = time.time() - timer click.secho( "[+] It took {} seconds to create {} topics and {} posts".format( elapsed, topic_count, post_count), fg="cyan") # this just makes the most sense for the command name; use -i to # init the db as well if not test_data: click.secho("[+] Populating the database with some defaults...", fg="cyan") create_default_groups() create_default_settings()
def install(welcome, force, username, email, password, no_plugins): """Installs flaskbb. If no arguments are used, an interactive setup will be run. """ if not current_app.config["CONFIG_PATH"]: click.secho( "[!] No 'flaskbb.cfg' config found. " "You can generate a configuration file with 'flaskbb makeconfig'.", fg="red", ) sys.exit(1) click.secho("[+] Installing FlaskBB...", fg="cyan") if database_exists(db.engine.url): if force or click.confirm( click.style( "Existing database found. Do you want to delete the old one and " "create a new one?", fg="magenta", )): db.drop_all() else: sys.exit(0) # creating database from scratch and 'stamping it' create_latest_db() click.secho("[+] Creating default settings...", fg="cyan") create_default_groups() create_default_settings() click.secho("[+] Creating admin user...", fg="cyan") prompt_save_user(username, email, password, "admin") if welcome: click.secho("[+] Creating welcome forum...", fg="cyan") create_welcome_forum() if not no_plugins: click.secho("[+] Installing default plugins...", fg="cyan") run_plugin_migrations() click.secho("[+] Compiling translations...", fg="cyan") compile_translations() click.secho("[+] FlaskBB has been successfully installed!", fg="green", bold=True)
def populate(bulk_data, test_data, posts, topics, force, initdb): """Creates the necessary tables and groups for FlaskBB.""" if force: click.secho("[+] Recreating database...", fg="cyan") db.drop_all() # do not initialize the db if -i is passed if not initdb: create_latest_db() if initdb: click.secho("[+] Initializing database...", fg="cyan") create_latest_db() run_plugin_migrations() if test_data: click.secho("[+] Adding some test data...", fg="cyan") create_test_data() if bulk_data: click.secho("[+] Adding a lot of test data...", fg="cyan") timer = time.time() rv = insert_bulk_data(int(topics), int(posts)) if not rv and not test_data: create_test_data() rv = insert_bulk_data(int(topics), int(posts)) elapsed = time.time() - timer click.secho("[+] It took {:.2f} seconds to create {} topics and {} " "posts.".format(elapsed, rv[0], rv[1]), fg="cyan") # this just makes the most sense for the command name; use -i to # init the db as well if not test_data and not bulk_data: click.secho("[+] Populating the database with some defaults...", fg="cyan") create_default_groups() create_default_settings()
def install(welcome, force, username, email, password, no_plugins): """Installs flaskbb. If no arguments are used, an interactive setup will be run. """ click.secho("[+] Installing FlaskBB...", fg="cyan") if database_exists(db.engine.url): if force or click.confirm(click.style( "Existing database found. Do you want to delete the old one and " "create a new one?", fg="magenta") ): db.drop_all() else: sys.exit(0) # creating database from scratch and 'stamping it' create_latest_db() click.secho("[+] Creating default settings...", fg="cyan") create_default_groups() create_default_settings() click.secho("[+] Creating admin user...", fg="cyan") prompt_save_user(username, email, password, "admin") if welcome: click.secho("[+] Creating welcome forum...", fg="cyan") create_welcome_forum() if not no_plugins: click.secho("[+] Installing default plugins...", fg="cyan") run_plugin_migrations() click.secho("[+] Compiling translations...", fg="cyan") compile_translations() click.secho("[+] FlaskBB has been successfully installed!", fg="green", bold=True)