Beispiel #1
5
 public function exec()
 {
     foreach ($GLOBALS['modules'] as $key => $module) {
         $GLOBALS['current'] = $module->name();
         \Launcher::launch($GLOBALS['modules'][$key]);
     }
 }
 public function getTableLaunchers($name, $get_version = 'all')
 {
     $cache_key = 'table-launchers-' . $name . '-' . $get_version;
     if (Cache::tags('launchers')->has($cache_key)) {
         $modpacks_array = Cache::tags('launchers')->get($cache_key);
     } else {
         $modpacks_array = [];
         $modpack_id_array = [];
         $get_version = $this->getVersion($get_version);
         $launcher = Launcher::where('slug', '=', $name)->first();
         $launcher_id = $launcher->id;
         if ($get_version == 'all') {
             $raw_modpacks = Modpack::where('launcher_id', '=', $launcher_id)->with('creators')->with('version')->with('launcher')->get();
         } else {
             $version = MinecraftVersion::where('name', '=', $get_version)->first();
             $version_id = $version->id;
             $raw_modpacks = Modpack::where('launcher_id', '=', $launcher_id)->where('minecraft_version_id', '=', $version_id)->with('creators')->with('launcher')->with('version')->get();
         }
         foreach ($raw_modpacks as $modpack) {
             if (in_array($modpack->id, $modpack_id_array)) {
                 continue;
             }
             $modpacks_array[] = $this->buildModpackArray($modpack);
             $mod_id_array[] = $modpack->id;
         }
         Cache::tags('launchers')->forever($cache_key, $modpacks_array);
     }
     return $this->buildDTLauncherOutput($modpacks_array);
 }
 public function run()
 {
     Launcher::create(['name' => 'Feed the Beast', 'short_name' => 'ftb', 'deck' => 'Feed The Beast is a group of people that specialise in making high quality modpacks and maps for Minecraft.', 'website' => 'http://www.feed-the-beast.com/', 'download_link' => 'http://www.feed-the-beast.com/', 'description' => 'Feed The Beast is a group of people that specialise in making high quality modpacks and maps for Minecraft. We started out as a skyblock style challenge map that focused on the use of tech style mods. These maps became extremely popular and in order to allow more people access to the maps the FTB Launcher was created.', 'slug' => 'feed-the-beast', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     Launcher::create(['name' => 'ATLauncher', 'short_name' => 'atlauncher', 'deck' => 'ATLauncher is a simple and easy to use Minecraft Launcher which contains many different ModPacks including several public ModPacks for you to choose from.', 'website' => 'http://www.atlauncher.com/', 'download_link' => 'http://www.atlauncher.com/downloads', 'description' => 'ATLauncher is a simple and easy to use Minecraft Launcher which contains 199 different ModPacks including 38 public ModPacks for you to choose from. We at ATLauncher do not make any of these packs which makes what we do very unique. We help others get ModPacks out there and in the hands of the public.', 'slug' => 'atlauncher', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     Launcher::create(['name' => 'Technic Platform', 'short_name' => 'technic', 'deck' => 'A popular launcher bringing some of your favorite modpacks such as TPPI.', 'website' => 'http://www.technicpack.net/', 'download_link' => 'http://www.technicpack.net/download', 'description' => '', 'slug' => 'technic-platform', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     Launcher::create(['name' => 'Custom', 'deck' => '', 'website' => '', 'download_link' => '', 'description' => '', 'slug' => 'custom', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
 }
 /**
  * Invokes the framework, application and object setup.
  * @return void
  */
 public static function invoke()
 {
     // find the route
     // invoke the controller
     // invoke the action
     // invoke the view
     self::$application = Scratch::singleton();
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     $modpackIds = Modpack::lists('id');
     $laucherIds = Launcher::lists('id');
     foreach (range(1, 10) as $index) {
         ModpackCode::create(['code' => $faker->word, 'modpack_id' => $faker->randomElement($modpackIds), 'launcher_id' => $faker->randomElement($laucherIds), 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     }
 }
 /**
  * {@inheritdoc}   
  */
 public function run($thread = 0)
 {
     //run params
     $startRunTime = time();
     $maxRunTime = $startRunTime + $this->maxExecutionTime;
     $countExecutedJobs = 0;
     //params for get item of queue
     $threadRun = $thread ?: $this->thread;
     $queue = new Job_queue();
     do {
         //set timeout for next iteration
         usleep(1000000 * $this->runTimeout);
         $countExecutedJobs++;
         try {
             //getting item
             $item = $queue->getItem($this->failRetryTime, $threadRun);
             if (!$item->exists()) {
                 throw new Exception("No actually items for run at " . date($this->dateFormat, time()));
             }
             //get params for execute
             $command = $item->command;
             $argsStr = $item->args;
             $args = json_decode($argsStr, true);
             if (empty($command)) {
                 $item->state = $item::STATUS_FAILED;
                 $item->save();
                 throw new Exception("Can't run item - data is missing!");
             }
             //start executing
             $startExecute = new DateTime();
             $item->state = $item::STATUS_RUNNING;
             $item->started_at = $startExecute->format($this->dateFormat);
             if (!$item->save()) {
                 throw new Exception($item->error->string);
             }
         } catch (Exception $e) {
             continue;
         }
         try {
             $this->launcher->execute($command, $args);
             $item->state = $item::STATUS_FINISHED;
         } catch (Exception $e) {
             log_message('TASK_ERROR', __FUNCTION__ . $e->getMessage());
             $item->state = $item->retries <= $item->max_retries ? $item::STATUS_INCOMPLETE : $item::STATUS_FAILED;
         }
         //end executing
         $endExecute = new DateTime();
         $item->retries++;
         $item->closed_at = $endExecute->format($this->dateFormat);
         $item->runtime = $startExecute->diff($endExecute)->format('%s');
         $item->memory_usage = memory_get_usage(false);
         $item->memory_usage_real = memory_get_usage(true);
         if (!$item->save()) {
             log_message('TASK_ERROR', 'Item not saved' . $item->error->string);
         }
     } while ($countExecutedJobs < $this->maxJobs && time() < $maxRunTime);
 }
Beispiel #7
0
 public function valid($url)
 {
     $pattern = \Launcher::valid_in_objects($this->patterns, 'valid', $url);
     if (!is_null($pattern)) {
         $this->loader->add_pile($pattern->get_pile());
         return true;
     }
     return false;
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     $launcherIds = Launcher::lists('id');
     $minecraftVersionIds = MinecraftVersion::lists('id');
     foreach (range(1, 30) as $index) {
         $name = $faker->bs;
         Modpack::create(['name' => $name, 'launcher_id' => $faker->randomElement($launcherIds), 'minecraft_version_id' => $faker->randomElement($minecraftVersionIds), '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 function getSitemapLaunchers()
 {
     $launchers = Launcher::orderBy('created_at', 'desc')->get();
     foreach ($launchers as $launcher) {
         $this->sitemap->add(URL::to('launcher/' . $launcher->slug));
         foreach ($this->minecraft_version_array as $version) {
             $this->sitemap->add(URL::to('launcher/' . $launcher->slug . '/' . $version));
         }
     }
     return $this->sitemap->render('xml');
 }
Beispiel #10
0
 public function exec()
 {
     $loader = $this->router->get();
     if ($loader === false) {
         self::status(404);
         return false;
     }
     \Launcher::launch($loader);
     parent::exec();
     // launching modules
 }
Beispiel #11
0
 public function exec()
 {
     if ($this->get_option('bootable')) {
         $this->object = \Launcher::boot($this->object);
     }
     foreach ($this->get_option('methods') as $key => $value) {
         if (is_int($key)) {
             if (is_string($value)) {
                 $this->set_result($value, call_user_func(array($this->object, $value)));
             }
         } elseif (is_string($key)) {
             $this->set_result($key, call_user_func_array(array($this->object, $key), $value));
         }
     }
     return array($this->name() => $this->get_results());
 }
 public function getLauncherVersion($name, $version = 'all')
 {
     $table_javascript = route('tdf_name', ['launchers', $version, $name]);
     $version = $this->getVersion($version);
     if ($version == 'all') {
         $version = 'All';
     }
     $launcher = Launcher::where('slug', '=', $name)->first();
     if (!$launcher) {
         App::abort(404);
     }
     $raw_links = ['website' => $launcher->website, 'download_link' => $launcher->download_link, 'donate_link' => $launcher->donate_link, 'wiki_link' => $launcher->wiki_link];
     $links = [];
     foreach ($raw_links as $index => $link) {
         if ($link != '') {
             $links["{$index}"] = $link;
         }
     }
     $title = $version . ' ' . $launcher->name . ' Modpacks - ' . $this->site_name;
     $meta_description = $version . ' Modpacks for ' . $launcher->name;
     return View::make('launchers.list', ['table_javascript' => $table_javascript, 'version' => $version, 'launcher' => $launcher, 'links' => $links, 'title' => $title, 'meta_description' => $meta_description]);
 }
 protected function launch($element, $argument, $memoized)
 {
     if (is_array($element)) {
         $mem = array();
         // Memoization
         foreach ($element as $sub) {
             $temp = $this->launch($sub, $argument, false);
             if (!is_null($temp)) {
                 $mem[] = $temp;
             }
         }
         return $mem;
     } elseif ($element instanceof \collections\ILaunched) {
         $element->init($argument, $memoized);
         return $element->launch(NULL);
     } elseif ($element instanceof \Closure || is_callable($element)) {
         return $memoized ? call_user_func_array($element, $argument) : $element($argument);
     } elseif (\Launcher::can_boot($element)) {
         return \Launcher::boot($element);
     }
     return $element;
     // Default
 }
Beispiel #14
0
 public function valid($url)
 {
     return is_array($this->pattern) ? !is_null(\Launcher::valid_in($this->pattern, array('\\routing\\Pattern', 'pattern_valid'), $url)) : self::pattern_valid($this->pattern, $url);
     // Else, testing the only one
 }
Beispiel #15
0
            echo 'Hi !';
        } elseif ($event == 'bye') {
            echo 'Bye !';
        } else {
            echo 'Oh no ! ' . $event . ' isn\'t a proper event';
        }
    }
    public function error($status)
    {
        echo 'Oh no ! Module error ' . $status;
    }
}
$Action = new Executors\Object('A', array('sayHi'));
$Event = new Executors\Object('Event_A', array('valid'));
$loader = new Loaders\Controller();
$loader->add_event($Event, $Action);
$controller = $loader->load();
Launcher::boot($controller);
// @TODO - Better support of functions/files to includes/bootables as actions in helpers
// @TODO - change file names to ALL lowercases, easier to maintain (then change Get and Post class names to GET and POST, easier to read)
// @TODO - Rewrites controllers and modules, and the way the latter handle model and view
// @TODO - Rewrites router system, making it easier to use and more flexible
// @TODO - Support [permmissions, errors, queries, form] IN controllers and separate (as other objects) in modules and controllers
// @TODO - handles normal php options : ?id=1&page=3 etc... in router
// @TODO - Error handling
// @TODO - Find a way to implement libraries
/* @TODO - In core :
	- Template
	-- Parsers : html, file inclusions etc...
	- Databases (ORM)
*/
Beispiel #16
0
require_once "bakery/globals.php";
require_once "bakery/launcher.php";
$url = str_replace('index.php', '/', $_SERVER['PHP_SELF']);
$url = str_replace($url, '', $_SERVER['REQUEST_URI']);
$url = explode('/', $url);
$page = array_shift($url);
$args = array();
foreach ($url as $val) {
    $args[] = urldecode($val);
}
$tools = array("Lineup", "Players", "User", "Teams", "View", "Game", "Login", "Logout", "Profile");
$thePage = $args[0];
if (!empty($thePage) && !in_array($thePage, $tools)) {
    $th->load($thePage);
} else {
    if (in_array($thePage, $tools)) {
        if ($thePage == "View") {
            $th->load("Header");
        }
        $launcher = new Launcher($thePage, $args);
        $launcher->runTool();
        if ($thePage == "View") {
            $th->load("Footer");
        }
    } else {
        $th->load("Header");
        $th->load("Home");
        $th->load("Footer");
    }
}
Beispiel #17
0
 protected function exec_bootable($boot, $return)
 {
     if ($return) {
         return \Launcher::boot($boot);
     } else {
         \Launcher::boot($boot);
     }
 }