diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2010-02-26 09:06:04 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2010-02-26 09:35:24 (GMT) |
commit | 7f6dd863a0410ca0361d16340fcf9e529c655c18 (patch) | |
tree | d54657f05e81997830c2c9633f30f715827ac7d2 | |
parent | 3d912c085949e8d250da311973bf42db6cd2777f (diff) |
Rrturn current sugar versions for "All versions" search
-rw-r--r-- | site/app/models/version.php | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/site/app/models/version.php b/site/app/models/version.php index 8d8054d..396124f 100644 --- a/site/app/models/version.php +++ b/site/app/models/version.php @@ -137,10 +137,8 @@ class Version extends AppModel if (!is_array($status)) $status = array($status); $status_sql = implode(',',$status); - $sp = null; - if (isset($app_ver)) - if ($app_ver != 'any') - $sp = $app_ver; + if (isset($app_ver) && $app_ver != 'any') + $sp = $app_ver; else { if (preg_match('/OLPC\/0\.([^-]*)-/', env('HTTP_USER_AGENT'), $matches)) { if (floatval($matches[1]) <= 4.6) @@ -170,14 +168,8 @@ class Version extends AppModel appversions as C ON C.id = A.max WHERE Version.addon_id = {$id} - ORDER BY"; - if (isset($sp)) - $sql .= " - IF({$sp} AND ({$sp} < CAST(B.version AS DECIMAL(3,3)) OR {$sp} > CAST(C.version AS DECIMAL(3,3))), 1, 1000000) + CAST(Version.version AS DECIMAL) DESC"; - else - $sql .= " - Version.created DESC"; - $sql .= " + ORDER BY + IF({$sp} AND ({$sp} < CAST(B.version AS DECIMAL(3,3)) OR {$sp} > CAST(C.version AS DECIMAL(3,3))), 1, 1000000) + CAST(Version.version AS DECIMAL) DESC LIMIT 1 "; |