Merge "registration: Only allow one extension to set a specific config setting"
[lhc/web/wiklou.git] / includes / registration / ExtensionRegistry.php
index eac04a9..740fed4 100644 (file)
@@ -319,7 +319,9 @@ class ExtensionRegistry {
                        define( $name, $val );
                }
                foreach ( $info['autoloaderPaths'] as $path ) {
-                       require_once $path;
+                       if ( file_exists( $path ) ) {
+                               require_once $path;
+                       }
                }
 
                $this->loaded += $info['credits'];
@@ -332,6 +334,12 @@ class ExtensionRegistry {
                }
 
                foreach ( $info['callbacks'] as $name => $cb ) {
+                       if ( !is_callable( $cb ) ) {
+                               if ( is_array( $cb ) ) {
+                                       $cb = '[ ' . implode( ', ', $cb ) . ' ]';
+                               }
+                               throw new UnexpectedValueException( "callback '$cb' is not callable" );
+                       }
                        call_user_func( $cb, $info['credits'][$name] );
                }
        }