Example #1
0
 /**
  * Update a file
  *
  * @access public
  * @author Cédric Alfonsi, <*****@*****.**>
  * @param  File resource
  * @param  string path
  * @param  int revision
  * @return boolean
  * @see core_kernel_versioning_File::update()
  */
 public function update(core_kernel_file_File $resource, $path, $revision = null)
 {
     $returnValue = (bool) false;
     common_Logger::i('svn_update ' . $path . ' revision=' . $revision);
     if ($resource->getRepository()->authenticate()) {
         $returnValue = svn_update($path, $revision) === false ? false : true;
     }
     return (bool) $returnValue;
 }
 public static function update($path)
 {
     if (!self::isRepository($path)) {
         throw new pakeException('"' . $path . '" directory is not a Subversion repository');
     }
     pake_echo_action('svn update', $path);
     if (extension_loaded('svn')) {
         $result = svn_update($path);
         if (false === $result) {
             throw new pakeException('Couldn\'t update "' . $path . '" repository');
         }
     } else {
         pake_sh(escapeshellarg(pake_which('svn')) . ' update ' . escapeshellarg($path));
     }
 }
Example #3
0
<?php

$repos = 'https://shopexts.googlecode.com/svn/trunk/site/pg.app.yiyiee.com';
$work_dir = dirname(__FILE__);
if ($ret = svn_update($work_dir)) {
    echo "update to rev {$ret}";
} else {
    echo "update fail!";
}
 /**
  * 针对一个项目,将其发布代码目录更新到指定版本,并将版本号回写到Project记录中。
  * 
  */
 private function _runUpdate($task)
 {
     if ($task->project_id) {
         $pj_dir = \Project::getTempDir($task->project_id);
         $project = \Project::find($task->project_id);
         switch ($project->vcs_type) {
             case 'svn':
                 if (function_exists('svn_update')) {
                     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_update($pj_dir, $task->version);
                     if ($result !== false) {
                         $project->current_version = $this->get_dir_version($pj_dir);
                         $project->save();
                     }
                     return array('result' => $result !== false, 'output' => '');
                 } else {
                     $command = "svn update {$pj_dir} -r {$task->version}";
                     $command .= " --no-auth-cache --username={$project->username} --password={$project->password}";
                     exec($command, $output, $return_var);
                     if ($return_var == 0) {
                         $project->current_version = $project->current_version;
                         $project->save();
                     }
                     return array('result' => $return_var == 0, 'output' => implode("\n", $output) . " code {$return_var}");
                 }
                 break;
             case 'git':
                 break;
         }
     }
 }
<?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");
}
Example #6
0
 function actualizasvn()
 {
     if (!extension_loaded('svn')) {
         $data['content'] = 'La extension svn no esta cargada, debe cargarla para poder usar estas opciones';
     } else {
         $dir = getcwd();
         $svn = $dir . '/.svn';
         if (!is_writable($svn)) {
             $data['content'] = 'No se tiene permiso al directorio .svn, comuniquese con soporte t&eacute;cnico';
         } else {
             $aver = 0;
             //<-- falta consultar la version actual
             $ver = svn_update($dir);
             if ($ver > 0) {
                 if ($ver > $aver) {
                     $data['content'] = 'Actualizado a la versi&oacute;n: ' . $ver;
                 } else {
                     $data['content'] = 'Ya estaba la ultima versi&oacute;n instalada ' . $arr['revision'];
                 }
             } else {
                 $data['content'] = 'Hubo problemas con la actualizaci&oacute;n, comuniquese con soporte t&eacute;cnico';
             }
         }
     }
     $data['title'] = 'Actualizacion de ProteoERP desde el svn';
     $data['head'] = '';
     $this->load->view('view_ventanas', $data);
 }
 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');
     }
 }
<?php

