Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-27120: Cache dirname transformations in progressive_parser::dirname

  • Loading branch information...
commit 066af1bbc78564222a5c69e13fe167d3c1ee35b9 1 parent 28729e2
Tony Levi tlevi authored rajeshtaneja committed
Showing with 9 additions and 1 deletion.
  1. +9 −1 backup/util/xml/parser/progressive_parser.class.php
10 backup/util/xml/parser/progressive_parser.class.php
View
@@ -149,7 +149,15 @@ public function process() {
* handling parser paths, see MDL-24381
*/
public static function dirname($path) {
- return str_replace('\\', '/', dirname($path));
+ static $cache = array();
+
+ if (!isset($cache[$path])) {
+ if (count($cache) > 4096)
+ $cache = array();
+ $cache[$path] = str_replace('\\', '/', dirname($path));
+ }
+
+ return $cache[$path];
}
// Protected API starts here
Please sign in to comment.
Something went wrong with that request. Please try again.