• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mysqlconf.MySQL类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mysqlconf.MySQL的典型用法代码示例。如果您正苦于以下问题:Python MySQL类的具体用法?Python MySQL怎么用?Python MySQL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了MySQL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: Dialog

        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "b2evolution Password",
            "Enter new password for the b2evolution 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "b2evolution Email",
            "Enter email address for the b2evolution 'admin' account.",
            "[email protected]")

    inithooks_cache.write('APP_EMAIL', email)

    hash = hashlib.md5(password).hexdigest()

    m = MySQL()
    for username in ('admin', 'ablogger', 'demouser'):
        m.execute('UPDATE b2evolution.users SET user_pass=\"%s\", user_email=\"%s\", user_unsubscribe_key=\"%s\" WHERE user_login=\"%s\";' % (hash, email, randomkey(), username))


if __name__ == "__main__":
    main()

开发者ID:qrntz,项目名称:b2evolution,代码行数:29,代码来源:b2evolution.py


示例2: Dialog

            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Zoneminder Password",
            "Enter new password for the Zoneminder 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Zoneminder Email",
            "Enter email address for the Zoneminder alerts.",

            "[email protected]")

    inithooks_cache.write('APP_EMAIL', email)




    m = MySQL()
    hash=m.execute('')
    m.execute('UPDATE zm.Users SET Password=PASSWORD(\"%s\") WHERE Username=\"admin\";' % password )
    m.execute('UPDATE zm.Config SET Value=\"%s\" WHERE Name=\"ZM_EMAIL_ADDRESS\";' % email)

if __name__ == "__main__":
    main()
开发者ID:ghoulmann,项目名称:zoneminder,代码行数:30,代码来源:zoneminder.py


示例3: Dialog

        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Kliqqi Password",
            "Enter new password for the Kliqqi 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Kliqqi Email",
            "Enter email address for the Kliqqi 'admin' account.",
            "[email protected]")

    inithooks_cache.write('APP_EMAIL', email)

    salt = ''.join((random.choice(string.letters+string.digits) for x in range(9)))
    hash = salt + hashlib.sha1(salt + password).hexdigest()

    m = MySQL()
    m.execute('UPDATE kliqqi.users SET user_pass=\"%s\" WHERE user_login=\"admin\";' % hash)
    m.execute('UPDATE kliqqi.users SET user_email=\"%s\" WHERE user_login=\"admin\";' % email)

if __name__ == "__main__":
    main()

开发者ID:JedMeister,项目名称:pligg,代码行数:29,代码来源:kliqqi.py


示例4: system

#    system("mv -f solr-ssl.pem /usr/local/solr/server/etc")

    # Solr - enable SSL.
#    system("echo 'SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_KEY_STORE_PASSWORD=%s' >> /var/lib/solr/solr.in.sh" % adminpass)
#    system("echo 'SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_TRUST_STORE_PASSWORD=%s' >> /var/lib/solr/solr.in.sh" % adminpass)
#    system("echo 'SOLR_SSL_NEED_CLIENT_AUTH=false' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_WANT_CLIENT_AUTH=false' >> /var/lib/solr/solr.in.sh")
#    system("echo 'SOLR_SSL_OPTS=\"-Djavax.net.ssl.keyStore=etc/solr-ssl.keystore.jks -Djavax.net.ssl.trustStore=etc/solr-ssl.keystore.jks\"' >> /var/lib/solr/solr.in.sh")

    # Drupal - check change admin/password.
    try:
        pwd.getpwnam('admin')
        system("echo admin:%s | chpasswd" % adminpass)
        m = MySQL()
        m.execute('SET PASSWORD FOR [email protected] = PASSWORD(%s) ;' % adminpass)
    except KeyError:
        system("useradd -g root -m -s /bin/bash admin")
        system("echo admin:%s | chpasswd" % adminpass)
        m = MySQL()
        m.execute('CREATE USER [email protected] IDENTIFIED BY \"%s\";' % adminpass)

    # Drupal - check change cssadmin/password with toggle to create base site.
    try:
        # Check cssadmin exists with exception if not.
        pwd.getpwnam('cssadmin')

        # Change cssadmin password.
        system("echo cssadmin:%s | chpasswd" % adminpass)
开发者ID:bormanst,项目名称:formavid,代码行数:30,代码来源:formavid.py


