From 4eaa77af51274b8b2d009feb0365031d64a3aee2 Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Sun, 20 Jan 2013 14:00:21 +0100 Subject: [PATCH 1/2] Gracefully fail in case of remote error Currently if the request for remote pages is a success but the one for media fails, then we have the error message "Failed to fetch remote file list" but the list of pages is displayed, and (if php warnings are enabled) we then have Warning: Invalid argument supplied for foreach() in sync/admin.php on line 546 It's therefore not quite clear for the user if it's a success or a failure (and in particular if he can go on) The goal of this patch is to keep only the "failed to fetch ..." error message --- admin.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin.php b/admin.php index 6a724e5..c07d68a 100644 --- a/admin.php +++ b/admin.php @@ -156,6 +156,11 @@ function html() { $media = $this->_getSyncList('media'); } } + + if ( $pages === false || $media === false ){ + return; + } + if(count($pages) || count($media)){ $this->_directionFormStart($lnow,$rnow); if(count($pages)) From 3161720b18b9164ff7718c739d9c2f0e971f2089 Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Sun, 20 Jan 2013 18:51:58 +0100 Subject: [PATCH 2/2] No need to fetch images if we've already failed --- admin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin.php b/admin.php index c07d68a..8831550 100644 --- a/admin.php +++ b/admin.php @@ -151,8 +151,9 @@ function html() { $this->profiles[$this->profno]['type'] == 1){ $pages = $this->_getSyncList('pages'); } - if($this->profiles[$this->profno]['type'] == 0 || - $this->profiles[$this->profno]['type'] == 2){ + if(($this->profiles[$this->profno]['type'] == 0 || + $this->profiles[$this->profno]['type'] == 2) + && $pages !== false ){ $media = $this->_getSyncList('media'); } }