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


PHP adoSchema::ParseSchemaString方法代码示例

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


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

示例1: printmsg

                    printmsg("ERROR => There was an error creating DB user: " . $db->ErrorMsg(), 0);
                }
                // add the default domain to the system
                // This is a manual add with hard coded values for timers.
                $xmldefdomain = <<<EOL
<?xml version="1.0"?>
<schema version="0.3">
<sql>
    <query>INSERT INTO domains (id,name,admin_email,default_ttl,refresh,retry,expiry,minimum) VALUES (1,'{$default_domain}','hostmaster', 86400, 86400, 3600, 3600, 3600)</query>
    <query>UPDATE sys_config SET value='{$default_domain}' WHERE name like 'dns_defaultdomain'</query>
</sql>
</schema>
EOL;
                $schema = new adoSchema($db);
                // Build the SQL array from the schema XML file
                $domainsql = $schema->ParseSchemaString($xmldefdomain);
                // Execute the SQL on the database
                if ($schema->ExecuteSchema($domainsql) == 2) {
                    $text .= "<img src=\"{$images}/silk/accept.png\" border=\"0\" /> Created default DNS domain '{$default_domain}'.<br>";
                } else {
                    $status++;
                    $text .= "<img src=\"{$images}/silk/exclamation.png\" border=\"0\" /> Failed to create default DNS domain '{$default_domain}'.<br><span style='font-size: xx-small;'>" . $db->ErrorMsg() . "</span><br>";
                }
                // Open the database config and write the contents to it.
                if (!($fh = @fopen($dbconffile, 'w'))) {
                    $status++;
                    $text .= "<img src=\"{$images}/silk/exclamation.png\" border=\"0\" /> Failed to open config file for writing: '{$dbconffile}'.<br>";
                } else {
                    fwrite($fh, "<?php\n\n\$ona_contexts=" . var_export($ona_contexts, TRUE) . ";\n\n?>");
                    fclose($fh);
                    $text .= "<img src=\"{$images}/silk/accept.png\" border=\"0\" /> Created database connection config file.<br>";
开发者ID:edt82,项目名称:ona,代码行数:31,代码来源:install.php

示例2: execute_upgrade_file

function execute_upgrade_file($folder, $installed_version)
{
    global $db, $page, $conf;
    // At first the config file
    $upgrade_path = BASEDIR . '/upgrade/' . $folder;
    new ConfUpdater(CONFIG_PATH, $upgrade_path);
    $upgrade_info = parse_ini_file($upgrade_path . '/upgrade.info', true);
    // dev version upgrade?
    if ($folder == Flyspray::base_version($installed_version)) {
        $type = 'develupgrade';
    } else {
        $type = 'defaultupgrade';
    }
    // Next a mix of XML schema files and PHP upgrade scripts
    if (!isset($upgrade_info[$type])) {
        die('#1 Bad upgrade.info file.');
    }
    ksort($upgrade_info[$type]);
    foreach ($upgrade_info[$type] as $file) {
        if (substr($file, -4) == '.php') {
            require_once $upgrade_path . '/' . $file;
        }
        if (substr($file, -4) == '.xml') {
            $schema = new adoSchema($db->dblink);
            $xml = file_get_contents($upgrade_path . '/' . $file);
            // $xml = str_replace('<table name="', '<table name="' . $conf['database']['dbprefix'], $xml);
            // Set the prefix for database objects ( before parsing)
            $schema->setPrefix($conf['database']['dbprefix'], false);
            $schema->ParseSchemaString($xml);
            $schema->ExecuteSchema(null, true);
        }
    }
    // Last but not least global prefs update
    if (isset($upgrade_info['fsprefs'])) {
        $sql = $db->Query('SELECT pref_name FROM {prefs}');
        $existing = $db->FetchCol($sql);
        // Add what is missing
        foreach ($upgrade_info['fsprefs'] as $name => $value) {
            if (!in_array($name, $existing)) {
                $db->Query('INSERT INTO {prefs} (pref_name, pref_value) VALUES (?, ?)', array($name, $value));
            }
        }
        // Delete what is too much
        foreach ($existing as $name) {
            if (!isset($upgrade_info['fsprefs'][$name])) {
                $db->Query('DELETE FROM {prefs} WHERE pref_name = ?', array($name));
            }
        }
    }
    $db->Query('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(basename($upgrade_path), 'fs_ver'));
    #$page->assign('done', true);
    return "Write " . basename($upgrade_path) . " into table {prefs} fs_ver in database";
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:53,代码来源:upgrade.php


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