We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5070
    • 36 Posts
    redman :the line below means that it’s calling the method called $resource, and since there’s a switch case for ’createDocument’, it can call the createDocument ok, so that’s not the problem:
    return $this->$resource($headerArray, $params);
    but in the switch case, it do nothing in case of createDocument. You can see:
           // call the correct handler, and pass parameters
           switch ($resource)
           {
           case 'createDocument':
           case 'unpublishDocument':
           case 'createSnippet':
         ..............

    so that when i pasted the code you’d provided, and tried to add some code like below at the beginning of that fuction to check if this function is called:
    echo 'start creating document...';

    the result is that the line hasn’t never been printed out.
    it doesn’t work. undecided
    it would be highly appreciated if you can release a new update.
      • 24719
      • 194 Posts
      because there’s no ’break’ after the case statement, it just carries on executing from that point. so it will end up at the right place.

      // call the correct handler, and pass parameters
             switch ($resource)
             {
             case 'createDocument':      // carry on 
             case 'unpublishDocument':      // carry on 
             case 'createSnippet':      // carry on 
             //case 'deleteSnippet':
             case 'createChunk':      // carry on 
             //case 'deleteChunk':
                                                 // connect to db
                 $this->connectToDB($params['localdb']);
             case 'getDB':                // now call the method called $resource
                 return $this->$resource($headerArray, $params);
                 break;
             default:      // something we aren't expecting, so throw an exception
                 throw new Exception("Invalid method '$resource' requested.");
                 break;
             }
      


      if it’s not getting into that method, that means that modxDBServer isn’t returning createDocument to the client.

      can you start modxDBServer manually, run modxDBClient createDocument... and then paste in the output from modxDBServer in here please. can you also print_r the params and headerArray and echo the value of $resource before the switch statement in the client, and paste that in. i’ll put together a new release when i have time.

      ta
        • 5070
        • 36 Posts
        redman, i didn’t notice that there isn’t any "break" after every case statement.
        I usually run startmodxDBServer.sh twice :
        - 1st time it returns :
        cat: /var/run/modxDBServer.pid: No such file or directory
        kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
        

        - 2nd time it returns: nothing
        I saw modxDBServer name with its id in the process list.
        Below lines are the values of variables which were printed before the switch statement:
        print_r($params);
        ==>Array
        (
            [parent] => 55
            [db] => orchidslingshot
            [localdb] => OrchidSlingshot
            [resource] => createDocument
        )
        
        print_r($headerArray);
        ==>Array
        (
            [STATUS] => SUCCESS
            [REQUEST] => createDocument?parent=55&db=orchidslingshot&localdb=OrchidSlingshot
            [ID] => 385
        )
        
        echo $resource;
        ==>createDocument

        I saw children with ID = 385 had been created under its parent 55 on the Production database but development database. shocked
          • 5070
          • 36 Posts
          Hi there,
          long time no see. do you have any suggestion?
            • 24719
            • 194 Posts
            Hi,

            sorry for the delay...

            i’ve no idea why it isn’t working for you. I’ve repackaged the tar file that you can download from the first page of this thread so it now contains the latest code. It’s possible i’d fixed a bug and hadn’t updated the package.

            if that doesn’t work, the only other thing that looks a little bit suspicious to me is that your production db name is all lowercase, while your local db name is camel-cased. is that definitely correct?

            hope this helps....
              • 5070
              • 36 Posts
              Thanks for your update,
              I were out all last week, i will try with new version and will let you know the result.
                • 15001
                • 697 Posts
                Hi redman and everyone,

                I just downloaded modxDBServer and I’m very excited about this tool. But I did not test it yet.

                Currently, my remote (production) server is more up-to-date than my local (development server).
                This is because making small updates locally and then transfering the whole database was painful.
                However, I would prefer working locally because in such case the speed of the backend is better.

                I read the README file and, from what I understood, with modxDBServer the most up-to-date version is on the server.
                This allows having several client development stations updated with the server content.

                From what I understood, when editing, modxDBClient acts on the remote (production) server and then updates the development server.

                So, changes done directly in the development environment are considered "temporary" tables and do not update the remote production server.

                Now, I have several questions :

                1) Is there a way to edit locally and update the production server with the "temporary" tables ?

                2) What happens if a "temporary" document with id 123 was created on one development server and another document with the same id was created meanwhile on the remote server.
                Does the tool overwrite the local document when updating the development server ?

                3) Does MODx backend loads with the speed of a local installation or is it loaded from the remote (production) server ?

                4) If the backend is loaded from the remote server, is it possible to invert the roles ?
                (i.e. having modxDBServer on the local machine and modxDBClient on the remote machine)
                I know this would only allow lonesome development. (Just for speed.)

                5) What about FTP and files that are not stored in database ?
                I think there is something for FTP transferts coming with this tool.
                In my case, some PHP code is written locally and not stored in database.
                I need local (dev) ----> remote (prod) transfert of such files. Not the contrary.
                Does modxDBServer/Client handle this or should I use a classical FTP client as usual ?
                Is there a risk that modxDBServer overwrite the last version of some file with some old version located on the remote server ?

                6) The README file tells :
                The modxDBServer and modxDBClient applications provide a solution. modxDBServer
                can be set to run on a staging machine to which developers only have limited
                access.
                What is a "staging machine" ?
                A third "pre-release" machine that acts as buffer between the production server and the development server(s) ?

                7) To use the tool, do I need a static IP (or dynamic DNS system) attached to the local development server(s) or is this useless ?

                Many thanks for your help.

                Cheers,
                Julien