Skip to content
Snippets Groups Projects
Select Git revision
  • 2e1ed6d6a70534679e8c89ca38b4a738e700f51a
  • master default
  • fix-remote-url_v4.9.1
  • fix-remote-url_v4.8.3
  • fix-remote-url_v4.8.x
  • fix-remote-url_v4.7.x
  • fix-remote-url_v4.6.0
  • fix-remote-urls
8 results

deploy.php

Blame
    • Tim Hunt's avatar
      2e1ed6d6
      Purge the question definition cache in Moodle 2.4+. · 2e1ed6d6
      Tim Hunt authored
      From Moodle 2.4 onwards, question definitions are cached, so when
      we update the question definition in some way that Moodle core does
      not know about (for example when deploying variants) we must remember
      to notify the question cache, so that it can refresh the definition
      of that question.
      2e1ed6d6
      History
      Purge the question definition cache in Moodle 2.4+.
      Tim Hunt authored
      From Moodle 2.4 onwards, question definitions are cached, so when
      we update the question definition in some way that Moodle core does
      not know about (for example when deploying variants) we must remember
      to notify the question cache, so that it can refresh the definition
      of that question.
    rejects.py 972 B
    # Analyze milter log to find abusers
    
    fp = open('/var/log/milter/milter.log','r')
    subdict = {}
    ipdict = {}
    spamcnt = {}
    for line in fp:
      a = line.split(None,4)
      if len(a) < 4: continue
      dt,tm,id,op = a[:4]
      if op == 'Subject:':
        if len(a) > 4: subdict[id] = a[4].rstrip()
      elif op == 'connect':
        ipdict[id] = a[4].rstrip()
      elif op in ('eom','dspam'):
        if id in subdict: del subdict[id]
        if id in ipdict: del ipdict[id]
      elif op in ('REJECT:','DSPAM:','SPAM:','abort'):
        if id in subdict:
          if id in ipdict:
            ip = ipdict[id]
    	del ipdict[id]
    	f,host,raw = ip.split(None,2)
    	if host in spamcnt:
    	  spamcnt[host] += 1
    	else:
    	  spamcnt[host] = 1
          else: ip = ''
          print dt,tm,op,a[4].rstrip(),subdict[id]
          del subdict[id]
        else:
          print line.rstrip()
    print len(subdict),'leftover entries'
    
    spamlist = filter(lambda x: x[1] > 1,spamcnt.items())
    spamlist.sort(lambda x,y: x[1] - y[1])
    for ip,cnt in spamlist:
      print cnt,ip