Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6173dbe

Browse files
committed
Add support for PHPMyAdmin 3
PHPMyAdmin 3 uses frames. The content frame has to be opened before we can go to the export page.
1 parent 9d222d7 commit 6173dbe

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

‎phpmyadmin_sql_backup.py‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
DEFAULT_PREFIX_FORMAT = r'%Y-%m-%d--%H-%M-%S-UTC_'
3838

3939

40+
def is_login_successful(g):
41+
return g.doc.text_search("frame_content") or g.doc.text_search("server_export.php")
42+
43+
44+
def open_frame_if_phpmyadmin_3(g):
45+
frame_url_selector = g.doc.select("id('frame_content')/@src")
46+
if frame_url_selector.exists():
47+
g.go(frame_url_selector.text())
48+
49+
4050
def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=False, prepend_date=True, basename=None,
4151
output_directory=os.getcwd(), exclude_dbs=None, compression='none', prefix_format=None,
4252
timeout=60, http_auth=None):
@@ -53,10 +63,11 @@ def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=F
5363
g.doc.set_input_by_id('input_password', password)
5464
g.submit()
5565

56-
try:
57-
g.doc.text_assert('server_export.php')
58-
except Exception as e:
66+
if not is_login_successful(g):
5967
raise ValueError('Could not login - did you provide the correct username / password? ({})'.format(e))
68+
69+
open_frame_if_phpmyadmin_3(g)
70+
6071
export_url = g.doc.select("id('topmenu')//a[contains(@href,'server_export.php')]/@href").text()
6172
g.go(export_url)
6273

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /