Merge pull request #12443 from owncloud/issue/6101-all-classes-autoloadable

Issue/6101 Make all interfaces/classes autoloadable
This commit is contained in:
Morris Jobke 2014-11-28 09:40:27 +01:00
commit 7a9af8c40c
9 changed files with 171 additions and 100 deletions

View file

@ -9,16 +9,6 @@
namespace OC;
class NaturalSort_DefaultCollator {
public function compare($a, $b) {
if ($a === $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
}
class NaturalSort {
private static $instance;
private $collator;
@ -114,4 +104,3 @@ class NaturalSort {
return self::$instance;
}
}

View file

@ -0,0 +1,19 @@
<?php
/**
* Copyright (c) 2014 Vincent Petry <PVince81@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*
*/
namespace OC;
class NaturalSort_DefaultCollator {
public function compare($a, $b) {
if ($a === $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
}

View file

@ -0,0 +1,24 @@
<?php
/**
* ownCloud
*
* @author Robin Appelman
* @copyright 2012 Robin Appelman icewind@owncloud.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
/**
* Public interface of ownCloud for apps to use.
* Files/Storage interface
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
interface IHomeStorage {
}

View file

@ -336,7 +336,3 @@ interface Storage {
*/
public function instanceOfStorage($class);
}
interface IHomeStorage {
}

View file

@ -342,86 +342,3 @@ class Share extends \OC\Share\Constants {
return \OC\Share\Share::isResharingAllowed();
}
}
/**
* Interface that apps must implement to share content.
*/
interface Share_Backend {
/**
* Check if this $itemSource exist for the user
* @param string $itemSource
* @param string $uidOwner Owner of the item
* @return boolean|null Source
*
* Return false if the item does not exist for the user
*/
public function isValidSource($itemSource, $uidOwner);
/**
* Get a unique name of the item for the specified user
* @param string $itemSource
* @param string|false $shareWith User the item is being shared with
* @param array|null $exclude List of similar item names already existing as shared items @deprecated since version OC7
* @return string Target name
*
* This function needs to verify that the user does not already have an item with this name.
* If it does generate a new name e.g. name_#
*/
public function generateTarget($itemSource, $shareWith, $exclude = null);
/**
* Converts the shared item sources back into the item in the specified format
* @param array $items Shared items
* @param int $format
* @return TODO
*
* The items array is a 3-dimensional array with the item_source as the
* first key and the share id as the second key to an array with the share
* info.
*
* The key/value pairs included in the share info depend on the function originally called:
* If called by getItem(s)Shared: id, item_type, item, item_source,
* share_type, share_with, permissions, stime, file_source
*
* If called by getItem(s)SharedWith: id, item_type, item, item_source,
* item_target, share_type, share_with, permissions, stime, file_source,
* file_target
*
* This function allows the backend to control the output of shared items with custom formats.
* It is only called through calls to the public getItem(s)Shared(With) functions.
*/
public function formatItems($items, $format, $parameters = null);
}
/**
* Interface for share backends that share content that is dependent on files.
* Extends the Share_Backend interface.
*/
interface Share_Backend_File_Dependent extends Share_Backend {
/**
* Get the file path of the item
* @param string $itemSource
* @param string $uidOwner User that is the owner of shared item
* @return string|false
*/
public function getFilePath($itemSource, $uidOwner);
}
/**
* Interface for collections of of items implemented by another share backend.
* Extends the Share_Backend interface.
*/
interface Share_Backend_Collection extends Share_Backend {
/**
* Get the sources of the children of the item
* @param string $itemSource
* @return array Returns an array of children each inside an array with the keys: source, target, and file_path if applicable
*/
public function getChildren($itemSource);
}

View file

@ -0,0 +1,68 @@
<?php
/**
* ownCloud
*
* @author Bjoern Schiessle, Michael Gapczynski
* @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
* 2014 Bjoern Schiessle <schiessle@owncloud.com>
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
/**
* Interface that apps must implement to share content.
*/
interface Share_Backend {
/**
* Check if this $itemSource exist for the user
* @param string $itemSource
* @param string $uidOwner Owner of the item
* @return boolean|null Source
*
* Return false if the item does not exist for the user
*/
public function isValidSource($itemSource, $uidOwner);
/**
* Get a unique name of the item for the specified user
* @param string $itemSource
* @param string|false $shareWith User the item is being shared with
* @param array|null $exclude List of similar item names already existing as shared items @deprecated since version OC7
* @return string Target name
*
* This function needs to verify that the user does not already have an item with this name.
* If it does generate a new name e.g. name_#
*/
public function generateTarget($itemSource, $shareWith, $exclude = null);
/**
* Converts the shared item sources back into the item in the specified format
* @param array $items Shared items
* @param int $format
* @return TODO
*
* The items array is a 3-dimensional array with the item_source as the
* first key and the share id as the second key to an array with the share
* info.
*
* The key/value pairs included in the share info depend on the function originally called:
* If called by getItem(s)Shared: id, item_type, item, item_source,
* share_type, share_with, permissions, stime, file_source
*
* If called by getItem(s)SharedWith: id, item_type, item, item_source,
* item_target, share_type, share_with, permissions, stime, file_source,
* file_target
*
* This function allows the backend to control the output of shared items with custom formats.
* It is only called through calls to the public getItem(s)Shared(With) functions.
*/
public function formatItems($items, $format, $parameters = null);
}

View file

@ -0,0 +1,29 @@
<?php
/**
* ownCloud
*
* @author Bjoern Schiessle, Michael Gapczynski
* @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
* 2014 Bjoern Schiessle <schiessle@owncloud.com>
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
/**
* Interface for collections of of items implemented by another share backend.
* Extends the Share_Backend interface.
*/
interface Share_Backend_Collection extends Share_Backend {
/**
* Get the sources of the children of the item
* @param string $itemSource
* @return array Returns an array of children each inside an array with the keys: source, target, and file_path if applicable
*/
public function getChildren($itemSource);
}

View file

@ -0,0 +1,31 @@
<?php
/**
* ownCloud
*
* @author Bjoern Schiessle, Michael Gapczynski
* @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
* 2014 Bjoern Schiessle <schiessle@owncloud.com>
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
/**
* Interface for share backends that share content that is dependent on files.
* Extends the Share_Backend interface.
*/
interface Share_Backend_File_Dependent extends Share_Backend {
/**
* Get the file path of the item
* @param string $itemSource
* @param string $uidOwner User that is the owner of shared item
* @return string|false
*/
public function getFilePath($itemSource, $uidOwner);
}

View file

@ -19,8 +19,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
OC::$CLASSPATH['OCP\Share_Backend']='lib/public/share.php';
class Test_Share_Backend implements OCP\Share_Backend {
const FORMAT_SOURCE = 0;