예제 #1
0
function run_propel_build_schema($task, $args)
{
    _call_phing($task, 'creole', false);
    // fix database name
    if (file_exists('config/schema.xml')) {
        $schema = file_get_contents('config/schema.xml');
        $schema = preg_replace('/<database\\s+name="[^"]+"/s', '<database name="propel"', $schema);
        file_put_contents('config/schema.xml', $schema);
    }
    if (!isset($args[0]) || $args[0] != 'xml') {
        _propel_convert_xml_schema(false, '');
        $finder = pakeFinder::type('file')->name('schema.xml');
        pake_remove($finder, 'config');
    }
}
예제 #2
0
function run_propel_build_schema($task, $args)
{
    $propelIniFile = 'propel.ini';
    if (isset($args[0])) {
        $propelIniFile = $args[0] . '.ini';
        if (!file_exists('config' . PATH_SEP . $propelIniFile)) {
            $path = explode('/', $args[0]);
            if (count($path) > 2) {
                throw new Exception('the propel.ini must be in your config directory.');
            }
            if (count($path) == 1) {
                $path[1] = 'propel';
            }
            $propelIniFile = 'plugins' . PATH_SEP . $path[0] . PATH_SEP . 'config' . PATH_SEP . $path[1] . '.ini';
            pake_echo_action('propel.ini', "using the file : {$propelIniFile} ");
            _call_phing($task, 'creole', false, $path[1] . '.ini', PATH_PLUGINS . $path[0] . PATH_SEP);
            // fix database name
            if (file_exists(PATH_PLUGINS . $path[0] . PATH_SEP . 'config/schema.xml')) {
                $schema = file_get_contents(PATH_PLUGINS . $path[0] . PATH_SEP . 'config/schema.xml');
                $schema = preg_replace('/<database\\s+name="[^"]+"/s', '<database name="propel"', $schema);
                file_put_contents(PATH_PLUGINS . $path[0] . PATH_SEP . 'config/schema.xml', $schema);
            }
            return;
        }
    }
    pake_echo_action('propel.ini', "using the file : {$propelIniFile} ");
    _call_phing($task, 'creole', false, $propelIniFile);
    // fix database name
    if (file_exists('config/schema.xml')) {
        $schema = file_get_contents('config/schema.xml');
        $schema = preg_replace('/<database\\s+name="[^"]+"/s', '<database name="propel"', $schema);
        file_put_contents('config/schema.xml', $schema);
    }
}