Beispiel #1
0
 public function autoloadXml($path)
 {
     // TODO: This method is called too frequently. It should only be called when something is actually missing from in-memory
     // otherwise we are wasting cycles and string comparisons
     $paths = (array) $path;
     $freeswitch_filemap = kohana::config('freeswitch.filemap');
     foreach ($paths as $path) {
         foreach ($freeswitch_filemap as $key => $options) {
             if (isset($options['filename'])) {
                 if (strpos($path, $options['query']) !== FALSE) {
                     // See if this is already in memory
                     if (!isset($this->sectionsUsed[$key])) {
                         Event::run('freeswitch.autoloadxml', $options);
                         $this->sectionsUsed[$key] = TRUE;
                         Kohana::log('debug', 'FreeSWITCH -> For query ' . $path . ' we\'re loading ' . $options['filename']);
                         Telephony::load($options);
                         $freeswitch_filemap[$key] = $options;
                     }
                 }
             }
         }
     }
     kohana::config_set('freeswitch.filemap', $freeswitch_filemap);
 }