当前位置: 首页>>代码示例>>PHP>>正文


PHP wfIsWindows函数代码示例

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


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

示例1: __construct

	protected function __construct() {
		$idFile = wfTempDir() . '/mw-' . __CLASS__ . '-UID-nodeid';
		$nodeId = is_file( $idFile ) ? file_get_contents( $idFile ) : '';
		// Try to get some ID that uniquely identifies this machine (RFC 4122)...
		if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
			wfSuppressWarnings();
			if ( wfIsWindows() ) {
				// http://technet.microsoft.com/en-us/library/bb490913.aspx
				$csv = trim( wfShellExec( 'getmac /NH /FO CSV' ) );
				$line = substr( $csv, 0, strcspn( $csv, "\n" ) );
				$info = str_getcsv( $line );
				$nodeId = isset( $info[0] ) ? str_replace( '-', '', $info[0] ) : '';
			} elseif ( is_executable( '/sbin/ifconfig' ) ) { // Linux/BSD/Solaris/OS X
				// See http://linux.die.net/man/8/ifconfig
				$m = array();
				preg_match( '/\s([0-9a-f]{2}(:[0-9a-f]{2}){5})\s/',
					wfShellExec( '/sbin/ifconfig -a' ), $m );
				$nodeId = isset( $m[1] ) ? str_replace( ':', '', $m[1] ) : '';
			}
			wfRestoreWarnings();
			if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
				$nodeId = MWCryptRand::generateHex( 12, true );
				$nodeId[1] = dechex( hexdec( $nodeId[1] ) | 0x1 ); // set multicast bit
			}
			file_put_contents( $idFile, $nodeId ); // cache
		}
		$this->nodeId32 = wfBaseConvert( substr( sha1( $nodeId ), 0, 8 ), 16, 2, 32 );
		$this->nodeId48 = wfBaseConvert( $nodeId, 16, 2, 48 );
		// If different processes run as different users, they may have different temp dirs.
		// This is dealt with by initializing the clock sequence number and counters randomly.
		$this->lockFile88 = wfTempDir() . '/mw-' . __CLASS__ . '-UID-88';
		$this->lockFile128 = wfTempDir() . '/mw-' . __CLASS__ . '-UID-128';
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:33,代码来源:UIDGenerator.php

