Can not add any books or pages to bookstack from Confluence export
Hi, I have a confluence wiki export of HTML pages and have tried to import them into Bookstack using the importer.php script. It fails to import or create any books.
I have created a credentials.php, and set the URL of the bookstack service. I also edited importer.php to set the book_title (and I created the same named book in bookstack via the web UI),I set the read_path which points to a local HTML folder containing the html web pages exported from confluence. But when I run the comment line it fails with this message
G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\examples>php importer.php array(2) { [0]=> object(stdClass)#2 (10) { ["id"]=> int(1) ["slug"]=> string(29) "stock-market-price-prediction" ["name"]=> string(29) "Stock Market Price Prediction" ["description"]=> string(187) "TODO (See D:\mldev\project\TransformerStockPrices\TODO)Find more todos In MS Edge there is a collection called Stock Prediction 2024 with links in for LSTM vs Generative web pages etc. " ["created_at"]=> string(27) "2025-05-22T05:07:08.000000Z" ["updated_at"]=> string(27) "2025-05-22T05:13:58.000000Z" ["owned_by"]=> int(3) ["created_by"]=> int(3) ["updated_by"]=> int(3) ["cover"]=> NULL } [1]=> object(stdClass)#3 (10) { ["id"]=> int(2) ["slug"]=> string(7) "sm-test" ["name"]=> string(7) "SM_Test" ["description"]=> string(0) "" ["created_at"]=> string(27) "2025-05-22T06:50:51.000000Z" ["updated_at"]=> string(27) "2025-05-22T06:50:51.000000Z" ["owned_by"]=> int(3) ["created_by"]=> int(3) ["updated_by"]=> int(3) ["cover"]=> NULL } } PHP Warning: Attempt to read property "name" on array in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 492
Warning: Attempt to read property "name" on array in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 492 NULL PHP Warning: Attempt to read property "name" on array in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 494
Warning: Attempt to read property "name" on array in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 494 PHP Warning: Attempt to read property "name" on int in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 492
Warning: Attempt to read property "name" on int in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 492 NULL PHP Warning: Attempt to read property "name" on int in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 494
Warning: Attempt to read property "name" on int in G:\SDK_FW_3rd\3rdRepos\bookstackimport\bookstack-html-importer\bookstack_client.php on line 494
Looks like the structure passed back from bookstack has changed and php code is trying to treat teh int 14 as a string name, line 494 is this
483 function create_book( $book_title, $check_existing = true ) { 484 $book_id = false; 485 486 # Check books if required (default) 487 if ( is_bool( $check_existing ) && $check_existing ) { 488 $books = $this->get_books( array() ); 489 490 if ( $books ) { 491 foreach ( $books as $book ) { 492 $this->log( $book->name ); 493 //continue; 494 if ( $book->name === $book_title ) { #THIS LINE FAILS 495 $book_id = $book->id; 496 $this->log( "Book exists with ID: {$book_id}" ); 497 498 return $book_id; 499 } 500 } 501 } 502 }
Any help would be appreciated ! Thanks.