Posted By

matthewnovak on 10/26/08


Tagged

wordpress auto install


Versions (?)

Automatically Installing Wordpress Part 2


 / Published in: Python
 

URL: http://blackcodeseo.com/automatically-installing-wordpress/

  1. import MySQLdb
  2.  
  3. tblPrefix = 'TABLE_PREFIX'
  4.  
  5. conn = MySQLdb.connect (host='localhost', user='USERNAME', passwd='PASSWORD', db='DATABASE')
  6. cursor = conn.cursor()
  7.  
  8. # delete hello world post
  9. cursor.execute('delete * from %sposts' % (tblPrefix))
  10.  
  11. # create a password, wp makes a random default one
  12. cursor.execute("""update %susers set user_pass = md5('PASSWORD') where user_login='admin'""" % (tblPrefix))
  13.  
  14. # title the blog
  15. cursor.execute('''update %soptions set option_value='TITLE_OF_BLOG' where option_id=3''' % (tblPrefix))
  16.  
  17. # make the blog public
  18. cursor.execute('''update %soptions set option_value = '1' where option_name = 'blog_public' ''' % (tblPrefix))
  19.  
  20. # allow pingback
  21. cursor.execute("""update %soptions set option_value = '1' where option_name = 'default_pingback_flag'""" % (tblPrefix))
  22.  
  23. # open for pings
  24. cursor.execute("""update %soptions set option_value = 'open' where option_name = 'default_ping_status'""" % (tblPrefix))
  25.  
  26. # open for comments
  27. cursor.execute("""update %soptions set option_value = 'open' where option_name = 'default_comment_status'""" % (tblPrefix))
  28.  
  29. # disallow comment registration
  30. cursor.execute("""update %soptions set option_value = '0' where option_name = 'comment_registration'""" % (tblPrefix))
  31.  
  32. # non-static page
  33. cursor.execute("""update %soptions set option_value = '0' where option_name = 'page_on_front'""" % (tblPrefix))
  34.  
  35. cursor.close()
  36. conn.close()

Report this snippet  

You need to login to post a comment.