本文整理汇总了PHP中Gdn_ApplicationManager::ApplicationHasSetup方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_ApplicationManager::ApplicationHasSetup方法的具体用法?PHP Gdn_ApplicationManager::ApplicationHasSetup怎么用?PHP Gdn_ApplicationManager::ApplicationHasSetup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_ApplicationManager
的用法示例。
在下文中一共展示了Gdn_ApplicationManager::ApplicationHasSetup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Applications
/**
* Application management screen.
*/
public function Applications($Filter = '', $TransientKey = '')
{
$Session = Gdn::Session();
$ApplicationName = $Session->ValidateTransientKey($TransientKey) ? $Filter : '';
if (!in_array($Filter, array('enabled', 'disabled'))) {
$Filter = '';
}
$this->Filter = $Filter;
$this->Permission('Garden.Applications.Manage');
$this->AddSideMenu('garden/settings/applications');
$this->AddJsFile('applications.js');
$this->Title(Translate('Applications'));
$AuthenticatedPostBack = $this->Form->AuthenticatedPostBack();
$ApplicationManager = new Gdn_ApplicationManager();
$this->AvailableApplications = $ApplicationManager->AvailableVisibleApplications();
$this->EnabledApplications = $ApplicationManager->EnabledVisibleApplications();
// Loop through all of the available visible apps and mark them if they have an update available
// Retrieve the list of apps that require updates from the config file
$RequiredUpdates = Format::Unserialize(Gdn::Config('Garden.RequiredUpdates', ''));
if (is_array($RequiredUpdates)) {
foreach ($RequiredUpdates as $UpdateInfo) {
if (is_object($UpdateInfo)) {
$UpdateInfo = Format::ObjectAsArray($UpdateInfo);
}
$NewVersion = ArrayValue('Version', $UpdateInfo, '');
$Name = ArrayValue('Name', $UpdateInfo, '');
$Type = ArrayValue('Type', $UpdateInfo, '');
foreach ($this->AvailableApplications as $App => $Info) {
$CurrentName = ArrayValue('Name', $Info, $App);
if ($CurrentName == $Name && $Type == 'Application') {
$Info['NewVersion'] = $NewVersion;
$this->AvailableApplications[$App] = $Info;
}
}
}
}
if ($ApplicationName != '') {
if (array_key_exists($ApplicationName, $this->EnabledApplications) === TRUE) {
try {
$ApplicationManager->DisableApplication($ApplicationName);
} catch (Exception $e) {
$this->Form->AddError(strip_tags($e->getMessage()));
}
} else {
try {
$ApplicationManager->CheckRequirements($ApplicationName);
} catch (Exception $e) {
$this->Form->AddError(strip_tags($e->getMessage()));
}
if ($this->Form->ErrorCount() == 0) {
$Validation = new Gdn_Validation();
$ApplicationManager->RegisterPermissions($ApplicationName, $Validation);
$ApplicationManager->EnableApplication($ApplicationName, $Validation);
if ($ApplicationManager->ApplicationHasSetup($ApplicationName)) {
$ApplicationManager->ApplicationSetup($ApplicationName, $this->ControllerName, $Validation);
}
}
$this->Form->SetValidationResults($Validation->Results());
}
if ($this->Form->ErrorCount() == 0) {
Redirect('settings/applications');
}
}
$this->Render();
}