fix in login and pluginregistry
This commit is contained in:
committed by
Ronald Quenta
parent
519e9e477f
commit
c979a43d36
@@ -358,7 +358,7 @@ class WebApplication
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hook to get rest api classes from plugins
|
// hook to get rest api classes from plugins
|
||||||
if (class_exists('PMPluginRegistry') && file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
|
if (class_exists('PMPluginRegistry')) {
|
||||||
$pluginRegistry = \PMPluginRegistry::loadSingleton(PATH_DATA_SITE . 'plugin.singleton');
|
$pluginRegistry = \PMPluginRegistry::loadSingleton(PATH_DATA_SITE . 'plugin.singleton');
|
||||||
$plugins = $pluginRegistry->getRegisteredRestServices();
|
$plugins = $pluginRegistry->getRegisteredRestServices();
|
||||||
|
|
||||||
@@ -370,8 +370,9 @@ class WebApplication
|
|||||||
$loader->add($pluginSourceDir);
|
$loader->add($pluginSourceDir);
|
||||||
|
|
||||||
foreach ($plugin as $class) {
|
foreach ($plugin as $class) {
|
||||||
if (class_exists($class['namespace'])) {
|
$className = is_object($class) ? $class->namespace: $class['namespace'];
|
||||||
$this->rest->addAPIClass($class['namespace'], strtolower($pluginName));
|
if (class_exists($className)) {
|
||||||
|
$this->rest->addAPIClass($className, strtolower($pluginName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ class headPublisher
|
|||||||
*/
|
*/
|
||||||
// Load external/plugin css
|
// Load external/plugin css
|
||||||
// NOTE is necesary to move this to decorator server
|
// NOTE is necesary to move this to decorator server
|
||||||
if (class_exists('PMPluginRegistry') && PATH_DATA != PATH_C) {
|
if (class_exists('PMPluginRegistry') && defined('SYS_SYS')) {
|
||||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||||
$registeredCss = $oPluginRegistry->getRegisteredCss();
|
$registeredCss = $oPluginRegistry->getRegisteredCss();
|
||||||
foreach ($registeredCss as $cssFile) {
|
foreach ($registeredCss as $cssFile) {
|
||||||
@@ -550,7 +550,7 @@ class headPublisher
|
|||||||
$this->extJsScript[] = '/extjs/' . $cacheName;
|
$this->extJsScript[] = '/extjs/' . $cacheName;
|
||||||
|
|
||||||
//hook for registered javascripts from plugins
|
//hook for registered javascripts from plugins
|
||||||
if (class_exists('PMPluginRegistry') && PATH_DATA != PATH_C) {
|
if (class_exists('PMPluginRegistry') && defined('SYS_SYS')) {
|
||||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||||
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
|
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class PluginsRegistry extends BasePluginsRegistry
|
|||||||
|
|
||||||
public static function update($aData)
|
public static function update($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection(UsersPropertiesPeer::DATABASE_NAME);
|
$oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($aData['PR_UID']);
|
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($aData['PR_UID']);
|
||||||
if ($oPluginsRegistry) {
|
if ($oPluginsRegistry) {
|
||||||
@@ -135,4 +135,36 @@ class PluginsRegistry extends BasePluginsRegistry
|
|||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function enable($pr_uid)
|
||||||
|
{
|
||||||
|
$oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
|
||||||
|
try {
|
||||||
|
$oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($pr_uid);
|
||||||
|
if ($oPluginsRegistry) {
|
||||||
|
$aData['PLUGIN_ENABLE'] = true;
|
||||||
|
$oPluginsRegistry->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
if ($oPluginsRegistry->validate()) {
|
||||||
|
$oConnection->begin();
|
||||||
|
$iResult = $oPluginsRegistry->save();
|
||||||
|
$oConnection->commit();
|
||||||
|
return $iResult;
|
||||||
|
} else {
|
||||||
|
$sMessage = '';
|
||||||
|
$aValidationFailures = $oPluginsRegistry->getValidationFailures();
|
||||||
|
/** @var ValidationFailed $oValidationFailure */
|
||||||
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
|
}
|
||||||
|
throw (new Exception('The registry cannot be updated!<br />' . $sMessage));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw (new Exception('This row doesn\'t exist!'));
|
||||||
|
}
|
||||||
|
} catch (Exception $oError) {
|
||||||
|
$oConnection->rollback();
|
||||||
|
throw ($oError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -790,7 +790,7 @@ class SkinEngine
|
|||||||
$sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']);
|
$sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (class_exists('PMPluginRegistry')) {
|
if (class_exists('PMPluginRegistry') && defined("SYS_SYS")) {
|
||||||
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
$oPluginRegistry = &PMPluginRegistry::getSingleton();
|
||||||
if ( isset($sFotoSelect) && $sFotoSelect!='' && !(strcmp($sWspaceSelect, SYS_SYS)) ){
|
if ( isset($sFotoSelect) && $sFotoSelect!='' && !(strcmp($sWspaceSelect, SYS_SYS)) ){
|
||||||
$sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
|
$sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ class PluginAdapter
|
|||||||
{
|
{
|
||||||
$this->pluginRegistry = \G::json_decode(\G::json_encode($pluginsSingleton->iterateVisible()));
|
$this->pluginRegistry = \G::json_decode(\G::json_encode($pluginsSingleton->iterateVisible()));
|
||||||
foreach ($this->pluginRegistry->_aPluginDetails as $nameSpace => $value) {
|
foreach ($this->pluginRegistry->_aPluginDetails as $nameSpace => $value) {
|
||||||
$this->savePluginOld($nameSpace, $this->pluginRegistry);
|
$this->savePluginMigrate($nameSpace, $this->pluginRegistry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function savePluginOld($sNamespace, $pluginRegistry)
|
public function savePluginMigrate($sNamespace, $pluginRegistry)
|
||||||
{
|
{
|
||||||
$structurePlugin = $this->getOldPluginStructure($sNamespace, $pluginRegistry);
|
$structurePlugin = $this->getOldPluginStructure($sNamespace, $pluginRegistry);
|
||||||
$plugin = $this->diffFieldTable($structurePlugin);
|
$plugin = $this->diffFieldTable($structurePlugin);
|
||||||
@@ -126,6 +126,10 @@ class PluginAdapter
|
|||||||
$plugin->pluginName == $nameSpace
|
$plugin->pluginName == $nameSpace
|
||||||
) {
|
) {
|
||||||
$structurePlugins[$propertyName][] = $plugin;
|
$structurePlugins[$propertyName][] = $plugin;
|
||||||
|
} elseif (is_array($plugin) && $key == $nameSpace) {
|
||||||
|
$structurePlugins[$propertyName][$key] = $plugin;
|
||||||
|
} elseif (is_bool($plugin) && $key == $nameSpace) {
|
||||||
|
$structurePlugins[$propertyName][$key] = $plugin;
|
||||||
} elseif (is_string($plugin) && $plugin == $nameSpace) {
|
} elseif (is_string($plugin) && $plugin == $nameSpace) {
|
||||||
$structurePlugins[$propertyName][] = $plugin;
|
$structurePlugins[$propertyName][] = $plugin;
|
||||||
}
|
}
|
||||||
@@ -240,7 +244,7 @@ class PluginAdapter
|
|||||||
property_exists($oPlugins, $nameAttribute) &&
|
property_exists($oPlugins, $nameAttribute) &&
|
||||||
$plugin->_aPluginDetails[$namePlugin]->enabled
|
$plugin->_aPluginDetails[$namePlugin]->enabled
|
||||||
) {
|
) {
|
||||||
$oPlugins->{$nameAttribute} = array_merge($oPlugins->{$nameAttribute}, $detail);
|
$oPlugins->{$nameAttribute} = array_merge($oPlugins->{$nameAttribute}, (array)$detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class PluginsRegistry extends Plugins
|
|||||||
* get the plugin details, by filename
|
* get the plugin details, by filename
|
||||||
*
|
*
|
||||||
* @param string $sFilename
|
* @param string $sFilename
|
||||||
* @return null
|
* @return null|PluginDetail
|
||||||
*/
|
*/
|
||||||
public function getPluginDetails($sFilename)
|
public function getPluginDetails($sFilename)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user