Major overhaul of caching system (work in progress)
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / cache / builder / StyleCacheBuilder.class.php
1 <?php
2 namespace wcf\system\cache\builder;
3 use wcf\data\style\Style;
4 use wcf\system\WCF;
5
6 /**
7 * Caches the styles and style variables.
8 *
9 * @author Marcel Werk
10 * @copyright 2001-2013 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf
13 * @subpackage system.cache.builder
14 * @category Community Framework
15 */
16 class StyleCacheBuilder extends AbstractCacheBuilder {
17 /**
18 * @see wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
19 */
20 public function rebuild(array $parameters) {
21 $data = array(
22 'default' => 0,
23 'styles' => array()
24 );
25
26 // get all styles
27 $sql = "SELECT *
28 FROM wcf".WCF_N."_style
29 ORDER BY styleName ASC";
30 $statement = WCF::getDB()->prepareStatement($sql);
31 $statement->execute();
32 while ($row = $statement->fetchArray()) {
33 if ($row['isDefault']) $data['default'] = $row['styleID'];
34 $style = new Style(null, $row);
35 $style->loadVariables();
36
37 $data['styles'][$row['styleID']] = $style;
38 }
39
40 return $data;
41 }
42 }