示例2: __construct

	function __construct() {
		global $wgWebStoreSettings, $wgUploadDirectory, $wgTmpDirectory, $wgFileStore;

		foreach ( $wgWebStoreSettings as $name => $value ) {
			$this->$name = $value;
		}
		if ( !$this->tmpDir ) {
			$this->tmpDir = $wgTmpDirectory;
		}
		if ( !$this->publicDir ) {
			$this->publicDir = $wgUploadDirectory;
		}
		if ( !$this->deletedDir ) {
			if ( isset( $wgFileStore['deleted']['directory'] ) ) {
				$this->deletedDir = $wgFileStore['deleted']['directory'];
			} else {
				// No deletion
				$this->errors[] = new WebStoreWarning( 'webstore_no_deleted' );
				$this->deletedDir = false;
			}
		}
		$this->windows = wfIsWindows();


	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:25,代码来源:WebStoreCommon.php

示例3: getLineEnding

 function getLineEnding()
 {
     if (wfIsWindows()) {
         return "\r\n";
     } else {
         return "\n";
     }
 }
开发者ID:valhallasw,项目名称:mediawiki-extensions-OpenStackManager,代码行数:8,代码来源:OpenStackNovaController.php

示例4: testToString

 /**
  * @covers MailAddress::toString
  * @dataProvider provideToString
  */
 public function testToString($useRealName, $address, $name, $realName, $expected)
 {
     if (wfIsWindows()) {
         $this->markTestSkipped('This test only works on non-Windows platforms');
     }
     $this->setMwGlobals('wgEnotifUseRealName', $useRealName);
     $ma = new MailAddress($address, $name, $realName);
     $this->assertEquals($expected, $ma->toString());
 }
开发者ID:rploaiza,项目名称:dbpedia-latinoamerica,代码行数:13,代码来源:MailAddressTest.php

示例5: testBug67870

 public function testBug67870()
 {
     $command = wfIsWindows() ? 'for /l %i in (1, 1, 1001) do @echo ' . str_repeat('*', 331) : 'printf "%-333333s" "*"';
     // Test several times because it involves a race condition that may randomly succeed or fail
     for ($i = 0; $i < 10; $i++) {
         $output = wfShellExec($command);
         $this->assertEquals(333333, strlen($output));
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:9,代码来源:wfShellExecTest.php

示例6: testMultipleArgsAsArray

 public function testMultipleArgsAsArray()
 {
     if (wfIsWindows()) {
         $expected = '"foo" "bar" "baz"';
     } else {
         $expected = "'foo' 'bar' 'baz'";
     }
     $actual = wfEscapeShellArg(['foo', 'bar', 'baz']);
     $this->assertEquals($expected, $actual);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:wfEscapeShellArgTest.php

示例7: getVars

function getVars($_gv_filename)
{
    require $_gv_filename;
    $vars = get_defined_vars();
    unset($vars['_gv_filename']);
    # Clean up line endings
    if (wfIsWindows()) {
        $vars = unixLineEndings($vars);
    }
    return $vars;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:11,代码来源:serialize.php

示例8: open

	/**
	 * Open a /dev/urandom file handle
	 * Returns a Status object
	 */
	function open() {
		if ( $this->urandom ) {
			return Status::newGood();
		}

		if ( wfIsWindows() ) {
			return Status::newFatal( 'securepoll-urandom-not-supported' );
		}
		$this->urandom = fopen( '/dev/urandom', 'rb' );
		if ( !$this->urandom ) {
			return Status::newFatal( 'securepoll-dump-no-urandom' );
		}
		return Status::newGood();
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:18,代码来源:Random.php

示例9: w2lTempDir

/**
 * Tries to get the system directory for temporary files. The TMPDIR, TMP, and
 * TEMP environment variables are then checked in sequence, and if none are set
 * try sys_get_temp_dir() for PHP >= 5.2.1. All else fails, return /tmp for Unix
 * or C:\Windows\Temp for Windows and hope for the best.
 * It is common to call it with tempnam().
 *
 * NOTE: When possible, use instead the tmpfile() function to create
 * temporary files to avoid race conditions on file creation, etc.
 *
 * This function is from MediaWiki 1.19
 *
 * @return String
 */
function w2lTempDir()
{
    foreach (array('TMPDIR', 'TMP', 'TEMP') as $var) {
        $tmp = getenv($var);
        if ($tmp && file_exists($tmp) && is_dir($tmp) && is_writable($tmp)) {
            return $tmp;
        }
    }
    if (function_exists('sys_get_temp_dir')) {
        return sys_get_temp_dir();
    }
    # Usual defaults
    return wfIsWindows() ? 'C:\\Windows\\Temp' : '/tmp';
}
开发者ID:mediawiki-extensions,项目名称:wiki2latex,代码行数:28,代码来源:w2lFunctions.php

示例10: toString

 /**
  * Return formatted and quoted address to insert into SMTP headers
  * @return string
  */
 function toString()
 {
     # PHP's mail() implementation under Windows is somewhat shite, and
     # can't handle "Joe Bloggs <joe@bloggs.com>" format email addresses,
     # so don't bother generating them
     if ($this->name != '' && !wfIsWindows()) {
         $quoted = wfQuotedPrintable($this->name);
         if (strpos($quoted, '.') !== false) {
             $quoted = '"' . $quoted . '"';
         }
         return "{$quoted} <{$this->address}>";
     } else {
         return $this->address;
     }
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:19,代码来源:UserMailer.php

示例11: testUnitTestFileNamesEndWithTest

 /**
  * Verify all files that appear to be tests have file names ending in
  * Test.  If the file names do not end in Test, they will not be run.
  */
 public function testUnitTestFileNamesEndWithTest()
 {
     if (wfIsWindows()) {
         $this->markTestSkipped('This test does not work on Windows');
     }
     $rootPath = escapeshellarg(__DIR__);
     $testClassRegex = implode('|', array('ApiFormatTestBase', 'ApiTestCase', 'MediaWikiLangTestCase', 'MediaWikiTestCase', 'PHPUnit_Framework_TestCase'));
     $testClassRegex = "^class .* extends ({$testClassRegex})";
     $finder = "find {$rootPath} -name '*.php' '!' -name '*Test.php'" . " | xargs grep -El '{$testClassRegex}|function suite\\('";
     $results = null;
     $exitCode = null;
     exec($finder, $results, $exitCode);
     $this->assertEquals(0, $exitCode, 'Verify find/grep command succeeds.');
     $results = array_filter($results, array($this, 'filterSuites'));
     $this->assertEquals(array(), $results, 'Unit test file names must end with Test.');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:StructureTest.php

示例12: stream_open

 function stream_open($path, $mode, $options, &$opened_path)
 {
     if ($mode[0] == 'r') {
         $options = 'e -bd -so';
     } elseif ($mode[0] == 'w') {
         $options = 'a -bd -si';
     } else {
         return false;
     }
     $arg = wfEscapeShellArg($this->stripPath($path));
     $command = "7za {$options} {$arg}";
     if (!wfIsWindows()) {
         // Suppress the stupid messages on stderr
         $command .= ' 2>/dev/null';
     }
     $this->stream = popen($command, $mode);
     return $this->stream !== false;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:18,代码来源:dumpTextPass.php

示例13: main

 public static function main($exit = true)
 {
     $command = new self();
     if (wfIsWindows()) {
         # Windows does not come anymore with ANSI.SYS loaded by default
         # PHPUnit uses the suite.xml parameters to enable/disable colors
         # which can be then forced to be enabled with --colors.
         # The below code inject a parameter just like if the user called
         # phpunit with a --no-color option (which does not exist). It
         # overrides the suite.xml setting.
         # Probably fix bug 29226
         $command->arguments['colors'] = false;
     }
     # Makes MediaWiki PHPUnit directory includable so the PHPUnit will
     # be able to resolve relative files inclusion such as suites/*
     # PHPUnit uses stream_resolve_include_path() internally
     # See bug 32022
     set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path());
     $command->run($_SERVER['argv'], $exit);
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:20,代码来源:MediaWikiPHPUnitCommand.php

示例14: testUnitTestFileNamesEndWithTest

 /**
  * Verify all files that appear to be tests have file names ending in
  * Test.  If the file names do not end in Test, they will not be run.
  * @group medium
  */
 public function testUnitTestFileNamesEndWithTest()
 {
     if (wfIsWindows()) {
         $this->markTestSkipped('This test does not work on Windows');
     }
     $rootPath = escapeshellarg(__DIR__ . '/..');
     $testClassRegex = implode('|', ['ApiFormatTestBase', 'ApiTestCase', 'ApiQueryTestBase', 'ApiQueryContinueTestBase', 'MediaWikiLangTestCase', 'MediaWikiMediaTestCase', 'MediaWikiTestCase', 'ResourceLoaderTestCase', 'PHPUnit_Framework_TestCase', 'DumpTestCase']);
     $testClassRegex = "^class .* extends ({$testClassRegex})";
     $finder = "find {$rootPath} -name '*.php' '!' -name '*Test.php'" . " | xargs grep -El '{$testClassRegex}|function suite\\('";
     $results = null;
     $exitCode = null;
     exec($finder, $results, $exitCode);
     $this->assertEquals(0, $exitCode, 'Verify find/grep command succeeds.');
     $results = array_filter($results, [$this, 'filterSuites']);
     $strip = strlen($rootPath) - 1;
     foreach ($results as $k => $v) {
         $results[$k] = substr($v, $strip);
     }
     $this->assertEquals([], $results, "Unit test file in {$rootPath} must end with Test.");
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:25,代码来源:StructureTest.php

示例15: toString

 /**
  * Return formatted and quoted address to insert into SMTP headers
  * @return string
  */
 function toString()
 {
     # PHP's mail() implementation under Windows is somewhat shite, and
     # can't handle "Joe Bloggs <joe@bloggs.com>" format email addresses,
     # so don't bother generating them
     if ($this->address) {
         if ($this->name != '' && !wfIsWindows()) {
             global $wgEnotifUseRealName;
             $name = $wgEnotifUseRealName && $this->realName !== '' ? $this->realName : $this->name;
             $quoted = UserMailer::quotedPrintable($name);
             if (strpos($quoted, '.') !== false || strpos($quoted, ',') !== false) {
                 $quoted = '"' . $quoted . '"';
             }
             return "{$quoted} <{$this->address}>";
         } else {
             return $this->address;
         }
     } else {
         return "";
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:25,代码来源:MailAddress.php


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