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

Commit

Permalink
Code clean, unused imports, unreachable statements, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jun 10, 2016
1 parent 4907af8 commit b8282a9
Show file tree
Hide file tree
Showing 132 changed files with 335 additions and 323 deletions.
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Controller/CliRunner.php
Expand Up @@ -134,7 +134,7 @@ public static function runCommandInBackground($cmd, $logFile)
if (AJXP_SERVER_DEBUG) $cmd .= " > " . $logFile;
if (class_exists("COM") && ConfService::getCoreConf("CLI_USE_COM")) {
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C $cmd", 0, false);
$WshShell->Run("cmd /C $cmd", 0, false);
} else {
$basePath = str_replace("/", DIRECTORY_SEPARATOR, AJXP_INSTALL_PATH);
$tmpBat = implode(DIRECTORY_SEPARATOR, array($basePath, "data", "tmp", md5(time()) . ".bat"));
Expand Down
13 changes: 8 additions & 5 deletions core/src/core/src/pydio/Core/Controller/XMLWriter.php
Expand Up @@ -24,6 +24,8 @@
use Pydio\Access\Core\IAjxpWrapperProvider;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Model\RepositoryInterface;
use Pydio\Core\Model\UserInterface;
use Pydio\Core\Services\LocaleService;
use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\Utils;
Expand Down Expand Up @@ -79,6 +81,7 @@ public static function close($docNode="tree", $print = true)
{
if($print){
print("</$docNode>");
return "";
}else{
return "</$docNode>";
}
Expand Down Expand Up @@ -615,10 +618,10 @@ public static function writeRepositoriesData(ContextInterface $ctx)

/**
* @param string $repoId
* @param \Pydio\Access\Core\Model\Repository $repoObject
* @param RepositoryInterface $repoObject
* @param array $exposed
* @param array $streams
* @param AbstractAjxpUser $loggedUser
* @param UserInterface $loggedUser
* @param string $accessStatus
* @return string
* @throws \Exception
Expand All @@ -638,7 +641,7 @@ public static function repositoryToXML($repoId, $repoObject, $exposed, $streams,
}

$streamString = "";
if (in_array($repoObject->accessType, $streams)) {
if (in_array($repoObject->getAccessType(), $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($repoObject->getUniqueUser()) {
Expand Down Expand Up @@ -678,7 +681,7 @@ public static function repositoryToXML($repoId, $repoObject, $exposed, $streams,
$ctx = Context::contextWithObjects($loggedUser, $repoObject);
$roleString="";
if($loggedUser != null){
$merged = $loggedUser->mergedRole;
$merged = $loggedUser->getMergedRole();
$params = array();
foreach($exposed as $exposed_prop){
$metaOptions = $repoObject->getContextOption($ctx, "META_SOURCES");
Expand All @@ -701,7 +704,7 @@ public static function repositoryToXML($repoId, $repoObject, $exposed, $streams,
$roleString.= ' hasMask="true" ';
}
}
return "<repo access_type=\"".$repoObject->accessType."\" id=\"".$repoId."\"$statusString $streamString $slugString $isSharedString $roleString><label>".TextEncoder::toUTF8(Utils::xmlEntities($repoObject->getDisplay()))."</label>".$descTag.$repoObject->getClientSettings($ctx)."</repo>";
return "<repo access_type=\"".$repoObject->getAccessType()."\" id=\"".$repoId."\"$statusString $streamString $slugString $isSharedString $roleString><label>".TextEncoder::toUTF8(Utils::xmlEntities($repoObject->getDisplay()))."</label>".$descTag.$repoObject->getClientSettings($ctx)."</repo>";

}

Expand Down
Expand Up @@ -23,7 +23,7 @@
use Pydio\Core\Http\Message\UserMessage;
use Pydio\Core\Http\Response\JSONSerializableResponseChunk;
use Pydio\Core\Http\Response\XMLSerializableResponseChunk;
use Pydio\Core\Services\ConfService;

use Pydio\Core\Services\LocaleService;

defined('AJXP_EXEC') or die('Access not allowed');
Expand Down
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Core\Exception;

use Pydio\Core\Exception\PydioException;


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

Expand Down
Expand Up @@ -23,7 +23,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Core\Controller\Controller;

use Pydio\Core\Exception\AuthRequiredException;
use Pydio\Core\Exception\LoginException;
use Pydio\Core\Http\Server;
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Http/Dav/AuthBackendBasic.php
Expand Up @@ -28,10 +28,10 @@
use Pydio\Core\Exception\WorkspaceNotFoundException;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Model\UserInterface;
use Pydio\Core\PluginFramework\PluginsService;

use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\RepositoryService;

use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\TextEncoder;
use Pydio\Log\Core\AJXP_Logger;
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Http/Dav/AuthBackendDigest.php
Expand Up @@ -24,8 +24,8 @@
use Pydio\Core\Exception\RepositoryLoadException;
use Pydio\Core\Exception\WorkspaceForbiddenException;
use Pydio\Core\Exception\WorkspaceNotFoundException;
use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\Services\RepositoryService;


use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\TextEncoder;
use \Sabre;
Expand Down
1 change: 0 additions & 1 deletion core/src/core/src/pydio/Core/Http/Dav/Collection.php
Expand Up @@ -166,7 +166,6 @@ public function getChildren()


$contents = array();
$errors = array();

$nodes = scandir($this->getUrl());

Expand Down
3 changes: 2 additions & 1 deletion core/src/core/src/pydio/Core/Http/Dav/Node.php
Expand Up @@ -20,6 +20,7 @@
*/
namespace Pydio\Core\Http\Dav;

use Pydio\Core\Exception\PydioException;
use \Sabre;
use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Core\IAjxpWrapperProvider;
Expand Down Expand Up @@ -89,7 +90,7 @@ public function getAccessDriver()
$n = new AJXP_Node($this->getUrl());
return $n->getDriver();
}
throw new \Exception("Cannot find driver instance for current node! ".$this->path);
throw new \Sabre\DAV\Exception\NotFound("Cannot find driver instance for current node! ".$this->path);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Http/Dav/RootCollection.php
Expand Up @@ -23,7 +23,7 @@
use Pydio\Core\Model\FilteredRepositoriesList;
use \Sabre;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\ConfService;

use Pydio\Core\PluginFramework\PluginsService;

defined('AJXP_EXEC') or die( 'Access not allowed');
Expand Down
12 changes: 4 additions & 8 deletions core/src/core/src/pydio/Core/Http/Middleware/AuthMiddleware.php
Expand Up @@ -26,19 +26,15 @@
use Pydio\Core\Exception\AuthRequiredException;
use Pydio\Core\Exception\NoActiveWorkspaceException;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Exception\RepositoryLoadException;

use Pydio\Core\Http\Server;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\Services\AuthService;

use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\LocaleService;
use Pydio\Core\Services\RolesService;
use Pydio\Core\Services\SessionService;
use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\Utils;
use Pydio\Log\Core\AJXP_Logger;


use Zend\Diactoros\Response\EmptyResponse;

defined('AJXP_EXEC') or die('Access not allowed');
Expand Down
Expand Up @@ -23,7 +23,7 @@
use \Psr\Http\Message\ServerRequestInterface;
use \Psr\Http\Message\ResponseInterface;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Http\Rest\ApiRouter;

use Pydio\Core\Http\Response\SerializableResponseStream;
use Pydio\Core\Http\Server;
use Pydio\Core\Utils\Utils;
Expand Down
Expand Up @@ -178,7 +178,7 @@ public function readFile($node = null, $filePath = null, $data = null, $headerTy
} else {
$size = $byteLength;
}
if ($confGzip && ($size > $confGzipLimit || !function_exists("gzencode") || @strpos($serverParams['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE)) {
if ($confGzip && ($size > $confGzipLimit || !function_exists("gzencode") || (isSet($serverParams['HTTP_ACCEPT_ENCODING']) && strpos($serverParams['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE))) {
$confGzip = false;
}

Expand Down
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Core\Http\Response;

use Pydio\Core\Http\Response\SerializableResponseChunk;


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

Expand Down
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Core\Http\Response;

use Pydio\Core\Http\Response\SerializableResponseChunk;


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

Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Http/Rest/ApiRouter.php
Expand Up @@ -100,7 +100,7 @@ public function route(ServerRequestInterface &$request, ResponseInterface &$resp
//$response = $response->withStatus(404);
break;
case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
$allowedMethods = $routeInfo[1];
//$allowedMethods = $routeInfo[1];
//$response = $response->withStatus(405);
break;
case \FastRoute\Dispatcher::FOUND:
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Http/Rest/RestAuthMiddleware.php
Expand Up @@ -25,12 +25,12 @@
use Pydio\Core\Exception\NoActiveWorkspaceException;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Exception\WorkspaceForbiddenException;
use Pydio\Core\Exception\WorkspaceNotFoundException;

use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\RepositoryService;

use Pydio\Core\Services\RolesService;
use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\Utils;
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Http/Server.php
Expand Up @@ -23,7 +23,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Http\Cli\CliMiddleware;

use Pydio\Core\Http\Message\PromptMessage;
use Pydio\Core\Http\Message\UserMessage;
use Pydio\Core\Http\Middleware\ITopLevelMiddleware;
Expand Down
Expand Up @@ -141,7 +141,7 @@ public function route(ServerRequestInterface &$request, ResponseInterface &$resp
//$response = $response->withStatus(404);
break;
case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
$allowedMethods = $routeInfo[1];
//$allowedMethods = $routeInfo[1];
//$response = $response->withStatus(405);
break;
case \FastRoute\Dispatcher::FOUND:
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Http/TopLevelRouter.php
Expand Up @@ -23,7 +23,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Utils\Utils;

use Zend\Diactoros\ServerRequestFactory;

defined('AJXP_EXEC') or die('Access not allowed');
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Model/Context.php
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Core\Model;

use Pydio\Core\Services\AuthService;

use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\RepositoryService;

Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/PluginFramework/Plugin.php
Expand Up @@ -23,8 +23,8 @@
use Pydio\Access\Core\AJXP_MetaStreamWrapper;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Model\RepositoryInterface;
use Pydio\Core\Services\AuthService;


use Pydio\Core\Services\ConfService;
use Pydio\Core\Controller\XMLWriter;
use Pydio\Log\Core\AJXP_Logger;
Expand Down
Expand Up @@ -31,10 +31,10 @@
use Pydio\Core\Exception\RepositoryLoadException;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Model\RepositoryInterface;
use Pydio\Core\Services\AuthService;


use Pydio\Core\Services\CacheService;
use Pydio\Core\Services\ConfService;

use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\Utils;
use Pydio\Log\Core\AJXP_Logger;
Expand Down
6 changes: 3 additions & 3 deletions core/src/core/src/pydio/Core/Services/ConfService.php
Expand Up @@ -20,16 +20,16 @@
*/
namespace Pydio\Core\Services;

use Pydio\Access\Core\AbstractAccessDriver;

use Pydio\Access\Core\AJXP_MetaStreamWrapper;
use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Auth\Core\AbstractAuthDriver;
use Pydio\Cache\Core\AbstractCacheDriver;
use Pydio\Conf\Core\AbstractAjxpUser;
use Pydio\Conf\Core\AbstractConfDriver;
use Pydio\Core\Exception\PydioException;

use Pydio\Core\Model\Context;
use Pydio\Core\Model\RepositoryInterface;

use Pydio\Core\Model\UserInterface;
use Pydio\Core\PluginFramework\CoreInstanceProvider;
use Pydio\Core\Utils\Utils;
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Utils/BruteForceHelper.php
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Core\Utils;

use Pydio\Core\Services\AuthService;

use Pydio\Core\Services\ConfService;
use Pydio\Log\Core\AJXP_Logger;

Expand Down
1 change: 1 addition & 0 deletions core/src/core/src/pydio/Core/Utils/PydioSdkGenerator.php
Expand Up @@ -30,6 +30,7 @@
namespace Pydio\Core\Utils;

//define("JSON_DIR", AJXP_INSTALL_PATH."/core/doc/api");
use Pydio\Core\PluginFramework\Plugin;
use Pydio\Core\PluginFramework\PluginsService;

define("JSON_DIR", AJXP_INSTALL_PATH."/../api");
Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Core/Utils/TextEncoder.php
Expand Up @@ -21,7 +21,7 @@
namespace Pydio\Core\Utils;

use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\ConfService;

use Pydio\Core\Services\SessionService;

defined('AJXP_EXEC') or die( 'Access not allowed');
Expand Down
5 changes: 3 additions & 2 deletions core/src/core/src/pydio/Core/Utils/Utils.php
Expand Up @@ -21,9 +21,10 @@
namespace Pydio\Core\Utils;

use Psr\Http\Message\UploadedFileInterface;
use Pydio\Access\Core\Model\Repository;

use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Model\RepositoryInterface;
use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\ConfService;
use Pydio\Core\PluginFramework\Plugin;
Expand Down Expand Up @@ -915,7 +916,7 @@ public static function detectServerURL($withURI = false)
}

/**
* @param Repository $repository
* @param RepositoryInterface $repository
* @return string
*/
public static function getWorkspaceShortcutURL($repository){
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Utils/VarsFilter.php
Expand Up @@ -24,8 +24,8 @@
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services;
use Pydio\Core\Services\AuthService;
use Pydio\Conf\Core\AbstractAjxpUser;


use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\UsersService;

Expand Down
2 changes: 1 addition & 1 deletion core/src/core/src/pydio/Tests/UsersConfig.php
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Tests;

use Pydio\Core\Services\AuthService;

use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\UsersService;

Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/access.demo/class.demoAccessDriver.php
Expand Up @@ -24,7 +24,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Access\Core\Model\Repository;
use Pydio\Core\Controller\XMLWriter;

use Pydio\Core\Exception\PydioException;

defined('AJXP_EXEC') or die( 'Access not allowed');
Expand Down

0 comments on commit b8282a9

Please sign in to comment.