|
posde
|
 |
« on: September 24, 2008, 12:21:52 pm » |
|
Hi, usually, the course of action with LinuxMCE is, to utilize sqlCVS to commit a new device template for anyone to use it. Unfortunately, anonymous commits to sqlCVS have caused myself problems in the past. I had a need to export created device templates, to import those devices into a new LinuxMCE installation. I created a small script called DeviceTemplate2php. This script can be called from a html page, and creates a new php file called device####.php, where #### is replaced with the original device template ID. The small script is located at http://possy.de/DeviceTemplate2php.tar.gz and should be stored on the LinuxMCE core in /var/www/ under the name DeviceTemplate2php.php. Now you can execute the file from your browser by using the url http://dcerouter/DeviceTemplate2php.php?DeviceTemplateID=1933in case you want to export your device template 1933. Please try it out, and let me know any problems you might experience. rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
|
Itsik
|
 |
« Reply #1 on: September 24, 2008, 05:53:17 pm » |
|
Thats great !  I'll try it asap ... One question, how do you import the template into another installation ? thnx Itsik
|
|
|
|
|
Logged
|
|
|
|
|
posde
|
 |
« Reply #2 on: September 24, 2008, 08:05:12 pm » |
|
Hello Itsik,
you execute the generated file on the command line. It is a PHP script that does the relevant SQL INSERT commands
rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
bulek
Administrator
wants to work for LinuxMCE
    
Posts: 868
Living with LMCE
|
 |
« Reply #3 on: September 24, 2008, 09:47:42 pm » |
|
Hello Itsik,
you execute the generated file on the command line. It is a PHP script that does the relevant SQL INSERT commands
rgds Oliver
Hi, thanks for effort. It will be really useful... BTW, does this work also if you created new commands or other types of data along with new template that needs them ? Thanks in advance, Bulek.
|
|
|
|
|
Logged
|
Thanks in advance,
regards,
Bulek.
|
|
|
|
posde
|
 |
« Reply #4 on: September 24, 2008, 10:17:56 pm » |
|
Bulek,
try it out, I don't know, but the system tries its best to catch all related stuff (currently except the pnp shell script, as I don't know how to package it). It's a v0.01, so please be gentle, backup your data before, and just check it out.
rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
eran
Newbie

Posts: 10
|
 |
« Reply #5 on: September 28, 2008, 09:08:45 am » |
|
I have tried it:
and I got empty file and error:
Creating file /tmp/device1931dMMD0L
Notice: Undefined offset: 0 in /var/www/DeviceTemplate2php.php on line 128
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/DeviceTemplate2php.php on line 75
Notice: Undefined offset: 0 in /var/www/DeviceTemplate2php.php on line 128
Done creating file!
Now the file /tmp/device1931dMMD0L needs to be executed. Please do that on the command line using
php /tmp/device1931dMMD0L
|
|
|
|
|
Logged
|
|
|
|
|
posde
|
 |
« Reply #6 on: September 28, 2008, 11:02:36 am » |
|
Eran, thanks for testing. I have tried it: and I got empty file and error: Creating file /tmp/device1931dMMD0L Notice: Undefined offset: 0 in /var/www/DeviceTemplate2php.php on line 128 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/DeviceTemplate2php.php on line 75 Notice: Undefined offset: 0 in /var/www/DeviceTemplate2php.php on line 128 Done creating file! Now the file /tmp/device1931dMMD0L needs to be executed. Please do that on the command line using php /tmp/device1931dMMD0L
The file /tmp/device1931dMMD0L is empty? If yes, are you able to make a dump of your mysql database, and put it somewhere I can take a look at it? rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
eran
Newbie

Posts: 10
|
 |
« Reply #7 on: September 28, 2008, 12:44:41 pm » |
|
Well chacked again - the file is not empty - I have to read it with root!
It looks like it has every thing inside and if I try to execute it from command line (of course with root) - ./devi......
line 1: ?php: no such file or directory line 2: syntax error near unexpected token 'E_ALL' line 2: ' error_reporting('E_ALL');'
and no templete was add...
|
|
|
|
|
Logged
|
|
|
|
|
posde
|
 |
« Reply #8 on: October 01, 2008, 08:37:33 pm » |
|
eran, you have to executed with the php interpreter, i.e. php devic..... rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
eran
Newbie

Posts: 10
|
 |
« Reply #9 on: October 06, 2008, 02:09:07 pm » |
|
well I think it is working but there are some error during the creation of the new template fro example: InfraredGroup: 5995 Notice: Undefined variable: line in /tmp/device1931olq20t on line 20
Notice: Undefined variable: index in /tmp/device1931olq20t on line 20
Notice: Undefined variable: waitTime in /tmp/device1931olq20t on line 20
Notice: Undefined variable: line in /tmp/device1931olq20t on line 20
Notice: Undefined variable: waitTime in /tmp/device1931olq20t on line 20
Notice: Undefined variable: line in /tmp/device1931olq20t on line 20
Notice: Undefined variable: line in /tmp/device1931olq20t on line 20
Notice: Undefined variable: line in /tmp/device1931olq20t on line 20
Notice: Undefined variable: line in /tmp/device1931olq20t on line 20
Notice: Undefined variable: line in /tmp/device1931olq20t on line 20 New DeviceTemplate: 1936
and checking template 1936 looks like a good template I did not find where to cahnge the name of the device so I get two template for the same name...
|
|
|
|
|
Logged
|
|
|
|
eran
Newbie

Posts: 10
|
 |
« Reply #10 on: October 07, 2008, 11:09:45 am » |
|
Hi again! I am trying to build a back with the export procedure and for that I am trying to export more templates
now I tried to build the template to the PLC BUS export it - It look like everything there and when trying to import it again i got:
root@dcerouter:~/Desktop# php device1938FV1q1t
Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/linuxmce/Desktop/device1938FV1q1t on line 15
and this is the file that was created: (device1938FV1q1t) I tried to include the code but I got "The message exceeds the maximum allowed length (20000 characters)." so I cant add it here so if you need to see it tell me how to send you the file
I will try other different template and let you know about problems...
Tnx. Eran.
|
|
|
|
|
Logged
|
|
|
|
|
posde
|
 |
« Reply #11 on: October 09, 2008, 09:24:53 pm » |
|
Eran,
could you paste the problematic file to filebin.ca
thanks rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
eran
Newbie

Posts: 10
|
 |
« Reply #12 on: October 10, 2008, 06:05:01 am » |
|
|
|
|
|
|
Logged
|
|
|
|
|
posde
|
 |
« Reply #13 on: October 10, 2008, 09:26:45 pm » |
|
Is that an existing template you are trying to Export, or did you create it new? It is definitly more complex than any of the ones I have played with. Is the device working correct?
A brief look just shows that it might be the length of the insert statement.
I will look into it. But please post any information you have for this as well.
Thanks
rgds Oliver
|
|
|
|
|
Logged
|
|
|
|
eran
Newbie

Posts: 10
|
 |
« Reply #14 on: October 11, 2008, 07:41:49 am » |
|
Oliver just as I wrote to you: this is most of Dan's PLCBUS template. (I left some ruby code out but the big 373 routine is there) by the way when I am trying to take existing one I am getting: <?php error_reporting(E_ALL); $link = mysql_connect("localhost","root"); mysql_select_db("pluto_main",$link); $deviceTemplateID = $newPK; print "New DeviceTemplate: " . $newPK; ?>
this is for template 1779 Eran.
|
|
|
|
|
Logged
|
|
|
|
|