示例5: Dialog

        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Collabtive Password",
            "Enter new password for the Collabtive 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Collabtive Email",
            "Enter email address for the Collabtive 'admin' account.",
            "[email protected]")

    hash = hashlib.sha1(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE collabtive.user SET pass=\"%s\", email=\"%s\" WHERE name=\"admin\";' % (hash, email))
    m.execute('UPDATE collabtive.settings SET settingsValue=\"%s\" WHERE settingsKey=\"mailfrom\";' % email)


if __name__ == "__main__":
    main()

开发者ID:qrntz,项目名称:collabtive,代码行数:29,代码来源:collabtive.py


示例6: locals

            "Magento Email",
            "Enter email address for the Magento 'admin' account.",
            "[email protected]")
    
    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Magento Domain",
            "Enter the domain to serve Magento.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hashpass = hashlib.md5("qX" + password).hexdigest() + ":qX"

    m = MySQL()
    m.execute('UPDATE magento.admin_user SET email=\"%s\" WHERE username=\"admin\";' % email)
    m.execute('UPDATE magento.admin_user SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
    m.execute('UPDATE magento.core_config_data SET value=\"http://%s/\" WHERE path=\"web/unsecure/base_url\";' % (domain))
    m.execute('UPDATE magento.core_config_data SET value=\"https://%s/\" WHERE path=\"web/secure/base_url\";' % (domain))

    # delete cache so it will be rebuilt for new domain
    shutil.rmtree("/var/www/magento/var/cache", ignore_errors=True)

if __name__ == "__main__":
    main()

开发者ID:Drakas,项目名称:magento,代码行数:29,代码来源:magento.py


示例7: locals

            "Enter new password for the ProjectPier 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "ProjectPier Email",
            "Please enter email address for the ProjectPier 'admin' account.",
            "[email protected]")

    inithooks_cache.write('APP_EMAIL', email)

    pos = random.randrange(25)
    salt = hashlib.sha1(str(uuid.uuid4())).hexdigest()[pos:pos+13]

    token = hashlib.sha1(salt + password).hexdigest()

    x = [str(i) for i in range(10)]
    random.shuffle(x)
    twister = ''.join(x)

    m = MySQL()
    m.execute('UPDATE projectpier.users SET email = "%s", token = "%s", salt = "%s", twister = "%s", updated_on = NOW() WHERE id = 1;' % (email, token, salt, twister))
    m.execute('UPDATE projectpier.contacts SET email="%s", updated_on=NOW() WHERE user_id = 1;')

if __name__ == "__main__":
    main()


开发者ID:JedMeister,项目名称:projectpier,代码行数:28,代码来源:projectpier.py


示例8: usage

            usage()
        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "Wordpress Password",
            "Enter new password for the Wordpress 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "Wordpress Email",
            "Please enter email address for the Wordpress 'admin' account.",
            "[email protected]")
    
    hashpass = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE wordpress.wp_users SET user_email=\"%s\" WHERE user_nicename=\"admin\";' % email)
    m.execute('UPDATE wordpress.wp_users SET user_pass=\"%s\" WHERE user_nicename=\"admin\";' % hashpass)

if __name__ == "__main__":
    main()

开发者ID:KingDistributionsIncorporated,项目名称:wordpress,代码行数:29,代码来源:wordpress.py


示例9: MySQL

            "Enter the domain to serve Elgg. Note: Elgg does not support http without further configuration, domain will default to https.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    fqdn = re.compile(r"https?://")
    fqdn = fqdn.sub('', domain).strip('/')
    domain = "https://%s/" % fqdn

    inithooks_cache.write('APP_DOMAIN', fqdn)

    salt = bcrypt.gensalt(10) 
    hashpass = bcrypt.hashpw(password, salt)

    m = MySQL()
    m.execute('UPDATE elgg.elgg_users_entity SET password_hash=\"%s\" WHERE username=\"admin\";' % hashpass)

    m.execute('UPDATE elgg.elgg_users_entity SET email=\"%s\" WHERE username=\"admin\";' % email)

    m.execute('UPDATE elgg.elgg_metastrings SET string=\"%s\" WHERE string LIKE \"%%@%%\";' % email)
    m.execute('UPDATE elgg.elgg_sites_entity SET url=\"%s\" WHERE guid = 1;' % domain)

    with open('/etc/cron.d/elgg', 'r') as fob:
        contents = fob.read()

    contents = re.sub("ELGG='.*'", "ELGG='%s'" % domain, contents)

    with open('/etc/cron.d/elgg', 'w') as fob:
        fob.write(contents)
