Beispiel #1
0
 def RemoveExpiredItems(self):
     timenow=time.time()
     ThreeDaysAgo=time.time()-MU_MainConfig.THREEDAYS
     zset=r.zrangebyscore('expire',ThreeDaysAgo,timenow)
     hkeys=r.hkeys('queue')
     setofzset=set(zset)
     setofhkeys=set(hkeys)
     intersection=list(setofzset&setofhkeys)
     for i in range(len(hkeys)):
         if hkeys[i] not in intersection:
             title=r.hget('queue',hkeys[i])
             if hkeys[i] is MU_MainConfig.EDITEDPREFIX+title:
                 r.zrem('expire',MU_MainConfig.EDITEDPREFIX+title)
                 r.hdel('queue',hkeys[i])
                 name=r.hget('img',MU_MainConfig.EDITEDPREFIX+title)
                 os.remove('../imgcache/'+name)
                 r.hdel('img',MU_MainConfig.EDITEDPREFIX+title)
                 r.hdel('imgkey',MU_MainConfig.EDITEDPREFIX+title)
                 score=r.zscore('queuenumber',title)
                 r.zrem('queuenumber',title)
                 scorequeue=r.zrange('queuenumber',int(score)-1,-1)
                 for i in range(len(scorequeue)):
                     score=r.zscore('queuenumber',scorequeue[i])
                     r.zadd('queuenumber',scorequeue[i],score-1)
             else:
                 r.zrem('expire',MU_MainConfig.EDITEDPREFIX+title)
                 r.hdel('queue',hkeys[i])
Beispiel #2
0
 def PostItem(self):
     Keys=r.zrange('queuenumber',0,-1)
     ReadyToPostItem=Keys[0]
     UnPushed=ForbiddenItemPushed(ReadyToPostItem)
     if UnPushed is not False:
         name=r.hget('img',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem)
         post(ReadyToPostItem,name)
         r.hdel('queue',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem)
         os.remove('../imgcache/'+name)
         r.hdel('img',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem)
         r.hdel('imgkey',MU_MainConfig.EDITEDPREFIX+ReadyToPostItem)
         score=r.zscore('queuenumber',ReadyToPostItem)
         r.zrem('queuenumber',ReadyToPostItem)
         scorequeue=r.zrange('queuenumber',int(score)-1,-1)
         for i in range(len(scorequeue)):
             score=r.zscore('queuenumber',scorequeue[i])
             r.zadd('queuenumber',scorequeue[i],score-1)
         r.hset('queue',MU_MainConfig.PUSHEDPREFIX+ReadyToPostItem,ReadyToPostItem)
     else:
         pass
Beispiel #3
0
def DeletePage(title):
    r.zrem('expire',MU_MainConfig.EDITEDPREFIX+title)
    r.hdel('queue',MU_MainConfig.EDITEDPREFIX+title)
    name=r.hget('img',MU_MainConfig.EDITEDPREFIX+title)
    os.remove('../imgcache/'+name)
    r.hdel('img',MU_MainConfig.EDITEDPREFIX+title)
    r.hdel('imgkey',title)
    score=r.zscore('queuenumber',title)
    r.zrem('queuenumber',title)
    scorequeue=r.zrange('queuenumber',int(score)-1,-1)
    for i in range(len(scorequeue)):
        score=r.zscore('queuenumber',scorequeue[i])
        r.zadd('queuenumber',scorequeue[i],score-1)
    return True