本文整理汇总了PHP中Package::getPackageID方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::getPackageID方法的具体用法?PHP Package::getPackageID怎么用?PHP Package::getPackageID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::getPackageID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByPackage
/**
* Gets an array of BlockTypes for a given Package
* @param Package $pkg
* @return BlockType[]
*/
public static function getByPackage($pkg) {
$db = Loader::db();
$r = $db->Execute("select btID from BlockTypes where pkgID = ?", $pkg->getPackageID());
$blockTypes = array();
while ($row = $r->FetchRow()) {
$blockTypes[] = BlockType::getByID($row['btID']);
}
return $blockTypes;
}
示例2: getListByPackage
/**
* @param Package $pkg
* @return array
*/
public static function getListByPackage($pkg)
{
$db = Loader::db();
$upaIDs = $db->GetCol('select upaID from UserPointActions where pkgID = ? order by upaName asc', array($pkg->getPackageID()));
$actions = array();
foreach ($upaIDs as $upaID) {
$action = static::getByID($upaID);
if (is_object($action)) {
$actions[] = $action;
}
}
return $actions;
}
示例3: getAllExistingRequirements
/**
* Checks which package requirements do already exist in right version.
* Returns a list with all existing requirements.
*
* @return array
*/
public function getAllExistingRequirements()
{
$existingRequirements = array();
$existingPackages = array();
if ($this->package !== null) {
$sql = "SELECT\t\tpackage.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName\n\t\t\t\tFROM\t\twcf" . WCF_N . "_package_requirement requirement\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\t\tON\t\t(package.packageID = requirement.requirement)\n\t\t\t\tWHERE\t\trequirement.packageID = " . $this->package->getPackageID();
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$existingRequirements[$row['package']] = $row;
}
}
// build sql
$packageNames = '';
$requirements = $this->getRequirements();
foreach ($requirements as $requirement) {
if (isset($existingRequirements[$requirement['name']])) {
$existingPackages[$requirement['name']] = array();
$existingPackages[$requirement['name']][$existingRequirements[$requirement['name']]['packageID']] = $existingRequirements[$requirement['name']];
} else {
if (!empty($packageNames)) {
$packageNames .= ',';
}
$packageNames .= "'" . escapeString($requirement['name']) . "'";
}
}
// check whether the required packages do already exist
if (!empty($packageNames)) {
$sql = "SELECT \tpackage.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName\n\t\t\t\tFROM\twcf" . WCF_N . "_package package\n\t\t\t\tWHERE\tpackage.package IN (" . $packageNames . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
// check required package version
if (isset($requirements[$row['package']]['minversion']) && Package::compareVersion($row['packageVersion'], $requirements[$row['package']]['minversion']) == -1) {
continue;
}
if (!isset($existingPackages[$row['package']])) {
$existingPackages[$row['package']] = array();
}
$existingPackages[$row['package']][$row['packageID']] = $row;
}
}
return $existingPackages;
}
示例4: getListByPackage
/**
* @param \Package $pkg
*
* @return Library[]
*/
public static function getListByPackage($pkg)
{
$db = Loader::db();
$saslHandles = $db->GetCol('select saslHandle from SystemAntispamLibraries where pkgID = ? order by saslHandle asc', array($pkg->getPackageID()));
$libraries = array();
foreach ($saslHandles as $saslHandle) {
$sasl = static::getByHandle($saslHandle);
$libraries[] = $sasl;
}
return $libraries;
}
示例5: getListByPackage
/**
* @param \Package $pkg A Concrete5 Package object
* @return array
*/
public static function getListByPackage($pkg)
{
$list = array();
$categories = Database::connection()->fetchAll('SELECT akCategoryID
FROM AttributeKeyCategories
WHERE pkgID = ?
ORDER BY akCategoryID ASC', array($pkg->getPackageID()));
foreach ($categories as $cat) {
$list[] = static::getByID($cat['akCategoryID']);
}
return $list;
}
示例6: addQueueEntries
/**
* Adds an uninstall entry to the package installation queue.
*
* @param Package $package
* @param array $packages
*/
public static function addQueueEntries(Package $package, $packages = array())
{
// get new process no
$processNo = PackageInstallationQueue::getNewProcessNo();
// add dependent packages to queue
$inserts = '';
$userID = WCF::getUser()->userID;
foreach ($packages as $dependentPackage) {
if (!empty($inserts)) {
$inserts .= ',';
}
$inserts .= "(" . $processNo . ", " . $userID . ", '" . escapeString($dependentPackage['packageName']) . "', " . $dependentPackage['packageID'] . ", 'uninstall')";
}
// add uninstalling package to queue
if (!empty($inserts)) {
$inserts .= ',';
}
$inserts .= "(" . $processNo . ", " . $userID . ", '" . escapeString($package->getName()) . "', " . $package->getPackageID() . ", 'uninstall')";
// insert queue entry (entries)
$sql = "INSERT INTO\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\t\t(processNo, userID, package, packageID, action)\n\t\t\tVALUES\t\t" . $inserts;
WCF::getDB()->sendQuery($sql);
// open queue
HeaderUtil::redirect('index.php?page=Package&action=openQueue&processNo=' . $processNo . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
exit;
}
示例7: getListByPackage
/**
* Return an array of AuthenticationTypes that are associated with a specific package.
* @param \Package $pkg
* @return \Concrete\Core\File\StorageLocation\Type\Type[]
*/
public static function getListByPackage(\Package $pkg)
{
$em = \ORM::entityManager('core');
return $em->getRepository('\\Concrete\\Core\\File\\StorageLocation\\Type\\Type')->findBy(array('pkgID' => $pkg->getPackageID()), array('fslTypeID' => 'asc'));
}
示例8: installBlockTypeFromPackage
/**
* installs a new BlockType from a package,
* typicaly called from a package controller's install() method durring package installation
* @todo Documentation how is the btID used, if you want to reserve/specify a btID??
* @param string $btHandle the block Type's handle
* @param Package $pkg
* @param int $btID if it's an existing block type
* @return void|string error message
*/
public function installBlockTypeFromPackage($btHandle, $pkg, $btID = 0) {
$dir1 = DIR_PACKAGES . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_BLOCKS;
$dir2 = DIR_PACKAGES_CORE . '/' . $pkg->getPackageHandle() . '/' . DIRNAME_BLOCKS;
if (file_exists($dir1)) {
$dir = $dir1;
$dirDbXml = $dir;
} else {
$dir = $dir2;
$dirDbXml = $dir;
}
// now we check to see if it's been overridden in the site root and if so we do it there
if ($btID > 0) {
// this is only necessary when it's an existing refresh
if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $btHandle . '/' . FILENAME_BLOCK_CONTROLLER)) {
$dir = DIR_FILES_BLOCK_TYPES;
}
if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $btHandle . '/' . FILENAME_BLOCK_DB)) {
$dirDbXml = DIR_FILES_BLOCK_TYPES;
}
}
$bt = new BlockType;
$bt->btHandle = $btHandle;
$bt->pkgHandle = $pkg->getPackageHandle();
$bt->pkgID = $pkg->getPackageID();
return BlockType::doInstallBlockType($btHandle, $bt, $dir, $btID, $dirDbXml);
}
示例9: getListByPackage
/**
* Return an array of AuthenticationTypes that are associated with a specific package.
* @param \Package $pkg
* @return \Concrete\Core\File\StorageLocation\Type\Type[]
*/
public static function getListByPackage(\Package $pkg)
{
$db = Database::get();
$em = $db->getEntityManager();
return $em->getRepository('\\Concrete\\Core\\File\\StorageLocation\\Type\\Type')->findBy(array('pkgID' => $pkg->getPackageID()), array('fslTypeID' => 'asc'));
}
示例10: writeConfigFile
/**
* Writes the config.inc.php for a standalone application.
*
* @param integer $packageID
*/
public static function writeConfigFile($packageID)
{
$package = new Package($packageID);
$packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $package->getDir()));
$file = new File($packageDir . PackageInstallation::CONFIG_FILE);
$file->write("<?php\n");
$currentPrefix = strtoupper($package->getAbbreviation());
// get dependencies (only standalones)
$sql = "SELECT\t\tpackage.*, IF(package.packageID = " . $packageID . ", 1, 0) AS sortOrder\n\t\t\tFROM\t\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\tON\t\t(package.packageID = package_dependency.dependency)\n\t\t\tWHERE\t\tpackage_dependency.packageID = " . $packageID . "\n\t\t\t\t\tAND package.standalone = 1\n\t\t\t\t\tAND package.packageDir <> ''\n\t\t\tORDER BY\tsortOrder DESC,\n\t\t\t\t\tpackage_dependency.priority DESC";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$dependency = new Package(null, $row);
$dependencyDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $dependency->getDir()));
$prefix = strtoupper($dependency->getAbbreviation());
$file->write("// " . $dependency->getPackage() . " vars\n");
$file->write("// " . strtolower($prefix) . "\n");
$file->write("if (!defined('" . $prefix . "_DIR')) define('" . $prefix . "_DIR', " . ($dependency->getPackageID() == $package->getPackageID() ? "dirname(__FILE__).'/'" : "'" . $dependencyDir . "'") . ");\n");
$file->write("if (!defined('RELATIVE_" . $prefix . "_DIR')) define('RELATIVE_" . $prefix . "_DIR', " . ($dependency->getPackageID() == $package->getPackageID() ? "''" : "RELATIVE_" . $currentPrefix . "_DIR.'" . FileUtil::getRelativePath($packageDir, $dependencyDir) . "'") . ");\n");
$file->write("if (!defined('" . $prefix . "_N')) define('" . $prefix . "_N', '" . WCF_N . "_" . $dependency->getInstanceNo() . "');\n");
$file->write("\$packageDirs[] = " . $prefix . "_DIR;\n");
$file->write("\n");
}
// write general information
$file->write("// general info\n");
$file->write("if (!defined('RELATIVE_WCF_DIR'))\tdefine('RELATIVE_WCF_DIR', RELATIVE_" . $currentPrefix . "_DIR.'" . FileUtil::getRelativePath($packageDir, WCF_DIR) . "');\n");
$file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', " . $package->getPackageID() . ");\n");
$file->write("if (!defined('PACKAGE_NAME')) define('PACKAGE_NAME', '" . str_replace("'", "\\'", $package->getName()) . "');\n");
$file->write("if (!defined('PACKAGE_VERSION')) define('PACKAGE_VERSION', '" . $package->getVersion() . "');\n");
// write end
$file->write("?>");
$file->close();
}