コード例 #1
0
def bst_weblinkback_updater(mode):
    """
    Update linkbacks
    @param mode: 1 delete rejected, broken and pending linkbacks whose URLs is on blacklist
                 2 update page titles of new linkbacks
                 3 update page titles of old linkbacks
                 4 update manually set page titles
                 5 detect and disable broken linkbacks
    @type mode: int
    """
    mode = int(mode)
    if mode == 1:
        write_message("Starting to delete rejected and pending linkbacks URLs on blacklist")
        delete_linkbacks_on_blacklist()
        write_message("Completed to delete rejected and pending linkbacks URLs on blacklist")
    elif mode == 2:
        write_message("Starting to update the page titles of new linkbacks")
        update_linkbacks(1)
        write_message("Completed to update the page titles of new linkbacks")
    elif mode == 3:
        write_message("Starting to update the page titles of old linkbacks")
        update_linkbacks(2)
        write_message("Completed to update the page titles of old linkbacks")
    elif mode == 4:
        write_message("Starting to update manually set page titles")
        update_linkbacks(3)
        write_message("Completed to update manually set page titles")
    elif mode == 5:
        write_message("Starting to detect and disable broken linkbacks")
        update_linkbacks(4)
        write_message("Completed to detect and disable broken linkbacks")
コード例 #2
0
def bst_weblinkback_updater(mode):
    """
    Update linkbacks
    @param mode: 1 delete rejected, broken and pending linkbacks whose URLs is on blacklist
                 2 update page titles of new linkbacks
                 3 update page titles of old linkbacks
                 4 update manually set page titles
                 5 detect and disable broken linkbacks
    @type mode: int
    """
    mode = int(mode)
    if mode == 1:
        write_message(
            "Starting to delete rejected and pending linkbacks URLs on blacklist"
        )
        delete_linkbacks_on_blacklist()
        write_message(
            "Completed to delete rejected and pending linkbacks URLs on blacklist"
        )
    elif mode == 2:
        write_message("Starting to update the page titles of new linkbacks")
        update_linkbacks(1)
        write_message("Completed to update the page titles of new linkbacks")
    elif mode == 3:
        write_message("Starting to update the page titles of old linkbacks")
        update_linkbacks(2)
        write_message("Completed to update the page titles of old linkbacks")
    elif mode == 4:
        write_message("Starting to update manually set page titles")
        update_linkbacks(3)
        write_message("Completed to update manually set page titles")
    elif mode == 5:
        write_message("Starting to detect and disable broken linkbacks")
        update_linkbacks(4)
        write_message("Completed to detect and disable broken linkbacks")
コード例 #3
0
def bst_weblinkback_updater(mode):
    """
    Update linkbacks
    @param mode: 1 delete rejected, broken and pending linkbacks whose URLs is on blacklist
                 2 update page titles of new linkbacks
                 3 update page titles of old linkbacks
                 4 update manually set page titles
                 5 detect and disable broken linkbacks
                 6 send notification email for all pending linkbacks
    @type mode: int
    """
    mode = int(mode)
    if mode == 1:
        write_message(
            "Starting to delete rejected and pending linkbacks URLs on blacklist"
        )
        delete_linkbacks_on_blacklist()
        write_message(
            "Completed to delete rejected and pending linkbacks URLs on blacklist"
        )
    elif mode == 2:
        write_message("Starting to update the page titles of new linkbacks")
        update_linkbacks(1)
        write_message("Completed to update the page titles of new linkbacks")
    elif mode == 3:
        write_message("Starting to update the page titles of old linkbacks")
        update_linkbacks(2)
        write_message("Completed to update the page titles of old linkbacks")
    elif mode == 4:
        write_message("Starting to update manually set page titles")
        update_linkbacks(3)
        write_message("Completed to update manually set page titles")
    elif mode == 5:
        write_message("Starting to detect and disable broken linkbacks")
        update_linkbacks(4)
        write_message("Completed to detect and disable broken linkbacks")
    elif mode == 6:
        write_message("Starting to send notification email")
        send_pending_linkbacks_notification(CFG_WEBLINKBACK_TYPE['TRACKBACK'])
        write_message("Completed to send notification email")
コード例 #4
0
    def test_delete_linkbacks_on_blacklist(self):
        """weblinkback - test delete linkbacks on blacklist"""
        for linkbackid in (1, 2, 3, 4):
            approve_linkback(linkbackid + self._max_id_lnkENTRY, self.user_info)
        for linkbackid in (5, 6):
            reject_linkback(linkbackid + self._max_id_lnkENTRY, self.user_info)

        add_url_to_list('RL1', CFG_WEBLINKBACK_LIST_TYPE['BLACKLIST'], self.user_info)
        add_url_to_list('URL5', CFG_WEBLINKBACK_LIST_TYPE['BLACKLIST'], self.user_info)
        add_url_to_list('RL7', CFG_WEBLINKBACK_LIST_TYPE['BLACKLIST'], self.user_info)
        set_url_broken('URL1')
        entry_table = self.get_all_from_table('lnkENTRY')
        self.assertEqual(CFG_WEBLINKBACK_STATUS['BROKEN'], entry_table[0][5])
        self.assertEqual(CFG_WEBLINKBACK_STATUS['BROKEN'], entry_table[8][5])
        self.assertEqual(9, len(self.get_all_from_table("lnkENTRY")))
        self.assertEqual(17, len(self.get_all_from_table("lnkENTRYLOG")))
        self.assertEqual(20, len(self.get_all_from_table("lnkLOG")))

        delete_linkbacks_on_blacklist()
        self.assertEqual(5, len(self.get_all_from_table("lnkENTRY")))
        self.assertEqual(9, len(self.get_all_from_table("lnkENTRYLOG")))
        self.assertEqual(12, len(self.get_all_from_table("lnkLOG")))
コード例 #5
0
def bst_weblinkback_updater(mode):
    """
    Update linkbacks
    @param mode: 1 delete rejected, broken and pending linkbacks whose URLs is on blacklist
                 2 update page titles of new linkbacks
                 3 update page titles of old linkbacks
                 4 update manually set page titles
                 5 detect and disable broken linkbacks
                 6 send notification email for all pending linkbacks
    @type mode: int
    """
    mode = int(mode)
    if mode == 1:
        write_message("Starting to delete rejected and pending linkbacks URLs on blacklist")
        delete_linkbacks_on_blacklist()
        write_message("Completed to delete rejected and pending linkbacks URLs on blacklist")
    elif mode == 2:
        write_message("Starting to update the page titles of new linkbacks")
        update_linkbacks(1)
        write_message("Completed to update the page titles of new linkbacks")
    elif mode == 3:
        write_message("Starting to update the page titles of old linkbacks")
        update_linkbacks(2)
        write_message("Completed to update the page titles of old linkbacks")
    elif mode == 4:
        write_message("Starting to update manually set page titles")
        update_linkbacks(3)
        write_message("Completed to update manually set page titles")
    elif mode == 5:
        write_message("Starting to detect and disable broken linkbacks")
        update_linkbacks(4)
        write_message("Completed to detect and disable broken linkbacks")
    elif mode == 6:
        write_message("Starting to send notification email")
        send_pending_linkbacks_notification(CFG_WEBLINKBACK_TYPE["TRACKBACK"])
        write_message("Completed to send notification email")