mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-03 18:36:22 +00:00
bookstack script work
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,20 @@
|
||||
################################################################################
|
||||
# use like this: python3 run.py > test.sql
|
||||
# TODO: you need to change the last comma to a semi colon for it to work in mysql
|
||||
# php artisan bookstack:regenerate-permissions
|
||||
################################################################################
|
||||
|
||||
import os
|
||||
import html
|
||||
directory = '/home/nick/tmp/emails'
|
||||
directory = '/home/nick/working/emails-2019'
|
||||
|
||||
# The insert statement to insert a page
|
||||
print("INSERT INTO `pages` (`id`, `book_id`, `chapter_id`, `name`, `slug`, `html`, `text`, `priority`, `created_at`, `updated_at`, `created_by`, `updated_by`, `restricted`, `draft`, `markdown`, `revision_count`, `template`) VALUES" )
|
||||
|
||||
os.chdir(directory)
|
||||
|
||||
for filename in os.listdir(directory):
|
||||
|
||||
if filename.endswith(".txt"):
|
||||
f = open(filename)
|
||||
|
||||
@@ -30,14 +34,14 @@ for filename in os.listdir(directory):
|
||||
htmlcontent=' '.join(htmlcontentspaces.split())
|
||||
|
||||
#generate slug
|
||||
slugnospace=str(filenoext[0]).replace(" ", "_")
|
||||
slugnospace=str(filenoext).replace(" ", "_")
|
||||
slug=slugnospace.lower()
|
||||
|
||||
# now write the sql query
|
||||
print("(NULL, '2', '0', '", end = '')
|
||||
print(filenoext, end = '')
|
||||
print("(NULL, '1', '_fixme_', '", end = '')
|
||||
print(filenoext, end = '') #Name
|
||||
print("', '", end = '')
|
||||
print(slug, end = '')
|
||||
print(slug, end = '') #slug
|
||||
print("', '", end = '')
|
||||
print(htmlcontent, end = '')
|
||||
print("', 'text_var', '0', NOW(), NOW(), '1', '1', '0', '0', 'markdown_var', '0', '0'),")
|
||||
Reference in New Issue
Block a user