Commit b9784877 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Markus Klein
Browse files

[BUGFIX] Make `top.TYPO3.Storage` available again

`top.TYPO3.Storage` is now globally available again, it's not necessary to
load this module via RequireJS. Please keep in mind this module is
deprecated.

Resolves: #83049
Related: #82603
Releases: master
Change-Id: I72796f377063c683f024a223818a599edade5367
Reviewed-on: https://review.typo3.org/54704


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Reviewed-by: Helmut Hummel's avatarHelmut Hummel <typo3@helhum.io>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
parent bf6ee546
......@@ -155,6 +155,7 @@ class BackendController
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextMenu');
// load the storage API and fill the UC into the PersistentStorage, so no additional AJAX call is needed
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage');
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage/Persistent', 'function(PersistentStorage) {
PersistentStorage.load(' . json_encode($this->getBackendUser()->uc) . ');
}');
......
......@@ -27,13 +27,71 @@ class Storage {
public Persistent: any;
constructor() {
this.Client = {
clear: (): any => {
this.logDeprecated('Client', 'clear');
Client.clear();
},
get: (key: string): any => {
this.logDeprecated('Client', 'get');
return Client.get(key);
},
isset: (key: string): any => {
this.logDeprecated('Client', 'isset');
return Client.isset(key);
},
set: (key: string, value: string): any => {
this.logDeprecated('Client', 'set');
return Client.set(key, value);
},
unset: (key: string): any => {
this.logDeprecated('Client', 'unset');
return Client.unset(key);
},
};
this.Persistent = {
addToList: (key: string, value: string): any => {
this.logDeprecated('Persistent', 'addToList');
return Persistent.addToList(key, value);
},
clear: (): any => {
this.logDeprecated('Persistent', 'clear');
Persistent.clear();
},
get: (key: string): any => {
this.logDeprecated('Persistent', 'get');
return Persistent.get(key);
},
isset: (key: string): any => {
this.logDeprecated('Persistent', 'isset');
return Persistent.isset(key);
},
load: (data: any): any => {
this.logDeprecated('Persistent', 'load');
return Persistent.load(data);
},
removeFromList: (key: string, value: string): any => {
this.logDeprecated('Persistent', 'removeFromList');
return Persistent.removeFromList(key, value);
},
set: (key: string, value: string): any => {
this.logDeprecated('Persistent', 'set');
return Persistent.set(key, value);
},
unset: (key: string): any => {
this.logDeprecated('Persistent', 'unset');
return Persistent.unset(key);
},
};
}
private logDeprecated = (className: string, methodName: string): any => {
if (console) {
console.warn(
'TYPO3/CMS/Backend/Storage and TYPO3.Storage are deprecated since TYPO3 v9 and will be removed in TYPO3 v10.',
'top.TYPO3.Storage.' + className + '.' + methodName + '() is marked as deprecated since TYPO3 v9 and will be '
+ 'removed in TYPO3 v10.',
);
}
this.Client = Client;
this.Persistent = Persistent;
}
}
......
......@@ -22,11 +22,69 @@ define(["require", "exports", "./Storage/Client", "./Storage/Persistent"], funct
*/
var Storage = (function () {
function Storage() {
if (console) {
console.warn('TYPO3/CMS/Backend/Storage and TYPO3.Storage are deprecated since TYPO3 v9 and will be removed in TYPO3 v10.');
}
this.Client = Client;
this.Persistent = Persistent;
var _this = this;
this.logDeprecated = function (className, methodName) {
if (console) {
console.warn('top.TYPO3.Storage.' + className + '.' + methodName + '() is marked as deprecated since TYPO3 v9 and will be '
+ 'removed in TYPO3 v10.');
}
};
this.Client = {
clear: function () {
_this.logDeprecated('Client', 'clear');
Client.clear();
},
get: function (key) {
_this.logDeprecated('Client', 'get');
return Client.get(key);
},
isset: function (key) {
_this.logDeprecated('Client', 'isset');
return Client.isset(key);
},
set: function (key, value) {
_this.logDeprecated('Client', 'set');
return Client.set(key, value);
},
unset: function (key) {
_this.logDeprecated('Client', 'unset');
return Client.unset(key);
},
};
this.Persistent = {
addToList: function (key, value) {
_this.logDeprecated('Persistent', 'addToList');
return Persistent.addToList(key, value);
},
clear: function () {
_this.logDeprecated('Persistent', 'clear');
Persistent.clear();
},
get: function (key) {
_this.logDeprecated('Persistent', 'get');
return Persistent.get(key);
},
isset: function (key) {
_this.logDeprecated('Persistent', 'isset');
return Persistent.isset(key);
},
load: function (data) {
_this.logDeprecated('Persistent', 'load');
return Persistent.load(data);
},
removeFromList: function (key, value) {
_this.logDeprecated('Persistent', 'removeFromList');
return Persistent.removeFromList(key, value);
},
set: function (key, value) {
_this.logDeprecated('Persistent', 'set');
return Persistent.set(key, value);
},
unset: function (key) {
_this.logDeprecated('Persistent', 'unset');
return Persistent.unset(key);
},
};
}
return Storage;
}());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment