Navigation Menu

Skip to content

Commit

Permalink
Dev: new controller for database update, accessible without being log…
Browse files Browse the repository at this point in the history
…ged.
  • Loading branch information
LouisGac committed Oct 16, 2015
1 parent 57361d9 commit c518471
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/controllers/AdminController.php
Expand Up @@ -132,10 +132,10 @@ public function run($action)
{
$sDBVersion = getGlobalSetting('DBVersion');
if ((int) $sDBVersion < Yii::app()->getConfig('dbversionnumber') && $action != 'update' && $action != 'authentication')
$this->redirect(array('/admin/update/sa/db'));
$this->redirect(array('/admin/databaseupdate/sa/db'));
}

if ($action != "db")
if ($action != "databaseupdate" && $action != "db")
if (empty($this->user_id) && $action != "authentication" && $action != "remotecontrol")
{
if (!empty($action) && $action != 'index')
Expand Down Expand Up @@ -185,6 +185,7 @@ public function getActionClasses()
'checkintegrity' => 'checkintegrity',
'conditions' => 'conditionsaction',
'database' => 'database',
'databaseupdate' => 'databaseupdate',
'dataentry' => 'dataentry',
'dumpdb' => 'dumpdb',
'emailtemplates' => 'emailtemplates',
Expand Down
50 changes: 50 additions & 0 deletions application/controllers/admin/databaseupdate.php
@@ -0,0 +1,50 @@
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
* LimeSurvey
* Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
*
*
*/

/**
* Update Database Controller
*
* @package LimeSurvey
* @subpackage Backend
*
* This controller must be accessible by unlogged user (in case of modifications of {{permissions}} blocking the login )
*
*/
class databaseupdate extends Survey_Common_Action
{
/**
* Update database
*/
public function db($continue = null)
{
Yii::app()->loadHelper("update/update");
if(isset($continue) && $continue=="yes")
{
$aViewUrls['output'] = CheckForDBUpgrades($continue);
$aData['display']['header'] = false;
}
else
{
$aData['display']['header'] = true;
$aViewUrls['output'] = CheckForDBUpgrades();
}

$aData['updatedbaction'] = true;

$this->_renderWrappedTemplate('update', $aViewUrls, $aData);
}
}

0 comments on commit c518471

Please sign in to comment.