Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 6919e6f

Browse files
committed
PhpDocs
1 parent cf6d95d commit 6919e6f

10 files changed

+133
-6
lines changed

core/src/core/classes/class.AJXP_AbstractMetaSource.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
*/
2121
defined('AJXP_EXEC') or die( 'Access not allowed');
2222

23+
/**
24+
* Class AJXP_AbstractMetaSource
25+
* Abstract class from which all meta.* plugins must extend.
26+
*/
2327
abstract class AJXP_AbstractMetaSource extends AJXP_Plugin {
2428

2529
/**

core/src/core/classes/class.AJXP_Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
class AJXP_Exception extends Exception
2828
{
29-
public function AJXP_Exception($messageString, $messageId = false)
29+
public function __construct($messageString, $messageId = false)
3030
{
3131
if ($messageId !== false && class_exists("ConfService")) {
3232
$messages = ConfService::getMessages();

core/src/core/classes/class.AJXP_MetaStreamWrapper.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121

2222
defined('AJXP_EXEC') or die('Access not allowed');
2323

24-
24+
/**
25+
* Class AJXP_MetaStreamWrapper
26+
*
27+
* Global streamWrapper that encapsulates all wrappers to access a driver's resource.
28+
* Registered under the "pydio" protocol, it should replace all the old ajxp.XX direct calls.
29+
* The static "appendMetaWrapper" method allows to add additional wrapper that will be sequentially called until
30+
* reaching the driver ajxp.XX wrapper.
31+
*
32+
* @package Pydio
33+
* @subpackage Core
34+
*/
2535
class AJXP_MetaStreamWrapper implements AjxpWrapper
2636
{
2737
/**
@@ -40,6 +50,10 @@ class AJXP_MetaStreamWrapper implements AjxpWrapper
4050

4151
protected static $cachedRepositoriesWrappers = array();
4252

53+
/**
54+
* Register the stack of protocols/wrappers.
55+
* @param null $registered_wrappers
56+
*/
4357
public static function register($registered_wrappers = null){
4458
if($registered_wrappers == null){
4559
$registered_wrappers = stream_get_wrappers();
@@ -51,6 +65,11 @@ public static function register($registered_wrappers = null){
5165
}
5266
}
5367

68+
/**
69+
* Register an addition protocol/wrapper in the stack
70+
* @param $name string
71+
* @param $className string
72+
*/
5473
public static function appendMetaWrapper($name, $className){
5574
self::$metaWrappers[$name] = $className;
5675
self::register();
@@ -105,6 +124,12 @@ protected static function actualRepositoryWrapperData($repositoryId){
105124
}
106125
}
107126

127+
/**
128+
* Return the final ajxp.XX wrapper class name.
129+
* @param string $repositoryId
130+
* @return string mixed
131+
* @throws Exception
132+
*/
108133
public static function actualRepositoryWrapperClass($repositoryId){
109134
$data = self::actualRepositoryWrapperData($repositoryId);
110135
return $data["classname"];

core/src/core/classes/class.AJXP_Permission.php

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121

2222
defined('AJXP_EXEC') or die('Access not allowed');
2323

24-
24+
/**
25+
* Class AJXP_Permission
26+
*
27+
* Atomic permission associated to a folder path. Can be initialized either with an integer
28+
* value (use MASK constants) or with a string value like "r", "rw", etc.
29+
*
30+
* @package Pydio
31+
* @subpackage Core
32+
*/
2533
class AJXP_Permission implements JsonSerializable
2634
{
2735
/**
@@ -55,25 +63,32 @@ function __construct($value = null){
5563
}
5664
}
5765

66+
/**
67+
* Replicate this permission.
68+
* @return AJXP_Permission
69+
*/
5870
function getCopy(){
5971
return new AJXP_Permission($this->value);
6072
}
6173

6274
/**
75+
* Test if the permission is readable
6376
* @return bool
6477
*/
6578
function canRead(){
6679
return ($this->value & self::READ) === self::READ;
6780
}
6881

6982
/**
83+
* Test if the permission is writeable
7084
* @return bool
7185
*/
7286
function canWrite(){
7387
return ($this->value & self::WRITE) === self::WRITE;
7488
}
7589

7690
/**
91+
* Test if the permission denies access, whatever happens.
7792
* @return bool
7893
*/
7994
function denies(){
@@ -82,10 +97,20 @@ function denies(){
8297
return false;
8398
}
8499

100+
/**
101+
* Test if the permission is just empty
102+
* @return bool
103+
*/
85104
function isEmpty(){
86105
return $this->value === 0;
87106
}
88107

108+
/**
109+
* Test permission against an integer value
110+
* @param int $numPerm
111+
* @return bool
112+
* @throws Exception
113+
*/
89114
function testPermission($numPerm){
90115
if(is_integer($numPerm) && ($numPerm < self::MASK)){
91116
$numPerm = $numPerm & self::MASK;
@@ -99,20 +124,34 @@ function testPermission($numPerm){
99124
}
100125
}
101126

127+
/**
128+
* Set this permission as readable
129+
* @param bool|true $value
130+
*/
102131
function setRead($value = true){
103132
if($value)
104133
$this->value = $this->value | self::READ;
105134
else{
106135
$this->value = $this->value & (self::READ ^ self::MASK);
107136
}
108137
}
138+
139+
/**
140+
* Set this permission as writeable
141+
* @param bool|true $value
142+
*/
109143
function setWrite($value = true){
110144
if($value)
111145
$this->value = $this->value | self::WRITE;
112146
else{
113147
$this->value = $this->value & (self::WRITE ^ self::MASK);
114148
}
115149
}
150+
151+
/**
152+
* Set this permission as denied
153+
* @param bool|true $value
154+
*/
116155
function setDeny($value = true){
117156
if($value)
118157
$this->value = self::DENY;
@@ -122,6 +161,7 @@ function setDeny($value = true){
122161
}
123162

124163
/**
164+
* Override this permission value with the one passed in parameter
125165
* @param AJXP_Permission $perm
126166
* @return AJXP_Permission
127167
*/

core/src/core/classes/class.AJXP_PermissionMask.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121

2222
defined('AJXP_EXEC') or die('Access not allowed');
2323

24-
24+
/**
25+
* Class AJXP_PermissionMask
26+
*
27+
* Stores a mapping of path => AJXP_Permission that can be used as a mask on an existing folder structure.
28+
*
29+
* @package Pydio
30+
* @subpackage Core
31+
*
32+
*/
2533
class AJXP_PermissionMask implements JsonSerializable, Serializable
2634
{
2735
/**
@@ -30,6 +38,7 @@ class AJXP_PermissionMask implements JsonSerializable, Serializable
3038
private $permissionTree = array();
3139

3240
/**
41+
* Initialize an empty mask, or from a serializedForm.
3342
* @param array|null $serializedForm
3443
*/
3544
function __construct($serializedForm = null){
@@ -48,6 +57,7 @@ function __construct($serializedForm = null){
4857
}
4958

5059
/**
60+
* Returns the whole permission tree
5161
* @return array
5262
*/
5363
function getTree(){
@@ -56,6 +66,7 @@ function getTree(){
5666
}
5767

5868
/**
69+
* Set the permision tree at once
5970
* @param array $tree
6071
* @return AJXP_PermissionMask;
6172
*/
@@ -65,6 +76,7 @@ function updateTree($tree){
6576
}
6677

6778
/**
79+
* Add a branch in the permissions tree
6880
* @param string $path
6981
* @param AJXP_Permission $permission
7082
* @return AJXP_PermissionMask
@@ -76,6 +88,7 @@ function updateBranch($path, $permission){
7688
}
7789

7890
/**
91+
* Delete a branch from the permission tree
7992
* @param string $path
8093
* @return AJXP_PermissionMask
8194
*/
@@ -85,6 +98,7 @@ function deleteBranch($path){
8598
}
8699

87100
/**
101+
* Merge the current permission tree with the one passed in parameter. The latter takes precedence on the first.
88102
* @param AJXP_PermissionMask $mask
89103
* @return AJXP_PermissionMask
90104
*/
@@ -96,6 +110,7 @@ function override($mask){
96110
}
97111

98112
/**
113+
* Copy the full tree from the one passed in parameter
99114
* @param AJXP_PermissionMask $mask
100115
* @return AJXP_PermissionMask
101116
*/
@@ -105,6 +120,7 @@ function copyMask($mask){
105120
}
106121

107122
/**
123+
* Test if a given path does have the given permission according to this mask permission tree.
108124
* @param string $test
109125
* @param string $permission
110126
* @return bool
@@ -146,6 +162,7 @@ function match($test, $permission){
146162
}
147163

148164
/**
165+
* Merge two trees
149166
* @param array $t1
150167
* @param array $t2
151168
* @return array
@@ -184,6 +201,7 @@ private function mergeTrees($t1, $t2){
184201
}
185202

186203
/**
204+
* Translate a path=> AJXP_Permission to an array-based branch.
187205
* @param string $path
188206
* @param AJXP_Permission $permission
189207
* @return array
@@ -205,6 +223,7 @@ private function pathToBranch($path, $permission){
205223
}
206224

207225
/**
226+
* Transform the permission tree into a flat structure of pathes => permissions.
208227
* @param array|null $tree
209228
* @param array|null $pathes
210229
* @param string $currentRoot
@@ -226,7 +245,11 @@ public function flattenTree($tree = null, &$pathes = null, $currentRoot=""){
226245
}
227246

228247

229-
248+
/**
249+
* Print the tree as a string (for debug puprpose).
250+
* @param $permissionTree
251+
* @param $level
252+
*/
230253
public function toStr($permissionTree, $level)
231254
{
232255
$level = $level + 1;

core/src/core/classes/class.AJXP_ProgressBarCLI.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
*/
2121
defined('AJXP_EXEC') or die( 'Access not allowed');
2222

23+
/**
24+
* Class AJXP_ProgressBarCLI
25+
* Simple object to print a progress bar on the command-line.
26+
*
27+
* @package Pydio
28+
* @subpackage Core
29+
*/
2330
class AJXP_ProgressBarCLI {
2431
private $strProgress = "";
2532
private $strLength = 25; // 50 '='

core/src/core/classes/class.AJXP_PromptException.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
define('AJXP_PROMPT_EXCEPTION_CONFIRM', 'AJXP_PROMPT_EXCEPTION_CONFIRM');
2525
define('AJXP_PROMPT_EXCEPTION_ALERT', 'AJXP_PROMPT_EXCEPTION_ALERT');
2626

27+
/**
28+
* Class AJXP_PromptException
29+
* Specific exception that triggers a prompt in the UI instead of displaying an error message.
30+
*
31+
* @package Pydio
32+
* @subpackage Core
33+
*/
2734
class AJXP_PromptException extends AJXP_Exception{
2835

2936
private $promptType = "prompt";
@@ -61,6 +68,12 @@ public function __construct($promptType, $data, $messageString, $messageId = fal
6168
parent::__construct($messageString, $messageId);
6269
}
6370

71+
/**
72+
* Prompt user for credentials
73+
* @param $sessionVariable
74+
* @param $switchToRepositoryId
75+
* @throws AJXP_PromptException
76+
*/
6477
public static function testOrPromptForCredentials($sessionVariable, $switchToRepositoryId){
6578
if(isSet($_GET["prompt_passed_data"]) && isSet($_GET["variable_name"]) && $_GET["variable_name"] == $sessionVariable){
6679
$_SESSION[$sessionVariable] = true;

core/src/core/classes/class.AJXP_SchemeTranslatorWrapper.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121

2222
defined('AJXP_EXEC') or die('Access not allowed');
2323

24-
24+
/**
25+
* Class AJXP_SchemeTranslatorWrapper
26+
* Simple Wrapper that justs converts a given protocol to another one.
27+
*
28+
* @package Pydio
29+
* @subpackage Core
30+
*/
2531
class AJXP_SchemeTranslatorWrapper extends AJXP_MetaStreamWrapper implements AjxpWrapper
2632
{
2733
/**

core/src/core/classes/class.AJXP_ShutdownScheduler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
defined('AJXP_EXEC') or die('Access not allowed');
2323
/**
24+
*
25+
* Registry for callbacks that must be triggered after the script is finished.
2426
*
2527
* @package Pydio
2628
* @subpackage Core

core/src/core/classes/class.PydioSdkGenerator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@
1818
*
1919
* The latest code can be found at <https://pyd.io/>.
2020
*
21+
*
22+
*/
23+
24+
/**
25+
* Class PydioSdkGenerator
2126
* Generate a Swagger file for Rest APIs documentation
27+
* @package Pydio
28+
* @subpackage Core
2229
*/
2330
class PydioSdkGenerator
2431
{

0 commit comments

Comments
 (0)