/** * Run the database seeds. * * @return void */ public function run() { DB::table('mods')->delete(); $testmod = Mod::create(array('pretty_name' => 'TestMod', 'name' => 'testmod', 'description' => 'This is a test mod for Solder', 'author' => 'Technic', 'link' => 'http://solder.io')); DB::table('modversions')->delete(); $testmodversion = Modversion::create(array('mod_id' => $testmod->id, 'version' => '0.1', 'md5' => 'fb6582e4d9c9bc208181907ecc108eb1')); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('mods')->delete(); $testmod = Mod::create(array('pretty_name' => 'TestMod', 'name' => 'testmod', 'description' => 'This is a test mod for Solder', 'author' => 'Technic', 'link' => 'http://solder.io')); DB::table('modversions')->delete(); $testmodversion = Modversion::create(array('mod_id' => $testmod->id, 'version' => '1.0', 'md5' => 'bdbc6c6cc48c7b037e4aef64b58258a3', 'filesize' => '295')); }
public function run() { $faker = Faker\Factory::create(); foreach (range(1, 200) as $index) { $name = $faker->bs; Mod::create(['name' => $name, 'deck' => $faker->sentence(12), 'website' => $faker->url, 'download_link' => $faker->url, 'donate_link' => $faker->url, 'wiki_link' => $faker->url, 'description' => $faker->paragraph(5), 'slug' => Str::slug($name), 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); } }
public static function getList() { $result = array(); if (is_dir(MODS_DIR) && $dh = opendir(MODS_DIR)) { while (($file = readdir($dh)) !== false) { if ( $file == '.' || $file == '..' || !is_dir(MODS_DIR . DIRECTORY_SEPARATOR . $file) ) continue; $result[] = Mod::create()->setName($file); } closedir($dh); } sort($result); return $result; }
public function createByHash($hash) { if ( !file_exists( $file = BUILDS_DIR . DIRECTORY_SEPARATOR . $hash . DIRECTORY_SEPARATOR . 'build.info' ) ) { throw new Exception('Its not build'); } else { foreach ( explode(';', file_get_contents($file)) as $modName ) { $this->addMod(Mod::create()->setName($modName)); } } return $this; }
function installMods($mods) { global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; $res = $db->sql_query( 'SELECT style_name FROM ' . $table_prefix . 'styles WHERE style_id = ' . $config['default_style'] ); $this->style = $db->sql_fetchfield('style_name'); $build = Build::create(); foreach ($mods as $modName) $build->addMod(Mod::create()->setName($modName)); try { $deps = $build->getDependences('style'); } catch (Exception $e) { return null; } if ($deps && !in_array($this->style, $deps)) { return $build; } else { try { InstallAction::me()->setBuild($build)->run(); file_put_contents( USER_DIR . DIRECTORY_SEPARATOR . '.htaccess', str_replace( $this->build->getHash(), $build->getHash(), file_get_contents( USER_DIR . DIRECTORY_SEPARATOR . '.htaccess' ) ) ); file_put_contents( USER_DIR . DIRECTORY_SEPARATOR . 'nginx.rewrite', str_replace( $this->build->getHash(), $build->getHash(), file_get_contents( USER_DIR . DIRECTORY_SEPARATOR . 'nginx.rewrite' ) ) ); } catch (Exception $e) { trigger_error($e->getMessage(),E_USER_WARNING); } } return $this; }