Ejemplo n.º 1
0
	def backfillAllGroups(self, groupName=''):
		n = self.n

		if groupName != '':
			grp = groups.getByName(groupName)
			if grp:
				res = dict(grp)
		else:
			res = groups.getActive()

		counter = 1
		if res:
			nntp = nntplib.connect()

			for groupArr in res:
				left = len(res)-counter
				print '%sStarting group %d of %d.%s' % (n, counter, len(res), n)
				self.backfillGroup(nntp, groupArr, left)
				counter += 1
		else:
			print 'No groups specified. Ensure groups are added to usepy\'s database for updating.'+n
Ejemplo n.º 2
0
	def updateAllGroups(self):
		res = groups.getActive()
		counter = 1
	
		if res:
			alltime = time.time()
			print 'Updating: ', len(res), 'group(s)'
	
			nntp = nntplib.connect()
	
			for groupArr in res:
				message = dict()
				print 'Starting group', counter, 'of', len(res)
				self.updateGroup(nntp, groupArr)
				counter += 1
	
			nntp.quit()
			print 'Updating completed in', int(time.time() - alltime), 'seconds.'
	
		else:
			print 'No groups specified. Ensure groups are added to usepy\'s database for updating.'
Ejemplo n.º 3
0
    def updateAllGroups(self):
        res = groups.getActive()
        counter = 1

        if res:
            alltime = time.time()
            print 'Updating: ', len(res), 'group(s)'

            nntp = nntplib.connect()

            for groupArr in res:
                message = dict()
                print 'Starting group', counter, 'of', len(res)
                self.updateGroup(nntp, groupArr)
                counter += 1

            nntp.quit()
            print 'Updating completed in', int(time.time() -
                                               alltime), 'seconds.'

        else:
            print 'No groups specified. Ensure groups are added to usepy\'s database for updating.'
Ejemplo n.º 4
0
	#backfill days or safe backfill date
	if intbackfilltype == 1:
		backfilldays = "backfill_target"
	elif intbackfilltype == 2:
		backfilldays = "datediff(curdate(),(select value from site where setting = 'safebackfilldate'))"

	#query to grab backfill groups
	cur.execute("SELECT name, first_record from groups where first_record IS NOT NULL and backfill = 1 and first_record_postdate != '2000-00-00 00:00:00' and (now() - interval %s day) < first_record_postdate %s" %(backfilldays, group))
	datas = cur.fetchone()
	if not datas:
		print("No Groups enabled for backfill")
		sys.exit()

	#get first, last from nntp sever
	time.sleep(0.01)
	s = nntplib.connect(conf['NNTP_SERVER'], conf['NNTP_PORT'], conf['NNTP_SSLENABLED'], conf['NNTP_USERNAME'], conf['NNTP_PASSWORD'])
	time.sleep(0.01)
	resp, count, first, last, name = s.group(datas[0])
	time.sleep(0.01)
	resp = s.quit()

	print("Group %s has %s articles, in the range %s to %s" %(name, "{:,}".format(int(count)), "{:,}".format(int(first)), "{:,}".format(int(last))))
	print("Our oldest post is: %s" %("{:,}".format(datas[1])))
	print("Available Posts: %s" %("{:,}".format(datas[1] - first)))
	count = datas[1]

	if (datas[1] - first) < 10000:
		group = ("%s 10000" %(datas[0]))
		subprocess.call(["php", pathname+"/../nix_scripts/tmux/bin/backfill_safe.php", ""+str(group)])
		cur.close()
		con.close()