Implement plugins_path() usage
This commit is contained in:
parent
f08f954248
commit
fbf46519b4
|
|
@ -62,7 +62,7 @@ class BackendController extends ControllerBase
|
||||||
if ($controllerObj = $this->findController(
|
if ($controllerObj = $this->findController(
|
||||||
$controllerClass,
|
$controllerClass,
|
||||||
$action,
|
$action,
|
||||||
Config::get('cms.pluginsDir', '/plugins')
|
plugins_path()
|
||||||
)) {
|
)) {
|
||||||
return $controllerObj->run($action, $controllerParams);
|
return $controllerObj->run($action, $controllerParams);
|
||||||
}
|
}
|
||||||
|
|
@ -81,14 +81,17 @@ class BackendController extends ControllerBase
|
||||||
* @param string $action Specifies a method name to execute.
|
* @param string $action Specifies a method name to execute.
|
||||||
* @return ControllerBase Returns the backend controller object
|
* @return ControllerBase Returns the backend controller object
|
||||||
*/
|
*/
|
||||||
protected function findController($controller, $action, $dirPrefix = null)
|
protected function findController($controller, $action, $inPath = null)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Workaround: Composer does not support case insensitivity.
|
* Workaround: Composer does not support case insensitivity.
|
||||||
*/
|
*/
|
||||||
if (!class_exists($controller)) {
|
if (!class_exists($controller)) {
|
||||||
|
if (!$inPath) {
|
||||||
|
$inPath = base_path();
|
||||||
|
}
|
||||||
$controller = Str::normalizeClassName($controller);
|
$controller = Str::normalizeClassName($controller);
|
||||||
$controllerFile = PATH_BASE.$dirPrefix.strtolower(str_replace('\\', '/', $controller)) . '.php';
|
$controllerFile = $inPath.strtolower(str_replace('\\', '/', $controller)) . '.php';
|
||||||
if ($controllerFile = File::existsInsensitive($controllerFile)) {
|
if ($controllerFile = File::existsInsensitive($controllerFile)) {
|
||||||
include_once($controllerFile);
|
include_once($controllerFile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ abstract class Skin
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->defaultSkinPath = PATH_BASE . '/modules/backend';
|
$this->defaultSkinPath = base_path() . '/modules/backend';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Guess the skin path
|
* Guess the skin path
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$themesDir = Config::get('cms.themesDir');
|
|
||||||
$uploadsDir = Config::get('cms.uploadsDir');
|
|
||||||
|
|
||||||
$warnings = [];
|
$warnings = [];
|
||||||
$writablePaths = [
|
$writablePaths = [
|
||||||
$themesDir,
|
temp_path(),
|
||||||
$uploadsDir,
|
themes_path(),
|
||||||
$uploadsDir.'/public',
|
uploads_path(),
|
||||||
$uploadsDir.'/protected',
|
uploads_path().'/public',
|
||||||
'/storage',
|
uploads_path().'/protected',
|
||||||
'/storage/logs',
|
base_path().'/storage',
|
||||||
'/storage/framework',
|
base_path().'/storage/logs',
|
||||||
'/storage/cms',
|
base_path().'/storage/framework',
|
||||||
'/storage/cms/cache',
|
base_path().'/storage/cms',
|
||||||
'/storage/cms/twig',
|
base_path().'/storage/cms/cache',
|
||||||
'/storage/cms/combiner',
|
base_path().'/storage/cms/twig',
|
||||||
|
base_path().'/storage/cms/combiner',
|
||||||
];
|
];
|
||||||
$requiredExtensions = [
|
$requiredExtensions = [
|
||||||
'GD' => extension_loaded('gd'),
|
'GD' => extension_loaded('gd'),
|
||||||
|
|
@ -26,7 +24,7 @@ $requiredExtensions = [
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($writablePaths as $path) {
|
foreach ($writablePaths as $path) {
|
||||||
if (!is_writable(PATH_BASE.$path))
|
if (!is_writable($path))
|
||||||
$warnings[] = Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>'.$path.'</strong>']);
|
$warnings[] = Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>'.$path.'</strong>']);
|
||||||
}
|
}
|
||||||
foreach ($requiredExtensions as $extension => $installed) {
|
foreach ($requiredExtensions as $extension => $installed) {
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ abstract class ComponentBase extends Extendable
|
||||||
*/
|
*/
|
||||||
public function getPath()
|
public function getPath()
|
||||||
{
|
{
|
||||||
return base_path().Config::get('cms.pluginsDir').$this->dirName;
|
return plugins_path().$this->dirName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -201,14 +201,6 @@ class PluginManager
|
||||||
$this->booted = true;
|
$this->booted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the absolute plugin path.
|
|
||||||
*/
|
|
||||||
public function getPath()
|
|
||||||
{
|
|
||||||
return base_path() . Config::get('cms.pluginsDir');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the directory path to a plugin
|
* Returns the directory path to a plugin
|
||||||
*/
|
*/
|
||||||
|
|
@ -306,7 +298,7 @@ class PluginManager
|
||||||
{
|
{
|
||||||
$plugins = [];
|
$plugins = [];
|
||||||
|
|
||||||
$dirPath = $this->getPath();
|
$dirPath = plugins_path();
|
||||||
if (!File::isDirectory($dirPath)) {
|
if (!File::isDirectory($dirPath)) {
|
||||||
return $plugins;
|
return $plugins;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1 @@
|
||||||
config.php
|
disabled.json
|
||||||
routes.php
|
|
||||||
compiled.php
|
|
||||||
services.json
|
|
||||||
events.scanned.php
|
|
||||||
routes.scanned.php
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue