]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Config/PreloadPConfigAdapter.php
coding standards
[friendica.git] / src / Core / Config / PreloadPConfigAdapter.php
index 8ed3ee10e82b9b4c75291af78a3d7e0157af5c81..ebccb018bce6a85eb0776fd525cff8bdadbb68f6 100644 (file)
@@ -2,11 +2,9 @@
 
 namespace Friendica\Core\Config;
 
-use dba;
 use Exception;
-use Friendica\App;
 use Friendica\BaseObject;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
 
 require_once 'include/dba.php';
 
@@ -15,7 +13,7 @@ require_once 'include/dba.php';
  *
  * Minimizes the number of database queries to retrieve configuration values at the cost of memory.
  *
- * @author Hypolite Petovan <mrpetovan@gmail.com>
+ * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
 class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
 {
@@ -36,11 +34,11 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
                        return;
                }
 
-               $pconfigs = dba::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
-               while ($pconfig = dba::fetch($pconfigs)) {
+               $pconfigs = DBA::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
+               while ($pconfig = DBA::fetch($pconfigs)) {
                        self::getApp()->setPConfigValue($uid, $pconfig['cat'], $pconfig['k'], $pconfig['v']);
                }
-               dba::close($pconfigs);
+               DBA::close($pconfigs);
 
                $this->config_loaded = true;
        }
@@ -52,8 +50,8 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
                }
 
                if ($refresh) {
-                       $config = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
-                       if (DBM::is_result($config)) {
+                       $config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
+                       if (DBA::isResult($config)) {
                                self::getApp()->setPConfigValue($uid, $cat, $k, $config['v']);
                        } else {
                                self::getApp()->deletePConfigValue($uid, $cat, $k);
@@ -84,7 +82,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
                // manage array value
                $dbvalue = is_array($value) ? serialize($value) : $value;
 
-               $result = dba::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
+               $result = DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $k], true);
                if (!$result) {
                        throw new Exception('Unable to store config value in [' . $uid . '][' . $cat . '][' . $k . ']');
                }
@@ -100,7 +98,7 @@ class PreloadPConfigAdapter extends BaseObject implements IPConfigAdapter
 
                self::getApp()->deletePConfigValue($uid, $cat, $k);
 
-               $result = dba::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
+               $result = DBA::delete('pconfig', ['uid' => $uid, 'cat' => $cat, 'k' => $k]);
 
                return $result;
        }