From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/Init.php | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'includes/Init.php') diff --git a/includes/Init.php b/includes/Init.php index de867282..72c10543 100644 --- a/includes/Init.php +++ b/includes/Init.php @@ -23,7 +23,7 @@ class MWInit { } /** - * Returns true if we are running under HipHop, whether in compiled or + * Returns true if we are running under HipHop, whether in compiled or * interpreted mode. * * @return bool @@ -47,10 +47,10 @@ class MWInit { } /** - * If we are running code compiled by HipHop, this will pass through the - * input path, assumed to be relative to $IP. If the code is interpreted, - * it will converted to a fully qualified path. It is necessary to use a - * path which is relative to $IP in order to make HipHop use its compiled + * If we are running code compiled by HipHop, this will pass through the + * input path, assumed to be relative to $IP. If the code is interpreted, + * it will converted to a fully qualified path. It is necessary to use a + * path which is relative to $IP in order to make HipHop use its compiled * code. * * @param $file string @@ -94,7 +94,7 @@ class MWInit { } /** - * Register an extension setup file and return its path for compiled + * Register an extension setup file and return its path for compiled * inclusion. Use this function in LocalSettings.php to add extensions * to the build. For example: * @@ -130,13 +130,13 @@ class MWInit { /** * Determine whether a class exists, using a method which works under HipHop. * - * Note that it's not possible to implement this with any variant of - * class_exists(), because class_exists() returns false for classes which - * are compiled in. + * Note that it's not possible to implement this with any variant of + * class_exists(), because class_exists() returns false for classes which + * are compiled in. * - * Calling class_exists() on a literal string causes the class to be made - * "volatile", which means (as of March 2011) that the class is broken and - * can't be used at all. So don't do that. See + * Calling class_exists() on a literal string causes the class to be made + * "volatile", which means (as of March 2011) that the class is broken and + * can't be used at all. So don't do that. See * https://github.com/facebook/hiphop-php/issues/314 * * @param $class string @@ -153,11 +153,32 @@ class MWInit { } /** - * Determine whether a function exists, using a method which works under + * Determine wether a method exists within a class, using a method which works + * under HipHop. + * + * Note that under HipHop when method_exists is given a string for it's class + * such as to test for a static method has the same issues as class_exists does. + * + * @param $class string + * @param $method string + * + * @return bool + */ + static function methodExists( $class, $method ) { + try { + $r = new ReflectionMethod( $class, $method ); + } catch( ReflectionException $r ) { + $r = false; + } + return $r !== false; + } + + /** + * Determine whether a function exists, using a method which works under * HipHop. * * @param $function string - * + * * @return bool */ static function functionExists( $function ) { -- cgit v1.2.2