return defined( 'HHVM_VERSION' );
}
+/**
+ * Check if we are running from the commandline
+ *
+ * @since 1.31
+ * @return bool
+ */
+function wfIsCLI() {
+ return PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg';
+}
+
/**
* Tries to get the system directory for temporary files. First
* $wgTmpDirectory is checked, and then the TMPDIR, TMP, and TEMP
* Find a file.
* Shortcut for RepoGroup::singleton()->findFile()
*
- * @param string $title String or Title object
+ * @param string|Title $title String or Title object
* @param array $options Associative array of options (see RepoGroup::findFile)
* @return File|bool File, or false if the file does not exist
*/
$ifWritesSince = null, $wiki = false, $cluster = false, $timeout = null
) {
if ( $timeout === null ) {
- $timeout = ( PHP_SAPI === 'cli' ) ? 86400 : 10;
+ $timeout = wfIsCLI() ? 86400 : 10;
}
if ( $cluster === '*' ) {