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


PHP Constants::writeConfigFile方法代码示例

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


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

示例1: createConstantsFile

/**
 * Creates constants.php that contains variable
 * definitions that the codev admin may want to tune.
 *
 * WARN: depending on your HTTP server installation, the file may be created
 * by user 'apache', so be sure that this user has write access
 * to the CoDev install directory
 *
 * @return NULL if OK, or an error message starting with 'ERROR' .
 */
function createConstantsFile($mantisPath, $mantisURL, $codevURL)
{
    // --- general ---
    Constants::$homepage_title = 'Welcome';
    Constants::$codevURL = $codevURL;
    Constants::$mantisURL = $mantisURL;
    Constants::$mantisPath = $mantisPath;
    Constants::$codevRootDir = dirname(dirname(__FILE__));
    Constants::$codevtt_logfile = Constants::$codevRootDir . '/codevtt.log';
    // --- database ---
    // already set...
    // --- mantis ---
    // already set...
    // --- status ---
    $status_new = array_search('new', Constants::$statusNames);
    $status_feedback = array_search('feedback', Constants::$statusNames);
    #$status_acknowledged = array_search('acknowledged', Constants::$statusNames);
    $status_open = array_search('open', Constants::$statusNames);
    $status_closed = array_search('closed', Constants::$statusNames);
    Constants::$status_new = $status_new;
    Constants::$status_feedback = $status_feedback;
    Constants::$status_open = NULL != $status_open ? $status_open : 50;
    // (50 = 'assigned' in default mantis workflow)
    Constants::$status_closed = $status_closed;
    // --- resolution ---
    Constants::$resolution_fixed = array_search('fixed', Constants::$resolution_names);
    Constants::$resolution_reopened = array_search('reopened', Constants::$resolution_names);
    // --- relationships ---
    define('BUG_CUSTOM_RELATIONSHIP_CONSTRAINED_BY', 2500);
    define('BUG_CUSTOM_RELATIONSHIP_CONSTRAINS', 2501);
    Constants::$relationship_constrained_by = 2500;
    Constants::$relationship_constrains = 2501;
    $retCode = Constants::writeConfigFile();
    if (!$retCode) {
        // TODO throw exception...
        return "ERROR: Could not create file " . Constants::$config_file;
    }
    return NULL;
}
开发者ID:dfuzeau,项目名称:codev,代码行数:49,代码来源:install_step2.php

示例2: createConfigFile

/**
 * writes an INCOMPLETE config.ini file (containing only DB access variables)
 *
 * WARN: depending on your HTTP server installation, the file may be created
 * by user 'apache', so be sure that this user has write access
 * to the CoDev install directory
 *
 * @return NULL if Success, ErrorString if Failed
 */
function createConfigFile($db_mantis_host = 'localhost', $db_mantis_user = 'mantis', $db_mantis_pass = '', $db_mantis_database = 'bugtracker', $proxy_host = NULL, $proxy_port = NULL)
{
    Constants::$db_mantis_host = $db_mantis_host;
    Constants::$db_mantis_user = $db_mantis_user;
    Constants::$db_mantis_pass = $db_mantis_pass;
    Constants::$db_mantis_database = $db_mantis_database;
    if (!is_null($proxy_host) && !is_null($proxy_port)) {
        Constants::$proxy = $proxy_host . ':' . $proxy_port;
    }
    // this writes an INCOMPLETE config.ini file (containing only DB access variables)
    $retCode = Constants::writeConfigFile();
    if (!$retCode) {
        throw new Exception("ERROR: Could not create file " . Constants::$config_file);
    }
}
开发者ID:dfuzeau,项目名称:codev,代码行数:24,代码来源:install_step1.php

示例3: createCustomFields

 createCustomFields($isCreateExtIdField);
 echo "DEBUG 6/16 create ExternalTasks Project<br/>";
 $extproj_id = createExternalTasksProject(T_("CodevTT_ExternalTasks"), T_("CodevTT ExternalTasks Project"));
 $adminLeader = UserCache::getInstance()->getUser($adminTeamLeaderId);
 echo "DEBUG 7/16 createAdminTeam  with leader:  " . $adminLeader->getName() . "<br/>";
 createAdminTeam($adminTeamName, $adminTeamLeaderId);
 echo "DEBUG 8/16 update status list<br/>";
 Constants::$status_new = $status_new;
 Constants::$status_feedback = $status_feedback;
 Constants::$status_open = $status_open;
 Constants::$status_closed = $status_closed;
 // Set path for .CSV reports (Excel)
 echo "DEBUG 9/16 add CodevTT output directory<br/>";
 Constants::$codevOutputDir = $codevOutputDir;
 Constants::$codevtt_logfile = $codevOutputDir . '/logs/codevtt.log';
 $retCode = Constants::writeConfigFile();
 if (FALSE == $retCode) {
     echo "<span class='error_font'>ERROR: could not update config file: " . Constants::$config_file . "</span><br/>";
     $installStepFailed = TRUE;
     exit;
 }
 echo "DEBUG 10/16 create Logger configuration file<br/>";
 $errStr = createLog4phpFile();
 if (NULL != $errStr) {
     echo "<span class='error_font'>" . $errStr . "</span><br/>";
     $installStepFailed = TRUE;
     exit;
 }
 echo "DEBUG 11/16 create output directories (logs, reports, cache)<br/>";
 $errStr = Tools::checkOutputDirectories();
 if (NULL !== $errStr) {
开发者ID:fg-ok,项目名称:codev,代码行数:31,代码来源:install_step3.php

示例4: update_config_file

/**
 * Some new variables may have been added, this rewrites the config.ini
 * file with new default values.
 *
 */
function update_config_file()
{
    // check if config.ini is writable
    if (!is_writable(Constants::$config_file)) {
        echo "<span class='warn_font'>File not writable : " . Constants::$config_file . '</span><br/>';
        return false;
    }
    // backup config.ini to config.ini.old_YYYYMMDDHHmmss
    if (is_writable(Constants::$codevRootDir)) {
        if (FALSE == copy(Constants::$config_file, Constants::$config_file . '.old_' . date('YmdHis'))) {
            echo "<span class='warn_font'>Could not backup config.ini file</span><br/>";
        }
    } else {
        echo "<span class='warn_font'>Could not backup config.ini file (directory not writable)</span><br/>";
    }
    // write new config.ini file
    return Constants::writeConfigFile();
}
开发者ID:siebrand,项目名称:codev,代码行数:23,代码来源:update_codevtt.php


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