mirror of
https://github.com/nickyeoman/docker-compose-cookbooks.git
synced 2026-09-04 02:46:23 +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
|
# 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
|
# 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 os
|
||||||
import html
|
import html
|
||||||
directory = '/home/nick/tmp/emails'
|
directory = '/home/nick/working/emails-2019'
|
||||||
|
|
||||||
# The insert statement to insert a page
|
# 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" )
|
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):
|
for filename in os.listdir(directory):
|
||||||
|
|
||||||
if filename.endswith(".txt"):
|
if filename.endswith(".txt"):
|
||||||
f = open(filename)
|
f = open(filename)
|
||||||
|
|
||||||
@@ -30,14 +34,14 @@ for filename in os.listdir(directory):
|
|||||||
htmlcontent=' '.join(htmlcontentspaces.split())
|
htmlcontent=' '.join(htmlcontentspaces.split())
|
||||||
|
|
||||||
#generate slug
|
#generate slug
|
||||||
slugnospace=str(filenoext[0]).replace(" ", "_")
|
slugnospace=str(filenoext).replace(" ", "_")
|
||||||
slug=slugnospace.lower()
|
slug=slugnospace.lower()
|
||||||
|
|
||||||
# now write the sql query
|
# now write the sql query
|
||||||
print("(NULL, '2', '0', '", end = '')
|
print("(NULL, '1', '_fixme_', '", end = '')
|
||||||
print(filenoext, end = '')
|
print(filenoext, end = '') #Name
|
||||||
print("', '", end = '')
|
print("', '", end = '')
|
||||||
print(slug, end = '')
|
print(slug, end = '') #slug
|
||||||
print("', '", end = '')
|
print("', '", end = '')
|
||||||
print(htmlcontent, end = '')
|
print(htmlcontent, end = '')
|
||||||
print("', 'text_var', '0', NOW(), NOW(), '1', '1', '0', '0', 'markdown_var', '0', '0'),")
|
print("', 'text_var', '0', NOW(), NOW(), '1', '1', '0', '0', 'markdown_var', '0', '0'),")
|
||||||
Reference in New Issue
Block a user