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