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


PHP OC_Helper::findBinaryPath方法代码示例

本文整理汇总了PHP中OC_Helper::findBinaryPath方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Helper::findBinaryPath方法的具体用法?PHP OC_Helper::findBinaryPath怎么用?PHP OC_Helper::findBinaryPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_Helper的用法示例。


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

示例1: setUp

 public function setUp()
 {
     $libreofficeBinary = \OC_Helper::findBinaryPath('libreoffice');
     $openofficeBinary = $libreofficeBinary ? null : \OC_Helper::findBinaryPath('openoffice');
     if ($libreofficeBinary || $openofficeBinary) {
         parent::setUp();
         $fileName = 'testimage.odt';
         $this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
         $this->width = 595;
         $this->height = 842;
         $this->provider = new \OC\Preview\OpenDocument();
     } else {
         $this->markTestSkipped('No Office provider present');
     }
 }
开发者ID:evanjt,项目名称:core,代码行数:15,代码来源:office.php

示例2: setUp

 public function setUp()
 {
     $avconvBinary = \OC_Helper::findBinaryPath('avconv');
     $ffmpegBinary = $avconvBinary ? null : \OC_Helper::findBinaryPath('ffmpeg');
     if ($avconvBinary || $ffmpegBinary) {
         parent::setUp();
         \OC\Preview\Movie::$avconvBinary = $avconvBinary;
         \OC\Preview\Movie::$ffmpegBinary = $ffmpegBinary;
         $fileName = 'testimage.mp4';
         $this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
         $this->width = 560;
         $this->height = 320;
         $this->provider = new \OC\Preview\Movie();
     } else {
         $this->markTestSkipped('No Movie provider present');
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:17,代码来源:movie.php

示例3: testEmailSuccessful

 public function testEmailSuccessful()
 {
     /**
      * FIXME: Disable test for systems where no sendmail is available since code is static.
      * @link https://github.com/owncloud/core/pull/12085
      */
     if (is_null(\OC_Helper::findBinaryPath('sendmail'))) {
         $this->markTestSkipped('sendmail is not available');
     }
     $randomToken = $this->container['SecureRandom'];
     $this->container['SecureRandom']->expects($this->once())->method('generate')->with('21')->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
     $this->container['UserManager']->expects($this->once())->method('userExists')->with('ExistingUser')->will($this->returnValue(true));
     $this->container['Config']->expects($this->once())->method('getUserValue')->with('ExistingUser', 'settings', 'email')->will($this->returnValue('test@example.com'));
     $this->container['SecureRandom']->expects($this->once())->method('getMediumStrengthGenerator')->will($this->returnValue($randomToken));
     $this->container['Config']->expects($this->once())->method('setUserValue')->with('ExistingUser', 'owncloud', 'lostpassword', 'ThisIsMaybeANotSoSecretToken!');
     $this->container['URLGenerator']->expects($this->once())->method('linkToRouteAbsolute')->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))->will($this->returnValue('https://ownCloud.com/index.php/lostpassword/'));
     $response = $this->lostController->email('ExistingUser');
     $expectedResponse = array('status' => 'success');
     $this->assertSame($expectedResponse, $response);
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:20,代码来源:lostcontrollertest.php

示例4: checkCode

 /**
  * check the code of an app with some static code checks
  * @param string $folder the folder of the app to check
  * @return boolean true for app is o.k. and false for app is not o.k.
  */
 public static function checkCode($appname, $folder)
 {
     $blacklist = array('OC_API::', 'OC_App::', 'OC_AppConfig::', 'OC_Avatar', 'OC_BackgroundJob::', 'OC_Config::', 'OC_DB::', 'OC_Files::', 'OC_Helper::', 'OC_Hook::', 'OC_Image::', 'OC_JSON::', 'OC_L10N::', 'OC_Log::', 'OC_Mail::', 'OC_Preferences::', 'OC_Request::', 'OC_Response::', 'OC_Template::', 'OC_User::', 'OC_Util::');
     // is the code checker enabled?
     if (OC_Config::getValue('appcodechecker', true)) {
         // check if grep is installed
         $grep = \OC_Helper::findBinaryPath('grep');
         if (!$grep) {
             OC_Log::write('core', 'grep not installed. So checking the code of the app "' . $appname . '" was not possible', OC_Log::ERROR);
             return true;
         }
         // iterate the bad patterns
         foreach ($blacklist as $bl) {
             $cmd = 'grep --include \\*.php -ri ' . escapeshellarg($bl) . ' ' . $folder . '';
             $result = exec($cmd);
             // bad pattern found
             if ($result != '') {
                 OC_Log::write('core', 'App "' . $appname . '" is using a not allowed call "' . $bl . '". Installation refused.', OC_Log::ERROR);
                 return false;
             }
         }
         return true;
     } else {
         return true;
     }
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:31,代码来源:installer.php

示例5: OC_Template

OC_App::setActiveNavigationEntry("admin");
$template = new OC_Template('settings', 'admin', 'user');
$l = OC_L10N::get('settings');
$showLog = \OC::$server->getConfig()->getSystemValue('log_type', 'owncloud') === 'owncloud';
$numEntriesToLoad = 3;
$entries = OC_Log_Owncloud::getEntries($numEntriesToLoad + 1);
$entriesRemaining = count($entries) > $numEntriesToLoad;
$entries = array_slice($entries, 0, $numEntriesToLoad);
$logFilePath = OC_Log_Owncloud::getLogFilePath();
$doesLogFileExist = file_exists($logFilePath);
$logFileSize = filesize($logFilePath);
$config = \OC::$server->getConfig();
$appConfig = \OC::$server->getAppConfig();
$request = \OC::$server->getRequest();
// Should we display sendmail as an option?
$template->assign('sendmail_is_available', (bool) \OC_Helper::findBinaryPath('sendmail'));
$template->assign('loglevel', $config->getSystemValue("loglevel", 2));
$template->assign('mail_domain', $config->getSystemValue("mail_domain", ''));
$template->assign('mail_from_address', $config->getSystemValue("mail_from_address", ''));
$template->assign('mail_smtpmode', $config->getSystemValue("mail_smtpmode", ''));
$template->assign('mail_smtpsecure', $config->getSystemValue("mail_smtpsecure", ''));
$template->assign('mail_smtphost', $config->getSystemValue("mail_smtphost", ''));
$template->assign('mail_smtpport', $config->getSystemValue("mail_smtpport", ''));
$template->assign('mail_smtpauthtype', $config->getSystemValue("mail_smtpauthtype", ''));
$template->assign('mail_smtpauth', $config->getSystemValue("mail_smtpauth", false));
$template->assign('mail_smtpname', $config->getSystemValue("mail_smtpname", ''));
$template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppassword", ''));
$template->assign('entries', $entries);
$template->assign('entriesremain', $entriesRemaining);
$template->assign('logFileSize', $logFileSize);
$template->assign('doesLogFileExist', $doesLogFileExist);
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:31,代码来源:admin.php

示例6: checkDependencies

 /**
  * check if smbclient is installed
  */
 public static function checkDependencies()
 {
     $smbClientExists = (bool) \OC_Helper::findBinaryPath('smbclient');
     return $smbClientExists ? true : array('smbclient');
 }
开发者ID:evanjt,项目名称:core,代码行数:8,代码来源:smb.php

示例7: 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

示例8: checkDependencies

 /**
  * check if smbclient is installed
  */
 public static function checkDependencies()
 {
     return (bool) \OC_Helper::findBinaryPath('smbclient') || Server::NativeAvailable() ? true : ['smbclient'];
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:7,代码来源:SMB.php

示例9: registerCoreProviders

 protected static function registerCoreProviders()
 {
     self::registerProvider('OC\\Preview\\TXT');
     self::registerProvider('OC\\Preview\\MarkDown');
     self::registerProvider('OC\\Preview\\Image');
     self::registerProvider('OC\\Preview\\MP3');
     // SVG, Office and Bitmap require imagick
     if (extension_loaded('imagick')) {
         $checkImagick = new \Imagick();
         $imagickProviders = array('SVG' => 'OC\\Preview\\SVG', 'TIFF' => 'OC\\Preview\\TIFF', 'PDF' => 'OC\\Preview\\PDF', 'AI' => 'OC\\Preview\\Illustrator', 'PSD' => 'OC\\Preview\\Photoshop', 'EPS' => 'OC\\Preview\\Postscript');
         foreach ($imagickProviders as $queryFormat => $provider) {
             if (count($checkImagick->queryFormats($queryFormat)) === 1) {
                 self::registerProvider($provider);
             }
         }
         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(\OC::$server->getConfig()->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) {
                     self::registerProvider('OC\\Preview\\MSOfficeDoc');
                     self::registerProvider('OC\\Preview\\MSOffice2003');
                     self::registerProvider('OC\\Preview\\MSOffice2007');
                     self::registerProvider('OC\\Preview\\OpenDocument');
                     self::registerProvider('OC\\Preview\\StarOffice');
                 }
             }
         }
     }
     // Video requires avconv or ffmpeg and is therefor
     // currently not supported on Windows.
     if (!\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;
             self::registerProvider('OC\\Preview\\Movie');
         }
     }
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:51,代码来源:preview.php

示例10: isCommandKnown

 /**
  * @param $command
  * @return bool
  */
 public function isCommandKnown($command)
 {
     $path = \OC_Helper::findBinaryPath($command);
     return $path !== null;
 }
开发者ID:gmurayama,项目名称:core,代码行数:9,代码来源:platform.php


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