Beispiel #1
0
def remove_user(uid):
    user = User.get(uid)
    if not user:
        print '---no user:%s' % uid

    print "---- delete from user, uid=", uid
    db_conn.execute("delete from user where id=%s", uid)
    db_conn.commit()
    User._clear_cache(uid)

    cursor = db_conn.execute("select id from status where user_id=%s", uid)
    if cursor:
        rows = cursor.fetchall()
        for row in rows:
            sid = row[0]
            print "---- delete mongo text, sid=", sid
            RawStatus.remove(sid)

    print "---- delete from status, uid=", uid
    db_conn.execute("delete from status where user_id=%s", uid)
    db_conn.commit()
    Status._clear_cache(uid, None)

    print "---- delete from passwd, uid=", uid
    db_conn.execute("delete from passwd where user_id=%s", uid)
    print "---- delete from sync_task, uid=", uid
    db_conn.execute("delete from sync_task where user_id=%s", uid)
    print "---- delete from user_alias, uid=", uid
    db_conn.execute("delete from user_alias where user_id=%s", uid)
    db_conn.commit()
Beispiel #2
0
def remove_user(uid, clear_status=True):
    user = User.get(uid)
    if not user:
        print "---no user:%s" % uid

    suicide_log.info("---- delete from user, uid=%s" % uid)
    db_conn.execute("delete from user where id=%s", uid)
    db_conn.commit()
    User._clear_cache(uid)

    if clear_status:
        cursor = db_conn.execute("select id from status where user_id=%s", uid)
        if cursor:
            rows = cursor.fetchall()
            for row in rows:
                sid = row[0]
                suicide_log.info("---- delete status text, sid=%s" % sid)
                RawStatus.remove(sid)

        suicide_log.info("---- delete from status, uid=" % uid)
        db_conn.execute("delete from status where user_id=%s", uid)
        db_conn.commit()
        Status._clear_cache(uid, None)

    suicide_log.info("---- delete from passwd, uid=%s" % uid)
    db_conn.execute("delete from passwd where user_id=%s", uid)
    suicide_log.info("---- delete from sync_task, uid=%s" % uid)
    db_conn.execute("delete from sync_task where user_id=%s", uid)
    suicide_log.info("---- delete from user_alias, uid=%s" % uid)
    db_conn.execute("delete from user_alias where user_id=%s", uid)
    db_conn.commit()
Beispiel #3
0
def remove_user(uid, clear_status=True):
    user = User.get(uid)
    if not user:
        print '---no user:%s' % uid

    suicide_log.info("---- delete from user, uid=%s" % uid)
    db_conn.execute("delete from user where id=%s", uid)
    db_conn.commit()
    User._clear_cache(uid)

    if clear_status:
        cursor = db_conn.execute("select id from status where user_id=%s", uid)
        if cursor:
            rows = cursor.fetchall()
            for row in rows:
                sid = row[0]
                suicide_log.info("---- delete status text, sid=%s" % sid)
                RawStatus.remove(sid)

        suicide_log.info("---- delete from status, uid=" % uid)
        db_conn.execute("delete from status where user_id=%s", uid)
        db_conn.commit()
        Status._clear_cache(uid, None)

    suicide_log.info("---- delete from passwd, uid=%s" % uid)
    db_conn.execute("delete from passwd where user_id=%s", uid)
    suicide_log.info("---- delete from sync_task, uid=%s" % uid)
    db_conn.execute("delete from sync_task where user_id=%s", uid)
    suicide_log.info("---- delete from user_alias, uid=%s" % uid)
    db_conn.execute("delete from user_alias where user_id=%s", uid)
    db_conn.commit()
Beispiel #4
0
def remove_status(uid):
    cursor = db_conn.execute("select id from status where user_id=%s", uid)
    if cursor:
        rows = cursor.fetchall()
        for row in rows:
            sid = row[0]
            print "---- delete mongo text, sid=", sid
            RawStatus.remove(sid)

    print "---- delete from status, uid=", uid
    db_conn.execute("delete from status where user_id=%s", uid)
    db_conn.commit()
    Status._clear_cache(uid, None)
Beispiel #5
0
#-*- coding:utf-8 -*-

import sys
sys.path.append('../')

from datetime import timedelta

from past.store import  db_conn
from past.model.kv import RawStatus

with open("ids.txt") as f:
    for id_ in f:
        id_ = id_.rstrip("\n")

        print id_
        cursor = db_conn.execute("delete from status where id=%s", id_)
        db_conn.commit()

        RawStatus.remove(id_)

        #cursor = db_conn.execute("select * from status where id=%s", id_)
        #print cursor.fetchone()