Permalink
Browse files

deprecate(filestore): deprecates giving files custom filestores

Fixes #9352
  • Loading branch information...
mrclay committed Feb 9, 2016
1 parent 1a31497 commit 0050b1dbf21961ab24f4046c2f2aa62fa7177080
Showing with 20 additions and 7 deletions.
  1. +10 −0 docs/guides/upgrading.rst
  2. +3 −1 engine/classes/ElggFile.php
  3. +7 −6 engine/lib/filestore.php
View
@@ -9,6 +9,16 @@ See the administrator guides for :doc:`how to upgrade a live site </admin/upgrad
:local:
:depth: 2
+From 2.0 to 2.1
+===============
+
+Deprecated APIs
+---------------
+
+ * ``ElggFile::setFilestore``
+ * ``get_default_filestore``
+ * ``set_default_filestore``
+
From 1.x to 2.0
===============
@@ -374,8 +374,10 @@ public function exists() {
* @param \ElggFilestore $filestore The file store.
*
* @return void
+ * @deprecated Will be removed in 3.0
*/
public function setFilestore(\ElggFilestore $filestore) {
+ elgg_deprecated_notice(__METHOD__ . ' is deprecated.', '2.1');
$this->filestore = $filestore;
}
@@ -395,7 +397,7 @@ protected function getFilestore() {
}
// such a common case we just assume for now
- $this->filestore = get_default_filestore();
+ $this->filestore = $GLOBALS['DEFAULT_FILE_STORE'];
if (!$this->guid) {
return $this->filestore;
View
@@ -428,11 +428,12 @@ function _elgg_clear_entity_files($entity) {
* Return the default filestore.
*
* @return \ElggFilestore
+ * @deprecated Will be removed in 3.0
*/
function get_default_filestore() {
- global $DEFAULT_FILE_STORE;
+ elgg_deprecated_notice(__FUNCTION__ . ' is deprecated.', '2.1');
- return $DEFAULT_FILE_STORE;
+ return $GLOBALS['DEFAULT_FILE_STORE'];
}
/**
@@ -441,12 +442,12 @@ function get_default_filestore() {
* @param \ElggFilestore $filestore An \ElggFilestore object.
*
* @return true
+ * @deprecated Will be removed in 3.0
*/
function set_default_filestore(\ElggFilestore $filestore) {
- global $DEFAULT_FILE_STORE;
-
- $DEFAULT_FILE_STORE = $filestore;
+ elgg_deprecated_notice(__FUNCTION__ . ' is deprecated.', '2.1');
+ $GLOBALS['DEFAULT_FILE_STORE'] = $filestore;
return true;
}
@@ -475,7 +476,7 @@ function _elgg_filestore_init() {
// Now register a default filestore
if (isset($CONFIG->dataroot)) {
- set_default_filestore(new \ElggDiskFilestore($CONFIG->dataroot));
+ $GLOBALS['DEFAULT_FILE_STORE'] = new \ElggDiskFilestore($CONFIG->dataroot);
}
// Fix MIME type detection for Microsoft zipped formats

0 comments on commit 0050b1d

Please sign in to comment.