• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfIsHHVM函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfIsHHVM函数的典型用法代码示例。如果您正苦于以下问题:PHP wfIsHHVM函数的具体用法?PHP wfIsHHVM怎么用?PHP wfIsHHVM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wfIsHHVM函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: newInstance

 /**
  * @since 1.21
  * @deprecated 1.25 Construct a SiteStore instance directly instead.
  *
  * @param ORMTable|null $sitesTable
  * @param BagOStuff|null $cache
  *
  * @return SiteStore
  */
 public static function newInstance(ORMTable $sitesTable = null, BagOStuff $cache = null)
 {
     if ($cache === null) {
         $cache = wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING);
     }
     $siteStore = new DBSiteStore();
     return new static($siteStore, $cache);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:17,代码来源:SiteSQLStore.php


示例2: isEnabled

 /**
  * Returns true if uploads are enabled.
  * Can be override by subclasses.
  * @return bool
  */
 public static function isEnabled()
 {
     global $wgEnableUploads;
     if (!$wgEnableUploads) {
         return false;
     }
     # Check php's file_uploads setting
     return wfIsHHVM() || wfIniGetBool('file_uploads');
 }
开发者ID:pirater,项目名称:mediawiki,代码行数:14,代码来源:UploadBase.php


示例3: __construct

 /**
  * Determine if there is a usable tidy.
  */
 public function __construct($useConfiguration = false)
 {
     global $IP, $wgUseTidy, $wgTidyBin, $wgTidyInternal, $wgTidyConfig, $wgTidyConf, $wgTidyOpts;
     $this->enabled = true;
     if ($useConfiguration) {
         if ($wgTidyConfig !== null) {
             $this->config = $wgTidyConfig;
         } elseif ($wgUseTidy) {
             $this->config = ['tidyConfigFile' => $wgTidyConf, 'debugComment' => false, 'tidyBin' => $wgTidyBin, 'tidyCommandLine' => $wgTidyOpts];
             if ($wgTidyInternal) {
                 $this->config['driver'] = wfIsHHVM() ? 'RaggettInternalHHVM' : 'RaggettInternalPHP';
             } else {
                 $this->config['driver'] = 'RaggettExternal';
             }
         } else {
             $this->enabled = false;
         }
     } else {
         $this->config = ['tidyConfigFile' => "{$IP}/includes/tidy/tidy.conf", 'tidyCommandLine' => ''];
         if (extension_loaded('tidy') && class_exists('tidy')) {
             $this->config['driver'] = wfIsHHVM() ? 'RaggettInternalHHVM' : 'RaggettInternalPHP';
         } else {
             if (is_executable($wgTidyBin)) {
                 $this->config['driver'] = 'RaggettExternal';
                 $this->config['tidyBin'] = $wgTidyBin;
             } else {
                 $path = Installer::locateExecutableInDefaultPaths($wgTidyBin);
                 if ($path !== false) {
                     $this->config['driver'] = 'RaggettExternal';
                     $this->config['tidyBin'] = $wgTidyBin;
                 } else {
                     $this->enabled = false;
                 }
             }
         }
     }
     if (!$this->enabled) {
         $this->config = ['driver' => 'disabled'];
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:43,代码来源:TidySupport.php


示例4: singleton

 protected static function singleton()
 {
     global $wgUseTidy, $wgTidyInternal, $wgTidyConf, $wgDebugTidy, $wgTidyConfig, $wgTidyBin, $wgTidyOpts;
     if (self::$instance === null) {
         if ($wgTidyConfig !== null) {
             $config = $wgTidyConfig;
         } elseif ($wgUseTidy) {
             // b/c configuration
             $config = array('tidyConfigFile' => $wgTidyConf, 'debugComment' => $wgDebugTidy, 'tidyBin' => $wgTidyBin, 'tidyCommandLine' => $wgTidyOpts);
             if ($wgTidyInternal) {
                 if (wfIsHHVM()) {
                     $config['driver'] = 'RaggettInternalHHVM';
                 } else {
                     $config['driver'] = 'RaggettInternalPHP';
                 }
             } else {
                 $config['driver'] = 'RaggettExternal';
             }
         } else {
             return false;
         }
         switch ($config['driver']) {
             case 'RaggettInternalHHVM':
                 self::$instance = new MediaWiki\Tidy\RaggettInternalHHVM($config);
                 break;
             case 'RaggettInternalPHP':
                 self::$instance = new MediaWiki\Tidy\RaggettInternalPHP($config);
                 break;
             case 'RaggettExternal':
                 self::$instance = new MediaWiki\Tidy\RaggettExternal($config);
                 break;
             case 'Html5Depurate':
                 self::$instance = new MediaWiki\Tidy\Html5Depurate($config);
                 break;
             default:
                 throw new MWException("Invalid tidy driver: \"{$config['driver']}\"");
         }
     }
     return self::$instance;
 }
开发者ID:ngertrudiz,项目名称:mediawiki,代码行数:40,代码来源:MWTidy.php


示例5: getDebugInfo

 /**
  * Returns the HTML to add to the page for the toolbar
  *
  * @param IContextSource $context
  * @return array
  */
 public static function getDebugInfo(IContextSource $context)
 {
     if (!self::$enabled) {
         return array();
     }
     global $wgVersion, $wgRequestTime;
     $request = $context->getRequest();
     // HHVM's reported memory usage from memory_get_peak_usage()
     // is not useful when passing false, but we continue passing
     // false for consistency of historical data in zend.
     // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246
     $realMemoryUsage = wfIsHHVM();
     return array('mwVersion' => $wgVersion, 'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP', 'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION, 'gitRevision' => GitInfo::headSHA1(), 'gitBranch' => GitInfo::currentBranch(), 'gitViewUrl' => GitInfo::headViewUrl(), 'time' => microtime(true) - $wgRequestTime, 'log' => self::$log, 'debugLog' => self::$debug, 'queries' => self::$query, 'request' => array('method' => $request->getMethod(), 'url' => $request->getRequestURL(), 'headers' => $request->getAllHeaders(), 'params' => $request->getValues()), 'memory' => $context->getLanguage()->formatSize(memory_get_usage($realMemoryUsage)), 'memoryPeak' => $context->getLanguage()->formatSize(memory_get_peak_usage($realMemoryUsage)), 'includes' => self::getFilesIncluded($context));
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:20,代码来源:MWDebug.php


示例6: while

}
$e = null;
// PHP exception
while (($line = Maintenance::readconsole()) !== false) {
    if ($e && !preg_match('/^(exit|die);?$/', $line)) {
        // Internal state may be corrupted or fatals may occur later due
        // to some object not being set. Don't drop out of eval in case
        // lines were being pasted in (which would then get dumped to the shell).
        // Instead, just absorb the remaning commands. Let "exit" through per DWIM.
        echo "Exception was thrown before; please restart eval.php\n";
        continue;
    }
    if ($useReadline) {
        readline_add_history($line);
        readline_write_history($historyFile);
    }
    try {
        $val = eval($line . ";");
    } catch (Exception $e) {
        echo "Caught exception " . get_class($e) . ": {$e->getMessage()}\n" . $e->getTraceAsString() . "\n";
        continue;
    }
    if (wfIsHHVM() || is_null($val)) {
        echo "\n";
    } elseif (is_string($val) || is_numeric($val)) {
        echo "{$val}\n";
    } else {
        var_dump($val);
    }
}
print "\n";
开发者ID:Tarendai,项目名称:spring-website,代码行数:31,代码来源:eval.php


示例7: phpClean

 /**
  * Use the HTML tidy extension to use the tidy library in-process,
  * saving the overhead of spawning a new process.
  *
  * @param string $text HTML to check
  * @param bool $stderr Whether to read result from error status instead of output
  * @param int &$retval Exit code (-1 on internal error)
  * @return string|null
  */
 private static function phpClean($text, $stderr = false, &$retval = null)
 {
     global $wgTidyConf, $wgDebugTidy;
     if (!wfIsHHVM() && !class_exists('tidy') || wfIsHHVM() && !function_exists('tidy_repair_string')) {
         wfWarn("Unable to load internal tidy class.");
         $retval = -1;
         return null;
     }
     $tidy = new tidy();
     $tidy->parseString($text, $wgTidyConf, 'utf8');
     if ($stderr) {
         $retval = $tidy->getStatus();
         return $tidy->errorBuffer;
     }
     $tidy->cleanRepair();
     $retval = $tidy->getStatus();
     if ($retval == 2) {
         // 2 is magic number for fatal error
         // http://www.php.net/manual/en/function.tidy-get-status.php
         $cleansource = null;
     } else {
         $cleansource = tidy_get_output($tidy);
         if ($wgDebugTidy && $retval > 0) {
             $cleansource .= "<!--\nTidy reports:\n" . str_replace('-->', '--&gt;', $tidy->errorBuffer) . "\n-->";
         }
     }
     return $cleansource;
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:37,代码来源:MWTidy.php


示例8: softwareInformation

 /**
  * Returns wiki text showing the third party software versions (apache, php, mysql).
  *
  * @return string
  */
 public static function softwareInformation()
 {
     $dbr = wfGetDB(DB_REPLICA);
     // Put the software in an array of form 'name' => 'version'. All messages should
     // be loaded here, so feel free to use wfMessage in the 'name'. Raw HTML or
     // wikimarkup can be used.
     $software = [];
     $software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
     if (wfIsHHVM()) {
         $software['[http://hhvm.com/ HHVM]'] = HHVM_VERSION . " (" . PHP_SAPI . ")";
     } else {
         $software['[https://php.net/ PHP]'] = PHP_VERSION . " (" . PHP_SAPI . ")";
     }
     $software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();
     if (IcuCollation::getICUVersion()) {
         $software['[http://site.icu-project.org/ ICU]'] = IcuCollation::getICUVersion();
     }
     // Allow a hook to add/remove items.
     Hooks::run('SoftwareInfo', [&$software]);
     $out = Xml::element('h2', ['id' => 'mw-version-software'], wfMessage('version-software')->text()) . Xml::openElement('table', ['class' => 'wikitable plainlinks', 'id' => 'sv-software']) . "<tr>\n\t\t\t\t\t<th>" . wfMessage('version-software-product')->text() . "</th>\n\t\t\t\t\t<th>" . wfMessage('version-software-version')->text() . "</th>\n\t\t\t\t</tr>\n";
     foreach ($software as $name => $version) {
         $out .= "<tr>\n\t\t\t\t\t<td>" . $name . "</td>\n\t\t\t\t\t<td dir=\"ltr\">" . $version . "</td>\n\t\t\t\t</tr>\n";
     }
     return $out . Xml::closeElement('table');
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:30,代码来源:SpecialVersion.php


示例9: doEnvironmentChecks

 /**
  * Do initial checks of the PHP environment. Set variables according to
  * the observed environment.
  *
  * It's possible that this may be called under the CLI SAPI, not the SAPI
  * that the wiki will primarily run under. In that case, the subclass should
  * initialise variables such as wgScriptPath, before calling this function.
  *
  * Under the web subclass, it can already be assumed that PHP 5+ is in use
  * and that sessions are working.
  *
  * @return Status
  */
 public function doEnvironmentChecks()
 {
     // Php version has already been checked by entry scripts
     // Show message here for information purposes
     if (wfIsHHVM()) {
         $this->showMessage('config-env-hhvm', HHVM_VERSION);
     } else {
         $this->showMessage('config-env-php', PHP_VERSION);
     }
     $good = true;
     // Must go here because an old version of PCRE can prevent other checks from completing
     list($pcreVersion) = explode(' ', PCRE_VERSION, 2);
     if (version_compare($pcreVersion, self::MINIMUM_PCRE_VERSION, '<')) {
         $this->showError('config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion);
         $good = false;
     } else {
         foreach ($this->envChecks as $check) {
             $status = $this->{$check}();
             if ($status === false) {
                 $good = false;
             }
         }
     }
     $this->setVar('_Environment', $good);
     return $good ? Status::newGood() : Status::newFatal('config-env-bad');
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:39,代码来源:Installer.php


示例10: wfShellExec

/**
 * Execute a shell command, with time and memory limits mirrored from the PHP
 * configuration if supported.
 * @param string $cmd Command line, properly escaped for shell.
 * @param &$retval null|Mixed optional, will receive the program's exit code.
 *                 (non-zero is usually failure). If there is an error from
 *                 read, select, or proc_open(), this will be set to -1.
 * @param array $environ optional environment variables which should be
 *                 added to the executed command environment.
 * @param array $limits optional array with limits(filesize, memory, time, walltime)
 *                 this overwrites the global wgMaxShell* limits.
 * @param array $options Array of options:
 *    - duplicateStderr: Set this to true to duplicate stderr to stdout,
 *      including errors from limit.sh
 *
 * @return string collected stdout as a string
 */
function wfShellExec($cmd, &$retval = null, $environ = array(), $limits = array(), $options = array())
{
    global $IP, $wgMaxShellMemory, $wgMaxShellFileSize, $wgMaxShellTime, $wgMaxShellWallClockTime, $wgShellCgroup;
    $disabled = wfShellExecDisabled();
    if ($disabled) {
        $retval = 1;
        return $disabled == 'safemode' ? 'Unable to run external programs in safe mode.' : 'Unable to run external programs, proc_open() is disabled.';
    }
    $includeStderr = isset($options['duplicateStderr']) && $options['duplicateStderr'];
    wfInitShellLocale();
    $envcmd = '';
    foreach ($environ as $k => $v) {
        if (wfIsWindows()) {
            /* Surrounding a set in quotes (method used by wfEscapeShellArg) makes the quotes themselves
             * appear in the environment variable, so we must use carat escaping as documented in
             * http://technet.microsoft.com/en-us/library/cc723564.aspx
             * Note however that the quote isn't listed there, but is needed, and the parentheses
             * are listed there but doesn't appear to need it.
             */
            $envcmd .= "set {$k}=" . preg_replace('/([&|()<>^"])/', '^\\1', $v) . '&& ';
        } else {
            /* Assume this is a POSIX shell, thus required to accept variable assignments before the command
             * http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_01
             */
            $envcmd .= "{$k}=" . escapeshellarg($v) . ' ';
        }
    }
    $cmd = $envcmd . $cmd;
    $useLogPipe = false;
    if (php_uname('s') == 'Linux') {
        $time = intval(isset($limits['time']) ? $limits['time'] : $wgMaxShellTime);
        if (isset($limits['walltime'])) {
            $wallTime = intval($limits['walltime']);
        } elseif (isset($limits['time'])) {
            $wallTime = $time;
        } else {
            $wallTime = intval($wgMaxShellWallClockTime);
        }
        $mem = intval(isset($limits['memory']) ? $limits['memory'] : $wgMaxShellMemory);
        $filesize = intval(isset($limits['filesize']) ? $limits['filesize'] : $wgMaxShellFileSize);
        if ($time > 0 || $mem > 0 || $filesize > 0 || $wallTime > 0) {
            $cmd = '/bin/bash ' . escapeshellarg("{$IP}/includes/limit.sh") . ' ' . escapeshellarg($cmd) . ' ' . escapeshellarg("MW_INCLUDE_STDERR=" . ($includeStderr ? '1' : '') . ';' . "MW_CPU_LIMIT={$time}; " . 'MW_CGROUP=' . escapeshellarg($wgShellCgroup) . '; ' . "MW_MEM_LIMIT={$mem}; " . "MW_FILE_SIZE_LIMIT={$filesize}; " . "MW_WALL_CLOCK_LIMIT={$wallTime}; " . "MW_USE_LOG_PIPE=yes");
            $useLogPipe = true;
        } elseif ($includeStderr) {
            $cmd .= ' 2>&1';
        }
    } elseif ($includeStderr) {
        $cmd .= ' 2>&1';
    }
    wfDebug("wfShellExec: {$cmd}\n");
    $desc = array(0 => array('file', 'php://stdin', 'r'), 1 => array('pipe', 'w'), 2 => array('file', 'php://stderr', 'w'));
    if ($useLogPipe) {
        $desc[3] = array('pipe', 'w');
    }
    # TODO/FIXME: This is a bad hack to workaround an HHVM bug that prevents
    # proc_open() from opening stdin/stdout, so use /dev/null *for now*
    # See bug 56597 / https://github.com/facebook/hhvm/issues/1247 for more info
    if (wfIsHHVM()) {
        $desc[0] = array('file', '/dev/null', 'r');
        $desc[2] = array('file', '/dev/null', 'w');
    }
    $pipes = null;
    $proc = proc_open($cmd, $desc, $pipes);
    if (!$proc) {
        wfDebugLog('exec', "proc_open() failed: {$cmd}");
        $retval = -1;
        return '';
    }
    $outBuffer = $logBuffer = '';
    $emptyArray = array();
    $status = false;
    $logMsg = false;
    // According to the documentation, it is possible for stream_select()
    // to fail due to EINTR. I haven't managed to induce this in testing
    // despite sending various signals. If it did happen, the error
    // message would take the form:
    //
    // stream_select(): unable to select [4]: Interrupted system call (max_fd=5)
    //
    // where [4] is the value of the macro EINTR and "Interrupted system
    // call" is string which according to the Linux manual is "possibly"
    // localised according to LC_MESSAGES.
    $eintr = defined('SOCKET_EINTR') ? SOCKET_EINTR : 4;
//.........这里部分代码省略.........
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:GlobalFunctions.php


示例11: function

 * Thiswas sourced from TranslateWiki (https://github.com/wikimedia/translatewiki/blob/0b7ba4665ab3e599516d2c2774e2541495a9d7a4/TranslatewikiSettings.php#L478)
 */
$wgHooks['GetBetaFeaturePreferences'][] = function ($user, &$prefs) {
    $prefs['hhvm-beta'] = array('label-message' => 'hhvm-beta-label', 'desc-message' => 'hhvm-beta-desc', 'info-link' => 'http://www.hhvm.com/', 'discussion-link' => 'https://meta.orain.org/wiki/Forum:HHVM');
};
$wgHooks['BeforePageDisplay'][] = function (OutputPage $out) {
    $req = $out->getRequest();
    $user = $out->getUser();
    $hasCookie = $req->getCookie('hhvm', '');
    $wantsCookie = BetaFeatures::isFeatureEnabled($user, 'hhvm-beta');
    if (!$hasCookie && $wantsCookie) {
        $req->response()->setcookie('hhvm', '1', 0, array('prefix' => ''));
    }
    if ($hasCookie && !$wantsCookie) {
        $req->response()->setcookie('hhvm', '0', -1, array('prefix' => ''));
    }
};
$wgHooks['RecentChange_save'][] = function (RecentChange $rc) {
    if (wfIsHHVM()) {
        ChangeTags::addTags('HHVM', $rc->getAttribute('rc_id'));
    }
    return true;
};
$wgHooks['LocalisationCacheRecache'][] = function ($cache, $code, &$cachedData) {
    if ($code === 'en') {
        $cachedData['messages']['hhvm-beta-label'] = 'HHVM';
        $cachedData['messages']['hhvm-beta-desc'] = 'HHVM is a new and faster PHP runtime.';
        $cachedData['messages']['tag-HHVM'] = '[[m:Forum:HHVM|HHVM]]';
        $cachedData['messages']['tag-HHVM-description'] = 'Changes made using HHVM. These are tagged for analysis purposes';
    }
};
开发者ID:Agent-Isai,项目名称:ansible-playbook,代码行数:31,代码来源:LocalBetaFeatureHHVM.php


示例12: function

return ['DBLoadBalancerFactory' => function (MediaWikiServices $services) {
    $config = $services->getMainConfig()->get('LBFactoryConf');
    $class = LBFactory::getLBFactoryClass($config);
    if (!isset($config['readOnlyReason'])) {
        // TODO: replace the global wfConfiguredReadOnlyReason() with a service.
        $config['readOnlyReason'] = wfConfiguredReadOnlyReason();
    }
    return new $class($config);
}, 'DBLoadBalancer' => function (MediaWikiServices $services) {
    // just return the default LB from the DBLoadBalancerFactory service
    return $services->getDBLoadBalancerFactory()->getMainLB();
}, 'SiteStore' => function (MediaWikiServices $services) {
    $rawSiteStore = new DBSiteStore($services->getDBLoadBalancer());
    // TODO: replace wfGetCache with a CacheFactory service.
    // TODO: replace wfIsHHVM with a capabilities service.
    $cache = wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING);
    return new CachingSiteStore($rawSiteStore, $cache);
}, 'SiteLookup' => function (MediaWikiServices $services) {
    // Use the default SiteStore as the SiteLookup implementation for now
    return $services->getSiteStore();
}, 'ConfigFactory' => function (MediaWikiServices $services) {
    // Use the bootstrap config to initialize the ConfigFactory.
    $registry = $services->getBootstrapConfig()->get('ConfigRegistry');
    $factory = new ConfigFactory();
    foreach ($registry as $name => $callback) {
        $factory->register($name, $callback);
    }
    return $factory;
}, 'MainConfig' => function (MediaWikiServices $services) {
    // Use the 'main' config from the ConfigFactory service.
    return $services->getConfigFactory()->makeConfig('main');
开发者ID:claudinec,项目名称:galan-wiki,代码行数:31,代码来源:ServiceWiring.php


示例13: filter

 /**
  * Run JavaScript or CSS data through a filter, caching the filtered result for future calls.
  *
  * Available filters are:
  *
  *    - minify-js \see JavaScriptMinifier::minify
  *    - minify-css \see CSSMin::minify
  *
  * If $data is empty, only contains whitespace or the filter was unknown,
  * $data is returned unmodified.
  *
  * @param string $filter Name of filter to run
  * @param string $data Text to filter, such as JavaScript or CSS text
  * @param array $options For back-compat, can also be the boolean value for "cacheReport". Keys:
  *  - (bool) cache: Whether to allow caching this data. Default: true.
  *  - (bool) cacheReport: Whether to include the "cache key" report comment. Default: true.
  * @return string Filtered data, or a comment containing an error message
  */
 public function filter($filter, $data, $options = array())
 {
     // Back-compat
     if (is_bool($options)) {
         $options = array('cacheReport' => $options);
     }
     // Defaults
     $options += array('cache' => true, 'cacheReport' => true);
     // Don't filter empty content
     if (trim($data) === '') {
         return $data;
     }
     if (!in_array($filter, array('minify-js', 'minify-css'))) {
         $this->logger->warning('Invalid filter {filter}', array('filter' => $filter));
         return $data;
     }
     if (!$options['cache']) {
         $result = $this->applyFilter($filter, $data);
     } else {
         $key = wfMemcKey('resourceloader', 'filter', $filter, self::$filterCacheVersion, md5($data));
         $cache = wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING);
         $cacheEntry = $cache->get($key);
         if (is_string($cacheEntry)) {
             wfIncrStats("resourceloader_cache.{$filter}.hit");
             return $cacheEntry;
         }
         $result = '';
         try {
             wfIncrStats("resourceloader_cache.{$filter}.miss");
             $result = $this->applyFilter($filter, $data);
             if ($options['cacheReport']) {
                 $result .= "\n/* cache key: {$key} */";
             }
             $cache->set($key, $result);
         } catch (Exception $e) {
             MWExceptionHandler::logException($e);
             $this->logger->warning('Minification failed: {exception}', array('exception' => $e));
             $this->errors[] = self::formatExceptionNoComment($e);
         }
     }
     return $result;
 }
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:60,代码来源:ResourceLoader.php


示例14: __construct

 public function __construct()
 {
     $this->worker = new SitesModuleWorker(Settings::singleton(), SiteSQLStore::newInstance(), wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING));
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:4,代码来源:SitesModule.php


示例15: getSourceSection

 /**
  * Get the descriptor of the fieldset that contains the file source
  * selection. The section is 'source'
  *
  * @return array Descriptor array
  */
 protected function getSourceSection()
 {
     if ($this->mSessionKey) {
         return array('SessionKey' => array('type' => 'hidden', 'default' => $this->mSessionKey), 'SourceType' => array('type' => 'hidden', 'default' => 'Stash'));
     }
     $canUploadByUrl = UploadFromUrl::isEnabled() && UploadFromUrl::isAllowed($this->getUser()) === true && $this->getConfig()->get('CopyUploadsFromSpecialUpload');
     $radio = $canUploadByUrl;
     $selectedSourceType = strtolower($this->getRequest()->getText('wpSourceType', 'File'));
     $descriptor = array();
     if ($this->mTextTop) {
         $descriptor['UploadFormTextTop'] = array('type' => 'info', 'section' => 'source', 'default' => $this->mTextTop, 'raw' => true);
     }
     $this->mMaxUploadSize['file'] = UploadBase::getMaxUploadSize('file');
     # Limit to upload_max_filesize unless we are running under HipHop and
     # that setting doesn't exist
     if (!wfIsHHVM()) {
         $this->mMaxUploadSize['file'] = min($this->mMaxUploadSize['file'], wfShorthandToInteger(ini_get('upload_max_filesize')), wfShorthandToInteger(ini_get('post_max_size')));
     }
     $help = $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['file']))->parse();
     // If the user can also upload by URL, there are 2 different file size limits.
     // This extra message helps stress which limit corresponds to what.
     if ($canUploadByUrl) {
         $help .= $this->msg('word-separator')->escaped();
         $help .= $this->msg('upload_source_file')->parse();
     }
     $descriptor['UploadFile'] = array('class' => 'UploadSourceField', 'section' => 'source', 'type' => 'file', 'id' => 'wpUploadFile', 'radio-id' => 'wpSourceTypeFile', 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'help' => $help, 'checked' => $selectedSourceType == 'file');
     if ($canUploadByUrl) {
         $this->mMaxUploadSize['url'] = UploadBase::getMaxUploadSize('url');
         $descriptor['UploadFileURL'] = array('class' => 'UploadSourceField', 'section' => 'source', 'id' => 'wpUploadFileURL', 'radio-id' => 'wpSourceTypeurl', 'label-message' => 'sourceurl', 'upload-type' => 'url', 'radio' => &$radio, 'help' => $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['url']))->parse() . $this->msg('word-separator')->escaped() . $this->msg('upload_source_url')->parse(), 'checked' => $selectedSourceType == 'url');
     }
     Hooks::run('UploadFormSourceDescriptors', array(&$descriptor, &$radio, $selectedSourceType));
     $descriptor['Extensions'] = array('type' => 'info', 'section' => 'source', 'default' => $this->getExtensionsMessage(), 'raw' => true);
     return $descriptor;
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:40,代码来源:SpecialUpload.php


示例16: envCheckCache

 /**
  * Environment check for compiled object cache types.
  */
 protected function envCheckCache()
 {
     $caches = array();
     foreach ($this->objectCaches as $name => $function) {
         if (function_exists($function)) {
             if ($name == 'xcache' && !wfIniGetBool('xcache.var_size')) {
                 continue;
             }
             $caches[$name] = true;
         }
     }
     if (!$caches) {
         $key = 'config-no-cache';
         // PHP >=5.5 is called APCu, earlier versions use APC (T61998).
         if (!wfIsHHVM() && version_compare(PHP_VERSION, '5.5', '>=')) {
             // config-no-cache-apcu
             $key .= '-apcu';
         }
         $this->showMessage($key);
     }
     $this->setVar('_Caches', $caches);
 }
开发者ID:paladox,项目名称:2,代码行数:25,代码来源:Installer.php


示例17: filter

 /**
  * Run JavaScript or CSS data through a filter, caching the filtered result for future calls.
  *
  * Available filters are:
  *
  *    - minify-js \see JavaScriptMinifier::minify
  *    - minify-css \see CSSMin::minify
  *
  * If $data is empty, only contains whitespace or the filter was unknown,
  * $data is returned unmodified.
  *
  * @param string $filter Name of filter to run
  * @param string $data Text to filter, such as JavaScript or CSS text
  * @param array $options For back-compat, can also be the boolean value for "cacheReport". Keys:
  *  - (bool) cache: Whether to allow caching this data. Default: true.
  *  - (bool) cacheReport: Whether to include the "cache key" report comment. Default: false.
  * @return string Filtered data, or a comment containing an error message
  */
 public function filter($filter, $data, $options = array())
 {
     // Back-compat
     if (is_bool($options)) {
         $options = array('cacheReport' => $options);
     }
     // Defaults
     $options += array('cache' => true, 'cacheReport' => false);
     $stats = RequestContext::getMain()->getStats();
     // Don't filter empty content
     if (trim($data) === '') {
         return $data;
     }
     if (!in_array($filter, array('minify-js', 'minify-css'))) {
         $this->logger->warning('Invalid filter {filter}', array('filter' => $filter));
         return $data;
     }
     if (!$options['cache']) {
         $result = self::applyFilter($filter, $data, $this->config);
     } else {
         $key = wfGlobalCacheKey('resourceloader', 'filter', $filter, self::$filterCacheVersion, md5($data));
         $cache = wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING);
         $cacheEntry = $cache->get($key);
         if (is_string($cacheEntry)) {
             $stats->increment("resourceloader_cache.{$filter}.hit");
             return $cacheEntry;
         }
         $result = '';
         try {
             $statStart = microtime(true);
             $result = self::applyFilter($filter, $data, $this->config);
             $statTiming = microtime(true) - $statStart;
             $stats->increment("resourceloader_cache.{$filter}.miss");
             $stats->timing("resourceloader_cache.{$filter}.timing", 1000 * $statTiming);
             if ($options['cacheReport']) {
                 $result .= "\n/* cache key: {$key} */";
             }
             // Set a TTL since HHVM's APC doesn't have any limitation or eviction logic.
             $cache->set($key, $result, 24 * 3600);
         } catch (Exception $e) {
             MWExceptionHandler::logException($e);
             $this->logger->warning('Minification failed: {exception}', array('exception' => $e));
             $this->errors[] = self::formatExceptionNoComment($e);
         }
     }
     return $result;
 }
开发者ID:ErdemA,项目名称:mediawiki,代码行数:65,代码来源:ResourceLoader.php


示例18: isHipHop

 /**
  * Returns true if we are running under HipHop, whether in compiled or
  * interpreted mode.
  *
  * @deprecated since 1.22
  * @return bool
  */
 static function isHipHop()
 {
     return wfIsHHVM();
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:11,代码来源:Init.php



注:本文中的wfIsHHVM函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfIsInfinity函数代码示例发布时间:2022-05-23
下一篇:
PHP wfIsDebugRawPage函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap