当前位置: 首页>>代码示例>>PHP>>正文


PHP utils::GetConfig方法代码示例

本文整理汇总了PHP中utils::GetConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::GetConfig方法的具体用法?PHP utils::GetConfig怎么用?PHP utils::GetConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils的用法示例。


在下文中一共展示了utils::GetConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null)
 {
     // Compute the name of a lock for mysql
     // Note: names are server-wide!!! So let's make the name specific to this iTop instance
     $oConfig = utils::GetConfig();
     // Will return an empty config when called during the setup
     $sDBName = $oConfig->GetDBName();
     $sDBSubname = $oConfig->GetDBSubname();
     $this->sName = 'itop.' . $sName;
     if (substr($sName, -strlen($sDBName . $sDBSubname)) != $sDBName . $sDBSubname) {
         // If the name supplied already ends with the expected suffix
         // don't add it twice, since the setup may try to detect an already
         // running cron job by its mutex, without knowing if the config already exists or not
         $this->sName .= $sDBName . $sDBSubname;
     }
     $this->bLocked = false;
     // Not yet locked
     if (!array_key_exists($this->sName, self::$aAcquiredLocks)) {
         self::$aAcquiredLocks[$this->sName] = 0;
     }
     // It is a MUST to create a dedicated session each time a lock is required, because
     // using GET_LOCK anytime on the same session will RELEASE the current and unique session lock (known issue)
     $sDBHost = is_null($sDBHost) ? $oConfig->GetDBHost() : $sDBHost;
     $sDBUser = is_null($sDBUser) ? $oConfig->GetDBUser() : $sDBUser;
     $sDBPwd = is_null($sDBPwd) ? $oConfig->GetDBPwd() : $sDBPwd;
     $this->InitMySQLSession($sDBHost, $sDBUser, $sDBPwd);
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:27,代码来源:mutex.class.inc.php

示例2: __construct

 public function __construct($sName, $sDBHost = null, $sDBUser = null, $sDBPwd = null)
 {
     // Compute the name of a lock for mysql
     // Note: the name is server-wide!!!
     $this->sName = 'itop.' . $sName;
     $this->bLocked = false;
     // Not yet locked
     if (!array_key_exists($this->sName, self::$aAcquiredLocks)) {
         self::$aAcquiredLocks[$this->sName] = 0;
     }
     // It is a MUST to create a dedicated session each time a lock is required, because
     // using GET_LOCK anytime on the same session will RELEASE the current and unique session lock (known issue)
     $oConfig = utils::GetConfig();
     $sDBHost = is_null($sDBHost) ? $oConfig->GetDBHost() : $sDBHost;
     $sDBUser = is_null($sDBUser) ? $oConfig->GetDBUser() : $sDBUser;
     $sDBPwd = is_null($sDBPwd) ? $oConfig->GetDBPwd() : $sDBPwd;
     $this->InitMySQLSession($sDBHost, $sDBUser, $sDBPwd);
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:18,代码来源:mutex.class.inc.php

示例3: GetValidationPattern

 public function GetValidationPattern()
 {
     return $this->GetOptional('validation_pattern', '^' . utils::GetConfig()->Get('url_validation_pattern') . '$');
 }
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:4,代码来源:attributedef.class.inc.php

示例4: DBRestore

                    $oDBRS = new DBRestore($sDBHost, $sDBUser, $sDBPwd, $sDBName, $sDBSubName);
                    $oDBRS->SetMySQLBinDir($sMySQLBinDir);
                    $sBackupDir = APPROOT . 'data/backups/';
                    $sBackupFile = $sBackupDir . $sFile;
                    $sRes = $oDBRS->RestoreFromZip($sBackupFile, $sEnvironment);
                    IssueLog::Info('Backup Restore - Done, releasing the LOCK');
                    $oRestoreMutex->Unlock();
                } catch (Exception $e) {
                    $oRestoreMutex->Unlock();
                    $oPage->p('Error: ' . $e->getMessage());
                }
            }
            $oPage->output();
            break;
        case 'download':
            require_once APPROOT . '/application/startup.inc.php';
            require_once APPROOT . '/application/loginwebpage.class.inc.php';
            LoginWebPage::DoLogin(true);
            // Check user rights and prompt if needed (must be admin)
            if (utils::GetConfig()->Get('demo_mode')) {
                throw new Exception('iTop is in demonstration mode: the feature is disabled');
            }
            $sFile = utils::ReadParam('file', '', false, 'raw_data');
            $oBackup = new DBBackupScheduled();
            $sBackupDir = APPROOT . 'data/backups/';
            $oBackup->DownloadBackup($sBackupDir . $sFile);
            break;
    }
} catch (Exception $e) {
    IssueLog::Error($e->getMessage());
}
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:31,代码来源:ajax.backup.php

示例5: array

    $aDisplayProcesses = array();
    foreach ($aProcesses as $oExecInstance) {
        $aDisplayProcesses[] = get_class($oExecInstance);
    }
    $sDisplayProcesses = implode(', ', $aDisplayProcesses);
    $oP->p("Background processes: " . $sDisplayProcesses);
}
if (utils::ReadParam('status_only', false, true)) {
    // Display status and exit
    DisplayStatus($oP);
    exit(0);
}
require_once APPROOT . 'core/mutex.class.inc.php';
$oP->p("Starting: " . time() . ' (' . date('Y-m-d H:i:s') . ')');
try {
    $oConfig = utils::GetConfig();
    $oMutex = new iTopMutex('cron.' . $oConfig->GetDBName() . '_' . $oConfig->GetDBSubname());
    if ($oMutex->TryLock()) {
        // Note: testing this now in case some of the background processes forces the read-only mode for a while
        //       in that case it is better to exit with the check on reentrance (mutex)
        if (!MetaModel::DBHasAccess(ACCESS_ADMIN_WRITE)) {
            $oP->p("A database maintenance is ongoing (read-only mode even for admins).");
            $oP->Output();
            exit - 1;
        }
        CronExec($oP, $aProcesses, $bVerbose);
        $oMutex->Unlock();
    } else {
        // Exit silently
        $oP->p("Already running...");
    }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:31,代码来源:cron.php


注:本文中的utils::GetConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。