2011-04-04 14:40:36 +00:00
|
|
|
<?php
|
2012-05-12 20:33:02 +00:00
|
|
|
/**
|
|
|
|
|
* Some functions that are useful during startup.
|
|
|
|
|
*
|
2013-05-08 06:48:56 +00:00
|
|
|
* This class previously contained some functionality related to a PHP compiler
|
|
|
|
|
* called hphpc. That compiler has now been discontinued.
|
|
|
|
|
*
|
2012-05-12 20:33:02 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
*/
|
2011-04-04 14:40:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Some functions that are useful during startup.
|
2013-05-08 06:48:56 +00:00
|
|
|
*
|
|
|
|
|
* This class previously contained some functionality related to a PHP compiler
|
|
|
|
|
* called hphpc. That compiler has now been discontinued. All methods are now
|
|
|
|
|
* deprecated.
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
class MWInit {
|
2014-05-11 15:32:18 +00:00
|
|
|
private static $compilerVersion;
|
2011-04-04 14:40:36 +00:00
|
|
|
|
|
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* @deprecated since 1.22
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
static function getCompilerVersion() {
|
2013-05-08 06:48:56 +00:00
|
|
|
return false;
|
2011-04-04 14:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2011-09-04 21:40:17 +00:00
|
|
|
* Returns true if we are running under HipHop, whether in compiled or
|
2011-04-04 14:40:36 +00:00
|
|
|
* interpreted mode.
|
2011-05-28 18:59:42 +00:00
|
|
|
*
|
2013-05-08 06:48:56 +00:00
|
|
|
* @deprecated since 1.22
|
2011-05-28 18:59:42 +00:00
|
|
|
* @return bool
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
static function isHipHop() {
|
2013-10-29 22:23:30 +00:00
|
|
|
return wfIsHHVM();
|
2011-04-04 14:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* Get a fully-qualified path for a source file relative to $IP.
|
|
|
|
|
* @deprecated since 1.22
|
2011-05-28 18:59:42 +00:00
|
|
|
*
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $file
|
2011-05-28 18:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @return string
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
static function interpretedPath( $file ) {
|
|
|
|
|
global $IP;
|
|
|
|
|
return "$IP/$file";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* @deprecated since 1.22
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $file
|
2011-05-28 18:59:42 +00:00
|
|
|
* @return string
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
static function compiledPath( $file ) {
|
|
|
|
|
global $IP;
|
2013-05-08 06:48:56 +00:00
|
|
|
return "$IP/$file";
|
2011-05-30 13:49:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* @deprecated since 1.22
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $file
|
2011-06-16 23:40:13 +00:00
|
|
|
* @return string
|
2011-05-30 13:49:09 +00:00
|
|
|
*/
|
|
|
|
|
static function extCompiledPath( $file ) {
|
2013-05-08 06:48:56 +00:00
|
|
|
return false;
|
2011-05-30 13:49:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* Deprecated wrapper for class_exists()
|
|
|
|
|
* @deprecated since 1.22
|
2011-05-28 18:59:42 +00:00
|
|
|
*
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $class
|
2011-05-28 18:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @return bool
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
static function classExists( $class ) {
|
2013-05-08 06:48:56 +00:00
|
|
|
return class_exists( $class );
|
2011-04-04 14:40:36 +00:00
|
|
|
}
|
|
|
|
|
|
2012-01-09 13:45:34 +00:00
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* Deprecated wrapper for method_exists()
|
|
|
|
|
* @deprecated since 1.22
|
2012-01-09 13:45:34 +00:00
|
|
|
*
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $class
|
|
|
|
|
* @param string $method
|
2012-01-09 13:45:34 +00:00
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
static function methodExists( $class, $method ) {
|
2013-05-08 06:48:56 +00:00
|
|
|
return method_exists( $class, $method );
|
2012-01-09 13:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
2011-04-04 14:40:36 +00:00
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* Deprecated wrapper for function_exists()
|
|
|
|
|
* @deprecated since 1.22
|
2011-05-28 18:59:42 +00:00
|
|
|
*
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $function
|
2011-09-04 21:40:17 +00:00
|
|
|
*
|
2011-05-28 18:59:42 +00:00
|
|
|
* @return bool
|
2011-04-04 14:40:36 +00:00
|
|
|
*/
|
|
|
|
|
static function functionExists( $function ) {
|
2013-05-08 06:48:56 +00:00
|
|
|
return function_exists( $function );
|
2011-04-04 14:40:36 +00:00
|
|
|
}
|
2011-05-27 06:25:21 +00:00
|
|
|
|
|
|
|
|
/**
|
2013-05-08 06:48:56 +00:00
|
|
|
* Deprecated wrapper for call_user_func_array()
|
|
|
|
|
* @deprecated since 1.22
|
|
|
|
|
*
|
2014-04-20 19:16:57 +00:00
|
|
|
* @param string $className
|
|
|
|
|
* @param string $methodName
|
|
|
|
|
* @param array $args
|
2011-06-16 23:40:13 +00:00
|
|
|
*
|
2012-02-09 21:35:05 +00:00
|
|
|
* @return mixed
|
2011-05-27 06:25:21 +00:00
|
|
|
*/
|
|
|
|
|
static function callStaticMethod( $className, $methodName, $args ) {
|
2013-05-08 06:48:56 +00:00
|
|
|
return call_user_func_array( array( $className, $methodName ), $args );
|
2011-05-27 06:25:21 +00:00
|
|
|
}
|
2011-04-04 14:40:36 +00:00
|
|
|
}
|