public function do_update()
 {
     $updateVersion = $this->post('updateVersion');
     if (!$updateVersion) {
         $this->error->add(t('Invalid version'));
     } else {
         $upd = ApplicationUpdate::getByVersionNumber($updateVersion);
     }
     if (!is_object($upd)) {
         $this->error->add(t('Invalid version'));
     } else {
         if (version_compare($upd->getUpdateVersion(), APP_VERSION, '<=')) {
             $this->error->add(t('You may only apply updates with a greater version number than the version you are currently running.'));
         }
     }
     if (!$this->error->has()) {
         $resp = $upd->apply();
         if ($resp !== true) {
             switch ($resp) {
                 case ApplicationUpdate::E_UPDATE_WRITE_CONFIG:
                     $this->error->add(t('Unable to write to config/site.php. You must make config/site.php writable in order to upgrade in this manner.'));
                     break;
             }
         } else {
             header('Location: ' . BASE_URL . REL_DIR_FILES_TOOLS_REQUIRED . '/upgrade?source=dashboard_update');
             exit;
         }
     }
     $this->view();
 }