當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OC_Util::runningOnWindows方法代碼示例

本文整理匯總了PHP中OC_Util::runningOnWindows方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Util::runningOnWindows方法的具體用法?PHP OC_Util::runningOnWindows怎麽用?PHP OC_Util::runningOnWindows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC_Util的用法示例。


在下文中一共展示了OC_Util::runningOnWindows方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 public function setUp()
 {
     if (OC_Util::runningOnWindows()) {
         $this->markTestSkipped('tar archives are not supported on windows');
     }
     parent::setUp();
 }
開發者ID:Romua1d,項目名稱:core,代碼行數:7,代碼來源:tar.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     if (\OC_Util::runningOnWindows()) {
         $this->markTestSkipped('[Windows] tar archives are not supported on Windows');
     }
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:7,代碼來源:TARTest.php

示例3: tearDownAfterClassCleanFileMapper

 /**
  * Remove all entries from the files map table
  * @param string $dataDir
  */
 protected static function tearDownAfterClassCleanFileMapper($dataDir)
 {
     if (\OC_Util::runningOnWindows()) {
         $mapper = new \OC\Files\Mapper($dataDir);
         $mapper->removePath($dataDir, true, true);
     }
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:11,代碼來源:testcase.php

示例4: testRoot

	/**
	 * Tests that the root path matches the data dir
	 */
	public function testRoot() {
		if (\OC_Util::runningOnWindows()) {
			// Windows removes trailing slashes when returning paths
			$this->assertEquals(rtrim($this->tmpDir, '/'), $this->instance->getLocalFolder(''));
		} else {
			$this->assertEquals($this->tmpDir, $this->instance->getLocalFolder(''));
		}
	}
開發者ID:ninjasilicon,項目名稱:core,代碼行數:11,代碼來源:home.php

示例5: testGetStringMimeType

 function testGetStringMimeType()
 {
     if (\OC_Util::runningOnWindows()) {
         $this->markTestSkipped('[Windows] Strings have mimetype application/octet-stream on Windows');
     }
     $result = OC_Helper::getStringMimeType("/data/data.tar.gz");
     $expected = 'text/plain; charset=us-ascii';
     $this->assertEquals($result, $expected);
 }
開發者ID:DaubaKao,項目名稱:owncloud-core,代碼行數:9,代碼來源:helper.php

示例6: testDetectString

 public function testDetectString()
 {
     if (\OC_Util::runningOnWindows()) {
         $this->markTestSkipped('[Windows] Strings have mimetype application/octet-stream on Windows');
     }
     $result = $this->detection->detectString("/data/data.tar.gz");
     $expected = 'text/plain; charset=us-ascii';
     $this->assertEquals($expected, $result);
 }
開發者ID:evanjt,項目名稱:core,代碼行數:9,代碼來源:detection.php

示例7: loadBackends

 /**
  * Load storage backends provided by this app
  */
 protected function loadBackends()
 {
     $container = $this->getContainer();
     $service = $container->query('OCA\\Files_External\\Service\\BackendService');
     $service->registerBackends([$container->query('OCA\\Files_External\\Lib\\Backend\\Local'), $container->query('OCA\\Files_External\\Lib\\Backend\\FTP'), $container->query('OCA\\Files_External\\Lib\\Backend\\DAV'), $container->query('OCA\\Files_External\\Lib\\Backend\\OwnCloud'), $container->query('OCA\\Files_External\\Lib\\Backend\\SFTP'), $container->query('OCA\\Files_External\\Lib\\Backend\\AmazonS3'), $container->query('OCA\\Files_External\\Lib\\Backend\\Dropbox'), $container->query('OCA\\Files_External\\Lib\\Backend\\Google'), $container->query('OCA\\Files_External\\Lib\\Backend\\Swift'), $container->query('OCA\\Files_External\\Lib\\Backend\\SFTP_Key')]);
     if (!\OC_Util::runningOnWindows()) {
         $service->registerBackends([$container->query('OCA\\Files_External\\Lib\\Backend\\SMB'), $container->query('OCA\\Files_External\\Lib\\Backend\\SMB_OC')]);
     }
 }
開發者ID:matthias-g,項目名稱:core,代碼行數:12,代碼來源:application.php

示例8: dataFileNameProvider

 public function dataFileNameProvider()
 {
     $path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR;
     $filePaths = array(array($path . 'lorem.txt', 446));
     if (!\OC_Util::runningOnWindows()) {
         $filePaths[] = array($path . 'strängé filename (duplicate #2).txt', 446);
     }
     return $filePaths;
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:9,代碼來源:LargeFileHelperGetFileSizeTest.php

示例9: getBackends

 /**
  * @{inheritdoc}
  */
 public function getBackends()
 {
     $container = $this->getContainer();
     $backends = [$container->query('OCA\\Files_External\\Lib\\Backend\\Local'), $container->query('OCA\\Files_External\\Lib\\Backend\\FTP'), $container->query('OCA\\Files_External\\Lib\\Backend\\DAV'), $container->query('OCA\\Files_External\\Lib\\Backend\\OwnCloud'), $container->query('OCA\\Files_External\\Lib\\Backend\\SFTP'), $container->query('OCA\\Files_External\\Lib\\Backend\\AmazonS3'), $container->query('OCA\\Files_External\\Lib\\Backend\\Dropbox'), $container->query('OCA\\Files_External\\Lib\\Backend\\Google'), $container->query('OCA\\Files_External\\Lib\\Backend\\Swift'), $container->query('OCA\\Files_External\\Lib\\Backend\\SFTP_Key')];
     if (!\OC_Util::runningOnWindows()) {
         $backends[] = $container->query('OCA\\Files_External\\Lib\\Backend\\SMB');
         $backends[] = $container->query('OCA\\Files_External\\Lib\\Backend\\SMB_OC');
     }
     return $backends;
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:13,代碼來源:Application.php

示例10: tearDown

 public function tearDown()
 {
     \OC_User::setUserId($this->user);
     foreach ($this->storages as $storage) {
         $cache = $storage->getCache();
         $ids = $cache->getAll();
         $cache->clear();
     }
     if ($this->tempStorage && !\OC_Util::runningOnWindows()) {
         system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir()));
     }
 }
開發者ID:Combustible,項目名稱:core,代碼行數:12,代碼來源:view.php

示例11: testEtagChange

 public function testEtagChange()
 {
     if (\OC_Util::runningOnWindows()) {
         $this->markTestSkipped('On Windows platform we have no stable etag generation - yet');
     }
     $this->instance->file_put_contents('test.txt', 'foo');
     $this->instance->touch('test.txt', time() - 2);
     $etag1 = $this->instance->getETag('test.txt');
     $this->instance->file_put_contents('test.txt', 'bar');
     $etag2 = $this->instance->getETag('test.txt');
     $this->assertNotEquals($etag1, $etag2);
 }
開發者ID:Romua1d,項目名稱:core,代碼行數:12,代碼來源:local.php

示例12: testMimeType

 public function testMimeType()
 {
     $img = new \OC_Image(OC::$SERVERROOT . '/tests/data/testimage.png');
     $this->assertEquals('image/png', $img->mimeType());
     $img = new \OC_Image(null);
     $this->assertEquals('', $img->mimeType());
     if (\OC_Util::runningOnWindows()) {
         $this->markTestSkipped('[Windows] Images created with imagecreate() are pngs on windows');
     }
     $img = new \OC_Image(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.jpg'));
     $this->assertEquals('image/jpeg', $img->mimeType());
     $img = new \OC_Image(base64_encode(file_get_contents(OC::$SERVERROOT . '/tests/data/testimage.gif')));
     $this->assertEquals('image/gif', $img->mimeType());
 }
開發者ID:heldernl,項目名稱:owncloud8-extended,代碼行數:14,代碼來源:image.php

示例13: strpos

$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
$template->assign('allowLinks', $appConfig->getValue('core', 'shareapi_allow_links', 'yes'));
$template->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired());
$template->assign('allowPublicUpload', $appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes'));
$template->assign('allowResharing', $appConfig->getValue('core', 'shareapi_allow_resharing', 'yes'));
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$databaseOverload = strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false;
$template->assign('databaseOverload', $databaseOverload);
$template->assign('cronErrors', $appConfig->getValue('core', 'cronErrors'));
// warn if php is not setup properly to get system variables with getenv
$path = getenv('PATH');
$template->assign('getenvServerNotWorking', empty($path));
// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
// warn if outdated version of a memcache module is used
$caches = ['apcu' => ['name' => $l->t('APCu'), 'version' => '4.0.6'], 'redis' => ['name' => $l->t('Redis'), 'version' => '2.2.5']];
$outdatedCaches = [];
foreach ($caches as $php_module => $data) {
    $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
    if ($isOutdated) {
        $outdatedCaches[$php_module] = $data;
    }
}
$template->assign('OutdatedCacheWarning', $outdatedCaches);
// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$formsAndMore = array();
if ($request->getServerProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() || $suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || !OC_Util::fileInfoLoaded() || $databaseOverload) {
    $formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & setup warnings'));
開發者ID:WeatherellTechnology,項目名稱:weatherstorm7,代碼行數:31,代碼來源:admin.php

示例14: registerCoreProviders

 /**
  * Register the default providers (if enabled)
  */
 protected function registerCoreProviders()
 {
     if ($this->registeredCoreProviders) {
         return;
     }
     $this->registeredCoreProviders = true;
     $this->registerCoreProvider('OC\\Preview\\TXT', '/text\\/plain/');
     $this->registerCoreProvider('OC\\Preview\\MarkDown', '/text\\/(x-)?markdown/');
     $this->registerCoreProvider('OC\\Preview\\PNG', '/image\\/png/');
     $this->registerCoreProvider('OC\\Preview\\JPEG', '/image\\/jpeg/');
     $this->registerCoreProvider('OC\\Preview\\GIF', '/image\\/gif/');
     $this->registerCoreProvider('OC\\Preview\\BMP', '/image\\/bmp/');
     $this->registerCoreProvider('OC\\Preview\\XBitmap', '/image\\/x-xbitmap/');
     $this->registerCoreProvider('OC\\Preview\\MP3', '/audio\\/mpeg/');
     // SVG, Office and Bitmap require imagick
     if (extension_loaded('imagick')) {
         $checkImagick = new \Imagick();
         $imagickProviders = ['SVG' => ['mimetype' => '/image\\/svg\\+xml/', 'class' => '\\OC\\Preview\\SVG'], 'TIFF' => ['mimetype' => '/image\\/tiff/', 'class' => '\\OC\\Preview\\TIFF'], 'PDF' => ['mimetype' => '/application\\/pdf/', 'class' => '\\OC\\Preview\\PDF'], 'AI' => ['mimetype' => '/application\\/illustrator/', 'class' => '\\OC\\Preview\\Illustrator'], 'PSD' => ['mimetype' => '/application\\/x-photoshop/', 'class' => '\\OC\\Preview\\Photoshop'], 'EPS' => ['mimetype' => '/application\\/postscript/', 'class' => '\\OC\\Preview\\Postscript'], 'TTF' => ['mimetype' => '/application\\/(?:font-sfnt|x-font$)/', 'class' => '\\OC\\Preview\\Font']];
         foreach ($imagickProviders as $queryFormat => $provider) {
             $class = $provider['class'];
             if (!in_array(trim($class, '\\'), $this->getEnabledDefaultProvider())) {
                 continue;
             }
             if (count($checkImagick->queryFormats($queryFormat)) === 1) {
                 $this->registerCoreProvider($class, $provider['mimetype']);
             }
         }
         if (count($checkImagick->queryFormats('PDF')) === 1) {
             // Office previews are currently not supported on Windows
             if (!\OC_Util::runningOnWindows() && \OC_Helper::is_function_enabled('shell_exec')) {
                 $officeFound = is_string($this->config->getSystemValue('preview_libreoffice_path', null));
                 if (!$officeFound) {
                     //let's see if there is libreoffice or openoffice on this machine
                     $whichLibreOffice = shell_exec('command -v libreoffice');
                     $officeFound = !empty($whichLibreOffice);
                     if (!$officeFound) {
                         $whichOpenOffice = shell_exec('command -v openoffice');
                         $officeFound = !empty($whichOpenOffice);
                     }
                 }
                 if ($officeFound) {
                     $this->registerCoreProvider('\\OC\\Preview\\MSOfficeDoc', '/application\\/msword/');
                     $this->registerCoreProvider('\\OC\\Preview\\MSOffice2003', '/application\\/vnd.ms-.*/');
                     $this->registerCoreProvider('\\OC\\Preview\\MSOffice2007', '/application\\/vnd.openxmlformats-officedocument.*/');
                     $this->registerCoreProvider('\\OC\\Preview\\OpenDocument', '/application\\/vnd.oasis.opendocument.*/');
                     $this->registerCoreProvider('\\OC\\Preview\\StarOffice', '/application\\/vnd.sun.xml.*/');
                 }
             }
         }
     }
     // Video requires avconv or ffmpeg and is therefor
     // currently not supported on Windows.
     if (in_array('OC\\Preview\\Movie', $this->getEnabledDefaultProvider()) && !\OC_Util::runningOnWindows()) {
         $avconvBinary = \OC_Helper::findBinaryPath('avconv');
         $ffmpegBinary = $avconvBinary ? null : \OC_Helper::findBinaryPath('ffmpeg');
         if ($avconvBinary || $ffmpegBinary) {
             // FIXME // a bit hacky but didn't want to use subclasses
             \OC\Preview\Movie::$avconvBinary = $avconvBinary;
             \OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary;
             $this->registerCoreProvider('\\OC\\Preview\\Movie', '/video\\/.*/');
         }
     }
 }
開發者ID:brunomilet,項目名稱:owncloud-core,代碼行數:66,代碼來源:previewmanager.php

示例15: install

 /**
  * @param $options
  * @return array
  */
 public static function install($options)
 {
     $l = self::getTrans();
     $error = array();
     $dbType = $options['dbtype'];
     if (empty($options['adminlogin'])) {
         $error[] = $l->t('Set an admin username.');
     }
     if (empty($options['adminpass'])) {
         $error[] = $l->t('Set an admin password.');
     }
     if (empty($options['directory'])) {
         $options['directory'] = OC::$SERVERROOT . "/data";
     }
     if (!isset(self::$dbSetupClasses[$dbType])) {
         $dbType = 'sqlite';
     }
     $username = htmlspecialchars_decode($options['adminlogin']);
     $password = htmlspecialchars_decode($options['adminpass']);
     $dataDir = htmlspecialchars_decode($options['directory']);
     $class = self::$dbSetupClasses[$dbType];
     /** @var \OC\Setup\AbstractDatabase $dbSetup */
     $dbSetup = new $class(self::getTrans(), 'db_structure.xml');
     $error = array_merge($error, $dbSetup->validate($options));
     // validate the data directory
     if (!is_dir($dataDir) and !mkdir($dataDir) or !is_writable($dataDir)) {
         $error[] = $l->t("Can't create or write into the data directory %s", array($dataDir));
     }
     if (count($error) != 0) {
         return $error;
     }
     //no errors, good
     if (isset($options['trusted_domains']) && is_array($options['trusted_domains'])) {
         $trustedDomains = $options['trusted_domains'];
     } else {
         $trustedDomains = array(OC_Request::serverHost());
     }
     if (OC_Util::runningOnWindows()) {
         $dataDir = rtrim(realpath($dataDir), '\\');
     }
     //use sqlite3 when available, otherwise sqlite2 will be used.
     if ($dbType == 'sqlite' and class_exists('SQLite3')) {
         $dbType = 'sqlite3';
     }
     //generate a random salt that is used to salt the local user passwords
     $salt = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(30);
     \OC::$server->getConfig()->setSystemValue('passwordsalt', $salt);
     // generate a secret
     $secret = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(48);
     \OC::$server->getConfig()->setSystemValue('secret', $secret);
     //write the config file
     \OC::$server->getConfig()->setSystemValue('trusted_domains', $trustedDomains);
     \OC::$server->getConfig()->setSystemValue('datadirectory', $dataDir);
     \OC::$server->getConfig()->setSystemValue('overwrite.cli.url', \OC_Request::serverProtocol() . '://' . \OC_Request::serverHost() . OC::$WEBROOT);
     \OC::$server->getConfig()->setSystemValue('dbtype', $dbType);
     \OC::$server->getConfig()->setSystemValue('version', implode('.', OC_Util::getVersion()));
     try {
         $dbSetup->initialize($options);
         $dbSetup->setupDatabase($username);
     } catch (DatabaseSetupException $e) {
         $error[] = array('error' => $e->getMessage(), 'hint' => $e->getHint());
         return $error;
     } catch (Exception $e) {
         $error[] = array('error' => 'Error while trying to create admin user: ' . $e->getMessage(), 'hint' => '');
         return $error;
     }
     //create the user and group
     try {
         OC_User::createUser($username, $password);
     } catch (Exception $exception) {
         $error[] = $exception->getMessage();
     }
     if (count($error) == 0) {
         $appConfig = \OC::$server->getAppConfig();
         $appConfig->setValue('core', 'installedat', microtime(true));
         $appConfig->setValue('core', 'lastupdatedat', microtime(true));
         OC_Group::createGroup('admin');
         OC_Group::addToGroup($username, 'admin');
         OC_User::login($username, $password);
         //guess what this does
         OC_Installer::installShippedApps();
         // create empty file in data dir, so we can later find
         // out that this is indeed an ownCloud data directory
         file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/.ocdata', '');
         // Update htaccess files for apache hosts
         if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
             self::updateHtaccess();
             self::protectDataDirectory();
         }
         //and we are done
         OC_Config::setValue('installed', true);
     }
     return $error;
 }
開發者ID:Romua1d,項目名稱:core,代碼行數:98,代碼來源:setup.php


注:本文中的OC_Util::runningOnWindows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。