<?php /** * These seeds are the minimum required data for proper * system funtionality. */ /** * Rows 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) { Rails\ActiveRecord\ActiveRecord::connection()->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]);
# 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"); /** * 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);