HOR-3275
This commit is contained in:
@@ -74,15 +74,18 @@ function flush_cache($args, $opts)
|
|||||||
Bootstrap::setConstantsRelatedWs($workspace->name);
|
Bootstrap::setConstantsRelatedWs($workspace->name);
|
||||||
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton";
|
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton";
|
||||||
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
|
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
|
||||||
$items = \PMPlugin::getlist($workspace->name);
|
$items = \PMPlugin::getListAllPlugins($workspace->name);
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($item["sStatusFile"] === true) {
|
if ($item->enabled === true) {
|
||||||
$path = PATH_PLUGINS . $item["sFile"];
|
require_once($item->sFilename);
|
||||||
require_once($path);
|
$details = $oPluginRegistry->getPluginDetails(basename($item->sFilename));
|
||||||
$details = $oPluginRegistry->getPluginDetails($item["sFile"]);
|
|
||||||
//Only if the API directory structure is defined
|
//Only if the API directory structure is defined
|
||||||
$pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
|
$pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
|
||||||
if (is_dir($pathApiDirectory)) {
|
if (is_dir($pathApiDirectory)) {
|
||||||
|
$pluginSrcDir = PATH_PLUGINS . $details->sNamespace . PATH_SEP . 'src';
|
||||||
|
$loader = \Maveriks\Util\ClassLoader::getInstance();
|
||||||
|
$loader->add($pluginSrcDir);
|
||||||
|
$oPluginRegistry->registerRestService($details->sNamespace);
|
||||||
if (class_exists($details->sClassName)) {
|
if (class_exists($details->sClassName)) {
|
||||||
$oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename);
|
$oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename);
|
||||||
$oPlugin->setup();
|
$oPlugin->setup();
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ class PMPlugin
|
|||||||
* @param string $workspace
|
* @param string $workspace
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getList($workspace)
|
public static function getListPluginsManager($workspace)
|
||||||
{
|
{
|
||||||
$items = Array();
|
$items = Array();
|
||||||
$aPluginsPP = array();
|
$aPluginsPP = array();
|
||||||
@@ -576,6 +576,27 @@ class PMPlugin
|
|||||||
}
|
}
|
||||||
return $items;
|
return $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getListAllPlugins($workspace)
|
||||||
|
{
|
||||||
|
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP . "plugin.singleton";
|
||||||
|
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
|
||||||
|
//$oPluginRegistry = PMPluginRegistry::getSingleton();
|
||||||
|
$items = [];
|
||||||
|
if ($handle = opendir(PATH_PLUGINS)) {
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
|
||||||
|
include_once (PATH_PLUGINS . $file);
|
||||||
|
$detail = $oPluginRegistry->getPluginDetails($file);
|
||||||
|
if ($detail !== null) {
|
||||||
|
$items[] = $detail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,5 +25,5 @@
|
|||||||
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
|
||||||
|
|
||||||
G::LoadClass('plugin');
|
G::LoadClass('plugin');
|
||||||
$items = \PMPlugin::getlist(SYS_SYS);
|
$items = \PMPlugin::getListPluginsManager(SYS_SYS);
|
||||||
echo G::json_encode($items);
|
echo G::json_encode($items);
|
||||||
|
|||||||
Reference in New Issue
Block a user