开发者ID:turnkeylinux-apps,项目名称:elgg,代码行数:30,代码来源:elgg.py


示例10: locals

            "Enter email address for the ClipBucket 'admin' account.",
            "[email protected]")

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "ClipBucket Domain",
            "Enter the domain to serve ClipBucket.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hash = clipbucket_hash(password)

    m = MySQL()
    m.execute('UPDATE clipbucket.users SET password=\"%s\", email=\"%s\" WHERE username=\"admin\";' % (hash, email))

    m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"support_email\";' % email)
    m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"website_email\";' % email)
    m.execute('UPDATE clipbucket.config SET value=\"%s\" WHERE name=\"welcome_email\";' % email)

    m.execute('UPDATE clipbucket.config SET value=\"http://%s\" WHERE name=\"baseurl\";' % domain)
    

if __name__ == "__main__":
    main()

开发者ID:JedMeister,项目名称:clipbucket,代码行数:29,代码来源:clipbucket.py


示例11: locals

            "Enter new password for the SilverStripe 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "SilverStripe Email",
            "Enter email address for the SilverStripe 'admin' account.",
            "[email protected]")

    salt = bcrypt.gensalt(10)
    hash = bcrypt.hashpw(password, salt)

    # munge the salt and hash, argh!
    _salt = salt[4:]
    _hash = "$2y$" + hash[4:]

    m = MySQL()
    m.execute('UPDATE silverstripe.Member SET Salt=\"%s\" WHERE ID=1;' % _salt)
    m.execute('UPDATE silverstripe.Member SET Password=\"%s\" WHERE ID=1;' % _hash)
    m.execute('UPDATE silverstripe.Member SET Email=\"%s\" WHERE ID=1;' % email)

    m.execute('UPDATE silverstripe.MemberPassword SET Salt=\"%s\" WHERE ID=1;' % _salt)
    m.execute('UPDATE silverstripe.MemberPassword SET Password=\"%s\" WHERE ID=1;' % _hash)


if __name__ == "__main__":
    main()

开发者ID:OnGle,项目名称:silverstripe,代码行数:29,代码来源:silverstripe.py


示例12: Dialog

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "eZ Platform Password",
            "Enter new password for the eZ Platform 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "eZ Platform Email",
            "Enter email address for the eZ Platform 'admin' account.",
            "[email protected]")

    inithooks_cache.write('APP_EMAIL', email)
    # tweak configuration files
    # calculate password hash and tweak database
    hash = hashlib.md5("admin\n%s" % password).hexdigest()

    m = MySQL()
    m.execute('UPDATE ezplatform.ezuser SET password_hash="%s" WHERE login="admin";' % hash)
    m.execute('UPDATE ezplatform.ezuser SET email="%s" WHERE login="admin";' % email)

    m.execute('UPDATE ezplatform.ezcontentobject_name SET name="TurnKey Linux eZ Platform" WHERE contentobject_id="1"')

if __name__ == "__main__":
    main()

开发者ID:JedMeister,项目名称:ezpublish,代码行数:28,代码来源:ezplatform.py


示例13: locals

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Elgg Domain",
            "Enter the domain to serve Elgg.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    domain = domain.strip("/")
    if not domain.startswith("http://"):
        domain = "http://%s/" % domain

    salt = "".join(random.choice(string.letters) for line in range(8))
    hashpass = hashlib.md5(password + salt).hexdigest()

    m = MySQL()
    m.execute('UPDATE elgg.elgg_users_entity SET salt=\"%s\" WHERE username=\"admin\";' % salt)
    m.execute('UPDATE elgg.elgg_users_entity SET password=\"%s\" WHERE username=\"admin\";' % hashpass)
    m.execute('UPDATE elgg.elgg_users_entity SET email=\"%s\" WHERE username=\"admin\";' % email)

    m.execute('UPDATE elgg.elgg_metastrings SET string=\"%s\" WHERE string LIKE \"%%@%%\";' % email)
    m.execute('UPDATE elgg.elgg_sites_entity SET url=\"%s\" WHERE url LIKE \"http://%%\";' % domain)

