protected static function read() { // Checkout Latest Copy First chdir(SITES_XML_SVN_WC_PATH); svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, SITES_XML_SVN_USERNAME); svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, SITES_XML_SVN_PASSWORD); svn_checkout(SITES_XML_SVN_REPO_PATH, SITES_XML_SVN_WC_PATH); //Need to use php5.5.18 // Read XML File Conent $file = fopen('sites.xml', 'r'); //examine if file is opened or not $meta = stream_get_meta_data($file); //var_dump($meta['mode']); $content = fread($file, filesize('sites.xml')); //var_dump($content); fclose($file); /*$simplexml = simplexml_load_string($content); $json = json_encode($simplexml); var_dump("json",$json); $decodedArray = json_decode($json); var_dump("dArray",$decodedArray);*/ //Decode XML (Parse) $xmlDecoder = new XMLDecoder(); $decodedArray = $xmlDecoder->decode($content); var_dump("decoded_array", $decodedArray); //output // Root of Domain Whitelist //$root = &$decodedArray[0]['child'][0]['child']; return $decodedArray; }
public function clone_repo($path) { if (!svn_checkout($path, realpath($this->temp_location))) { return false; } return true; }
/** * Checkout the repository * * @access public * @author Cédric Alfonsi, <*****@*****.**> * @param Repository vcs * @param string url * @param string path * @param int revision * @return boolean */ public function checkout(core_kernel_versioning_Repository $vcs, $url, $path, $revision = null) { $returnValue = (bool) false; $startTime = helpers_Time::getMicroTime(); if ($vcs->authenticate()) { $returnValue = svn_checkout($url, $path, $revision); } $endTime = helpers_Time::getMicroTime(); common_Logger::i("svn_checkout (" . $url . ' -> ' . $path . ') -> ' . ($endTime - $startTime) . 's'); return (bool) $returnValue; }
/** * Initialize repository * * Initialize repository from the given URL. Optionally username and * password may be passed to the method, if required for the repository. * * @param string $url * @param string $user * @param string $password * @return void */ public function initialize($url, $user = null, $password = null) { if ($user !== null) { svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE, true); svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $user); if ($password !== null) { svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $password); } } if (svn_checkout($url, $this->root) === false || ($this->currentVersion = (string) svn_update($this->root)) === false) { throw new vcsCheckoutFailedException($url); } }
public static function checkout($src_url, $target_path) { pake_mkdirs($target_path); if (self::isRepository($target_path)) { throw new pakeException('"' . $target_path . '" directory is a Subversion repository already'); } if (count(pakeFinder::type('any')->in($target_path)) > 0) { throw new pakeException('"' . $target_path . '" directory is not empty. Can not checkout there'); } pake_echo_action('svn checkout', $target_path); if (extension_loaded('svn')) { $result = svn_checkout($src_url, $target_path); if (false === $result) { throw new pakeException('Couldn\'t checkout "' . $src_url . '" repository'); } } else { pake_sh(escapeshellarg(pake_which('svn')) . ' checkout ' . escapeshellarg($src_url) . ' ' . escapeshellarg($target_path)); } }
/** * 针对一个项目Project,获取最新版本库,放到指定目录,并将版本号回写到Project记录中。 * */ private function _runCheckout($task) { if ($task->project_id) { $pj_dir = \Project::getTempDir($task->project_id); //项目代码存放目录 if (!file_exists($pj_dir)) { if (!mkdir($pj_dir, 0750)) { return array('result' => false, 'output' => "mkdir {$pj_dir} failed!"); } } $project = \Project::find($task->project_id); switch ($project->vcs_type) { case 'svn': if (false) { if ($project->username) { svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $project->username); svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $project->password); } $result = svn_checkout($project->src_addr, $pj_dir); if ($result) { $project->current_version = $this->get_dir_version($pj_dir); $project->save(); } return array('result' => $result, 'output' => ''); } else { $command = "svn checkout {$project->src_addr} {$pj_dir} --no-auth-cache"; if ($project->username) { $command .= " --username={$project->username} --password={$project->password}"; } exec($command, $output, $return_var); if ($return_var == 0) { $project->current_version = $this->get_dir_version($pj_dir); $project->save(); } return array('result' => $return_var == 0, 'output' => implode("\n", $output) . " code {$return_var}"); } break; case 'git': break; } } }
function svn_checkout_group($group, $global, $base_dir) { if ($group['get'][0] == '*') { svn_checkout($global['svn_repo'] . $group['svn_path'], $global['svn_user'], $global['svn_pass'], $base_dir . $group['local_path']); } else { foreach ($group['get'] as $current) { svn_checkout($global['svn_repo'] . $group['svn_path'] . $current, $global['svn_user'], $global['svn_pass'], $base_dir . $group['local_path'] . $current); } } }
<?php svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'vahagn'); svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'Vahagn123'); if ($_REQUEST["checkout"]) { echo svn_checkout('http://*****:*****@naghashyan.com/svn/pcstore', "/var/www/pcstore"); } else { echo svn_update("/var/www/pcstore"); }
public function ajaxProcessSvnCheckout() { $this->nextParams = $this->currentParams; if ($this->useSvn) { $svnLink = 'http://svn.prestashop.com/trunk'; $dest = $this->autoupgradePath . DIRECTORY_SEPARATOR . $this->svnDir; $svnStatus = svn_status($dest); if (is_array($svnStatus)) { if (sizeof($svnStatus) == 0) { $this->next = 'svnExport'; $this->nextDesc = sprintf($this->l('working copy already %s up-to-date. now exporting it into latest dir'), $dest); } else { // we assume no modification has been done // @TODO a svn revert ? if ($svnUpdate = svn_update($dest)) { $this->next = 'svnExport'; $this->nextDesc = sprintf($this->l('SVN Update done for working copy %s . now exporting it into latest...'), $dest); } } } else { // no valid status found // @TODO : is 0777 good idea ? if (!file_exists($dest)) { if (!@mkdir($dest, 0777)) { $this->next = 'error'; $this->nextDesc = sprintf($this->l('unable to create directory %s'), $dest); return false; } } if (svn_checkout($svnLink, $dest)) { $this->next = 'svnExport'; $this->nextDesc = sprintf($this->l('SVN Checkout done from %s . now exporting it into latest...'), $svnLink); return true; } else { $this->next = 'error'; $this->nextDesc = $this->l('SVN Checkout error...'); } } } else { $this->next = 'error'; $this->nextDesc = $this->l('not allowed to use svn'); } }