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'); } }
$svnrevision = explode(":", $svnrevision); if (isset($svnrevision[1])) { $svnrevision = $svnrevision[1]; } else { $svnrevision = $svnrevision[0]; } // parse string to check if revision is modified if (substr(trim($svnrevision), -1) == "M") { $files_modified = true; } // echo versions echo "Your SVN client version: " . svn_client_version(); echo "<br/>Your ResourceSpace SVN version: " . $svnrevision; // next, analyze an svn status report to see if the installation is clean and can be updated using this tool. if ($files_modified) { $svn_status = svn_status($storagedir . "/../"); ?> <br/> <br/> <table class="InfoTable"> <?php for ($n = 1; $n < count($svn_status); $n++) { if ($svn_status[$n]["text_status"] == 8) { ?> <tr> <td><?php echo $svn_status[$n]["path"]; ?> </td> <td><b><?php echo "modified";
protected function svnSt($svnUri) { return svn_status($svnUri); }
public function log($path = '.', $num = 5) { if ($this->has_svn) { $this->auth(); return svn_status($path, SVN_NON_RECURSIVE | SVN_ALL); } else { if (!$num) { $num = $this->last(); } ob_start(); header('Content-Type: text/plain; charset=UTF-8'); print shell_exec("svn log -l {$num} " . $this->args()); $st = ob_get_contents(); ob_end_clean(); $log = new \SimpleXMLElement($st); $r = []; //\bbn\tools::hdump($st); foreach ($log->logentry as $l) { $r[(int) $l['revision']] = ['author' => (string) $l->author, 'date' => date('Y-m-d H:i:s', strtotime($l->date)), 'msg' => (string) $l->msg]; } return $r; } }
//create_table($c1); //insert_data($c1); // Insert a row using c1 //insert_data($c2); // Insert a row using c2 // //select_data($c1); // Results of both inserts are returned //select_data($c2); // //rollback($c1); // Rollback using c1 // //select_data($c1); // Both inserts have been rolled back //select_data($c2); // //insert_data($c2); // Insert a row using c2 //commit($c2); // commit using c2 // //select_data($c1); // result of c2 insert is returned // //delete_data($c1); // delete all rows in table using c1 //select_data($c1); // no rows returned //select_data($c2); // no rows returned //commit($c1); // commit using c1 // //select_data($c1); // no rows returned //select_data($c2); // no rows returned // //drop_table($c1); //print "</PRE></HTML>"; var_dump(svn_status(realpath('wc'))); ?>
/** * Retrieve file's status * * @access public * @author Cédric Alfonsi, <*****@*****.**> * @param File resource * @param string path * @param array options * @return int */ public function getStatus(core_kernel_file_File $resource, $path, $options = array()) { $returnValue = (int) 0; $startTime = helpers_Time::getMicroTime(); if ($resource->getRepository()->authenticate()) { //Status of the target $status = null; //Get a list of statuses $svnStatusOptions = SVN_NON_RECURSIVE; if ($options['SHOW_UPDATES']) { $svnStatusOptions = $svnStatusOptions | SVN_SHOW_UPDATES; } $statuses = @svn_status($path, $svnStatusOptions); // * An explanation could be that the file is in a non working copy directory, it occured when we create a folders structure if ($statuses !== false) { //Extract required status foreach ($statuses as $s) { if ($s['path'] == $path) { $status = $s; } } // If the file has a status, check the status is not unversioned or added if (!is_null($status)) { if ($status['locked']) { $returnValue = VERSIONING_FILE_STATUS_LOCKED; } else { if ($status['repos_text_status'] == VERSIONING_FILE_STATUS_DELETED) { $returnValue = VERSIONING_FILE_STATUS_REMOTELY_DELETED; } else { if ($status['repos_text_status'] == VERSIONING_FILE_STATUS_MODIFIED) { $returnValue = VERSIONING_FILE_STATUS_REMOTELY_MODIFIED; } else { $returnValue = $status['text_status']; } } } } else { if (!file_exists($path)) { $returnValue = VERSIONING_FILE_STATUS_UNVERSIONED; } else { $returnValue = VERSIONING_FILE_STATUS_NORMAL; } } } else { $returnValue = VERSIONING_FILE_STATUS_UNVERSIONED; } } $endTime = helpers_Time::getMicroTime(); common_Logger::i("svn_getStatus ('.{$path}.') '.{$returnValue}.' -> " . ($endTime - $startTime) . 's'); return (int) $returnValue; }