configM4Exists() public static method

One extension directory might contains multiple config*.m4 file, like memcache extension.
public static configM4Exists ( $extensionDir )
Example #1
0
 public function execute()
 {
     $buildDir = Config::getCurrentBuildDir();
     $extDir = $buildDir . DIRECTORY_SEPARATOR . 'ext';
     // list for extensions which are not enabled
     $extensions = array();
     $extensionNames = array();
     // some extension source not in root directory
     $lookupDirectories = array('', 'ext', 'extension');
     if (file_exists($extDir) && is_dir($extDir)) {
         $this->logger->debug("Scanning {$extDir}...");
         foreach (scandir($extDir) as $extName) {
             if ($extName == "." || $extName == "..") {
                 continue;
             }
             $dir = $extDir . DIRECTORY_SEPARATOR . $extName;
             foreach ($lookupDirectories as $lookupDirectory) {
                 $extensionDir = $dir . (empty($lookupDirectory) ? '' : DIRECTORY_SEPARATOR . $lookupDirectory);
                 if ($m4files = ExtensionFactory::configM4Exists($extensionDir)) {
                     $this->logger->debug("Loading extension information {$extName} from {$extensionDir}");
                     foreach ($m4files as $m4file) {
                         try {
                             $ext = ExtensionFactory::createM4Extension($extName, $m4file);
                             // $ext = ExtensionFactory::createFromDirectory($extName, $dir);
                             $extensions[$ext->getExtensionName()] = $ext;
                             $extensionNames[] = $extName;
                             break;
                         } catch (Exception $e) {
                         }
                     }
                     break;
                 }
             }
         }
     }
     $this->logger->info('Loaded extensions:');
     foreach ($extensions as $extName => $ext) {
         if (extension_loaded($extName)) {
             $this->describeExtension($ext);
         }
     }
     $this->logger->info('Available local extensions:');
     foreach ($extensions as $extName => $ext) {
         if (extension_loaded($extName)) {
             continue;
         }
         $this->describeExtension($ext);
     }
 }