<nav class="wcf-tabMenu">
<ul>
<li><a href="#information">{lang}wcf.acp.package.information.title{/lang}</a></li>
- {if $requiredPackages|count || $dependentPackages|count}<li><a href="#dependencies">{lang}wcf.acp.package.dependencies.title{/lang}</a></li>{/if}
+ {if $package->getRequiredPackages()|count || $package->getDependentPackages()|count}
+ <li><a href="#dependencies">{lang}wcf.acp.package.dependencies.title{/lang}</a></li>
+ {/if}
</ul>
</nav>
{/if}
</div>
- {if $requiredPackages|count || $dependentPackages|count}
+ {if $package->getRequiredPackages()|count || $package->getDependentPackages()|count}
<div id="dependencies" class="wcf-border wcf-tabMenuContainer wcf-tabMenuContent">
<nav class="wcf-menu">
<ul>
- {if $requiredPackages|count}<li><a href="#dependencies-required">{lang}wcf.acp.package.dependencies.required{/lang}</a></li>{/if}
- {if $dependentPackages|count}<li><a href="#dependencies-dependent">{lang}wcf.acp.package.dependencies.dependent{/lang}</a></li>{/if}
+ {if $package->getRequiredPackages()|count}
+ <li><a href="#dependencies-required">{lang}wcf.acp.package.dependencies.required{/lang}</a></li>
+ {/if}
+ {if $package->getDependentPackages()|count}
+ <li><a href="#dependencies-dependent">{lang}wcf.acp.package.dependencies.dependent{/lang}</a></li>
+ {/if}
</ul>
</nav>
<tbody>
{content}
- {foreach from=$requiredPackages item=requiredPackage}
+ {foreach from=$package->getRequiredPackages() item=requiredPackage}
<tr>
<td class="columnIcon">
{if $__wcf->session->getPermission('admin.system.package.canUpdatePackage')}
- <a href="{link controller='PackageStartInstall' id=$requiredPackage.packageID}action=update{/link}"><img src="{@$__wcf->getPath()}icon/update1.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" class="jsTooltip" /></a>
+ <a href="{link controller='PackageStartInstall' id=$requiredPackage->packageID}action=update{/link}"><img src="{@$__wcf->getPath()}icon/update1.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" class="jsTooltip" /></a>
{else}
<img src="{@$__wcf->getPath()}icon/update1D.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" />
{/if}
- {if $__wcf->session->getPermission('admin.system.package.canUninstallPackage') && $requiredPackage.package != 'com.woltlab.wcf' && $requiredPackage.packageID != PACKAGE_ID}
- <a onclick="return confirm('{lang}wcf.acp.package.button.uninstall.sure{/lang}')" href="{link controller='Package'}action=startUninstall&packageID={@$requiredPackage.packageID}{/link}"><img src="{@$__wcf->getPath()}icon/delete1.svg" alt="" title="{lang}wcf.acp.package.button.uninstall{/lang}" class="jsTooltip" /></a>
+ {if $__wcf->session->getPermission('admin.system.package.canUninstallPackage') && $requiredPackage->package != 'com.woltlab.wcf' && $requiredPackage->packageID != PACKAGE_ID}
+ <a onclick="return confirm('{lang}wcf.acp.package.button.uninstall.sure{/lang}')" href="{link controller='Package'}action=startUninstall&packageID={@$requiredPackage->packageID}{/link}"><img src="{@$__wcf->getPath()}icon/delete1.svg" alt="" title="{lang}wcf.acp.package.button.uninstall{/lang}" class="jsTooltip" /></a>
{else}
<img src="{@$__wcf->getPath()}icon/delete1D.svg" alt="" title="{lang}wcf.acp.package.button.uninstall{/lang}" />
{/if}
</td>
- <td class="columnID"><p>{@$requiredPackage.packageID}</p></td>
+ <td class="columnID"><p>{@$requiredPackage->packageID}</p></td>
<td class="columnIcon">
- {if $requiredPackage.isApplication}
+ {if $requiredPackage->isApplication}
<img src="{@$__wcf->getPath()}icon/packageApplication1.svg" alt="" title="{lang}wcf.acp.package.type.application{/lang}" class="jsTooltip" />
- {elseif $requiredPackage.parentPackageID}
+ {elseif $requiredPackage->parentPackageID}
<img src="{@$__wcf->getPath()}icon/packagePlugin1.svg" alt="" title="{lang}wcf.acp.package.type.plugin{/lang}" class="jsTooltip" />
{else}
<img src="{@$__wcf->getPath()}icon/package1.svg" alt="" title="{lang}wcf.acp.package.type.other{/lang}" class="jsTooltip" />
{/if}
</td>
- <td class="columnTitle" title="{$requiredPackage.packageDescription}"><p><a href="{link controller='PackageView' id=$requiredPackage.packageID}{/link}">{$requiredPackage.packageName}{if $requiredPackage.instanceNo > 1 && $requiredPackage.instanceName == ''} (#{#$requiredPackage.instanceNo}){/if}</a></p></td>
- <td class="columnText">{if $requiredPackage.authorURL}<p><a href="{@$__wcf->getPath()}acp/dereferrer.php?url={$requiredPackage.authorURL|rawurlencode}" class="wcf-externalURL">{$requiredPackage.author}</a>{else}{$requiredPackage.author}</p>{/if}</td>
- <td class="columnText"><p>{$requiredPackage.packageVersion}</p></td>
- <td class="columnDate"><p>{@$requiredPackage.packageDate|date}</p></td>
+ <td class="columnTitle" title="{$requiredPackage->packageDescription}"><p><a href="{link controller='PackageView' id=$requiredPackage->packageID}{/link}">{$requiredPackage->packageName}{if $requiredPackage->instanceNo > 1 && $requiredPackage->instanceName == ''} (#{#$requiredPackage->instanceNo}){/if}</a></p></td>
+ <td class="columnText">{if $requiredPackage->authorURL}<p><a href="{@$__wcf->getPath()}acp/dereferrer.php?url={$requiredPackage->authorURL|rawurlencode}" class="wcf-externalURL">{$requiredPackage->author}</a>{else}{$requiredPackage->author}</p>{/if}</td>
+ <td class="columnText"><p>{$requiredPackage->packageVersion}</p></td>
+ <td class="columnDate"><p>{@$requiredPackage->packageDate|date}</p></td>
{event name='requirementColumns'}
</tr>
<tbody>
{content}
- {foreach from=$dependentPackages item=dependentPackage}
+ {foreach from=$package->getDependentPackages() item=dependentPackage}
<tr>
<td class="columnIcon">
{if $__wcf->session->getPermission('admin.system.package.canUpdatePackage')}
- <a href="{link controller='PackageStartInstall' id=$dependentPackage.packageID}action=update{/link}"><img src="{@$__wcf->getPath()}icon/update1.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" class="jsTooltip" /></a>
+ <a href="{link controller='PackageStartInstall' id=$dependentPackage->packageID}action=update{/link}"><img src="{@$__wcf->getPath()}icon/update1.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" class="jsTooltip" /></a>
{else}
<img src="{@$__wcf->getPath()}icon/update1D.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" />
{/if}
- {if $__wcf->session->getPermission('admin.system.package.canUninstallPackage') && $dependentPackage.package != 'com.woltlab.wcf' && $dependentPackage.packageID != PACKAGE_ID}
- <a onclick="return confirm('{lang}wcf.acp.package.button.uninstall.sure{/lang}')" href="{link controller='Package'}action=startUninstall&packageID={@$dependentPackage.packageID}{/link}"><img src="{@$__wcf->getPath()}icon/delete1.svg" alt="" title="{lang}wcf.acp.package.button.uninstall{/lang}" class="jsTooltip" /></a>
+ {if $__wcf->session->getPermission('admin.system.package.canUninstallPackage') && $dependentPackage->package != 'com.woltlab.wcf' && $dependentPackage->packageID != PACKAGE_ID}
+ <a onclick="return confirm('{lang}wcf.acp.package.button.uninstall.sure{/lang}')" href="{link controller='Package'}action=startUninstall&packageID={@$dependentPackage->packageID}{/link}"><img src="{@$__wcf->getPath()}icon/delete1.svg" alt="" title="{lang}wcf.acp.package.button.uninstall{/lang}" class="jsTooltip" /></a>
{else}
<img src="{@$__wcf->getPath()}icon/delete1D.svg" alt="" title="{lang}wcf.acp.package.button.uninstall{/lang}" />
{/if}
</td>
- <td class="columnID"><p>{@$dependentPackage.packageID}</p></td>
+ <td class="columnID"><p>{@$dependentPackage->packageID}</p></td>
<td class="columnIcon">
- {if $dependentPackage.isApplication}
+ {if $dependentPackage->isApplication}
<img src="{@$__wcf->getPath()}icon/packageApplication1.svg" alt="" title="{lang}wcf.acp.package.type.application{/lang}" class="jsTooltip" />
- {elseif $dependentPackage.parentPackageID}
+ {elseif $dependentPackage->parentPackageID}
<img src="{@$__wcf->getPath()}icon/packagePlugin1.svg" alt="" title="{lang}wcf.acp.package.type.plugin{/lang}" class="jsTooltip" />
{else}
<img src="{@$__wcf->getPath()}icon/package1.svg" alt="" title="{lang}wcf.acp.package.type.other{/lang}" class="jsTooltip" />
{/if}
</td>
- <td class="columnTitle" title="{$dependentPackage.packageDescription}"><p><a href="{link controller='PackageView' id=$dependentPackage.packageID}{/link}">{$dependentPackage.packageName}{if $dependentPackage.instanceNo > 1 && $dependentPackage.instanceName == ''} (#{#$dependentPackage.instanceNo}){/if}</a></p></td>
- <td class="columnText">{if $dependentPackage.authorURL}<p><a href="{@$__wcf->getPath()}acp/dereferrer.php?url={$dependentPackage.authorURL|rawurlencode}" class="wcf-externalURL">{$dependentPackage.author}</a>{else}{$dependentPackage.author}</p>{/if}</td>
- <td class="columnText"><p>{$dependentPackage.packageVersion}</p></td>
- <td class="columnDate"><p>{@$dependentPackage.packageDate|date}</p></td>
+ <td class="columnTitle" title="{$dependentPackage->packageDescription}"><p><a href="{link controller='PackageView' id=$dependentPackage->packageID}{/link}">{$dependentPackage->packageName}{if $dependentPackage->instanceNo > 1 && $dependentPackage->instanceName == ''} (#{#$dependentPackage->instanceNo}){/if}</a></p></td>
+ <td class="columnText">{if $dependentPackage->authorURL}<p><a href="{@$__wcf->getPath()}acp/dereferrer.php?url={$dependentPackage->authorURL|rawurlencode}" class="wcf-externalURL">{$dependentPackage->author}</a>{else}{$dependentPackage->author}</p>{/if}</td>
+ <td class="columnText"><p>{$dependentPackage->packageVersion}</p></td>
+ <td class="columnDate"><p>{@$dependentPackage->packageDate|date}</p></td>
{event name='dependencyColumns'}
</tr>
</div>
{assign var=noDependentIsActive value=true}
-{foreach from=$dependentPackages item=dependentPackage}
- {if $dependentPackage.package != 'com.woltlab.wcf' && $dependentPackage.packageID == PACKAGE_ID}
+{foreach from=$package->getDependentPackages() item=dependentPackage}
+ {if $dependentPackage->package != 'com.woltlab.wcf' && $dependentPackage->packageID == PACKAGE_ID}
{assign var=noDependentIsActive value=false}
{* TODO: maybe show users that this package can't be uninstalled because a dependent package is the active application *}
{/if}
*/
public $neededPermissions = array('admin.system.package.canUpdatePackage', 'admin.system.package.canUninstallPackage');
- /**
- * list with data of required packages explicitly given in the requiredPackages
- * tag during installation
- * @var array<string>
- */
- public $requiredPackages = array();
-
- /**
- * list with data of dependent packages
- * @var array<string>
- */
- public $dependentPackages = array();
-
- /**
- * list with data of required packages
- * @var array<string>
- */
- public $dependencies = array();
-
/**
* id of the package
* @var integer
}
}
- /**
- * @see wcf\page\IPage::readData()
- */
- public function readData() {
- parent::readData();
-
- // get package data
- $this->requiredPackages = $this->package->getRequiredPackages();
- $this->dependentPackages = $this->package->getDependentPackages();
- $this->dependencies = $this->package->getDependencies();
- }
-
/**
* @see wcf\page\IPage::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
- WCF::getTPL()->assign(array(
- 'requiredPackages' => $this->requiredPackages,
- 'dependentPackages' => $this->dependentPackages,
- 'dependencies' => $this->dependencies,
- 'package' => $this->package
- ));
+ WCF::getTPL()->assign('package', $this->package);
}
/**
*/
protected static $databaseTableIndexName = 'packageID';
+ /**
+ * list of packages that this package requires
+ * @var array<wcf\data\package\Package>
+ */
+ protected $dependencies = null;
+
+ /**
+ * list of packages that require this package
+ * @var array<wcf\data\package\Package>
+ */
+ protected $dependentPackages = null;
+
/**
* installation directory
- *
* @var string
*/
protected $dir = '';
+ /**
+ * list of packages that were given as required packages during installation
+ * @var array<wcf\data\package\Package>
+ */
+ protected $requiredPackages = null;
+
/**
* Returns true, if this package is required by other packages.
*
* @return array
*/
public function getDependencies() {
- $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
- FROM wcf".WCF_N."_package_dependency package_dependency
- LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_dependency.dependency)
- WHERE package_dependency.packageID = ?
- ORDER BY packageName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->packageID));
- $packages = array();
- while ($row = $statement->fetchArray()) {
- $packages[] = $row;
+ if ($this->dependencies === null) {
+ $this->dependencies = array();
+
+ $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
+ FROM wcf".WCF_N."_package_dependency package_dependency
+ LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_dependency.dependency)
+ WHERE package_dependency.packageID = ?
+ ORDER BY packageName ASC";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($this->packageID));
+ while ($package = $statement->fetchObject('wcf\data\package\Package')) {
+ $this->dependencies[$package->packageID] = $package;
+ }
}
- return $packages;
+ return $this->dependencies;
}
/**
* @return array
*/
public function getDependentPackages() {
- $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
- FROM wcf".WCF_N."_package_requirement package_requirement
- LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_requirement.packageID)
- WHERE package_requirement.requirement = ?
- ORDER BY packageName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->packageID));
- $packages = array();
- while ($row = $statement->fetchArray()) {
- $packages[] = $row;
+ if ($this->dependentPackages === null) {
+ $this->dependentPackages = array();
+
+ $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
+ FROM wcf".WCF_N."_package_requirement package_requirement
+ LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_requirement.packageID)
+ WHERE package_requirement.requirement = ?
+ ORDER BY packageName ASC";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($this->packageID));
+ while ($package = $statement->fetchObject('wcf\data\package\Package')) {
+ $this->dependentPackages[$package->packageID] = $package;
+ }
}
- return $packages;
+ return $this->dependentPackages;
}
/**
* @return array
*/
public function getRequiredPackages() {
- $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
- FROM wcf".WCF_N."_package_requirement package_requirement
- LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_requirement.requirement)
- WHERE package_requirement.packageID = ?
- ORDER BY packageName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->packageID));
- $packages = array();
- while ($row = $statement->fetchArray()) {
- $packages[] = $row;
+ if ($this->requiredPackages === null) {
+ $this->requiredPackages = array();
+
+ $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
+ FROM wcf".WCF_N."_package_requirement package_requirement
+ LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_requirement.requirement)
+ WHERE package_requirement.packageID = ?
+ ORDER BY packageName ASC";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($this->packageID));
+ while ($package = $statement->fetchObject('wcf\data\package\Package')) {
+ $this->requiredPackages[$package->packageID] = $package;
+ }
}
- return $packages;
+ return $this->requiredPackages;
}
/**