Exemplo n.º 1
0
}
/*
|--------------------------------------------------------------------------
| Set The CLI Options Array
|--------------------------------------------------------------------------
|
| If the current request is from the Artisan command-line interface, we
| will parse the command line arguments and options and set them the
| array of options in the $_SERVER global array for convenience.
|
*/
if (defined('STDIN')) {
    $console = CLI\Command::options($_SERVER['argv']);
    list($arguments, $options) = $console;
    $options = array_change_key_case($options, CASE_UPPER);
    $_SERVER['CLI'] = $options;
}
/*
|--------------------------------------------------------------------------
| Register The Laravel Bundles
|--------------------------------------------------------------------------
|
| Finally we will register all of the bundles that have been defined for
| the application. None of them will be started yet, but will be setup
| so that they may be started by the developer at any time.
|
*/
$bundles = (require path('app') . 'bundles' . EXT);
foreach ($bundles as $bundle => $config) {
    Bundle::register($bundle, $config);
}
Exemplo n.º 2
0
 public static function migrate($module_slug, $action = 'run')
 {
     require path('sys') . 'cli' . DS . 'dependencies' . EXT;
     try {
         $migrations_path = path('bundle') . $module_slug . DS . 'migrations' . DS;
         if (File::exists($migrations_path)) {
             $migration_files = glob($migrations_path . '*.php');
             if (!empty($migration_files)) {
                 if ($action == 'run') {
                     Bundle::register($module_slug);
                     $custom_tables = \Laravel\CLI\Command::run(array('migrate', $module_slug));
                     Bundle::disable($module_slug);
                     return true;
                 }
                 if ($action == 'rollback') {
                     Bundle::register($module_slug);
                     $custom_tables = \Laravel\CLI\Command::run(array('migrate:rollback', $module_slug));
                     Bundle::disable($module_slug);
                     return true;
                 }
                 Log::error('Failed to run migrations for module ' . $module_slug . '. Migration command [' . $action . '] is invalid.');
                 static::$errors->add('installer', 'Failed to run migrations for module ' . $module_slug . '. Migration command [' . $action . '] is invalid.');
                 return false;
             }
         }
         return true;
     } catch (\Exception $e) {
         Log::error($e->getMessage());
         //static::$errors->add('installer', 'Failed to run migrations.');
         return false;
     }
 }