Browse Source

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

tags/v11.0RC2
Joas Schilling 8 years ago
parent
commit
f37fa6e45c
No account linked to committer's email address

+ 2
- 4
apps/files_sharing/appinfo/app.php 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();

apps/files_sharing/lib/share/file.php → apps/files_sharing/lib/ShareBackend/File.php 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;

apps/files_sharing/lib/share/folder.php → apps/files_sharing/lib/ShareBackend/Folder.php 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

+ 1
- 1
apps/files_sharing/tests/BackendTest.php 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));

+ 1
- 1
lib/private/Share/Share.php 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`, '

+ 2
- 2
tests/lib/Files/EtagTest.php 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');

Loading…
Cancel
Save