本文整理汇总了PHP中PEAR_Task_Common::runPostinstallTasks方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Task_Common::runPostinstallTasks方法的具体用法?PHP PEAR_Task_Common::runPostinstallTasks怎么用?PHP PEAR_Task_Common::runPostinstallTasks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Task_Common
的用法示例。
在下文中一共展示了PEAR_Task_Common::runPostinstallTasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
//.........这里部分代码省略.........
$this->popExpect();
} else {
$this->expectError(PEAR_INSTALLER_FAILED);
$res = $this->_installFile2($pkg, $file, $atts, $tmp_path, $options);
$this->popExpect();
}
if (PEAR::isError($res)) {
if (empty($options['ignore-errors'])) {
$this->rollbackFileTransaction();
if ($res->getMessage() == "file does not exist") {
$this->raiseError("file {$file} in package.xml does not exist");
}
return $this->raiseError($res);
} else {
if (!isset($options['soft'])) {
$this->log(0, "Warning: " . $res->getMessage());
}
}
}
if ($res == PEAR_INSTALLER_OK) {
// Register files that were installed
$pkg->installedFile($file, $atts);
}
}
// }}}
// {{{ compile and install source files
if ($this->source_files > 0 && empty($options['nobuild'])) {
if (PEAR::isError($err = $this->_compileSourceFiles($savechannel, $pkg))) {
return $err;
}
}
// }}}
if (isset($backedup)) {
$this->_removeBackups($backedup);
}
if (!$this->commitFileTransaction()) {
$this->rollbackFileTransaction();
$this->configSet('default_channel', $savechannel);
return $this->raiseError("commit failed", PEAR_INSTALLER_FAILED);
}
// }}}
$ret = false;
$installphase = 'install';
$oldversion = false;
// {{{ Register that the package is installed -----------------------
if (empty($options['upgrade'])) {
// if 'force' is used, replace the info in registry
$usechannel = $channel;
if ($channel == 'pecl.php.net') {
$test = $installregistry->packageExists($pkgname, $channel);
if (!$test) {
$test = $installregistry->packageExists($pkgname, 'pear.php.net');
$usechannel = 'pear.php.net';
}
} else {
$test = $installregistry->packageExists($pkgname, $channel);
}
if (!empty($options['force']) && $test) {
$oldversion = $installregistry->packageInfo($pkgname, 'version', $usechannel);
$installregistry->deletePackage($pkgname, $usechannel);
}
$ret = $installregistry->addPackage2($pkg);
} else {
$usechannel = $channel;
if ($channel == 'pecl.php.net') {
$test = $installregistry->packageExists($pkgname, $channel);
if (!$test) {
$test = $installregistry->packageExists($pkgname, 'pear.php.net');
$usechannel = 'pear.php.net';
}
} else {
$test = $installregistry->packageExists($pkgname, $channel);
}
// new: upgrade installs a package if it isn't installed
if (!$test) {
$ret = $installregistry->addPackage2($pkg);
} else {
if ($usechannel != $channel) {
$installregistry->deletePackage($pkgname, $usechannel);
$ret = $installregistry->addPackage2($pkg);
} else {
$ret = $installregistry->updatePackage2($pkg);
}
$installphase = 'upgrade';
}
}
if (!$ret) {
$this->configSet('default_channel', $savechannel);
return $this->raiseError("Adding package {$channel}/{$pkgname} to registry failed");
}
// }}}
$this->configSet('default_channel', $savechannel);
if (class_exists('PEAR_Task_Common')) {
// this is auto-included if any tasks exist
if (PEAR_Task_Common::hasPostinstallTasks()) {
PEAR_Task_Common::runPostinstallTasks($installphase);
}
}
return $pkg->toArray(true);
}