2 namespace TYPO3\CMS\Core;
48 public function get($namespace, $key, $defaultValue = null)
54 return isset($this->entries[$namespace][$key]) ? $this->entries[$namespace][$key] : $defaultValue;
74 public function set($namespace, $key, $value)
80 $serializedValue = serialize($value);
81 $res =
$GLOBALS[
'TYPO3_DB']->exec_SELECTquery(
'uid',
'sys_registry',
'entry_namespace = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($namespace,
'sys_registry') .
' AND entry_key = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($key,
'sys_registry'));
82 if (
$GLOBALS[
'TYPO3_DB']->sql_num_rows($res) < 1) {
83 $GLOBALS[
'TYPO3_DB']->exec_INSERTquery(
'sys_registry', array(
84 'entry_namespace' => $namespace,
86 'entry_value' => $serializedValue
89 $GLOBALS[
'TYPO3_DB']->exec_UPDATEquery(
'sys_registry',
'entry_namespace = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($namespace,
'sys_registry') .
' AND entry_key = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($key,
'sys_registry'), array(
90 'entry_value' => $serializedValue
93 $this->entries[$namespace][$key] = $value;
104 public function remove($namespace, $key)
107 $GLOBALS[
'TYPO3_DB']->exec_DELETEquery(
'sys_registry',
'entry_namespace = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($namespace,
'sys_registry') .
' AND entry_key = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($key,
'sys_registry'));
108 unset($this->entries[$namespace][$key]);
121 $GLOBALS[
'TYPO3_DB']->exec_DELETEquery(
'sys_registry',
'entry_namespace = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($namespace,
'sys_registry'));
122 unset($this->entries[$namespace]);
134 return isset($this->loadedNamespaces[$namespace]);
147 $storedEntries =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetRows(
'*',
'sys_registry',
'entry_namespace = ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($namespace,
'sys_registry'));
148 foreach ($storedEntries as $storedEntry) {
149 $key = $storedEntry[
'entry_key'];
150 $this->entries[$namespace][$key] = unserialize($storedEntry[
'entry_value']);
152 $this->loadedNamespaces[$namespace] =
true;
168 if (strlen($namespace) < 2) {
169 throw new \InvalidArgumentException(
'Given namespace must be longer than two characters.', 1249755131);