mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Optimize autoloading and allow APC to cache plugin PHP
This commit is contained in:
parent
05b2296594
commit
77172e7978
2
bin/grav
2
bin/grav
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
require_once(__DIR__ . '/../system/autoload.php');
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
if (!ini_get('date.timezone')) {
|
||||
date_default_timezone_set('UTC');
|
||||
|
|
|
|||
|
|
@ -13,17 +13,23 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"twig/twig": "1.16.*@dev",
|
||||
"erusev/parsedown-extra": "dev-master",
|
||||
"symfony/yaml": "2.5.*@dev",
|
||||
"symfony/console": "2.5.*@dev",
|
||||
"symfony/event-dispatcher": "2.5.*@dev",
|
||||
"doctrine/cache": "1.4.*@dev",
|
||||
"tracy/tracy": "dev-master",
|
||||
"gregwar/image": "dev-master",
|
||||
"twig/twig": "~1.16",
|
||||
"erusev/parsedown-extra": "~0.2",
|
||||
"symfony/yaml": "~2.5",
|
||||
"symfony/console": "~2.5",
|
||||
"symfony/event-dispatcher": "~2.5",
|
||||
"doctrine/cache": "~1.3",
|
||||
"tracy/tracy": "~2.2",
|
||||
"gregwar/image": "~2.0",
|
||||
"ircmaxell/password-compat": "1.0.*",
|
||||
"mrclay/minify": "dev-master",
|
||||
"ornicar/php-user-agent": "1.0.*@dev",
|
||||
"mrclay/minify": "~2.2",
|
||||
"ornicar/php-user-agent": "1.0.*",
|
||||
"pimple/pimple": "~3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Grav\\": "system/src/"
|
||||
},
|
||||
"files": ["system/defines.php"]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
|
|||
use Grav\Common\Grav;
|
||||
use Grav\Common\Debugger;
|
||||
|
||||
// Register system libraries to the auto-loader.
|
||||
$loader = require_once __DIR__ . '/system/autoload.php';
|
||||
// Register the auto-loader.
|
||||
$loader = require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
if (!ini_get('date.timezone')) {
|
||||
date_default_timezone_set('UTC');
|
||||
|
|
@ -22,9 +22,6 @@ $grav = Grav::instance(
|
|||
]
|
||||
);
|
||||
|
||||
// Use output buffering to prevent headers from being sent too early.
|
||||
ob_start();
|
||||
|
||||
try {
|
||||
$grav['debugger']->init();
|
||||
$grav->process();
|
||||
|
|
@ -34,4 +31,3 @@ try {
|
|||
throw $e;
|
||||
}
|
||||
|
||||
ob_end_flush();
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
require_once(__DIR__ . '/../system/defines.php');
|
||||
|
||||
// Use composer auto-loader and just add our namespace into it.
|
||||
$loader = require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
$loader->addPsr4('Grav\\', LIB_DIR . 'Grav');
|
||||
|
||||
return $loader;
|
||||
|
|
@ -113,6 +113,9 @@ class Grav extends Container
|
|||
|
||||
public function process()
|
||||
{
|
||||
// Use output buffering to prevent headers from being sent too early.
|
||||
ob_start();
|
||||
|
||||
// Initialize stream wrappers.
|
||||
$this['locator'];
|
||||
|
||||
|
|
@ -140,6 +143,11 @@ class Grav extends Container
|
|||
$this->header();
|
||||
|
||||
echo $this->output;
|
||||
|
||||
ob_end_flush();
|
||||
flush();
|
||||
|
||||
$this->fireEvent('onOutputRendered');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Plugins extends Iterator
|
|||
continue;
|
||||
}
|
||||
|
||||
$filePath = 'plugin://' . $plugin . DS . $plugin . PLUGIN_EXT;
|
||||
$filePath = $this->grav['locator']('plugin://' . $plugin . DS . $plugin . PLUGIN_EXT);
|
||||
if (!is_file($filePath)) {
|
||||
throw new \RuntimeException(sprintf("Plugin '%s' enabled but not found!", $filePath, $plugin));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user