Skip to content

Commit

Permalink
include db update login bypass setting in settings.php
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed May 3, 2018
1 parent 9b6026a commit 559c9d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Modules/admin/admin_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,24 @@ function admin_controller()
// Allow for special admin session if updatelogin property is set to true in settings.php
// Its important to use this with care and set updatelogin to false or remove from settings
// after the update is complete.
if ($updatelogin || $session['admin']) {
if ($updatelogin===true) {
$route->format = 'html';
if ($route->action == 'db')
{
$applychanges = false;
if (isset($_GET['apply']) && $_GET['apply']==true) $applychanges = true;

require_once "Lib/dbschemasetup.php";
$updates = array(array(
'title'=>"Database schema", 'description'=>"",
'operations'=>db_schema_setup($mysqli,load_db_schema(),$applychanges)
));

return array('content'=>view("Modules/admin/update_view.php", array('applychanges'=>$applychanges, 'updates'=>$updates)));
}
}

if ($session['admin']) {

if ($route->format == 'html') {
if ($route->action == 'view') $result = view("Modules/admin/admin_main_view.php", array());
Expand Down
4 changes: 4 additions & 0 deletions default.emonpi.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,7 @@

// Dont change - developer updates this when the config format changes
$config_file_version = "10";

// Set to true to run database update without logging in
// URL Example: http://localhost/emoncms/admin/db
$updatelogin = false;
4 changes: 4 additions & 0 deletions default.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,7 @@

// Dont change - developer updates this when the config format changes
$config_file_version = "10";

// Set to true to run database update without logging in
// URL Example: http://localhost/emoncms/admin/db
$updatelogin = false;

0 comments on commit 559c9d6

Please sign in to comment.