Move Share backends to PSR-4 instead of using class path (#24941)

This commit is contained in:
Joas Schilling 2016-08-01 12:49:41 +02:00 committed by Roeland Jago Douma
parent 84e6b8d9d0
commit f37fa6e45c
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
6 changed files with 12 additions and 10 deletions

View File

@ -28,14 +28,12 @@
$l = \OC::$server->getL10N('files_sharing');
\OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
\OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';
\OC::$CLASSPATH['OC\Files\Storage\Shared'] = 'files_sharing/lib/sharedstorage.php';
\OCA\Files_Sharing\Helper::registerHooks();
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
\OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
\OCP\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders();

View File

@ -31,9 +31,11 @@
*
*/
namespace OCA\Files_Sharing\ShareBackend;
use OCA\FederatedFileSharing\FederatedShareProvider;
class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
class File implements \OCP\Share_Backend_File_Dependent {
const FORMAT_SHARED_STORAGE = 0;
const FORMAT_GET_FOLDER_CONTENTS = 1;

View File

@ -25,7 +25,9 @@
*
*/
class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share_Backend_Collection {
namespace OCA\Files_Sharing\ShareBackend;
class Folder extends File implements \OCP\Share_Backend_Collection {
/**
* get shared parents

View File

@ -79,7 +79,7 @@ class BackendTest extends TestCase {
$this->assertTrue(\OCP\Share::shareItem('folder', $fileinfo2['fileid'], \OCP\Share::SHARE_TYPE_USER,
self::TEST_FILES_SHARING_API_USER3, 31));
$backend = new \OC_Share_Backend_Folder();
$backend = new \OCA\Files_Sharing\ShareBackend\Folder();
$result = $backend->getParents($fileinfo3['fileid']);
$this->assertSame(2, count($result));

View File

@ -2533,7 +2533,7 @@ class Share extends Constants {
}
} else {
if ($fileDependent) {
if ($format == \OC_Share_Backend_File::FORMAT_GET_FOLDER_CONTENTS || $format == \OC_Share_Backend_File::FORMAT_FILE_APP_ROOT) {
if ($format == \OCA\Files_Sharing\ShareBackend\File::FORMAT_GET_FOLDER_CONTENTS || $format == \OCA\Files_Sharing\ShareBackend\File::FORMAT_FILE_APP_ROOT) {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
. '`share_type`, `share_with`, `file_source`, `path`, `file_target`, `stime`, '
. '`*PREFIX*share`.`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '

View File

@ -34,8 +34,8 @@ class EtagTest extends \Test\TestCase {
\OC_Hook::clear('OC_Filesystem', 'setup');
$application = new \OCA\Files_Sharing\AppInfo\Application();
$application->registerMountProviders();
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
\OCP\Share::registerBackend('file', 'OCA\Files_Sharing\ShareBackend\File');
\OCP\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
$config = \OC::$server->getConfig();
$this->datadir = $config->getSystemValue('datadirectory');