当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_Common::infoFromTgzFile方法代码示例

本文整理汇总了PHP中PEAR_Common::infoFromTgzFile方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Common::infoFromTgzFile方法的具体用法?PHP PEAR_Common::infoFromTgzFile怎么用?PHP PEAR_Common::infoFromTgzFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_Common的用法示例。


在下文中一共展示了PEAR_Common::infoFromTgzFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doSign

 function doSign($command, $options, $params)
 {
     // should move most of this code into PEAR_Packager
     // so it'll be easy to implement "pear package --sign"
     if (sizeof($params) != 1) {
         return $this->raiseError("bad parameter(s), try \"help {$command}\"");
     }
     if (!file_exists($params[0])) {
         return $this->raiseError("file does not exist: {$params['0']}");
     }
     $obj = new PEAR_Common();
     $info = $obj->infoFromTgzFile($params[0]);
     if (PEAR::isError($info)) {
         return $this->raiseError($info);
     }
     include_once "Archive/Tar.php";
     include_once "System.php";
     $tar = new Archive_Tar($params[0]);
     $tmpdir = System::mktemp('-d pearsign');
     if (!$tar->extractList('package.xml package.sig', $tmpdir)) {
         return $this->raiseError("failed to extract tar file");
     }
     if (file_exists("{$tmpdir}/package.sig")) {
         return $this->raiseError("package already signed");
     }
     @unlink("{$tmpdir}/package.sig");
     $input = $this->ui->userDialog($command, array('GnuPG Passphrase'), array('password'));
     $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output {$tmpdir}/package.sig {$tmpdir}/package.xml 2>/dev/null", "w");
     if (!$gpg) {
         return $this->raiseError("gpg command failed");
     }
     fwrite($gpg, "{$input['0']}\r");
     if (pclose($gpg) || !file_exists("{$tmpdir}/package.sig")) {
         return $this->raiseError("gpg sign failed");
     }
     $tar->addModify("{$tmpdir}/package.sig", '', $tmpdir);
     return true;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:38,代码来源:Package.php

示例2: list

$rel_id2name = $dbh->getAssoc("SELECT r.id,concat_ws('-', p.name, r.version) FROM packages p, releases r WHERE r.package = p.id");
print "<h2>Deleting Existing Dependencies...</h2>\n";
$dbh->setOption("optimize", "portability");
$dbh->query("DELETE FROM deps");
$ar = $dbh->affectedRows();
$dbh->setOption("optimize", "performance");
print "{$ar} rows deleted<br />\n";
print "<h2>Inserting New Dependencies...</h2>\n";
$sth = $dbh->query("SELECT package, release, fullpath FROM files");
while ($sth->fetchInto($row)) {
    list($package, $release, $fullpath) = $row;
    printf("<h3>%s (package %d, release %d):</h3>\n", basename($fullpath), $package, $release);
    if (!@file_exists($fullpath)) {
        continue;
    }
    $pkginfo = $pc->infoFromTgzFile($fullpath);
    if (empty($pkginfo['release_deps'])) {
        printf("%s : no dependencies<br />\n", $rel_id2name[$release]);
        continue;
    }
    foreach ($pkginfo['release_deps'] as $dep) {
        if ($dep['rel']) {
            $dep['relation'] = $dep['rel'];
            unset($dep['rel']);
        }
        $i = 0;
        $fields = implode(',', array_keys($dep));
        $values = array_values($dep);
        $phs = substr(str_repeat('?,', sizeof($values) + 2), 0, -1);
        $query = "INSERT INTO deps (package,release,{$fields}) VALUES({$phs})";
        $pq = $dbh->prepare($query);
开发者ID:phpsource,项目名称:web-pecl,代码行数:31,代码来源:fixdeps.php


注:本文中的PEAR_Common::infoFromTgzFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。