summaryrefslogtreecommitdiff
path: root/bin/dumpschema.sh
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2012-04-13 12:25:46 +0000
committerthomascube <thomas@roundcube.net>2012-04-13 12:25:46 +0000
commit9456eacbec25fac99d0b13f574aa45575a44b27b (patch)
treec7e595510be50e781c94a1195c898a2cde95078e /bin/dumpschema.sh
parentd5520d1f47cd66387eccd1b9c5c4751cb9a8ba9a (diff)
cleanup release branch; update versions
Diffstat (limited to 'bin/dumpschema.sh')
-rwxr-xr-xbin/dumpschema.sh101
1 files changed, 0 insertions, 101 deletions
diff --git a/bin/dumpschema.sh b/bin/dumpschema.sh
deleted file mode 100755
index e44b292a8..000000000
--- a/bin/dumpschema.sh
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env php
-<?php
-/*
-
- +-----------------------------------------------------------------------+
- | bin/dumpschema.sh |
- | |
- | This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
- | |
- | Licensed under the GNU General Public License version 3 or |
- | any later version with exceptions for skins & plugins. |
- | See the README file for a full license statement. |
- | |
- | PURPOSE: |
- | Dumps database schema in XML format using MDB2_Schema |
- | |
- +-----------------------------------------------------------------------+
- | Author: Thomas Bruederli <roundcube@gmail.com> |
- +-----------------------------------------------------------------------+
-
- $Id$
-
-*/
-
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
-
-require INSTALL_PATH.'program/include/clisetup.php';
-
-/** callback function for schema dump **/
-function print_schema($dump)
-{
- foreach ((array)$dump as $part)
- echo $dump . "\n";
-}
-
-$config = new rcube_config();
-
-// don't allow public access if not in devel_mode
-if (!$config->get('devel_mode') && $_SERVER['REMOTE_ADDR']) {
- header("HTTP/1.0 401 Access denied");
- die("Access denied!");
-}
-
-$options = array(
- 'use_transactions' => false,
- 'log_line_break' => "\n",
- 'idxname_format' => '%s',
- 'debug' => false,
- 'quote_identifier' => true,
- 'force_defaults' => false,
- 'portability' => false,
-);
-
-$dsnw = $config->get('db_dsnw');
-$dsn_array = MDB2::parseDSN($dsnw);
-
-// set options for postgres databases
-if ($dsn_array['phptype'] == 'pgsql') {
- $options['disable_smart_seqname'] = true;
- $options['seqname_format'] = '%s';
-}
-
-$schema =& MDB2_Schema::factory($dsnw, $options);
-$schema->db->supported['transactions'] = false;
-
-
-// send as text/xml when opened in browser
-if ($_SERVER['REMOTE_ADDR'])
- header('Content-Type: text/xml');
-
-
-if (PEAR::isError($schema)) {
- $error = $schema->getMessage() . ' ' . $schema->getUserInfo();
-}
-else {
- $dump_config = array(
- // 'output_mode' => 'file',
- 'output' => 'print_schema',
- );
-
- $definition = $schema->getDefinitionFromDatabase();
- $definition['charset'] = 'utf8';
-
- if (PEAR::isError($definition)) {
- $error = $definition->getMessage() . ' ' . $definition->getUserInfo();
- }
- else {
- $operation = $schema->dumpDatabase($definition, $dump_config, MDB2_SCHEMA_DUMP_STRUCTURE);
- if (PEAR::isError($operation)) {
- $error = $operation->getMessage() . ' ' . $operation->getUserInfo();
- }
- }
-}
-
-$schema->disconnect();
-
-if ($error && !$_SERVER['REMOTE_ADDR'])
- fputs(STDERR, $error);
-
-?>