From e6eada3811664bcaebb046dfed2c35c7eacb0159 Mon Sep 17 00:00:00 2001 From: Jonas Bengtsson Date: Sun, 18 Apr 2021 22:20:17 +0200 Subject: [PATCH] Add support for phpMyAdmin 5.1 --- phpmyadmin_sql_backup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpmyadmin_sql_backup.py b/phpmyadmin_sql_backup.py index fc99b25..e67da43 100644 --- a/phpmyadmin_sql_backup.py +++ b/phpmyadmin_sql_backup.py @@ -38,7 +38,7 @@ def is_login_successful(g): - return g.doc.text_search("frame_content") or g.doc.text_search("server_export.php") + return any(g.doc.text_search(s) for s in ["frame_content", "server_export.php", "index.php?route=/server/export"]) def open_frame_if_phpmyadmin_3(g): @@ -70,7 +70,11 @@ def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=F open_frame_if_phpmyadmin_3(g) - export_url = g.doc.select("id('topmenu')//a[contains(@href,'server_export.php')]/@href").text() + old_export_url_selector = g.doc.select("id('topmenu')//a[contains(@href,'server_export.php')]/@href") + if old_export_url_selector.exists(): + export_url = old_export_url_selector.text() + else: + export_url = g.doc.select("id('topmenu')//a[contains(@href,'index.php?route=/server/export')]/@href").text() g.go(export_url) dbs_available = [option.attrib['value'] for option in g.doc.form.inputs['db_select[]']]