Server IP : 127.0.0.2 / Your IP : 3.145.177.28 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/php/Composer/Repository/Vcs/ |
Upload File : |
<?php /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Repository\Vcs; use Composer\Config; use Composer\IO\IOInterface; use Composer\Util\ProcessExecutor; use Composer\Util\Perforce; /** * @author Matt Whittom <Matt.Whittom@veteransunited.com> */ class PerforceDriver extends VcsDriver { protected $depot; protected $branch; protected $perforce; protected $composerInfo; protected $composerInfoIdentifier; /** * {@inheritDoc} */ public function initialize() { $this->depot = $this->repoConfig['depot']; $this->branch = ''; if (!empty($this->repoConfig['branch'])) { $this->branch = $this->repoConfig['branch']; } $this->initPerforce($this->repoConfig); $this->perforce->p4Login($this->io); $this->perforce->checkStream($this->depot); $this->perforce->writeP4ClientSpec(); $this->perforce->connectClient(); return true; } private function initPerforce($repoConfig) { if (!empty($this->perforce)) { return; } $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot; $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io); } /** * {@inheritDoc} */ public function getComposerInformation($identifier) { if (!empty($this->composerInfoIdentifier)) { if (strcmp($identifier, $this->composerInfoIdentifier) === 0) { return $this->composerInfo; } } $composer_info = $this->perforce->getComposerInformation($identifier); return $composer_info; } /** * {@inheritDoc} */ public function getRootIdentifier() { return $this->branch; } /** * {@inheritDoc} */ public function getBranches() { $branches = $this->perforce->getBranches(); return $branches; } /** * {@inheritDoc} */ public function getTags() { $tags = $this->perforce->getTags(); return $tags; } /** * {@inheritDoc} */ public function getDist($identifier) { return null; } /** * {@inheritDoc} */ public function getSource($identifier) { $source = array( 'type' => 'perforce', 'url' => $this->repoConfig['url'], 'reference' => $identifier, 'p4user' => $this->perforce->getUser(), ); return $source; } /** * {@inheritDoc} */ public function getUrl() { return $this->url; } /** * {@inheritDoc} */ public function hasComposerFile($identifier) { $this->composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier); $this->composerInfoIdentifier = $identifier; return !empty($this->composerInfo); } /** * {@inheritDoc} */ public function getContents($url) { return false; } /** * {@inheritDoc} */ public static function supports(IOInterface $io, Config $config, $url, $deep = false) { if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) { return Perforce::checkServerExists($url, new ProcessExecutor($io)); } return false; } /** * {@inheritDoc} */ public function cleanup() { $this->perforce->cleanupClientSpec(); $this->perforce = null; } public function getDepot() { return $this->depot; } public function getBranch() { return $this->branch; } }