/**
  * Helper function to initialize the ORM and load the data model
  * from the given file
  * @param $oConfig object The configuration (volatile, not necessarily already on disk)
  * @param $bModelOnly boolean Whether or not to allow loading a data model with no corresponding DB 
  * @return none
  */
 public function InitDataModel($oConfig, $bModelOnly = true, $bUseCache = false)
 {
     require_once APPROOT . '/core/log.class.inc.php';
     require_once APPROOT . '/core/kpi.class.inc.php';
     require_once APPROOT . '/core/coreexception.class.inc.php';
     require_once APPROOT . '/core/dict.class.inc.php';
     require_once APPROOT . '/core/attributedef.class.inc.php';
     require_once APPROOT . '/core/filterdef.class.inc.php';
     require_once APPROOT . '/core/stimulus.class.inc.php';
     require_once APPROOT . '/core/MyHelpers.class.inc.php';
     require_once APPROOT . '/core/expression.class.inc.php';
     require_once APPROOT . '/core/cmdbsource.class.inc.php';
     require_once APPROOT . '/core/sqlquery.class.inc.php';
     require_once APPROOT . '/core/dbobject.class.php';
     require_once APPROOT . '/core/dbobjectsearch.class.php';
     require_once APPROOT . '/core/dbobjectset.class.php';
     require_once APPROOT . '/application/cmdbabstract.class.inc.php';
     require_once APPROOT . '/core/userrights.class.inc.php';
     require_once APPROOT . '/setup/moduleinstallation.class.inc.php';
     $sConfigFile = $oConfig->GetLoadedFile();
     if (strlen($sConfigFile) > 0) {
         $this->log_info("MetaModel::Startup from {$sConfigFile} (ModelOnly = {$bModelOnly})");
     } else {
         $this->log_info("MetaModel::Startup (ModelOnly = {$bModelOnly})");
     }
     if (!$bUseCache) {
         // Reset the cache for the first use !
         MetaModel::ResetCache(md5(APPROOT) . '-' . $this->sTargetEnv);
     }
     MetaModel::Startup($oConfig, $bModelOnly, $bUseCache);
 }
示例#2
0
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU Affero General Public License for more details.
//
//   You should have received a copy of the GNU Affero General Public License
//   along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
 * File to include to initialize the datamodel in memory
 *
 * @copyright   Copyright (C) 2010-2012 Combodo SARL
 * @license     http://opensource.org/licenses/AGPL-3.0
 */
require_once APPROOT . '/core/cmdbobject.class.inc.php';
require_once APPROOT . '/application/utils.inc.php';
session_name('itop-' . md5(APPROOT));
session_start();
if (isset($_REQUEST['switch_env'])) {
    $sEnv = $_REQUEST['switch_env'];
    $_SESSION['itop_env'] = $sEnv;
    // TODO: reset the credentials as well ??
} else {
    if (isset($_SESSION['itop_env'])) {
        $sEnv = $_SESSION['itop_env'];
    } else {
        $sEnv = ITOP_DEFAULT_ENV;
        $_SESSION['itop_env'] = ITOP_DEFAULT_ENV;
    }
}
$sConfigFile = APPCONF . $sEnv . '/' . ITOP_CONFIG_FILE;
MetaModel::Startup($sConfigFile);
示例#3
0
function InitDataModel($sConfigFileName, $bModelOnly = true)
{
    require_once APPROOT . '/core/log.class.inc.php';
    require_once APPROOT . '/core/kpi.class.inc.php';
    require_once APPROOT . '/core/coreexception.class.inc.php';
    require_once APPROOT . '/core/dict.class.inc.php';
    require_once APPROOT . '/core/attributedef.class.inc.php';
    require_once APPROOT . '/core/filterdef.class.inc.php';
    require_once APPROOT . '/core/stimulus.class.inc.php';
    require_once APPROOT . '/core/MyHelpers.class.inc.php';
    require_once APPROOT . '/core/expression.class.inc.php';
    require_once APPROOT . '/core/cmdbsource.class.inc.php';
    require_once APPROOT . '/core/sqlquery.class.inc.php';
    require_once APPROOT . '/core/dbobject.class.php';
    if (file_exists(APPROOT . '/core/dbsearch.class.php')) {
        // iTop 2.2.0 or newer
        require_once APPROOT . '/core/dbsearch.class.php';
    } else {
        // Pre 2.2
        require_once APPROOT . '/core/dbobjectsearch.class.php';
    }
    require_once APPROOT . '/core/dbobjectset.class.php';
    require_once APPROOT . '/application/cmdbabstract.class.inc.php';
    require_once APPROOT . '/core/userrights.class.inc.php';
    require_once APPROOT . '/setup/moduleinstallation.class.inc.php';
    MetaModel::ResetCache();
    MetaModel::Startup($sConfigFileName, $bModelOnly, false);
}
示例#4
0
 public function DoPrepare()
 {
     parent::DoPrepare();
     MetaModel::Startup('../config-test-itopv06.php');
 }
示例#5
0
 protected function DoPrepare()
 {
     $sConfigFile = APPROOT . $this->GetConfigFile();
     MetaModel::Startup($sConfigFile);
     // #@# Temporary disabled by Romain
     //		MetaModel::CheckDefinitions();
     // something here to create records... but that's another story
 }