Permalink
Browse files

Refactor names and namespaces

  • Loading branch information...
1 parent a970669 commit 310959a919cd177353a22ff2de16ce9a40c45e88 @cdujeu cdujeu committed Jun 22, 2016
Showing with 673 additions and 243 deletions.
  1. +7 −0 core/src/conf/bootstrap_context.php
  2. +2 −1 core/src/core/compat.php
  3. +3 −3 core/src/core/src/pydio/Core/Http/Dav/Node.php
  4. +3 −3 core/src/core/src/pydio/Core/PluginFramework/PluginsService.php
  5. +3 −3 core/src/plugins/core.access/src/Model/AJXP_Node.php
  6. +2 −2 core/src/plugins/core.index/class.AbstractSearchEngineIndexer.php
  7. +3 −2 core/src/plugins/core.mailer/class.AjxpMailer.php
  8. +2 −2 core/src/plugins/core.meta/{class.AJXP_AbstractMetaSource.php → AbstractMetaSource.php}
  9. +2 −2 core/src/plugins/core.metastore/{interface.MetaStoreProvider.php → IMetaStoreProvider.php}
  10. +5 −0 core/src/plugins/core.mq/ConsumeChannelMessage.php
  11. +25 −22 core/src/plugins/core.mq/{class.MqManager.php → MqManager.php}
  12. +1 −1 core/src/plugins/core.mq/manifest.xml
  13. +6 −5 core/src/plugins/core.notifications/{interface.AJXP_FeedStore.php → IFeedStore.php}
  14. +2 −1 core/src/plugins/core.notifications/{interface.AJXP_MessageExchanger.php → IMessageExchanger.php}
  15. +6 −4 core/src/plugins/core.notifications/{class.AJXP_Notification.php → Notification.php}
  16. +21 −17 core/src/plugins/core.notifications/{class.AJXP_NotificationCenter.php → NotificationCenter.php}
  17. +1 −1 core/src/plugins/core.notifications/manifest.xml
  18. +16 −10 core/src/plugins/feed.sql/{class.AJXP_SqlFeedStore.php → SqlFeedStore.php}
  19. +1 −1 core/src/plugins/feed.sql/manifest.xml
  20. +16 −8 core/src/plugins/meta.comments/{class.CommentsMetaManager.php → CommentsMetaManager.php}
  21. +1 −1 core/src/plugins/meta.comments/manifest.xml
  22. +30 −4 core/src/plugins/meta.exif/{class.ExifMetaManager.php → ExifMetaManager.php}
  23. +15 −0 core/src/plugins/meta.exif/ExifXmlMessage.php
  24. +59 −12 core/src/plugins/meta.exif/{class.GeoConversion.php → GeoConversion.php}
  25. +1 −1 core/src/plugins/meta.exif/manifest.xml
  26. +40 −12 core/src/plugins/meta.filehasher/{class.FileHasher.php → FileHasher.php}
  27. +1 −1 core/src/plugins/meta.filehasher/manifest.xml
  28. +34 −19 core/src/plugins/meta.git/{class.GitManager.php → GitManager.php}
  29. +1 −1 core/src/plugins/meta.git/manifest.xml
  30. +16 −2 core/src/plugins/meta.monitor_fs/{class.FSMonitoringManager.php → FSMonitoringManager.php}
  31. +2 −2 core/src/plugins/meta.monitor_fs/manifest.xml
  32. +33 −4 core/src/plugins/meta.mount/{class.FilesystemMounter.php → FilesystemMounter.php}
  33. +1 −1 core/src/plugins/meta.mount/manifest.xml
  34. +44 −7 core/src/plugins/meta.quota/{class.QuotaComputer.php → QuotaComputer.php}
  35. +1 −1 core/src/plugins/meta.quota/manifest.xml
  36. +10 −8 core/src/plugins/meta.simple_lock/{class.SimpleLockManager.php → SimpleLockManager.php}
  37. +1 −1 core/src/plugins/meta.simple_lock/manifest.xml
  38. +65 −10 core/src/plugins/meta.svn/{class.SvnManager.php → SvnManager.php}
  39. +1 −1 core/src/plugins/meta.svn/manifest.xml
  40. +14 −12 core/src/plugins/meta.syncable/{class.ChangesTracker.php → ChangesTracker.php}
  41. +1 −1 core/src/plugins/meta.syncable/manifest.xml
  42. +30 −7 core/src/plugins/meta.user/{class.UserMetaManager.php → UserMetaManager.php}
  43. +1 −1 core/src/plugins/meta.user/manifest.xml
  44. +28 −9 core/src/plugins/meta.watch/{class.MetaWatchRegister.php → WatchRegister.php}
  45. +1 −1 core/src/plugins/meta.watch/manifest.xml
  46. +30 −3 core/src/plugins/metastore.s3/{class.s3MetaStore.php → S3MetaStore.php}
  47. +1 −1 core/src/plugins/metastore.s3/manifest.xml
  48. +33 −3 core/src/plugins/metastore.serial/{class.SerialMetaStore.php → SerialMetaStore.php}
  49. +1 −1 core/src/plugins/metastore.serial/manifest.xml
  50. +25 −18 core/src/plugins/metastore.xattr/{class.xAttrMetaStore.php → XAttrMetaStore.php}
  51. +1 −1 core/src/plugins/metastore.xattr/manifest.xml
  52. +10 −3 core/src/plugins/mq.serial/{class.AJXP_SerialMessageExchanger.php → SerialMessageExchanger.php}
  53. +1 −1 core/src/plugins/mq.serial/manifest.xml
  54. +12 −4 core/src/plugins/mq.sql/{class.AJXP_SqlMessageExchanger.php → SqlMessageExchanger.php}
  55. +1 −1 core/src/plugins/mq.sql/manifest.xml
