Beispiel #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Index all files
     $tasks = array();
     foreach (\Stativo\Helpers\File::lists('Migration') as $namespace => $files) {
         foreach ($files as $file) {
             $migration = $namespace . '\\Migration\\' . $file;
             $db_mig = Migration::where('name', '=', $file)->first();
             if ($db_mig == null) {
                 $mig_insert = new Migration();
                 $mig_insert->name = $file;
                 $mig_insert->namespace = $migration;
                 $mig_insert->migrated = 0;
                 $mig_insert->save();
             }
         }
     }
     // Migrate all unmagrated migrations
     foreach (Migration::unmigrated()->get() as $migration) {
         $run = new $migration->namespace();
         if (method_exists($run, 'up')) {
             $output->writeln('Migrating: ' . $migration->name);
             $run->pre_up();
             $run->up();
         }
         $migration->migrated = 1;
         $migration->save();
     }
 }
Beispiel #2
0
 public function index()
 {
     $list = File::lists('', ['Language']);
     $classList = array();
     foreach ($list as $namespace => $classes) {
         foreach ($classes as $className) {
             $classList[strtolower($className)] = ['namespace' => $namespace, 'class' => $className];
         }
     }
     $template = view('Stativo/Guide/index');
     $template->with('nav', view('Stativo/Guide/navigation')->withList($list)->with('urlClass', $this->request->params('class')));
     if ($this->request->params('class') !== NULL) {
         $class = $classList[$this->request->params('class')]['namespace'] . '\\' . $classList[$this->request->params('class')]['class'];
         $reflector = new \ReflectionClass($class);
         $template->with('page', view('Stativo/Guide/class')->withReflect($reflector));
     } else {
         $template->with('page', view('Stativo/Guide/dashboard'));
     }
     $this->response->body($template->render());
 }
Beispiel #3
0
 /**
  * Language class constructor
  *
  * @uses Stativo\Core\Core
  * @param string $locale locale like en_US
  */
 public function __construct($locale = NULL)
 {
     self::$_config = Core::config('app')->get('language');
     if ($locale !== NULL) {
         self::$_config['default'] = $locale;
     }
     $language_code = strtolower(self::$_config['default']);
     self::$_config['path'] = APPPATH . 'Language' . DIRECTORY_SEPARATOR . $language_code . DIRECTORY_SEPARATOR;
     self::$_language_code = $language_code;
     $filesList = File::lists('Language' . DIRECTORY_SEPARATOR . self::$_language_code);
     self::$_language_array = array();
     foreach ($filesList as $namespace => $files) {
         foreach ($files as $file) {
             self::$_language_array[] = (require self::$_config['path'] . $file . '.php');
         }
     }
     foreach (self::$_language_array as $inner) {
         foreach ($inner as $key => $value) {
             self::$_language[$key] = $value;
         }
     }
     return $this;
 }
Beispiel #4
0
 public function run()
 {
     $call = explode(':', $this->arg->get('call'));
     $task = ucfirst($call[0]);
     if (isset($call[1])) {
         $method = $call[1];
     } else {
         $method = 'run';
     }
     $tasks = array();
     foreach (\Stativo\Helpers\File::lists('Task') as $namespace => $files) {
         foreach ($files as $file) {
             $task = $namespace . '\\Task\\' . $file;
             $tasks[] = new $task();
         }
     }
     $app = new Application('Stativo CLI', '1.0');
     $app->addCommands($tasks);
     $app->run();
     // $call   = \Stativo\Helpers\File::find($task, 'Task');
     // $call = new $call();
     // $call->$method();
 }