Пример #1
0
 public function action_upgrade()
 {
     $mig = \Migrate::latest();
     $version = \Model_Version::find('last', array('order_by' => array('meta_update_time' => 'desc')));
     Config::load('install', true);
     Config::set('install.version', $version['value']);
     Config::save('install', 'install');
     echo json_encode(array('status' => true, 'ver' => $version['value'], 'dat' => Date('d/m/Y', $version['meta_update_time'])));
 }
Пример #2
0
 public function action_index()
 {
     Config::load('install', true);
     $this->version = Config::get('install.version');
     $this->install_mode = 'Offline';
     if ($this->version <= 0) {
         $req = $this->requirements(false);
         if (!$req['next']) {
             return $this->step_0();
         }
         $step = \Input::get('step');
         if (!in_array($step, array(0, 1, 2, 3, 4))) {
             \Response::redirect(\Config::get('base_url') . '/installo?step=1');
         }
         switch ($step) {
             case 0:
                 return $this->step_0();
                 break;
             case 1:
                 return $this->step_1();
                 break;
             case 2:
                 return $this->step_2();
                 break;
             case 3:
                 return $this->step_3();
                 break;
             case 4:
                 return $this->step_4();
                 break;
         }
     } else {
         // If installed, just output "Already installed"
         $data['version'] = Model_Version::find('last', array('order_by' => 'meta_update_time'));
         $data['instaled'] = true;
         return View::forge('install/version', $data);
     }
 }
Пример #3
0
 public function action_index($id = null)
 {
     $this->install_mode = 'Online';
     Config::load('install', true);
     $this->version = Config::get('install.version');
     if ($this->version <= 0) {
         $data['instaled'] = false;
         $data['title'] = 'Installation';
         $view = View::forge('install/layout', $data);
         $req = $this->requirements(false);
         $view->requirements = View::forge('install/requirements', $req);
         //set empty
         $view->configdata = '';
         $view->license = '';
         //$req['next']=true;
         if ($req['next']) {
             //all requirements passed ok
             $config = $this->configdata();
             if ($config['next']) {
                 //install data passed, make install and goto license
                 if ($this->check_license($config)) {
                     return $this->_install($config);
                 } else {
                     $config['next'] = false;
                     $config['errors'] = array('Wrong license key!');
                 }
             }
             $view->configdata = View::forge('install/configdata', $config);
         }
         return $view;
     } else {
         $this->migrate_modules();
         $data['version'] = Model_Version::find('last', array('order_by' => 'meta_update_time'));
         $data['instaled'] = true;
         return View::forge('install/version', $data);
     }
 }
Пример #4
0
 public function check_remote()
 {
     $updatepath = self::NOCLAYER_UPDATE_PATH . $this->_lic->getFromLicenceNocVersion() . '/' . $this->_lic->getChannel();
     $data = @file_get_contents($updatepath);
     if ($data) {
         $arr = json_decode($data);
         $version = Model_Version::find('last', array('order_by' => array('meta_update_time' => 'desc')));
         //update time
         $version->lastcheck = time();
         //update newer version
         if ($version->mode != $arr->version) {
             $version->mode = $arr->version;
         }
         $version->save();
         $this->_master_version = $version;
         $this->_available_version = $version->mode;
     }
 }
Пример #5
0
 protected function _install($data)
 {
     $this->_makeConfig($data);
     //load config data and connect to database
     $l = Config::load('install', true);
     $lastestVersion = Config::get('install.version');
     $l = Config::load(Fuel::$env . '/db', null, true, true);
     Migrate::latest('default', 'app');
     $this->_installDefaultUserInDb($data);
     $this->migrate_modules();
     $this->__erase_old_migration();
     $db_master = Model_Version::find()->limit(1)->order_by('id', 'desc')->get_one();
     //set master on last
     $db_master->value = $lastestVersion;
     //set mode on last
     $db_master->mode = $lastestVersion;
     $db_master->save();
     $data['instaled'] = true;
     $data['version'] = $db_master;
     return View::forge('install/version', $data);
 }