Implement plugins_path() usage

This commit is contained in:
Samuel Georges 2015-02-07 15:37:07 +11:00
parent f08f954248
commit fbf46519b4
6 changed files with 23 additions and 35 deletions

View File

@ -62,7 +62,7 @@ class BackendController extends ControllerBase
if ($controllerObj = $this->findController(
$controllerClass,
$action,
Config::get('cms.pluginsDir', '/plugins')
plugins_path()
)) {
return $controllerObj->run($action, $controllerParams);
}
@ -81,14 +81,17 @@ class BackendController extends ControllerBase
* @param string $action Specifies a method name to execute.
* @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.
*/
if (!class_exists($controller)) {
if (!$inPath) {
$inPath = base_path();
}
$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)) {
include_once($controllerFile);
}

View File

@ -48,7 +48,7 @@ abstract class Skin
*/
public function __construct()
{
$this->defaultSkinPath = PATH_BASE . '/modules/backend';
$this->defaultSkinPath = base_path() . '/modules/backend';
/*
* Guess the skin path

View File

@ -1,21 +1,19 @@
<?php
$themesDir = Config::get('cms.themesDir');
$uploadsDir = Config::get('cms.uploadsDir');
$warnings = [];
$writablePaths = [
$themesDir,
$uploadsDir,
$uploadsDir.'/public',
$uploadsDir.'/protected',
'/storage',
'/storage/logs',
'/storage/framework',
'/storage/cms',
'/storage/cms/cache',
'/storage/cms/twig',
'/storage/cms/combiner',
temp_path(),
themes_path(),
uploads_path(),
uploads_path().'/public',
uploads_path().'/protected',
base_path().'/storage',
base_path().'/storage/logs',
base_path().'/storage/framework',
base_path().'/storage/cms',
base_path().'/storage/cms/cache',
base_path().'/storage/cms/twig',
base_path().'/storage/cms/combiner',
];
$requiredExtensions = [
'GD' => extension_loaded('gd'),
@ -26,7 +24,7 @@ $requiredExtensions = [
];
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>']);
}
foreach ($requiredExtensions as $extension => $installed) {

View File

@ -108,7 +108,7 @@ abstract class ComponentBase extends Extendable
*/
public function getPath()
{
return base_path().Config::get('cms.pluginsDir').$this->dirName;
return plugins_path().$this->dirName;
}
/**

View File

@ -201,14 +201,6 @@ class PluginManager
$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
*/
@ -306,7 +298,7 @@ class PluginManager
{
$plugins = [];
$dirPath = $this->getPath();
$dirPath = plugins_path();
if (!File::isDirectory($dirPath)) {
return $plugins;
}

View File

@ -1,6 +1 @@
config.php
routes.php
compiled.php
services.json
events.scanned.php
routes.scanned.php
disabled.json