Remove requiring vendor dependencies

Also avoid autoloading vendor.
This commit is contained in:
raviks789 2023-06-23 10:36:44 +02:00 committed by Johannes Meyer
parent 50bd5cfdc9
commit 8a17c56345
9 changed files with 1 additions and 90 deletions

View File

@ -43,7 +43,7 @@ abstract class ApplicationBootstrap
/**
* Base directory
*
* Parent folder for at least application, bin, modules, library/vendor and public
* Parent folder for at least application, bin, modules and public
*
* @var string
*/
@ -56,13 +56,6 @@ abstract class ApplicationBootstrap
*/
protected $appDir;
/**
* Vendor library directory
*
* @var string
*/
protected $vendorDir;
/**
* Icinga library directory
*
@ -161,7 +154,6 @@ abstract class ApplicationBootstrap
}
$this->baseDir = $baseDir;
$this->appDir = $baseDir . '/application';
$this->vendorDir = $baseDir . '/library/vendor';
if (substr(__DIR__, 0, 8) === 'phar:///') {
$this->libDir = dirname(dirname(__DIR__));
} else {
@ -206,15 +198,6 @@ abstract class ApplicationBootstrap
}
}
set_include_path(
implode(
PATH_SEPARATOR,
array($this->vendorDir, get_include_path())
)
);
Benchmark::measure('Bootstrap, autoloader registered');
Icinga::setApp($this);
require_once dirname(__FILE__) . '/functions.php';
@ -328,18 +311,6 @@ abstract class ApplicationBootstrap
return $this->getDirWithSubDir($this->appDir, $subDir);
}
/**
* Get the vendor library directory
*
* @param string $subDir Optional sub directory to get
*
* @return string
*/
public function getVendorDir($subDir = null)
{
return $this->getDirWithSubDir($this->vendorDir, $subDir);
}
/**
* Get the configuration directory
*

View File

@ -3,8 +3,6 @@
namespace Icinga\Application;
use Zend_Loader_Autoloader;
/**
* PSR-4 class loader
*/
@ -263,18 +261,6 @@ class ClassLoader
return array_key_exists($namespace, $this->applicationDirectories);
}
/**
* Require ZF autoloader
*
* @return Zend_Loader_Autoloader
*/
protected function requireZendAutoloader()
{
require_once 'Zend/Loader/Autoloader.php';
$this->gotZend = true;
return Zend_Loader_Autoloader::getInstance();
}
/**
* Load the given class or interface
*
@ -284,20 +270,6 @@ class ClassLoader
*/
public function loadClass($class)
{
// We are aware of the Zend_ prefix and lazyload it's autoloader.
// Return as fast as possible if we already did so.
if (substr($class, 0, 5) === 'Zend_') {
if (! $this->gotZend) {
$zendLoader = $this->requireZendAutoloader();
if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
// PHP7 seems to remember the autoload function stack before auto-loading. Thus
// autoload functions registered during autoload never get called
return $zendLoader::autoload($class);
}
}
return false;
}
if ($file = $this->getSourceFile($class)) {
if (file_exists($file)) {
require $file;

View File

@ -11,21 +11,6 @@ use Icinga\Util\Environment;
use Icinga\Web\Hook;
use Icinga\Web\Url;
call_user_func(function () {
/**
* @package dompdf
* @link http://dompdf.github.com/
* @author Benj Carson <benjcarson@digitaljunkies.ca>
* @author Fabien Ménager <fabien.menager@gmail.com>
* @author Alexander A. Klimov <alexander.klimov@icinga.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
$baseDir = Icinga::app()->getBaseDir('library/vendor/dompdf');
require_once "$baseDir/vendor/autoload.php";
});
class Pdf
{
protected function assertNoHeadersSent()

View File

@ -6,8 +6,6 @@ namespace Icinga\Util;
use Icinga\Less\Visitor;
use lessc;
require_once 'lessphp/lessc.inc.php';
class LessParser extends lessc
{
public function __construct()

View File

@ -23,10 +23,6 @@ class HtmlPurifier
*/
public function __construct($config = null)
{
require_once 'HTMLPurifier/Bootstrap.php';
require_once 'HTMLPurifier.php';
require_once 'HTMLPurifier.autoload.php';
$purifierConfig = \HTMLPurifier_Config::createDefault();
$purifierConfig->set('Core.EscapeNonASCIICharacters', true);
$purifierConfig->set('Attr.AllowedFrameTargets', array('_blank'));

View File

@ -10,8 +10,6 @@ class Markdown
{
public static function line($content, $config = null)
{
require_once 'Parsedown/Parsedown.php';
if ($config === null) {
$config = function (\HTMLPurifier_Config $config) {
$config->set('HTML.Parent', 'span'); // Only allow inline elements
@ -25,8 +23,6 @@ class Markdown
public static function text($content, $config = null)
{
require_once 'Parsedown/Parsedown.php';
if ($config === null) {
$config = function (\HTMLPurifier_Config $config) {
LinkTransformer::attachTo($config);

View File

@ -190,7 +190,6 @@ class JavaScript
}
if ($minified) {
require_once 'JShrink/Minifier.php';
$out .= Minifier::minify($js, ['flaggedComments' => false]);
$baseOut = Minifier::minify($baseJs, ['flaggedComments' => false]);
$out = ';' . ltrim($baseOut, ';') . "\n" . $out;

View File

@ -3,8 +3,6 @@
namespace Icinga\Module\Doc\Renderer;
require_once 'Parsedown/Parsedown.php';
use DOMDocument;
use DOMXPath;
use Parsedown;

View File

@ -23,10 +23,6 @@ class Zend_View_Helper_EscapeComment extends Zend_View_Helper_Abstract
public function escapeComment($comment)
{
if (self::$purifier === null) {
require_once 'HTMLPurifier/Bootstrap.php';
require_once 'HTMLPurifier.php';
require_once 'HTMLPurifier.autoload.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('Core.EscapeNonASCIICharacters', true);
$config->set('HTML.Allowed', 'a[href]');