//]]>
</script>
<style type="text/css">
+#health ul {
+ list-style: disc;
+ padding-left: 16px;
+}
#credits dd > ul > li {
display: inline;
}
content: "";
}
</style>
-{if $didYouKnow !== ''}<p class="info">{lang}wcf.acp.index.didYouKnow{/lang}: {$didYouKnow|language}</p>{/if}
+{if $didYouKnow !== ''}<p class="info">{lang}wcf.acp.index.didYouKnow{/lang}: {@$didYouKnow|language}</p>{/if}
+<p class="{@$health}">{lang}wcf.acp.index.health.summary.{@$health}{/lang}</p>
+{event name='boxes'}
-<div class="tabMenuContainer" data-active="credits" data-store="activeTabMenuItem">
+<div class="tabMenuContainer" data-active="{if $health !== 'success'}health{else}credits{/if}" data-store="activeTabMenuItem">
<nav class="tabMenu">
<ul>
+ {if $health !== 'success'}<li><a href="#health" title="Health">Health</a></li>{/if}
<li><a href="#credits" title="Credits">Credits</a></li>
+ {event name='tabs'}
</ul>
</nav>
-
+ {if $health !== 'success'}
+ <div id="health" class="container containerPadding shadow hidden tabMenuContent">
+ {foreach from=$healthDetails item='issues' key='healthType'}
+ {hascontent}
+ <fieldset><legend><img src="{$__wcf->getPath()}icon/system{$healthType|ucfirst}.svg" class="icon24" /> {lang}wcf.acp.index.health.detail.{@$healthType}{/lang}</legend>
+ <ul>
+ {content}
+ {foreach from=$issues item='issue'}
+ <li>{@$issue}</li>
+ {/foreach}
+ {/content}
+ </ul>
+ </fieldset>
+ {/hascontent}
+ {/foreach}
+ </div>
+ {/if}
<fieldset id="credits" class="container containerPadding shadow hidden tabMenuContent">
<dl>
<dt>{lang}wcf.acp.index.credits.developedBy{/lang}</dt>
<dt>{lang}wcf.acp.index.credits.developer{/lang}</dt>
<dd>
<ul>
- <li>Alexander Ebert</li><li>Marcel Werk</li>
+ <li>Alexander Ebert</li>
+ <li>Marcel Werk</li>
</ul>
</dd>
</dl>
<dt>{lang}wcf.acp.index.credits.designer{/lang}</dt>
<dd>
<ul>
- <li>Harald Szekely</li><li>Marcel Werk</li>
+ <li>Harald Szekely</li>
+ <li>Marcel Werk</li>
</ul>
</dd>
</dl>
<dt>{lang}wcf.acp.index.credits.contributor{/lang}</dt>
<dd>
<ul>
- <li>Thorsten Buitkamp</li><li>Tim Düsterhus</li><li>Matthias Schmidt</li>
+ <li>Thorsten Buitkamp</li>
+ <li>Tim Düsterhus</li>
+ <li>Matthias Schmidt</li>
+ <li>
+ <a href="{@RELATIVE_WCF_DIR}acp/dereferrer.php?url={"https://github.com/WoltLab/WCF/contributors"|rawurlencode}" class="externalURL">
+ {lang}wcf.acp.index.credits.contributor.more{/lang}
+ </a>
+ </li>
</ul>
</dd>
</dl>
<dd>{lang}wcf.acp.index.credits.trademarks{/lang}</dd>
</dl>
</fieldset>
+
+ {event name='tabContent'}
</div>
{include file='footer'}
\ No newline at end of file
namespace wcf\acp\page;
use wcf\page\AbstractPage;
use wcf\system\cache\CacheHandler;
+use wcf\system\event\EventHandler;
use wcf\system\language\LanguageFactory;
use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\WCF;
*/
public $didYouKnow = '';
+ /**
+ * Detailed Health-Status
+ *
+ * @var array
+ */
+ public $healthDetails = array('error' => array(), 'warning' => array(), 'info' => array());
+
/**
* @see wcf\page\IPage::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
+ $health = 'success';
+ if (!empty($this->healthDetails['error'])) $health = 'error';
+ else if (!empty($this->healthDetails['warning'])) $health = 'warning';
+ else if (!empty($this->healthDetails['info'])) $health = 'info';
+
WCF::getTPL()->assign(array(
- 'didYouKnow' => $this->didYouKnow
+ 'didYouKnow' => $this->didYouKnow,
+ 'health' => $health,
+ 'healthDetails' => $this->healthDetails
));
}
+ /**
+ * Performs various health checks
+ */
+ public function calculateHealth() {
+ try {
+ // TODO: Fill this list
+ $shouldBeWritable = array(WCF_DIR);
+ foreach ($shouldBeWritable as $file) {
+ if (!is_writable($file)) $this->healthDetails['warning'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.notWritable', array('file' => $file));
+ }
+
+ for($i = 0; $i < 7; $i++) {
+ if (file_exists(WCF_DIR.'log/'.date('Y-m-d', TIME_NOW - 86400 * $i).'.txt')) {
+ $this->healthDetails['error'][] = WCF::getLanguage()->getDynamicVariable('wcf.acp.index.health.exception', array('date' => TIME_NOW - 86400 * $i));
+ break;
+ }
+ }
+
+ EventHandler::getInstance()->fireAction($this, 'calculateHealth');
+ }
+ catch (\Exception $e) {
+ $this->healthDetails['error'][] = $e->getMessage();
+ }
+ }
+
/**
* @see wcf\page\IPage::readData()
*/
public function readData() {
parent::readData();
+ $this->calculateHealth();
+
$sql = "SELECT
languageItem
FROM