include './Header.php';
echo '<h1>Gestor de Actualizaciones</h1>';
echo '<p>Buscar e instalar. <a href="?doUpdate=true">&raquo; Actualizaciones...?</a></p>';
$doUpdate = filter_input(INPUT_GET, "doUpdate");
svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, TRUE);
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, "lupe");
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, "ggarza.");
if ($doUpdate) {
    $x = svn_update(filter_input(INPUT_SERVER, "CONTEXT_DOCUMENT_ROOT"), SVN_REVISION_HEAD, TRUE);
    echo 'Actualizado a la revision: ' . $x;
    echo '<br>';
}
echo '<p><h2>Log de Cambios</h2>';
$aLog = svn_log(filter_input(INPUT_SERVER, "CONTEXT_DOCUMENT_ROOT"), SVN_REVISION_PREV, SVN_REVISION_HEAD);
foreach ($aLog as $rev) {
    ?>
    <div class="panel panel-info">
        <div class="panel-heading">
            <h3 class="panel-title">Revision # <?php 
    echo $rev['rev'];
    ?>
</h3>
        </div>
        <div class="panel-body">
            Por: <?php 
    echo $rev['author'];
    ?>
<br>
            Mensaje: <?php 
Example #9
0
<?php

include "../../../include/db.php";
include "../../../include/general.php";
include "../../../include/authenticate.php";
if (!checkperm("a")) {
    exit("Access denied.");
}
$rev = getval("rev", "");
if (is_numeric($rev)) {
    svn_update($storagedir . "/../", $rev);
}
redirect("plugins/svn/pages/svn.php");
Example #10
0
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://localhost/piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->
</head>
<body>
<?php 
/**
 * Navigation
 */
if (isset($_GET['node'])) {
    switch ($_GET['node']) {
        case "svn":
            set_time_limit(0);
            svn_update();
            header("Location: index.php");
            exit;
        case "info":
            ob_start();
            phpinfo();
            preg_match('%<style type="text/css">(.*?)</style>.*?(<body>.*</body>)%s', ob_get_clean(), $matches);
            # $matches [1]; # Style information
            # $matches [2]; # Body information
            echo "<div id='main'><div id='info'>";
            echo $matches[2] . "\n</div>\n";
            echo "</div></div>";
            exit;
        case "errors":
            StartPage::showErrorLog();
            exit;
 /**
  * Update repository
  *
  * Update the repository to the most current state. Method will return
  * true, if an update happened, and false if no update was available.
  *
  * Optionally a version can be specified, in which case the repository
  * won't be updated to the latest version, but to the specified one.
  * 
  * @param string $version
  * @return bool
  */
 public function update($version = null)
 {
     // Remember version before update try
     $oldVersion = $this->getVersionString();
     if ($version !== null) {
         $this->currentVersion = (string) svn_update($this->root, (int) $version);
     } else {
         $this->currentVersion = (string) svn_update($this->root);
     }
     // Check if an update has happened
     return $oldVersion !== $this->currentVersion;
 }
Example #12
0
 function actualizaproteo()
 {
     session_write_close();
     set_time_limit(3600);
     $responde = '<h1>Resultado de la Actualizacion</h1>';
     if (!extension_loaded('svn')) {
         $responde .= 'La extension svn no esta cargada, debe cargarla para poder usar estas opciones...';
     } else {
         $dir = getcwd();
         $svn = $dir . '/.svn';
         if (!is_writable($svn)) {
             $responde .= 'No se tiene permiso al directorio .svn, comuniquese con soporte t&eacute;cnico...';
         } else {
             $antes = $this->datasis->traevalor('SVNVER', 'Version svn de proteo');
             if (empty($antes)) {
                 $aver = 0;
             } else {
                 $aver = intval($antes);
             }
             $ver = @svn_update($dir);
             if ($ver > 0) {
                 if ($ver > $aver) {
                     $responde .= 'Actualizado a la versi&oacute;n: ' . $ver;
                     $dbver = $this->db->escape($ver);
                     $mSQL = "UPDATE valores SET valor={$dbver} WHERE nombre='SVNVER'";
                     $this->db->simple_query($mSQL);
                     //$this->db->simple_query('TRUNCATE modbus');
                     $usr = $this->session->userdata('usuario');
                     if (empty($usr)) {
                         $usr = '******';
                     }
                     $dbusr = $this->db->escape($usr);
                     $mSQL = "INSERT INTO logusu (usuario,fecha,hora,modulo,comenta) VALUES ({$dbusr},CURDATE(),CURTIME(),'svnup','ACTUALIZADO A LA VERSION {$dbver} ANTERIOR {$antes}')";
                     $this->db->simple_query($mSQL);
                 } else {
                     $responde .= 'Ya estaba la ultima versi&oacute;n instalada ' . $aver;
                 }
             } else {
                 $responde .= 'Hubo problemas con la actualizaci&oacute;n, comuniquese con soporte t&eacute;cnico';
             }
         }
     }
     $host = $this->db->hostname;
     $db = $this->db->database;
     $pwd = $this->db->password;
     $usr = $this->db->username;
     $file = tempnam('/tmp', $db . '.sql');
     echo $responde;
 }