Skip to content

Commit

Permalink
Fix repetitive filesystem access / checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ggppdk committed Sep 6, 2017
1 parent 333d326 commit 85293f1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions administrator/components/com_fields/libraries/fieldsplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ abstract class FieldsPlugin extends JPlugin
*/
public function onCustomFieldsGetTypes()
{
// Cache filesystem access / checks
static $types_cache = array();

if (isset($types_cache[$this->_type][$this->_name]))
{
return $types_cache[$this->_type][$this->_name];
}

$types = array();

// The root of the plugin
Expand Down Expand Up @@ -84,6 +92,9 @@ public function onCustomFieldsGetTypes()
$types[] = $data;
}

// Add to cache
$types_cache[$this->_type][$this->_name] = $types;

// Return the data
return $types;
}
Expand Down

0 comments on commit 85293f1

Please sign in to comment.