本文整理汇总了PHP中Package::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::setName方法的具体用法?PHP Package::setName怎么用?PHP Package::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unserialize
/**
* @param array $data
*/
public function unserialize($data)
{
$data = json_decode($data, true);
$packageName = key($data['packages']);
$packages =& $data['packages'][$packageName];
foreach ($packages as $version => $info) {
$tmpPackage = new Package();
$tmpPackage->setName($packageName);
$tmpPackage->setTag($version);
$tmpPackage->setFromArray($info);
$this->data[$version] = $tmpPackage;
}
$this->name = $packageName;
list($this->vendorName, $this->packageName) = explode('/', $packageName);
}
示例2: getData
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
include "prepend.inc.php";
$Server = getData("Server", "integer");
$User = getData("User");
$Packagename = getData("Packagename");
$html = "<h1> Database " . $DB->Name($Server) . " - Package " . $Packagename . "</h1>";
if ($Packagename) {
$pack = new Package($Server);
$pack->setOwner($User);
$pack->setName($Packagename);
$pack->getData();
$html .= "<table border=0><tr><th>Tag</th><th>Value</th></tr>";
$html .= "<tr><td>Name</td><td>" . $pack->name . "</td></tr>";
$html .= "<tr><td>Owner</td><td>" . $pack->owner . "</td></tr>";
$html .= "<tr><td>Created</td><td>" . $pack->created . "</td></tr>";
$html .= "<tr><td>Last Modified</td><td>" . $pack->lastmodified . "</td></tr>";
$html .= "<tr><td>Status</td><td>" . $pack->status . "</td></tr>";
$html .= "</table>";
$html .= "<P><B>Package body:</b><br>";
$html .= nl2br($pack->sql) . "<br>";
$html .= "</P>";
}
$page = new Page("Package Properties");
$page->setHead();
$page->setBody();
示例3: installPackage
/**
* Installs a package.
*
* @param string $name
* @param bool $simulate
* @return bool
*/
public static function installPackage($name, $simulate = false)
{
$package = Curry_PackageManager::getPackage($name);
if (!$package) {
throw new Exception('Package not found');
}
$installedPackage = PackageQuery::create()->findPk($name);
if ($installedPackage) {
throw new Exception('Package already installed');
}
if (!$simulate && !self::execTask($package, 'preInstall', true)) {
return new Exception('Package installation prevented by preInstall hook.');
}
if (!$simulate) {
$installedPackage = new Package();
$installedPackage->setName($package['name']);
$installedPackage->setVersion($package['version']);
$installedPackage->save();
}
$tar = new Curry_Archive(self::getCachedFile($package['source'], true));
foreach ($tar as $tarFile) {
$file = $tarFile->getPathname();
try {
$target = PackageFile::mapFile($file);
} catch (Exception $e) {
self::log('Skipping: ' . $file);
continue;
}
// create directory
if ($tarFile->isDir()) {
if (!$simulate) {
if (!file_exists($target)) {
mkdir($target, 0777, true);
}
}
continue;
}
// Extract file
self::log('Adding: ' . $file, Curry_Backend::MSG_SUCCESS);
if (!$simulate) {
if (file_exists($target)) {
$backupTarget = $target . "." . date("-Ymd_His");
if (file_exists($backupTarget)) {
throw new Exception('Unable to backup existing file.');
}
rename($target, $backupTarget);
}
$tarFile->extract($target);
$packageFile = new PackageFile();
$packageFile->setPackage($installedPackage);
$packageFile->setFilename($file);
$packageFile->setChecksum(sha1_file($target));
$packageFile->save();
}
}
if (!$simulate) {
self::execTaskWithReload($package, 'postInstall');
}
self::$installed = null;
return true;
}
示例4: testGetAndSetName
public function testGetAndSetName()
{
$this->assertEquals(null, $this->sut->getName());
$this->sut->setName('bar');
$this->assertEquals('bar', $this->sut->getName());
}