本文整理汇总了PHP中Gantry\Framework\Gantry::restart方法的典型用法代码示例。如果您正苦于以下问题:PHP Gantry::restart方法的具体用法?PHP Gantry::restart怎么用?PHP Gantry::restart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gantry\Framework\Gantry
的用法示例。
在下文中一共展示了Gantry::restart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cleanup
public function cleanup()
{
$name = $this->extension->name;
$path = JPATH_SITE . '/templates/' . $name;
// Remove compiled CSS files if they exist.
$cssPath = $path . '/custom/css-compiled';
if (is_dir($cssPath)) {
\JFolder::delete($cssPath);
} elseif (is_file($cssPath)) {
\JFile::delete($cssPath);
}
// Remove wrongly named file if it exists.
$md5path = $path . '/MD5SUM';
if (is_file($md5path)) {
\JFile::delete($md5path);
}
// Restart Gantry and initialize it.
$gantry = Gantry::restart();
$gantry['theme.name'] = $name;
$gantry['streams']->register();
// Only add error service if debug mode has been enabled.
if ($gantry->debug()) {
$gantry->register(new ErrorServiceProvider());
}
/** @var Platform $patform */
$patform = $gantry['platform'];
/** @var UniformResourceLocator $locator */
$locator = $gantry['locator'];
// Initialize theme stream.
$details = new ThemeDetails($name);
$locator->addPath('gantry-theme', '', $details->getPaths(), false, true);
// Initialize theme cache stream and clear theme cache.
$cachePath = $patform->getCachePath() . '/' . $name;
if (is_dir($cachePath)) {
Folder::delete($cachePath);
}
Folder::create($cachePath);
$locator->addPath('gantry-cache', 'theme', [$cachePath], true, true);
$gantry['file.yaml.cache.path'] = $locator->findResource('gantry-cache://theme/compiled/yaml', true, true);
/** @var Outlines $outlines */
$outlines = $gantry['configurations'];
// Update positions in manifest file.
$positions = $outlines->positions();
$manifest = new Manifest($name);
$manifest->setPositions(array_keys($positions));
$manifest->save();
}