Exemplo n.º 1
0
 public function runUpgrade(TBGRequest $request)
 {
     $version_info = explode(',', file_get_contents(THEBUGGENIE_PATH . 'installed'));
     $this->current_version = $version_info[0];
     $this->upgrade_available = $this->current_version != '3.1';
     if ($this->upgrade_available) {
         $scope = new TBGScope();
         $scope->setID(1);
         $scope->setEnabled();
         TBGContext::setScope($scope);
     }
     $this->upgrade_complete = false;
     if ($this->upgrade_available && $request->isMethod(TBGRequest::POST)) {
         $this->upgrade_complete = false;
         switch ($this->current_version) {
             case '3.0':
                 $this->_upgradeFrom3dot0();
                 break;
         }
         if ($this->upgrade_complete) {
             $existing_installed_content = file_get_contents(THEBUGGENIE_PATH . 'installed');
             file_put_contents(THEBUGGENIE_PATH . 'installed', TBGSettings::getVersion(false, false) . ', upgraded ' . date('d.m.Y H:i') . "\n" . $existing_installed_content);
             unlink(THEBUGGENIE_PATH . 'upgrade');
             $this->current_version = '3.1';
             $this->upgrade_available = false;
         }
     } elseif ($this->current_version != '3.1') {
         $this->permissions_ok = false;
         if (is_writable(THEBUGGENIE_PATH . 'installed') && is_writable(THEBUGGENIE_PATH . 'upgrade')) {
             $this->permissions_ok = true;
         }
     } else {
         $this->forward(TBGContext::getRouting()->generate('home'));
     }
 }
Exemplo n.º 2
0
 public function runUpgrade(TBGRequest $request)
 {
     $version_info = explode(',', file_get_contents(THEBUGGENIE_PATH . 'installed'));
     $this->current_version = $version_info[0];
     $this->upgrade_available = $this->current_version != '3.3';
     if ($this->upgrade_available) {
         $scope = new TBGScope();
         $scope->setID(1);
         $scope->setEnabled();
         TBGContext::setScope($scope);
         TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.2');
         $this->statuses = TBGListTypesTable::getTable()->getStatusListForUpgrade();
         $this->adminusername = TBGUsersTable3dot2::getTable()->getAdminUsername();
     }
     $this->upgrade_complete = false;
     if ($this->upgrade_available && $request->isPost()) {
         $this->upgrade_complete = false;
         switch ($this->current_version) {
             case '3.0':
                 $this->_upgradeFrom3dot0();
             case '3.1':
                 $this->_upgradeFrom3dot1();
             case '3.2':
                 $this->_upgradeFrom3dot2($request);
         }
         if ($this->upgrade_complete) {
             $existing_installed_content = file_get_contents(THEBUGGENIE_PATH . 'installed');
             file_put_contents(THEBUGGENIE_PATH . 'installed', TBGSettings::getVersion(false, false) . ', upgraded ' . date('d.m.Y H:i') . "\n" . $existing_installed_content);
             $prev_error_reportiong_level = error_reporting(0);
             unlink(THEBUGGENIE_PATH . 'upgrade');
             error_reporting($prev_error_reportiong_level);
             if (file_exists(THEBUGGENIE_PATH . 'upgrade')) {
                 $this->upgrade_file_failed = true;
             }
             $this->current_version = TBGSettings::getVersion(false, false);
             $this->upgrade_available = false;
         }
     } elseif ($this->upgrade_available) {
         $this->permissions_ok = false;
         if (is_writable(THEBUGGENIE_PATH . 'installed') && is_writable(THEBUGGENIE_PATH . 'upgrade')) {
             $this->permissions_ok = true;
         }
     } elseif ($this->upgrade_complete) {
         $this->forward(TBGContext::getRouting()->generate('home'));
     }
 }