@@ -111,6 +111,13 @@ function AjaXplorer_autoload($className)
if($className == "dibi"){
require_once(AJXP_BIN_FOLDER."/lib/dibi/dibi.php");
}
+ $corePlugClass = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/core.*/".$className.".php", GLOB_NOSORT);
+ if ($corePlugClass !== false && count($corePlugClass)) {
+ require_once($corePlugClass[0]);
+ return;
+ }
+
+ // TODO : should be useless after refactorings
$corePlugClass = glob(AJXP_INSTALL_PATH."/".AJXP_PLUGINS_FOLDER."/core.*/class.".$className.".php", GLOB_NOSORT);
if ($corePlugClass !== false && count($corePlugClass)) {
require_once($corePlugClass[0]);
@@ -26,4 +26,5 @@ class_alias("Pydio\\Access\\Core\\Filter\\AJXP_PermissionMask", "AJXP_Permission
class_alias("Pydio\\Access\\Core\\Model\\AJXP_Node", "AJXP_Node", true);
class_alias("Pydio\\Conf\\Core\\AJXP_Role", "AJXP_Role", true);
class_alias("Pydio\\Access\\Core\\Model\\Repository", "Repository", true);
-class_alias("Pydio\\Access\\Core\\Filter\\ContentFilter", "ContentFilter", true);
+class_alias("Pydio\\Access\\Core\\Filter\\ContentFilter", "ContentFilter", true);
+class_alias("Pydio\\Notification\\Core\\Notification", "AJXP_Notification", true);
@@ -28,7 +28,7 @@
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Controller\Controller;
use Pydio\Core\PluginFramework\PluginsService;
-use Pydio\Metastore\Core\MetaStoreProvider;
+use Pydio\Metastore\Core\IMetaStoreProvider;
defined('AJXP_EXEC') or die( 'Access not allowed');
@@ -258,11 +258,11 @@ protected function getResourceData()
/**
- * @return MetaStoreProvider|bool
+ * @return IMetaStoreProvider|bool
*/
protected function getMetastore()
{
- /** @var MetaStoreProvider $metaStore */
+ /** @var IMetaStoreProvider $metaStore */
$metaStore = PluginsService::getInstance($this->context)->getUniqueActivePluginForType("metastore");
if($metaStore === false) return false;
$metaStore->initMeta($this->context, $this->getAccessDriver());
@@ -40,7 +40,7 @@
use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\Utils;
use Pydio\Log\Core\AJXP_Logger;
-use Pydio\Meta\Core\AJXP_AbstractMetaSource;
+use Pydio\Meta\Core\AbstractMetaSource;
defined('AJXP_EXEC') or die( 'Access not allowed');
@@ -234,7 +234,7 @@ private function initRepositoryPlugins($ctx){
$keys = array_keys($metaSources);
foreach ($keys as $plugId) {
if($plugId == "") continue;
- /** @var AJXP_AbstractMetaSource $instance */
+ /** @var AbstractMetaSource $instance */
$instance = $this->getPluginById($plugId);
if (!is_object($instance)) {
continue;
@@ -276,7 +276,7 @@ private function initRepositoryPlugins($ctx){
foreach ($keys as $plugId) {
if($plugId == "") continue;
$split = explode(".", $plugId);
- /** @var AJXP_AbstractMetaSource $instance */
+ /** @var AbstractMetaSource $instance */
$instance = $this->getPluginById($plugId);
if (!is_object($instance)) {
continue;
@@ -35,7 +35,7 @@
use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\Services\RepositoryService;
use Pydio\Core\Utils\Utils;
-use Pydio\Metastore\Core\MetaStoreProvider;
+use Pydio\Metastore\Core\IMetaStoreProvider;
/**
@@ -83,7 +83,7 @@ class AJXP_Node implements \JsonSerializable, ContextProviderInterface
*/
private $_accessDriver;
/**
- * @var MetaStoreProvider
+ * @var IMetaStoreProvider
*/
private $_metaStore;
@@ -206,7 +206,7 @@ public function setDriver($accessDriver)
}
/**
- * @return MetaStoreProvider
+ * @return IMetaStoreProvider
*/
protected function getMetaStore()
{
@@ -4,7 +4,7 @@
use Pydio\Core\Utils\StatHelper;
use Pydio\Core\Utils\Utils;
use Pydio\Core\Utils\VarsFilter;
-use Pydio\Meta\Core\AJXP_AbstractMetaSource;
+use Pydio\Meta\Core\AbstractMetaSource;
/**
* Created by PhpStorm.
@@ -13,7 +13,7 @@
* Time: 14:52
*/
-abstract class AbstractSearchEngineIndexer extends AJXP_AbstractMetaSource {
+abstract class AbstractSearchEngineIndexer extends AbstractMetaSource {
/**
* @param DOMNode $contribNode
@@ -32,6 +32,7 @@
use Pydio\Core\PluginFramework\Plugin;
use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\PluginFramework\SqlTableProvider;
+use Pydio\Notification\Core\Notification;
defined('AJXP_EXEC') or die('Access not allowed');
@@ -259,11 +260,11 @@ protected function computeEmailSendDate($frequencyType, $frequencyDetail){
}
/**
- * @param AJXP_Notification $notification
+ * @param Notification $notification
* @throws Exception
* @throws PydioException
*/
- public function processNotification(AJXP_Notification &$notification)
+ public function processNotification(Notification &$notification)
{
try{
$userObject = UsersService::getUserById($notification->getTarget());
@@ -29,10 +29,10 @@
defined('AJXP_EXEC') or die( 'Access not allowed');
/**
- * Class AJXP_AbstractMetaSource
+ * Class AbstractMetaSource
* Abstract class from which all meta.* plugins must extend.
*/
-abstract class AJXP_AbstractMetaSource extends Plugin {
+abstract class AbstractMetaSource extends Plugin {
/**
* @var AbstractAccessDriver
@@ -38,7 +38,7 @@
* @package AjaXplorer_Plugins
* @subpackage Core
*/
-interface MetaStoreProvider
+interface IMetaStoreProvider
{
/**
@@ -63,8 +63,8 @@ public function inherentMetaMove();
* Either AJXP_METADATA_SCOPE_REPOSITORY (this metadata is available only inside the current repository)
* or AJXP_METADATA_SCOPE_GLOBAL (metadata available globally).
*/
-
public function setMetadata($ajxpNode, $nameSpace, $metaData, $private = false, $scope=AJXP_METADATA_SCOPE_REPOSITORY);
+
/**
*
* @abstract
@@ -18,13 +18,18 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
+namespace Pydio\Mq\Core;
use Pydio\Core\Http\Response\JSONSerializableResponseChunk;
use Pydio\Core\Http\Response\XMLSerializableResponseChunk;
defined('AJXP_EXEC') or die('Access not allowed');
+/**
+ * Class ConsumeChannelMessage
+ * @package Pydio\Mq\Core
+ */
class ConsumeChannelMessage implements XMLSerializableResponseChunk, JSONSerializableResponseChunk
{
@@ -18,6 +18,7 @@
*
* The latest code can be found at <http://pyd.io/>.
*/
+namespace Pydio\Mq\Core;
use nsqphp\nsqphp;
use Psr\Http\Message\ResponseInterface;
@@ -36,6 +37,8 @@
use Pydio\Core\Controller\XMLWriter;
use Pydio\Core\PluginFramework\Plugin;
use Pydio\Core\Utils\UnixProcess;
+use Pydio\Notification\Core\IMessageExchanger;
+use Pydio\Notification\Core\Notification;
defined('AJXP_EXEC') or die( 'Access not allowed');
@@ -68,7 +71,7 @@ class MqManager extends Plugin
private $nsqClient;
/**
- * @var AJXP_MessageExchanger;
+ * @var IMessageExchanger;
*/
private $msgExchanger = false;
private $useQueue = false ;
@@ -85,23 +88,23 @@ public function init(ContextInterface $ctx, $options = [])
$this->useQueue = $this->pluginConf["USE_QUEUE"];
try {
$pService = PluginsService::getInstance($ctx);
- $this->msgExchanger = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_MS_INSTANCE"], "AJXP_MessageExchanger", $pService);
+ $this->msgExchanger = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_MS_INSTANCE"], "Pydio\\Notification\\Core\\IMessageExchanger", $pService);
if(!empty($this->msgExchanger)){
$pService->setPluginActive($this->msgExchanger->getType(), $this->msgExchanger->getName(), true, $this->msgExchanger);
}
if(AuthService::$bufferedMessage != null && $ctx->hasUser()){
$this->sendInstantMessage($ctx, AuthService::$bufferedMessage, $ctx->getUser()->getId());
AuthService::$bufferedMessage = null;
}
- } catch (Exception $e) {}
+ } catch (\Exception $e) {}
}
/**
- * @param AJXP_Notification $notification
- * @throws Exception
+ * @param Notification $notification
+ * @throws \Exception
*/
- public function sendToQueue(AJXP_Notification $notification)
+ public function sendToQueue(Notification $notification)
{
if (!$this->useQueue) {
$this->logDebug("SHOULD DISPATCH NOTIFICATION ON ".$notification->getNode()->getUrl()." ACTION ".$notification->getAction());
@@ -121,7 +124,7 @@ public function sendToQueue(AJXP_Notification $notification)
* @param $httpVars
* @param $fileVars
* @param ContextInterface $ctx
- * @throws Exception
+ * @throws \Exception
*/
public function consumeQueue($action, $httpVars, $fileVars, ContextInterface $ctx)
{
@@ -204,7 +207,7 @@ public function sendInstantMessage(ContextInterface $ctx, $xmlContent, $targetUs
}
// Publish for pollers
- $message = new stdClass();
+ $message = new \stdClass();
$message->content = $xmlContent;
if(isSet($userId)) {
$message->userId = $userId;
@@ -263,7 +266,7 @@ public function sendTaskMessage(ContextInterface $ctx, $content){
$nsq->publishTo(join(":", [$host, $port]), 1);
$nsq->publish('task', new \nsqphp\Message\Message(json_encode($content)));
$this->logInfo("Core.mq", "Published a message to NSQ :". json_encode($content));
- }catch (Exception $e){
+ }catch (\Exception $e){
$this->logError("Core.mq", "sendTaskMessage", $e->getMessage());
if(ConfService::currentContextIsCommandLine()){
print("Error while trying to send a task message ".json_encode($content)." : ".$e->getMessage());
@@ -374,7 +377,7 @@ public function clientChannelMethod(ServerRequestInterface $request, ResponseInt
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
- * @throws Exception
+ * @throws \Exception
*/
public function wsAuthenticate(ServerRequestInterface $request, ResponseInterface &$response)
{
@@ -383,15 +386,15 @@ public function wsAuthenticate(ServerRequestInterface $request, ResponseInterfac
$configs = $this->getConfigs();
$httpVars = $request->getQueryParams();
if (!isSet($httpVars["key"]) || $httpVars["key"] != $configs["WS_SERVER_ADMIN"]) {
- throw new Exception("Cannot authentify admin key");
+ throw new \Exception("Cannot authentify admin key");
}
/** @var \Pydio\Core\Model\ContextInterface $ctx */
$ctx = $request->getAttribute("ctx");
$user = $ctx->getUser();
if ($user == null) {
$this->logDebug("Error Authenticating through WebSocket (not logged)");
- throw new Exception("You must be logged in");
+ throw new \Exception("You must be logged in");
}
$serializer = new \Pydio\Core\Serializer\UserXML();
@@ -412,7 +415,7 @@ public function wsAuthenticate(ServerRequestInterface $request, ResponseInterfac
/**
* @param $params
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function switchWorkerOn($params)
{
@@ -424,7 +427,7 @@ public function switchWorkerOn($params)
$unixProcess->setPid($pId);
$status = $unixProcess->status();
if ($status) {
- throw new Exception("Worker seems to already be running!");
+ throw new \Exception("Worker seems to already be running!");
}
}
$cmd = ConfService::getGlobalConf("CLI_PHP")." worker.php";
@@ -441,7 +444,7 @@ public function switchWorkerOn($params)
/**
* @param $params
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function switchWorkerOff($params){
return $this->switchOff($params, "worker");
@@ -546,7 +549,7 @@ public function generateCaddyFile($params) {
/**
* @param $params
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function saveCaddyFile($params) {
$data = $this->generateCaddyFile($params);
@@ -563,7 +566,7 @@ public function saveCaddyFile($params) {
/**
* @param $params
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function switchCaddyOn($params) {
@@ -577,7 +580,7 @@ public function switchCaddyOn($params) {
$unixProcess->setPid($pId);
$status = $unixProcess->status();
if ($status) {
- throw new Exception("Caddy server seems to already be running!");
+ throw new \Exception("Caddy server seems to already be running!");
}
}
@@ -597,7 +600,7 @@ public function switchCaddyOn($params) {
/**
* @param $params
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function switchCaddyOff($params){
return $this->switchOff($params, "caddy");
@@ -615,14 +618,14 @@ public function getCaddyStatus($params){
* @param $params
* @param string $type
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function switchOff($params, $type = "ws")
{
$wDir = $this->getPluginWorkDir(true);
$pidFile = $wDir.DIRECTORY_SEPARATOR."$type-pid";
if (!file_exists($pidFile)) {
- throw new Exception("No information found about $type server");
+ throw new \Exception("No information found about $type server");
} else {
$pId = file_get_contents($pidFile);
$unixProcess = new UnixProcess();
@@ -637,7 +640,7 @@ public function switchOff($params, $type = "ws")
* @param $params
* @param string $type
* @return string
- * @throws Exception
+ * @throws \Exception
*/
public function getStatus($params, $type = "ws")
{
@@ -40,7 +40,7 @@
<global_param group="CONF_MESSAGE[Workers]" type="button" name="MQ_WORKER_SWITCH_ON" choices="run_plugin_action:core.mq:switchWorkerOn" label="CONF_MESSAGE[Start Worker]" description="CONF_MESSAGE[Switch a worker ON]" mandatory="false"/>
<global_param group="CONF_MESSAGE[Workers]" type="button" name="MQ_WORKER_SWITCH_OFF" choices="run_plugin_action:core.mq:switchWorkerOff" label="CONF_MESSAGE[Stop Worker]" description="CONF_MESSAGE[Switch a worker OFF]" mandatory="false"/>
</server_settings>
- <class_definition classname="MqManager" filename="plugins/core.mq/class.MqManager.php"/>
+ <class_definition classname="Pydio\Mq\Core\MqManager" filename="plugins/core.mq/MqManager.php"/>
<registry_contributions>
<actions>
<action name="consume_notification_queue">
Oops, something went wrong.

0 comments on commit 310959a

Please sign in to comment.