use Exception;
use Friendica\BaseObject;
-use Friendica\Database\dba;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
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
{
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;
}
}
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);
// 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 . ']');
}
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;
}