]> git.joonet.de Git - adminer.git/commitdiff
Preserve short variable names between versions if possible
authorJakub Vrana <jakub@vrana.cz>
Tue, 9 Aug 2011 08:22:14 +0000 (10:22 +0200)
committerJakub Vrana <jakub@vrana.cz>
Tue, 9 Aug 2011 08:22:14 +0000 (10:22 +0200)
compile.php

index 1293ef3de2479144a8d140c1054b43e7655736f6..e6339ccd386c71caae181c2417453b6b0d06b4eb 100644 (file)
@@ -115,8 +115,14 @@ function php_shrink($input) {
        }
        
        arsort($short_variables);
+       $chars = implode(range('a', 'z')) . '_' . implode(range('A', 'Z'));
+       // preserve variable names between versions if possible
+       $short_variables2 = array_splice($short_variables, strlen($chars));
+       ksort($short_variables);
+       ksort($short_variables2);
+       $short_variables += $short_variables2;
        foreach (array_keys($short_variables) as $number => $key) {
-               $short_variables[$key] = short_identifier($number, implode(range('a', 'z')) . '_' . implode(range('A', 'Z'))); // could use also numbers and \x7f-\xff
+               $short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
        }
        
        $set = array_flip(preg_split('//', '!"#$&\'()*+,-./:;<=>?@[\]^`{|}'));