Jump to:

4952 Posts in 14246 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » lokal (win) -> remote (linux), problems

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2442 Views
  • steffik
    Avatar
    Community Member
    15 Posts

    Re: lokal (win) -> remote (linux), problems Link to this post

    wiping the database doesn't really sound like a good solution to me - and i think my client won't like the idea as well.

    So i started writing that php script. I have very limited php skills, but this is what i have for now:

    At the moment the str_replace(...) Function doesn't always lead to the correct result, but i'm not sure where that comes from...

    <?php
    $dbFileName = "dumpTest.sql";
    $csvFileName = "TableNames.csv";

    repairFile($dbFileName, $csvFileName);

    function repairFile($dbFileName, $csvFileName) {
       $sqlFileHandle = fopen($dbFileName, "r");
       $contents = fread($sqlFileHandle, filesize($dbFileName));
       $csvFileHandle = fopen ($csvFileName,"r"); // Datei zum Lesen öffnen
       while ( ($data = fgetcsv ($csvFileHandle, 1000, ";")) !== FALSE ) {
          print $data[0].' -> '.$data[1].'<br>';
          $contents = str_replace($data[0], $data[1], $contents, $count);
          print $count.'<br>';
       }

       $sqlResultFileHandle = fopen($dbFileName, "w");
       
    if (!fwrite($sqlResultFileHandle, $contents)) {
    print "Can't write File $dbFileName";
    exit;
    }
       fclose($csvFileHandle);
       fclose($sqlFileHandle);
       fclose($sqlResultFileHandle);
    }
       unset($contents, $sqlFileHandle, $csvFileHandle);
       unset($GLOBALS['contents'], $GLOBALS['sqlFileHandle'], $GLOBALS['csvFileHandle']);

    ?>

    2442 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.