Loading...
 
Development

Development


Command Line Tiki Script

posts: 3 United States

I'm trying to write a command line script that converts from SnipSnap to TikiWiki. I've gotten as far as the following:

Copy to clipboard
require_once('tiki-setup.php'); include_once('lib/wiki/wikilib.php'); function get_value($snip, $name) { $temp = $snip->get_elements_by_tagname($name); return $temp[0]->get_content(); } if (!$dom = domxml_open_file("snipsnap.xml")) { echo "Error while parsing the document\n"; exit; } $root = $dom->document_element(); $snips = $root->get_elements_by_tagname("snip"); foreach($snips as $snip) { $name = get_value($snip,"name"); $oUser = get_value($snip,"oUser"); $cUser = get_value($snip,"cUser"); $mUser = get_value($snip,"mUser"); $cTime = get_value($snip,"cTime"); $mTime = get_value($snip,"mTime"); $viewCount = get_value($snip, "viewCount"); $content = get_value($snip, "content"); echo $name,"\n"; }


When this executes, I get the following output:

Copy to clipboard
PHP Warning: session_start(): open(\\sess_44b2709de24875b216b90ed483380e25, O_RDWR) failed: Invalid argument (22) in c:\devtools\tikiwiki\tikiwiki-1.8.2\tiki-setup_base.php on line 173


I would like to know if this warning will hurt the execution of the tikiwiki library?

My next step is to convert the SnipSnap content into TikiWiki content, and create pages with it. Can any body point me to any TikiWiki scripts that are oriented for the command line and use the TikiWiki library to create pages?
Richard

posts: 2881 United Kingdom

is the script located in the tikiroot?

Next id look at the tiki-editpage files and copy/paste some of the save routine there into your script.

Damian

posts: 3 United States

I finally figured out that the script belongs in the tikiroot. After I did that, the script started working and I've made quite a bit of progress. I am still getting the warning, but the wiki pages are posting to the database using $tikilib->create_page(...), so I'm happy. I found tiki-editpage and copied some stuff around.

Is there any interest in having my completed script posted to this thread? As an example written by a newbie?biggrin

Richard

posts: 2881 United Kingdom


>
> Is there any interest in having my completed script posted to this thread? As an example written by a newbie?biggrin
>
> Richard
>

We have a directory in CVS called doc/devtool/ for sure an item. Do you know CVS? If so let me have your SourceForge username and I'll add you to the project so you can commit it. Or let me have a copy through email and I'll get it added for you.

Damian


posts: 3 United States

I finally figured out that the script belongs in the tikiroot. After I did that, the script started working and I've made quite a bit of progress. I am still getting the warning, but the wiki pages are posting to the database using $tikilib->create_page(...), so I'm happy. I found tiki-editpage and copied some stuff around.

Is there any interest in having my completed script posted to this thread? As an example written by a newbie?biggrin

Richard

posts: 2881 United Kingdom


>
> Is there any interest in having my completed script posted to this thread? As an example written by a newbie?biggrin
>
> Richard
>

We have a directory in CVS called doc/devtool/ for sure an item. Do you know CVS? If so let me have your SourceForge username and I'll add you to the project so you can commit it. Or let me have a copy through email and I'll get it added for you.

Damian


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting