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


PHP System::which方法代码示例

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


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

示例1: start

 function start($args)
 {
     print_r($args);
     list($cmd, $this->repos, $this->rev, $this->email) = $args;
     if ($this->repos[0] == '/') {
         $this->repos = $this->repos = 'file://' . $this->repos;
     }
     $this->rev = (int) $this->rev;
     $last = $this->rev - 1;
     // techncially where the diff is!?
     require_once 'System.php';
     $svn = System::which('svn', '/usr/bin/svn');
     $cmd = "{$svn} diff -r{$last}:{$this->rev} {$this->repos}";
     $this->log = svn_log($this->repos, $this->rev, $this->rev - 1, 0, SVN_DISCOVER_CHANGED_PATHS);
     $syntax = $this->checkSyntax();
     //echo $cmd;
     $diff = `{$cmd}`;
     $diff = $this->log[0]['msg'] . "\n\n" . $diff;
     if ($syntax) {
         $diff = $syntax . "\n\n" . $diff;
     }
     $bits = explode('@', $this->email);
     $headers['From'] = "{$this->log[0]['author']} <{$this->log[0]['author']}@{$bits[1]}>";
     $headers['To'] = $this->email;
     $headers['Subject'] = "[SVN {$bits[1]}] " . ($syntax ? "ERROR!" : "") . $this->getFilenames() . " ({$this->rev})";
     $headers['Date'] = date('r');
     $headers['X-Mailer'] = 'svn hook';
     // Create the mail object using the Mail::factory method
     require_once 'Mail.php';
     $mail_object =& Mail::factory('smtp', $params);
     $mail_object->send($this->email, $headers, $diff);
     $this->sendPopup($syntax);
 }
开发者ID:Jan-E,项目名称:pecl-tools-svn,代码行数:33,代码来源:hook_emailcommit.php

示例2: EventGenerator_xte

 function EventGenerator_xte()
 {
     $xte = System::which('xte');
     if ($xte !== false) {
         $this->xte = $xte;
     } else {
         echo "Couldn't find xte program!\r\nTests won't run!\r\n";
     }
 }
开发者ID:rakotomandimby,项目名称:php-gtk-src,代码行数:9,代码来源:EventGenerator_xte.php

示例3: Net_Wifi

 /**
  * Constructor which tries to guess the paths of the tools
  */
 function Net_Wifi()
 {
     //try to find the paths
     $iwconfig = System::which('iwconfig');
     if ($iwconfig !== false) {
         $this->setPathIwconfig($iwconfig);
     } else {
         if (file_exists('/sbin/iwconfig')) {
             $this->setPathIwconfig('/sbin/iwconfig');
         }
     }
     $iwlist = System::which('iwlist');
     if ($iwlist !== false) {
         $this->setPathIwlist($iwlist);
     } else {
         if (file_exists('/sbin/iwlist')) {
             $this->setPathIwlist('/sbin/iwlist');
         }
     }
 }
开发者ID:Reviaco,项目名称:Reviaco-OS,代码行数:23,代码来源:Wifi.php

示例4: start

 function start($cli = false, $mods = '', $overwrite = array())
 {
     $ff = HTML_Flexyframework::get();
     $this->scanModules();
     //echo '<PRE>'; print_r($this->modtables); exit;
     $options =& PEAR::getStaticProperty('DB_DataObject', 'options');
     $proj = 'pman';
     //ucfirst(basename($options['database']));
     // we are going to generate all of the code into a temporay foldler..
     $user = posix_getpwuid(posix_getuid());
     $options['rootDir'] = ini_get('session.save_path') . '/temp_' . $proj . '_' . $user['name'];
     $options['cli'] = $cli;
     $options['mods'] = empty($mods) ? array() : explode('/', $mods);
     if (!file_exists($options['rootDir'])) {
         mkdir($options['rootDir'], 0775, true);
     }
     $this->rootDir = $options['rootDir'];
     $options['schema_location'] = $this->rootDir . '/' . $proj . '/DataObjects';
     $options['class_location'] = $this->rootDir . '/' . $proj . '/DataObjects';
     $options['require_prefix'] = $proj . '/DataObjects/';
     $options['class_prefix'] = $proj . '_DataObjects_';
     $this->debug(print_r($options, true));
     //  print_r($this);exit;
     $standard_database = $options['database'];
     parent::start();
     $this->scanModules();
     require_once 'System.php';
     $diff = System::which('diff');
     // now for each of the directories copy/show diffs..
     echo $cli ? '' : '<PRE>';
     $flist = $overwrite;
     foreach ($this->modtables as $m => $ar) {
         if ($options['database'] != $standard_database) {
             $options['database'] = $standard_database;
             parent::start();
         }
         $options['database'] = $standard_database;
         if (isset($options['database_' . $m])) {
             $options['database'] = $options['database_' . $m];
             //var_dump($url);exit;
             // start again?
             parent::start();
         }
         if (!empty($options['mods']) && !in_array($m, $options['mods'])) {
             continue;
         }
         // this happens when we have no database tables from a module,
         // but module code has been defined.
         if (!file_exists($options['rootDir'] . '/' . $m)) {
             continue;
         }
         foreach (scandir($options['rootDir'] . '/' . $m) as $f) {
             echo "SCAN {$options['rootDir']} {$f}\n";
             if (!strlen($f) || $f[0] == '.') {
                 continue;
             }
             // does it exist!!!
             $src = $options['rootDir'] . "/{$m}/{$f}";
             $tg = $ff->page->rootDir . "/Pman/{$m}/DataObjects/{$f}";
             if (preg_match('/\\.js$/', $f)) {
                 $tg = $ff->page->rootDir . "/Pman/{$m}/{$f}";
             }
             if (!file_exists($tg) || !filesize($tg)) {
                 if ($cli && file_exists($tg) || in_array($f, $flist) || in_array('_all_', $flist)) {
                     echo "COPY {$src} {$tg}" . ($cli ? "\n" : "<BR>");
                     copy($src, $tg);
                     continue;
                 }
                 echo "!!!!MISSING!!! {$tg}" . ($cli ? "\n" : "<BR>");
                 continue;
             }
             // always copy readers and ini file.=  nope - not on live..
             if ($cli && in_array($f, $flist) || in_array('_all_', $flist)) {
                 //|| $f=='pman.ini' || preg_match('/\.js$/', $f))) {
                 echo "COPY {$src} {$tg}" . ($cli ? "\n" : "<BR>");
                 copy($src, $tg);
                 continue;
             }
             // diff the two..
             $cmd = "{$diff} -u -w " . escapeshellarg($tg) . ' ' . escapeshellarg($src);
             $out = array();
             $ret = 0;
             exec($cmd, $out, $ret);
             if ($ret == 0) {
                 // files match..
                 continue;
             }
             // var_dump($ret);
             echo "\n" . implode("\n", $out) . "\n";
         }
     }
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:92,代码来源:Generator.php

示例5: testExecuteWithShortFormatOption

 public function testExecuteWithShortFormatOption()
 {
     $git = new VersionControl_Git('./fixtures/001_VersionControl_Git');
     $i1 = new DummyGitCommand($git);
     $result = $i1->setSubCommand('log')->setOption('n', '1')->setOption('pretty', 'oneline')->setOption('grep', 'initial')->execute();
     $this->assertEquals($i1->getCommandString(), @System::which('git') . ' log -n\'1\' --pretty=\'oneline\' --grep=\'initial\'');
     $this->assertEquals(trim($result), 'b8adc7214881bb71b9741b5d8228ebf346197d47 initial commit');
 }
开发者ID:alebear,项目名称:versioncontrol_git,代码行数:8,代码来源:VersionControl_Git_Util_CommandTest.php

示例6: define

if (getenv('PHP_PEAR_CACHE_TTL')) {
    define('PEAR_CONFIG_DEFAULT_CACHE_TTL', getenv('PHP_PEAR_CACHE_TTL'));
} else {
    define('PEAR_CONFIG_DEFAULT_CACHE_TTL', 3600);
}
// Default for sig_type
if (getenv('PHP_PEAR_SIG_TYPE')) {
    define('PEAR_CONFIG_DEFAULT_SIG_TYPE', getenv('PHP_PEAR_SIG_TYPE'));
} else {
    define('PEAR_CONFIG_DEFAULT_SIG_TYPE', 'gpg');
}
// Default for sig_bin
if (getenv('PHP_PEAR_SIG_BIN')) {
    define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN'));
} else {
    define('PEAR_CONFIG_DEFAULT_SIG_BIN', System::which('gpg', OS_WINDOWS ? 'c:\\gnupg\\gpg.exe' : '/usr/local/bin/gpg'));
}
// Default for sig_keydir
if (getenv('PHP_PEAR_SIG_KEYDIR')) {
    define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', getenv('PHP_PEAR_SIG_KEYDIR'));
} else {
    define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', PEAR_CONFIG_SYSCONFDIR . DIRECTORY_SEPARATOR . 'pearkeys');
}
/**
 * This is a class for storing configuration data, keeping track of
 * which are system-defined, user-defined or defaulted.
 */
class PEAR_Config extends PEAR
{
    // {{{ properties
    /**
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:Config.php

示例7: _postProcess

 /**
  * Image_Transform_Driver_NetPBM::_postProcess()
  *
  * @param $type
  * @param $quality
  * @return string A chain of shell command
  * @link http://netpbm.sourceforge.net/doc/directory.html
  */
 function _postProcess($type, $quality)
 {
     array_unshift($this->command, $this->_prepare_cmd(IMAGE_TRANSFORM_NETPBM_PATH, strtolower($this->type) . 'topnm', escapeshellarg($this->image)));
     $arg = '';
     $type = strtolower($type);
     $program = '';
     switch ($type) {
         // ppmto* converters
         case 'gif':
             if (!System::which(IMAGE_TRANSFORM_NETPBM_PATH . 'ppmquant' . (OS_WINDOWS ? '.exe' : ''))) {
                 return PEAR::raiseError('Couldn\'t find "ppmquant" binary', IMAGE_TRANSFORM_ERROR_UNSUPPORTED);
             }
             $this->command[] = $this->_prepare_cmd(IMAGE_TRANSFORM_NETPBM_PATH, 'ppmquant', 256);
         case 'acad':
         case 'bmp':
         case 'eyuv':
         case 'ilbm':
         case 'leaf':
         case 'lj':
         case 'mitsu':
         case 'mpeg':
         case 'neo':
         case 'pcx':
         case 'pi1':
         case 'pict':
         case 'pj':
         case 'pjxl':
         case 'puzz':
         case 'sixel':
         case 'tga':
         case 'uil':
         case 'xpm':
         case 'yuv':
             $program = 'ppmto' . $type;
             break;
             // Windows icon
         // Windows icon
         case 'winicon':
         case 'ico':
             $type = 'winicon';
             $program = 'ppmto' . $type;
             break;
             // pbmto* converters
         // pbmto* converters
         case 'ascii':
         case 'text':
         case 'txt':
             $type = 'ascii';
         case 'atk':
         case 'bbubg':
         case 'epsi':
         case 'epson':
         case 'escp2':
         case 'icon':
             // Sun icon
         // Sun icon
         case 'gem':
         case 'go':
         case 'lj':
         case 'ln03':
         case 'lps':
         case 'macp':
         case 'mda':
         case 'mgr':
         case 'pi3':
         case 'pk':
         case 'plot':
         case 'ptx':
         case 'wbp':
         case 'xbm':
         case 'x10bm':
         case 'ybm':
         case 'zinc':
         case '10x':
             $program = 'pbmto' . $type;
             break;
             // pamto* converters
         // pamto* converters
         case 'jpc':
             $type = 'jpeg2k';
         case 'html':
         case 'pfm':
         case 'tga':
             $program = 'pamto' . $type;
             break;
             // pnmto* converters
         // pnmto* converters
         case 'jpc':
             $type = 'jpeg2k';
             break;
         case 'wfa':
             $type = 'fiasco';
//.........这里部分代码省略.........
开发者ID:anvnguyen,项目名称:Goteo,代码行数:101,代码来源:NetPBM.php

示例8: which

 /**
  * Functionality similiar to unix 'which'. Searches the path
  * for the specified program. 
  *
  * @param $cmd name of the executable to search for 
  *
  * @access private
  * @return string returns the full path if found, false if not
  */
 function which($in_cmd)
 {
     // only pass non-empty strings to System::which()
     if (!is_string($in_cmd) || '' === $in_cmd) {
         return false;
     }
     // explicitly pass false as fallback value
     return System::which($in_cmd, false);
 }
开发者ID:orcoliver,项目名称:oneye,代码行数:18,代码来源:Command.php

示例9: _get_image_details

 /**
  * Image_Transform_Driver_IM::_get_image_details()
  *
  * @param string $image the path and name of the image file
  * @return none
  */
 function _get_image_details($image)
 {
     $retval = Image_Transform::_get_image_details($image);
     if (PEAR::isError($retval)) {
         unset($retval);
         if (!System::which(IMAGE_TRANSFORM_IM_PATH . 'identify' . (OS_WINDOWS ? '.exe' : ''))) {
             $this->isError(PEAR::raiseError('Couldn\'t find "identify" binary', IMAGE_TRANSFORM_ERROR_UNSUPPORTED));
         }
         $cmd = $this->_prepare_cmd(IMAGE_TRANSFORM_IM_PATH, 'identify', '-format %w:%h:%m ' . escapeshellarg($image));
         exec($cmd, $res, $exit);
         if ($exit == 0) {
             $data = explode(':', $res[0]);
             $this->img_x = $data[0];
             $this->img_y = $data[1];
             $this->type = strtolower($data[2]);
             $retval = true;
         } else {
             return PEAR::raiseError("Cannot fetch image or images details.", true);
         }
     }
     return $retval;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:28,代码来源:IM.php

示例10: build

 function build($proj)
 {
     echo "Building {$proj}\n";
     // var_dump($proj);
     if (empty($proj)) {
         $this->err = "no project";
         if ($this->cli) {
             echo $this->err;
         }
         return;
     }
     // first item in path is always the app start directory..
     $src = array_shift(explode(PATH_SEPARATOR, ini_get('include_path'))) . '/Pman/' . $proj;
     //$tmp = ini_get('session.save_path')."/{$proj}_". posix_getuid(). '_'.md5($src);
     require_once 'System.php';
     $seed = System::which('seed');
     if (!$seed) {
         $this->err = "no seed installed";
         if ($this->cli) {
             echo $this->err;
         }
         return false;
     }
     $o = HTML_FlexyFramework::get()->Pman_Core;
     if (empty($o['packseed']) || !file_exists($o['packseed'] . '/pack.js')) {
         $this->err = "no jstoolkit path set [Pman_Core][packseed] to the\n                    introspection documentation directory where pack.js is located.";
         if ($this->cli) {
             echo $this->err;
         }
         return false;
     }
     // should we be more specirfic!??!?!?
     $cmd = "{$seed} {$o['packseed']}/pack.js -m {$proj}  -a  {$src}/*.js";
     echo "{$cmd}\n";
     passthru($cmd);
     // technically we should trash old compiled files..
     // or we move towards a 'cache in session directory model..'
     /*
     
     $ret = $tmp . '/'. $proj . '.js';
     if ($this->cli) {
         echo "BUILT:  $ret \n";
         exit;
     }
     return $ret;
     */
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:47,代码来源:JsCompile.php

示例11: getGitCommandPath

 /**
  * Get the location to git binary
  *
  * @return string
  */
 public function getGitCommandPath()
 {
     // Guess path to git binary
     if (!$this->gitCommandPath) {
         $this->gitCommandPath = @System::which('git');
         if (!$this->gitCommandPath) {
             $message = 'Guessing path to git binary is failed.' . ' You must specify path to git binary yourself.';
             throw new VersionControl_Git_Exception($message);
         }
     }
     return $this->gitCommandPath;
 }
开发者ID:qinyuguang,项目名称:pbs,代码行数:17,代码来源:Git.php

示例12: testSetGitCommandPath

 public function testSetGitCommandPath()
 {
     $instance = new VersionControl_Git('./fixtures/001_VersionControl_Git');
     $this->assertEquals($instance->getGitCommandPath(), @System::which('git'));
     $instance->setGitCommandPath('/usr/local/bin/git');
     $this->assertEquals($instance->getGitCommandPath(), '/usr/local/bin/git');
 }
开发者ID:alebear,项目名称:versioncontrol_git,代码行数:7,代码来源:VersionControl_GitTest.php

示例13: define

    define('PEAR_CONFIG_DEFAULT_CACHE_TTL', 3600);
}

// Default for sig_type
if (getenv('PHP_PEAR_SIG_TYPE')) {
    define('PEAR_CONFIG_DEFAULT_SIG_TYPE', getenv('PHP_PEAR_SIG_TYPE'));
} else {
    define('PEAR_CONFIG_DEFAULT_SIG_TYPE', 'gpg');
}

// Default for sig_bin
if (getenv('PHP_PEAR_SIG_BIN')) {
    define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN'));
} else {
    define('PEAR_CONFIG_DEFAULT_SIG_BIN',
           System::which(
               'gpg', OS_WINDOWS ? 'c:\gnupg\gpg.exe' : '/usr/local/bin/gpg'));
}

// Default for sig_keydir
if (getenv('PHP_PEAR_SIG_KEYDIR')) {
    define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', getenv('PHP_PEAR_SIG_KEYDIR'));
} else {
    define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR',
           PEAR_CONFIG_SYSCONFDIR . DIRECTORY_SEPARATOR . 'pearkeys');
}

/**
 * This is a class for storing configuration data, keeping track of
 * which are system-defined, user-defined or defaulted.
 * @category   pear
 * @package    PEAR
开发者ID:radiocontrolled,项目名称:ATutor,代码行数:32,代码来源:Config.php

示例14: createBase

 function createBase()
 {
     require_once 'System.php';
     $iptables = System::which('iptables', '/sbin/iptables');
     if (!$iptables || !file_exists($iptables)) {
         $this->jerr("iptables could not be found.");
     }
     //$this->exec("{$iptables} -F postgres"); // flush old
     $this->exec("{$iptables} -X postgres");
     // flush old
     $this->exec("{$iptables} -N postgres");
     // create new..
     $this->exec($iptables . ' -A postgres -m limit --limit 2/min -j LOG ' . '--log-prefix "IPTables-Dropped: " --log-level 4');
     $this->exec("{$iptables} -A postgres -j DROP");
 }
开发者ID:roojs,项目名称:Pman.Admin,代码行数:15,代码来源:Iptables.php

示例15: run

 /**
  * Run the command with the defined switches.
  *
  * @param array $args     Arguments to pass to Subversion
  * @param array $switches Switches to pass to Subversion
  *
  * @return  mixed   $fetchmode specified output on success.
  * @throws VersionControl_SVN_Exception If command failed.
  */
 public function run($args = array(), $switches = array())
 {
     if ($this->svn_path != '') {
         $this->binaryPath = $this->svn_path;
     }
     if (!file_exists($this->binaryPath)) {
         $system = new System();
         $this->binaryPath = $system->which('svn');
     }
     if (sizeof($switches) > 0) {
         $this->switches = $switches;
     }
     if (sizeof($args) > 0) {
         foreach (array_keys($args) as $k) {
             $this->args[$k] = escapeshellarg($args[$k]);
         }
     }
     // Always prepare, allows for obj re-use. (Request #5021)
     $this->prepare();
     $out = array();
     // @var integer $returnVar Return number from shell execution.
     $returnVar = null;
     $cmd = $this->preparedCmd;
     // On Windows, don't use escapeshellcmd, and double-quote $cmd
     // so it's executed as
     // cmd /c ""C:\Program Files\SVN\bin\svn.exe" info "C:\Program Files\dev\trunk""
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $cmd = str_replace($this->binaryPath, escapeshellarg(str_replace('/', '\\', $this->binaryPath)), $cmd);
         if (!$this->passthru) {
             exec("cmd /c \"{$cmd} 2>&1\"", $out, $returnVar);
         } else {
             passthru("cmd /c \"{$cmd} 2>&1\"", $returnVar);
         }
     } else {
         if ($this->useEscapeshellcmd) {
             $cmd = escapeshellcmd($cmd);
         }
         if (!$this->passthru) {
             exec("{$this->prependCmd}{$cmd} 2>&1", $out, $returnVar);
         } else {
             passthru("{$this->prependCmd}{$cmd} 2>&1", $returnVar);
         }
     }
     if ($returnVar > 0) {
         throw new VersionControl_SVN_Exception('Execution of command failed returning: ' . $returnVar . "\n" . implode("\n", $out), VersionControl_SVN_Exception::EXEC);
     }
     return $this->parseOutput($out);
 }
开发者ID:ThiagoR,项目名称:firegento-contentsync,代码行数:57,代码来源:Command.php


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