public function on_load_bundle($pars)
{
$pars['id'] = $this->stripFileName($pars['id']);
$host_os = isset($pars['host_os']) ? $pars['host_os'] : (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'intosh') ? 'Mac' : 'Windows');
if (!in_array($host_os, array('Mac', 'Windows'))) {
$host_os = 'Windows';
}
$cached_file = $this->configuration['support-path'] . '/cached/bundle_' . $pars['id'] . '_' . $host_os . '.ser';
$bundle_last_modified = filectime($this->configuration['support-path'] . '/bundles/' . $pars['id'] . '/info.amBundle');
$bundle_dump = null;
if (file_exists($cached_file)) {
$bundle_cache = @unserialize(@file_get_contents($cached_file));
if (is_array($bundle_cache['bundle']) && $bundle_cache['time'] == $bundle_last_modified) {
$bundle_dump = $bundle_cache['bundle'];
}
}
if (null == $bundle_dump) {
$bundle = new AMYBundle($this->configuration['support-path'], $pars['id'], $host_os);
$bundle_dump = $bundle->dumpDefinition();
file_put_contents($cached_file, @serialize(array('time' => $bundle_last_modified, 'bundle' => $bundle_dump)));
}
self::setResult($bundle_dump);
}