Browse Source

738 Setup not working if access_mode=2 and a synchro data source has a new attribute to create

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4594 a333f486-631f-4898-b8df-5754b55c2be0
romainq 8 years ago
parent
commit
5f6f7c77eb
1 changed files with 10 additions and 2 deletions
  1. 10 2
      setup/runtimeenv.class.inc.php

+ 10 - 2
setup/runtimeenv.class.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2016 Combodo SARL
+// Copyright (C) 2010-2017 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -20,7 +20,7 @@
 /**
  * Manage a runtime environment
  *
- * @copyright   Copyright (C) 2010-2016 Combodo SARL
+ * @copyright   Copyright (C) 2010-2017 Combodo SARL
  * @license     http://opensource.org/licenses/AGPL-3.0
  */
 
@@ -505,6 +505,11 @@ class RunTimeEnvironment
 		{
 			if (MetaModel::DBExists(/* bMustBeComplete */ false))
 			{
+				// Have it work fine even if the DB has been set in read-only mode for the users
+				// (fix copied from RunTimeEnvironment::RecordInstallation)
+				$iPrevAccessMode = $oConfig->Get('access_mode');
+				$oConfig->Set('access_mode', ACCESS_FULL);
+
 				MetaModel::DBCreate(array($this, 'LogQueryCallback'));
 				$this->log_ok("Database structure successfully updated.");
 	
@@ -525,6 +530,9 @@ class RunTimeEnvironment
 				MetaModel::RebuildMetaEnums(true /*bVerbose*/);
 				$sFeedback = ob_get_clean();
 				$this->log_ok("Meta enums rebuilt: $sFeedback");
+
+				// Restore the previous access mode
+				$oConfig->Set('access_mode', $iPrevAccessMode);
 			}
 			else
 			{