public static function export($src_url, $target_path)
 {
     if (count(pakeFinder::type('any')->in($target_path)) > 0) {
         throw new pakeException('"' . $target_path . '" directory is not empty. Can not export there');
     }
     pake_echo_action('svn export', $target_path);
     if (extension_loaded('svn')) {
         $result = svn_export($src_url, $target_path, false);
         if (false === $result) {
             throw new pakeException('Couldn\'t export "' . $src_url . '" repository');
         }
     } else {
         pake_sh(escapeshellarg(pake_which('svn')) . ' export ' . escapeshellarg($src_url) . ' ' . escapeshellarg($target_path));
     }
 }
Esempio n. 2
0
 public function export($to, $rev = '')
 {
     if (is_dir($to)) {
         if ($this->has_svn) {
             $this->auth();
             return svn_export($this->url, $to, false);
         } else {
             ob_start();
             system("svn export " . $this->args() . " {$to} --force");
             $st = ob_get_contents();
             ob_end_clean();
             return $st;
         }
     }
 }
function svn_export_group($group, $global, $base_dir, $singleGet = null)
{
    $revision = array();
    if ($group['get'][0] == '*') {
        $revision[$global['svn_repo'] . $group['svn_path']] = svn_export($global['svn_repo'] . $group['svn_path'], $global['svn_user'], $global['svn_pass'], $base_dir . $group['local_path']);
    } else {
        if ($singleGet) {
            $revision[$global['svn_repo'] . $group['svn_path'] . $singleGet] = svn_export($global['svn_repo'] . $group['svn_path'] . $singleGet, $global['svn_user'], $global['svn_pass'], $base_dir . $group['local_path'] . $singleGet);
        } else {
            foreach ($group['get'] as $current) {
                $revision[$global['svn_repo'] . $group['svn_path'] . $current] = svn_export($global['svn_repo'] . $group['svn_path'] . $current, $global['svn_user'], $global['svn_pass'], $base_dir . $group['local_path'] . $current);
            }
        }
    }
    if (isset($group['remove'])) {
        foreach ($group['remove'] as $current) {
            $folders_to_remove = get_folders_to_remove($base_dir . $group['local_path'], $current);
            //$path = explode(" * ", $current);
            foreach ($folders_to_remove as $folder) {
                remove($base_dir . $group['local_path'] . '/' . $folder);
            }
        }
    }
    return $revision;
}
 public function ajaxProcessSvnExport()
 {
     if ($this->useSvn) {
         // first of all, delete the content of the latest root dir just in case
         if (is_dir($this->latestRootDir)) {
             Tools::deleteDirectory($this->latestRootDir, false);
         }
         if (!file_exists($this->latestRootDir)) {
             @mkdir($this->latestRootDir);
         }
         if (svn_export($this->autoupgradePath . DIRECTORY_SEPARATOR . $this->svnDir, $this->latestRootDir)) {
             // export means svn means install-dev and admin-dev.
             // let's rename admin to the correct admin dir
             // and rename install-dev to install
             $adminDir = str_replace($this->prodRootDir, '', $this->adminDir);
             rename($this->latestRootDir . DIRECTORY_SEPARATOR . 'install-dev', $this->latestRootDir . DIRECTORY_SEPARATOR . 'install');
             rename($this->latestRootDir . DIRECTORY_SEPARATOR . 'admin-dev', $this->latestRootDir . DIRECTORY_SEPARATOR . $adminDir);
             // Unsetting to force listing
             unset($this->nextParams['removeList']);
             $this->next = "removeSamples";
             $this->nextDesc = $this->l('Export svn complete. removing sample files...');
             return true;
         } else {
             $this->next = 'error';
             $this->nextDesc = $this->l('error when svn export ');
         }
     }
 }
Esempio n. 5
0
$code_v1_md5 = md5($code_v1);
$code_v2_md5 = md5($code_v2);
$svn_dir1 = DATA_DIR . $code_v1_md5;
$svn_dir2 = DATA_DIR . $code_v2_md5;
$svn_diff_file = DATA_DIR . $code_v1_md5 . "-" . $code_v2_md5 . ".diff";
// save the log
save_log($ldap, $code_v1, $code_v2);
$svn_v1_at_pos = strpos($code_v1, "@");
$svn_v2_at_pos = strpos($code_v2, "@");
$need_diff = false;
if (!file_exists($svn_dir1) || $svn_v1_at_pos == false) {
    svn_export($ldap, $passwd, $code_v1, $svn_dir1);
    $need_diff = true;
}
if (!file_exists($svn_dir2) || $svn_v2_at_pos == false) {
    svn_export($ldap, $passwd, $code_v2, $svn_dir2);
    $need_diff = true;
}
if (!file_exists($svn_diff_file) || $need_diff == true) {
    svn_diff($ldap, $passwd, $code_v1, $code_v2, $svn_diff_file);
}
# call bash file to generate result.php file
system("sh ./check_js.sh {$svn_dir1} {$svn_dir2} {$svn_diff_file}");
# touch("./result.php");
# output result to front
include "./result.php";
# will delete it later
/*
$old_array = Array(
    "js_file_path1" => Array(
        Array("2323", "dfasa", "adsfa"),
Esempio n. 6
0
 /**
  * Export specific source from the repository to the given target at the given revision
  *
  * @access public
  * @author Cédric Alfonsi, <*****@*****.**>
  * @param  Repository vcs
  * @param  string src
  * @param  string target
  * @param  int revision
  * @return boolean
  */
 public function export(core_kernel_versioning_Repository $vcs, $src, $target = null, $revision = null)
 {
     $returnValue = (bool) false;
     $startTime = helpers_Time::getMicroTime();
     $revision = is_null($revision) ? -1 : $revision;
     if ($vcs->authenticate()) {
         $returnValue = svn_export($src, $target, true, $revision);
     }
     $endTime = helpers_Time::getMicroTime();
     common_Logger::i("svn_export (" . $src . ' -> ' . $target . ') -> ' . ($endTime - $startTime) . 's');
     return (bool) $returnValue;
 }