[Mapbender-commits] r2820 - branches/2.5/http/tools
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Aug 15 07:32:27 EDT 2008
Author: christoph
Date: 2008-08-15 07:32:27 -0400 (Fri, 15 Aug 2008)
New Revision: 2820
Removed:
branches/2.5/http/tools/1_createMySqlDump.php
branches/2.5/http/tools/2_convertDataDumps.php
branches/2.5/http/tools/3_addHeaderToDataDumps.php
Log:
removed, belongs into trunk
Deleted: branches/2.5/http/tools/1_createMySqlDump.php
===================================================================
--- branches/2.5/http/tools/1_createMySqlDump.php 2008-08-15 11:26:10 UTC (rev 2819)
+++ branches/2.5/http/tools/1_createMySqlDump.php 2008-08-15 11:32:27 UTC (rev 2820)
@@ -1,61 +0,0 @@
-<?php
- $fileArray = array(
- "mysql" =>
- array( "from" => "../../resources/db/postgresql/utf8/pgsql_data.sql",
- "to" => "../../resources/db/mysql/utf8/mysql_data.sql")
- );
-
- function saveAsFile($filename, $data) {
- if ($h = fopen($filename, "w")) {
- if (!fwrite($h, $data)) {
- return false;
- }
- fclose($h);
- }
- return true;
- }
-
- // load file
- $from = $fileArray["mysql"]["from"];
- $to = $fileArray["mysql"]["to"];
-
- if (file_exists($from)) {
- $data = file_get_contents($from);
- }
- else {
- echo "Fatal error: File not found ('" . $from . "').\n";
- exit(1);
- }
-
- // replace postgresql's string escape syntax
- $pattern = "/, E'/";
- $data = preg_replace($pattern, ", '", $data);
-
- // disable foreign keys
- $pattern = "/UPDATE pg_catalog\.pg_class SET reltriggers = 0;/";
- if (preg_match($pattern, $data)) {
- $data = preg_replace($pattern, "SET FOREIGN_KEY_CHECKS=0;", $data);
- }
- else {
- echo "Fatal error: Didn't find expression (pattern: " . $pattern . ").\n";
- exit(1);
- }
-
- // enable foreign keys
- $pattern = "/UPDATE pg_catalog\.pg_class SET reltriggers = \(SELECT pg_catalog\.count\(\*\) FROM pg_catalog\.pg_trigger where pg_class\.oid = tgrelid\);/";
- if (preg_match($pattern, $data)) {
- $data = preg_replace($pattern, "SET FOREIGN_KEY_CHECKS=1;", $data);
- }
- else {
- echo "Fatal error: Didn't find expression (pattern: " . $pattern . ").\n";
- exit(1);
- }
-
- // save mysql file
- if (!saveAsFile($to, $data)) {
- echo "Fatal error: File could not be saved ('" . $to . "').\n";
- exit(1);
- }
- echo "Finished.\n\n";
- exit(0);
-?>
\ No newline at end of file
Deleted: branches/2.5/http/tools/2_convertDataDumps.php
===================================================================
--- branches/2.5/http/tools/2_convertDataDumps.php 2008-08-15 11:26:10 UTC (rev 2819)
+++ branches/2.5/http/tools/2_convertDataDumps.php 2008-08-15 11:32:27 UTC (rev 2820)
@@ -1,44 +0,0 @@
-<?php
- // needs to be set, otherwise the iconv option //TRANSLIT
- // won't work
- setlocale(LC_CTYPE, "de_DE.utf8");
-
- $fileArray = array(
- "mysql" =>
- array( "from" => "../../resources/db/mysql/utf8/mysql_data.sql",
- "to" => "../../resources/db/mysql/iso/mysql_data.sql"),
- "pgsql" =>
- array( "from" => "../../resources/db/postgresql/utf8/pgsql_data.sql",
- "to" => "../../resources/db/postgresql/iso/pgsql_data.sql")
- );
-
- function saveAsFile($filename, $data) {
- if ($h = fopen($filename, "w")) {
- if (!fwrite($h, $data)) {
- return false;
- }
- fclose($h);
- }
- return true;
- }
-
-
- foreach ($fileArray as $file) {
- $from = $file["from"];
- $to = $file["to"];
-
- if (file_exists($from)) {
- $data = file_get_contents($from);
- }
- else {
- echo "Fatal error: File not found ('" . $from . "').\n";
- }
-
- $dataConverted = iconv("UTF-8", "ASCII//TRANSLIT", $data);
-
- if (!saveAsFile($to, $dataConverted)) {
- echo "Fatal error: File could not be saved ('" . $to . "').\n";
- }
- }
- echo "Finished.\n\n";
-?>
\ No newline at end of file
Deleted: branches/2.5/http/tools/3_addHeaderToDataDumps.php
===================================================================
--- branches/2.5/http/tools/3_addHeaderToDataDumps.php 2008-08-15 11:26:10 UTC (rev 2819)
+++ branches/2.5/http/tools/3_addHeaderToDataDumps.php 2008-08-15 11:32:27 UTC (rev 2820)
@@ -1,53 +0,0 @@
-<?php
- require_once(dirname(__FILE__) . "/../../core/system.php");
- setlocale(LC_TIME, "de_DE.utf8");
-
- $fileArray = array(
- "mysql" =>
- array( "iso" => "../../resources/db/mysql/iso/mysql_data.sql",
- "utf8" => "../../resources/db/mysql/utf8/mysql_data.sql"),
- "postgresql" =>
- array( "iso" => "../../resources/db/postgresql/iso/pgsql_data.sql",
- "utf8" => "../../resources/db/postgresql/utf8/pgsql_data.sql")
- );
-
- function saveAsFile($filename, $data) {
- if ($h = fopen($filename, "w")) {
- if (!fwrite($h, $data)) {
- return false;
- }
- fclose($h);
- }
- return true;
- }
-
- foreach ($fileArray as $dbType => $files) {
- foreach ($files as $characterSet => $file) {
- if (file_exists($file)) {
- $data = file_get_contents($file);
- }
- else {
- echo "Fatal error: File not found ('" . $file . "').\n";
- exit(1);
- }
-
- // add header to file
- $header = "--\n" .
- "-- " . $dbType . " " . $characterSet . " data dump\n" .
- "-- \n" .
- "-- Mapbender " . MB_VERSION_NUMBER . " " . MB_VERSION_APPENDIX . "\n" .
- "-- \n" .
- "-- " . date("Y/m/d", MB_RELEASE_DATE) . "\n" .
- "--\n\n";
- $data = $header . $data;
-
- if (!saveAsFile($file, $data)) {
- echo "Fatal error: File could not be saved ('" . $file . "').\n";
- exit(1);
- }
-
- }
- }
- echo "Finished.\n\n";
- exit(0);
-?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list