Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Sources/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ class Config
public static string $sourcedir;

/**
* @var string
*
* Path to where our dependencies are located.
*/
public static string $vendordir;
Expand Down Expand Up @@ -322,6 +324,14 @@ class Config
*/
public static string $scripturl;

/**
* @var \Composer\Autoload\ClassLoader
*
* Autoloader instance.
* This is used to support the integrate_autoload hook.
*/
public static \Composer\Autoload\ClassLoader $loader;

/****************************
* Internal static properties
****************************/
Expand Down Expand Up @@ -1136,6 +1146,18 @@ public static function reloadModSettings(): void
die('SMF file version (' . SMF_VERSION . ') does not match SMF database version (' . self::$modSettings['smfVersion'] . ').<br>Run the SMF upgrader to fix this.<br><a href="https://wiki.simplemachines.org/smf/Upgrading">More information</a>.');
}

// Any autoloader integrations to add?
if (isset(self::$modSettings['integrate_autoload'])) {
$class_map = [];

IntegrationHook::call('integrate_autoload', [&$class_map]);

foreach ($class_map as $prefix => $dirname) {
self::$loader->addPsr4($prefix, $dirname);
}
}

// Ensure the cache_enable setting reflects reality.
self::$modSettings['cache_enable'] = Cache\CacheApi::$enable;

// Used to force browsers to download fresh CSS and JavaScript when necessary
Expand Down
49 changes: 25 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
{
"name": "simplemachines/smf",
"repositories": [
{
"url": "https://github.com/SimpleMachines/BuildTools.git",
"type": "vcs"
}
],
"name": "simplemachines/smf",
"repositories": [
{
"url": "https://github.com/SimpleMachines/BuildTools.git",
"type": "vcs"
}
],
"autoload": {
"psr-4": {
"SMF\\": "Sources/"
"SMF\\": "Sources/",
"SMF\\Themes\\": "Themes/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"simplemachines/build-tools": "dev-release-3.0",
"friendsofphp/php-cs-fixer": "^3.40"
},
"scripts": {
"lint": "php-cs-fixer --quiet check --config .php-cs-fixer.dist.php --path-mode=intersection $(git diff --name-only \"*.php\") || php-cs-fixer check --diff --config .php-cs-fixer.dist.php --path-mode=intersection $(git diff --name-only \"*.php\") --allow-risky=yes",
"lint-fix": "php-cs-fixer fix -v --config .php-cs-fixer.dist.php --path-mode=intersection $(git diff --name-only \"*.php\") --allow-risky=yes"
},
"config": {
"platform": {
"php": "8.0.0"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"simplemachines/build-tools": "dev-release-3.0",
"friendsofphp/php-cs-fixer": "^3.40"
},
"scripts": {
"lint": "php-cs-fixer --quiet check --config .php-cs-fixer.dist.php --path-mode=intersection $(git diff --name-only \"*.php\") || php-cs-fixer check --diff --config .php-cs-fixer.dist.php --path-mode=intersection $(git diff --name-only \"*.php\") --allow-risky=yes",
"lint-fix": "php-cs-fixer fix -v --config .php-cs-fixer.dist.php --path-mode=intersection $(git diff --name-only \"*.php\") --allow-risky=yes"
},
"config": {
"platform": {
"php": "8.0.0"
}
},
"require": {
"google/recaptcha": "^1.3",
"matthiasmullie/minify": "^1.3",
"bjeavons/zxcvbn-php": "^1.0",
"matthiasmullie/path-converter": "^1.1"
"matthiasmullie/path-converter": "^1.1"
}
}
10 changes: 4 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,11 @@
require_once $sourcedir . DIRECTORY_SEPARATOR . 'Config.php';
SMF\Config::set(get_defined_vars());

$loader = require SMF\Config::$vendordir . '/autoload.php';
// Start up the autoloader.
SMF\Config::$loader = require SMF\Config::$vendordir . '/autoload.php';

if (isset(SMF\Config::$modSettings['integrate_autoload'])) {
foreach (explode(',', SMF\Config::$modSettings['integrate_autoload']) as $prefix => $dirname) {
$loader->addPsr4($prefix, $dirname);
}
}
// Ensure the SMF namespace points to $sourcedir.
SMF\Config::$loader->setPsr4('SMF\\', $sourcedir);

// Ensure $db_last_error is set, too.
SMF\Config::getDbLastError();
Expand Down
6 changes: 6 additions & 0 deletions other/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@
* Path to the Packages directory.
*/
$packagesdir = __DIR__ . '/Packages';
/**
* @var string
*
* Path to where our dependencies are located.
*/
$vendordir = __DIR__ . '/vendor';
/**
* @var string
*
Expand Down
6 changes: 6 additions & 0 deletions other/Settings_bak.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@
* Path to the Packages directory.
*/
$packagesdir = __DIR__ . '/Packages';
/**
* @var string
*
* Path to where our dependencies are located.
*/
$vendordir = __DIR__ . '/vendor';
/**
* @var string
*
Expand Down