[Phpmyadmin-devel] repeated code in Version check

Michal Čihař michal at cihar.com
Tue Jul 30 09:15:34 CEST 2013


Hi

Dne Mon, 29 Jul 2013 21:49:22 +0200
Mohamed Ashraf <mohamed.ashraf.213 at gmail.com> napsal(a):

> I pulled master lately and I found that Michal Čihař has refactored
> the code that requests the latest version info. I needed to update a
> few things specifically with the renaming of the proxy variable names.
> 
> Anyway I noticed a strange piece of code in the function:
> 
>         if ($save) {
>             $_SESSION['cache']['version_check'] = array(
>                 'response' => $response,
>                 'timestamp' => time()
>             );
>         }
> 
>         $data = json_decode($response);
>         if (is_object($data)
>             && strlen($data->version)
>             && strlen($data->date)
>         ) {
>             if ($save) {
>                 $_SESSION['cache']['version_check'] = array(
>                     'response' => $response,
>                     'timestamp' => time()
>                 );
>             }
>         }
> 
> why is the part that saves the response in the cache written twice in
> succession. I looked at the commit in question dcd8d12cf6c4a345 and
> noticed that the first repetition did not exist in the original code.
> 
> I think that the first repetition should be removed but I thought I
> should run it by you first

Thanks for spotting this, I've fixed it in 7dc178c

-- 
	Michal Čihař | http://cihar.com | http://blog.cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20130730/31d3f8bf/attachment.sig>


More information about the Developers mailing list