if __name__ == "__main__":
    main()

开发者ID:aaronkempf,项目名称:elgg,代码行数:29,代码来源:elgg.py


示例14: locals

            "[email protected]")

    if not password:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        password = d.get_password(
            "Vtiger Password",
            "Enter new password for the Vtiger 'admin' account.")


    hashpass = hashlib.md5(password).hexdigest()

    command = ["php", join(dirname(__file__), 'vt_crypt.php'), "admin", password]
    p = subprocess.Popen(command, stdin=PIPE, stdout=PIPE, shell=False)
    stdout, stderr = p.communicate()
    if stderr:
        fatal(stderr)

    cryptpass = stdout.strip()

    m = MySQL()
    m.execute('UPDATE vtigercrm.vtiger_users SET email1=\"%s\" WHERE user_name=\"admin\";' % email)
    m.execute('UPDATE vtigercrm.vtiger_users SET user_hash=\"%s\" WHERE user_name=\"admin\";' % hashpass)
    m.execute('UPDATE vtigercrm.vtiger_users SET user_password=\"%s\" WHERE user_name=\"admin\";' % cryptpass)


if __name__ == "__main__":
    main()

开发者ID:aaronkempf,项目名称:vtiger,代码行数:29,代码来源:vtiger.py


示例15: Dialog

        elif opt == '--pass':
            password = val
        elif opt == '--email':
            email = val

    if not password:
        d = Dialog('TurnKey Linux - First boot configuration')
        password = d.get_password(
            "SimpleInvoices Password",
            "Enter new password for the 'admin' account.")

    if not email:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        email = d.get_email(
            "SimpleInvoices Email",
            "Enter email address for the 'admin' account.",
            "[email protected]")

    hash = hashlib.md5(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE simpleinvoices.si_user SET password=\"%s\" WHERE id=1;' % hash)
    m.execute('UPDATE simpleinvoices.si_user SET email=\"%s\" WHERE id=1;' % email)


if __name__ == "__main__":
    main()

开发者ID:aaronkempf,项目名称:simpleinvoices,代码行数:29,代码来源:simpleinvoices.py


示例16: locals

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "Piwik Domain",
            "Enter the domain to serve Piwik.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    domain = domain.strip("/")
    if not domain.startswith("http://"):
        domain = "http://%s/" % domain

    m = MySQL()
    m.execute('UPDATE piwik.piwik_option SET option_value=\"%s\" WHERE option_name=\"piwikUrl\";' % domain)
    piwik_config.update("[General]", "trusted_hosts[]", domain)

    hash = hashlib.md5(password).hexdigest()
    token = hashlib.md5('admin' + hash).hexdigest()

    m.execute('UPDATE piwik.piwik_user SET password=\"%s\", token_auth=\"%s\" WHERE login = \"admin\" AND superuser_access = 1;' % (hash, token))
    m.execute('UPDATE piwik.piwik_user SET email=\"%s\" WHERE login = \"admin\" AND superuser_access = 1;' % email)

if __name__ == "__main__":
    main()

开发者ID:gns-support,项目名称:piwik,代码行数:28,代码来源:piwik.py


示例17: in

        if opt in ("-h", "--help"):
            usage()
        elif opt == "--pass":
            password = val
        elif opt == "--email":
            email = val

    if not password:
        d = Dialog("TurnKey Linux - First boot configuration")
        password = d.get_password("ProcessMaker Password", "Enter new password for the ProcessMaker 'admin' account.")

    if not email:
        if "d" not in locals():
            d = Dialog("TurnKey Linux - First boot configuration")

        email = d.get_email(
            "ProcessMaker Email", "Enter email address for the ProcessMaker 'admin' account.", "[email protected]"
        )

    hashpass = hashlib.md5(password).hexdigest()

    m = MySQL()

    for database in ("wf_workflow", "rb_workflow"):
        m.execute('UPDATE %s.USERS SET USR_PASSWORD="%s" WHERE USR_USERNAME="admin";' % (database, hashpass))
        m.execute('UPDATE %s.USERS SET USR_EMAIL="%s" WHERE USR_USERNAME="admin";' % (database, email))


if __name__ == "__main__":
    main()
开发者ID:jpucheu,项目名称:processmaker,代码行数:30,代码来源:processmaker.py


示例18: locals

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "SimpleMachines Domain",
            "Enter the domain to serve SimpleMachines.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hash = hashlib.sha1('admin' + password).hexdigest()

    m = MySQL()
    m.execute('UPDATE simplemachines.members SET passwd=\"%s\" WHERE member_name=\"admin\";' % hash)
    m.execute('UPDATE simplemachines.members SET email_address=\"%s\" WHERE member_name=\"admin\";' % email)

    m.execute('UPDATE simplemachines.settings SET value=\"http://%s/Smileys\" WHERE variable=\"smileys_url\";' % domain)
    m.execute('UPDATE simplemachines.settings SET value=\"http://%s/avatars\" WHERE variable=\"avatar_url\";' % domain)
    
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/default\" WHERE variable=\"theme_url\" AND id_theme=1;' % domain)
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/default/images\" WHERE variable=\"images_url\" AND id_theme=1;' % domain)
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/core\" WHERE variable=\"theme_url\" AND id_theme=2;' % domain)
    m.execute('UPDATE simplemachines.themes SET value=\"http://%s/Themes/core/images\" WHERE variable=\"images_url\" AND id_theme=2;' % domain)

    config = "/var/www/simplemachines/Settings.php"
    system("sed -i \"s|boardurl.*|boardurl = 'http://%s';|\" %s" % (domain, config))
    system("sed -i \"s|webmaster_email.*|webmaster_email = '%s';|\" %s" % (email, config))
开发者ID:aaronkempf,项目名称:simplemachines,代码行数:29,代码来源:simplemachines.py


示例19: locals

    if not domain:
        if 'd' not in locals():
            d = Dialog('TurnKey Linux - First boot configuration')

        domain = d.get_input(
            "iceScrum Domain",
            "Enter the domain to serve iceScrum.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    hash = hashlib.sha256(password).hexdigest()

    m = MySQL()
    m.execute('UPDATE icescrum.icescrum2_user SET passwd=\"%s\" WHERE username=\"admin\";' % hash)
    m.execute('UPDATE icescrum.icescrum2_user SET email=\"%s\" WHERE username=\"admin\";' % email)

    config = "/etc/icescrum/config.groovy"
    system("sed -i \"s|serverURL =.*|serverURL = \\\"http://%s\\\"|\" %s" % (domain, config))

    # restart tomcat if running so changes will take effect
    try:
        system("/etc/init.d/tomcat7 status >/dev/null")
        system("/etc/init.d/tomcat7 restart")
    except:
        pass


if __name__ == "__main__":
开发者ID:qrntz,项目名称:icescrum,代码行数:30,代码来源:icescrum.py


示例20: sha1

            "PunBB Domain",
            "Enter the domain to serve PunBB.",
            DEFAULT_DOMAIN)

    if domain == "DEFAULT":
        domain = DEFAULT_DOMAIN

    inithooks_cache.write('APP_DOMAIN', domain)

    def sha1(s):
        return hashlib.sha1(s).hexdigest()
    
    salt = ''.join((random.choice(string.letters+string.digits) for x in range(12)))
    hash = sha1(salt + sha1(password))

    m = MySQL()
    m.execute('UPDATE punbb.users SET password=\"%s\", salt=\"%s\", email=\"%s\" WHERE username=\"admin\";' % (hash, salt, email))

    m.execute('UPDATE punbb.config SET conf_value=\"%s\" WHERE conf_name=\"o_mailing_list\";' % email)
    m.execute('UPDATE punbb.config SET conf_value=\"%s\" WHERE conf_name=\"o_admin_email\";' % email)
    m.execute('UPDATE punbb.config SET conf_value=\"%s\" WHERE conf_name=\"o_webmaster_email\";' % email)

    conf = "/var/www/punbb/config.php"
    system("sed -i \"s|base_url.*|base_url = 'https://%s';|\" %s" % (domain, conf))

    apache_conf = "/etc/apache2/sites-available/punbb.conf"
    system("sed -i \"s|https://.*|https://%s/\$1 [R,L]|\" %s" % (domain, apache_conf))

    system("service apache2 restart")

if __name__ == "__main__":
开发者ID:JedMeister,项目名称:punbb,代码行数:31,代码来源:punbb.py



注:本文中的mysqlconf.MySQL类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mysqlstmt.Select类代码示例发布时间:2022-05-27
下一篇:
Python models.DatabaseManager类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap