Permalink
Browse files

Remove unnecessary cache (this operation is not expensive, and only r…

…un once per dynamic_load)
  • Loading branch information...
flack committed Jan 7, 2019
1 parent 5ce29f8 commit e07044c8746dfe7f2322ab889aff686b2d2a6c11
Showing with 4 additions and 11 deletions.
  1. +4 −11 lib/midcom/core/service/implementation/urlparsertopic.php
@@ -25,24 +25,17 @@ class midcom_core_service_implementation_urlparsertopic implements midcom_core_s
public function tokenize($url)
{
static $tokenized = [];
$original_url = $url;
if (isset($tokenized[$original_url])) {
return $tokenized[$original_url];
}
$tokenized[$original_url] = [];
$tokenized = [];
if (strlen(midcom_connection::get_url('prefix')) > 1) {
// FIXME: Replace only the first instance, there might be others matching the same string
$url = str_replace(midcom_connection::get_url('prefix') . "/", '/', $url);
$url = preg_replace(preg_quote(midcom_connection::get_url('prefix') . '/'), '/', $url, 1);
}
$url = trim($url, '/');
if ($url != '') {
$argv_tmp = explode('/', $url);
$tokenized[$original_url] = array_filter($argv_tmp);
$tokenized = array_filter($argv_tmp);
}
return $tokenized[$original_url];
return $tokenized;
}
/**

0 comments on commit e07044c

Please sign in to comment.