Add clean
This commit is contained in:
parent
8bdaea3910
commit
d18f4e1579
@ -12,7 +12,7 @@ from lib.WPRemove import WPRemove
|
|||||||
|
|
||||||
def remove(args, basic, logger):
|
def remove(args, basic, logger):
|
||||||
removeWp = WPRemove(basic=basic, wordpress="", logger=logger)
|
removeWp = WPRemove(basic=basic, wordpress="", logger=logger)
|
||||||
if args.remove:
|
if args.remove == True:
|
||||||
for i in args.wordpress.split(","):
|
for i in args.wordpress.split(","):
|
||||||
removeWp.setUrl(i)
|
removeWp.setUrl(i)
|
||||||
removeWp.cleanPosts()
|
removeWp.cleanPosts()
|
||||||
@ -22,13 +22,13 @@ def remove(args, basic, logger):
|
|||||||
else:
|
else:
|
||||||
for i in args.wordpress.split(","):
|
for i in args.wordpress.split(","):
|
||||||
removeWp.setUrl(i)
|
removeWp.setUrl(i)
|
||||||
if args.posts:
|
if args.posts == True:
|
||||||
removeWp.cleanPosts()
|
removeWp.cleanPosts()
|
||||||
if args.categories:
|
if args.categories == True:
|
||||||
removeWp.cleanCategories()
|
removeWp.cleanCategories()
|
||||||
if args.tags:
|
if args.tags == True:
|
||||||
removeWp.cleanTags()
|
removeWp.cleanTags()
|
||||||
if args.media:
|
if args.media == True:
|
||||||
removeWp.cleanMedia()
|
removeWp.cleanMedia()
|
||||||
del removeWp
|
del removeWp
|
||||||
|
|
||||||
@ -136,10 +136,10 @@ if __name__ == '__main__':
|
|||||||
import_parser.add_argument("--wordpress", help="URL Wordpress", required=True)
|
import_parser.add_argument("--wordpress", help="URL Wordpress", required=True)
|
||||||
import_parser.add_argument("--serial", help="Serial execution", action="store_true")
|
import_parser.add_argument("--serial", help="Serial execution", action="store_true")
|
||||||
import_parser.add_argument("--remove-all", dest="remove", help="Remove all", action="store_true")
|
import_parser.add_argument("--remove-all", dest="remove", help="Remove all", action="store_true")
|
||||||
remove_parser.add_argument("--remove-posts", help="Remove all posts", dest="posts", action="store_true")
|
import_parser.add_argument("--remove-posts", help="Remove all posts", dest="posts", action="store_true")
|
||||||
remove_parser.add_argument("--remove-categories", help="Remove all categories", dest="categories", action="store_true")
|
import_parser.add_argument("--remove-categories", help="Remove all categories", dest="categories", action="store_true")
|
||||||
remove_parser.add_argument("--remove-tags", help="Remove all tags", dest="tags", action="store_true")
|
import_parser.add_argument("--remove-tags", help="Remove all tags", dest="tags", action="store_true")
|
||||||
remove_parser.add_argument("--remove-media", help="Remove all media", dest="media", action="store_true")
|
import_parser.add_argument("--remove-media", help="Remove all media", dest="media", action="store_true")
|
||||||
|
|
||||||
|
|
||||||
remove_parser = subparsers.add_parser("remove")
|
remove_parser = subparsers.add_parser("remove")
|
||||||
@ -193,7 +193,7 @@ if __name__ == '__main__':
|
|||||||
fileHandler.setFormatter(formatter)
|
fileHandler.setFormatter(formatter)
|
||||||
logger.addHandler(fileHandler)
|
logger.addHandler(fileHandler)
|
||||||
|
|
||||||
if args.command == "import":
|
if args.command == "import" or args.command == "remove":
|
||||||
password = args.password
|
password = args.password
|
||||||
if len(args.password) == 0:
|
if len(args.password) == 0:
|
||||||
password = getpass()
|
password = getpass()
|
||||||
@ -202,6 +202,7 @@ if __name__ == '__main__':
|
|||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
basic = HTTPBasicAuth(args.user, password)
|
basic = HTTPBasicAuth(args.user, password)
|
||||||
|
if args.command == "import":
|
||||||
wordpress = args.wordpress.split(",")
|
wordpress = args.wordpress.split(",")
|
||||||
importWp = WPimport(basic=basic, wordpress="", logger=logger, parser=args.parser)
|
importWp = WPimport(basic=basic, wordpress="", logger=logger, parser=args.parser)
|
||||||
if len(args.file) > 0:
|
if len(args.file) > 0:
|
||||||
@ -261,16 +262,9 @@ if __name__ == '__main__':
|
|||||||
]
|
]
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error("Threading error : {0}".format(err))
|
logger.error("Threading error : {0}".format(err))
|
||||||
|
exit(0)
|
||||||
|
|
||||||
if args.command == "remove":
|
|
||||||
password = args.password
|
if args.command == "remove":
|
||||||
if len(args.password) == 0:
|
remove(args, basic, logger)
|
||||||
password = getpass()
|
|
||||||
if len(password) == 0:
|
|
||||||
logger.error("No password error !!! ")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
basic = HTTPBasicAuth(args.user, password)
|
|
||||||
remove(args, basic, logger)
|
|
||||||
exit(0)
|
exit(0)
|
Loading…
x
Reference in New Issue
Block a user