define('LOGGER_ALL', 5);
/* @}*/
-/**
- * @name Cache
- * @deprecated since version 3.6
- * @see Cache
- *
- * Cache levels
- * @{
- */
-define('CACHE_MONTH', Cache::MONTH);
-define('CACHE_WEEK', Cache::WEEK);
-define('CACHE_DAY', Cache::DAY);
-define('CACHE_HOUR', Cache::HOUR);
-define('CACHE_HALF_HOUR', Cache::HALF_HOUR);
-define('CACHE_QUARTER_HOUR', Cache::QUARTER_HOUR);
-define('CACHE_FIVE_MINUTES', Cache::FIVE_MINUTES);
-define('CACHE_MINUTE', Cache::MINUTE);
-/* @}*/
-
/**
* @name Register
*
*/
define('MAX_LIKERS', 75);
-/**
- * Communication timeout
- */
-define('ZCURL_TIMEOUT', (-1));
-
/**
* @name Notify
*
}
}
-/**
- * Sets the base url for use in cmdline programs which don't have
- * $_SERVER variables
- *
- * @param object $a App
- */
-function check_url(App $a)
-{
- $url = Config::get('system', 'url');
-
- // if the url isn't set or the stored url is radically different
- // than the currently visited url, store the current value accordingly.
- // "Radically different" ignores common variations such as http vs https
- // and www.example.com vs example.com.
- // We will only change the url to an ip address if there is no existing setting
-
- if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->getHostName()))) {
- Config::set('system', 'url', System::baseUrl());
- }
-
- return;
-}
-
/**
* @brief Automatic database updates
* @param object $a App
} elseif (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED) && $a->module != 'view') {
$a->module = 'maintenance';
} else {
- check_url($a);
+ $a->checkURL();
check_db(false);
Addon::check();
}
DBA::escape(DateTimeFormat::utcNow())
);
if (DBA::isResult($ev)) {
- Cache::set($cachekey, $ev, CACHE_HOUR);
+ Cache::set($cachekey, $ev, Cache::HOUR);
}
}
"description" => L10n::t("Only one search per minute is permitted for not logged in users.")]);
killme();
}
- Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => $resultdata->accesses + 1]), CACHE_HOUR);
+ Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => $resultdata->accesses + 1]), Cache::HOUR);
} else
- Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => 1]), CACHE_HOUR);
+ Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => 1]), Cache::HOUR);
}
Nav::setSelected('search');
return $default;
}
+
+ /**
+ * Sets the base url for use in cmdline programs which don't have
+ * $_SERVER variables
+ */
+ public function checkURL()
+ {
+ $url = Config::get('system', 'url');
+
+ // if the url isn't set or the stored url is radically different
+ // than the currently visited url, store the current value accordingly.
+ // "Radically different" ignores common variations such as http vs https
+ // and www.example.com vs example.com.
+ // We will only change the url to an ip address if there is no existing setting
+
+ if (empty($url) || (!link_compare($url, $this->getBaseURL())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $this->getHostName()))) {
+ Config::set('system', 'url', $this->getBaseURL());
+ }
+ }
}
'content' => $json_string,
'created' => DateTimeFormat::utcNow()
], true);
- $cache_ttl = CACHE_DAY;
+ $cache_ttl = Cache::DAY;
} else {
- $cache_ttl = CACHE_FIVE_MINUTES;
+ $cache_ttl = Cache::FIVE_MINUTES;
}
Cache::set($cache_key, $json_string, $cache_ttl);
* Uncommented because the result of the queries are to big to store it in the cache.
* We need to decide if we want to change the db column type or if we want to delete it.
*/
- //Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $r, CACHE_FIVE_MINUTES);
+ //Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $r, Cache::FIVE_MINUTES);
return $r;
}
* Uncommented because the result of the queries are to big to store it in the cache.
* We need to decide if we want to change the db column type or if we want to delete it.
*/
- //Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $list, CACHE_FIVE_MINUTES);
+ //Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $list, Cache::FIVE_MINUTES);
return $list;
}
DBA::escape(L10n::t('Contact Photos'))
);
}
- Cache::set($key, $albums, CACHE_DAY);
+ Cache::set($key, $albums, Cache::DAY);
}
return $albums;
}
public static function clearAlbumCache($uid)
{
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
- Cache::set($key, null, CACHE_DAY);
+ Cache::set($key, null, Cache::DAY);
}
/**
);
if (DBA::isResult($s)) {
$r = DBA::toArray($s);
- Cache::set($cachekey, $r, CACHE_HOUR);
+ Cache::set($cachekey, $r, Cache::HOUR);
}
}
logger('URL ' . $my_url . ' already tried to authenticate.', LOGGER_DEBUG);
return;
} else {
- Cache::set($cachekey, true, CACHE_MINUTE);
+ Cache::set($cachekey, true, Cache::MINUTE);
}
logger('Not authenticated. Invoking reverse magic-auth for ' . $my_url, LOGGER_DEBUG);
// Only store into the cache if the value seems to be valid
if (!in_array($data['network'], [Protocol::PHANTOM, Protocol::MAIL])) {
- Cache::set("Probe::uri:".$network.":".$uri, $data, CACHE_DAY);
+ Cache::set("Probe::uri:".$network.":".$uri, $data, Cache::DAY);
/// @todo temporary fix - we need a real contact update function that updates only changing fields
/// The biggest problem is the avatar picture that could have a reduced image size.
$data = ActivityPub\Transmitter::createActivityFromItem($item_id);
- Cache::set($cachekey, $data, CACHE_QUARTER_HOUR);
+ Cache::set($cachekey, $data, Cache::QUARTER_HOUR);
return $data;
}
logger("Send participation for ".$item["guid"]." by ".$author, LOGGER_DEBUG);
// It doesn't matter what we store, we only want to avoid sending repeated notifications for the same item
- Cache::set($cachekey, $item["guid"], CACHE_QUARTER_HOUR);
+ Cache::set($cachekey, $item["guid"], Cache::QUARTER_HOUR);
return self::buildAndTransmit($owner, $contact, "participation", $message);
}
$msg = ["type" => $type, "message" => $message];
- Cache::set($cachekey, $msg, CACHE_QUARTER_HOUR);
+ Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
return $msg;
}
$comment['thread_parent_guid'] = self::getGuidFromUri($item['thr-parent'], $item['uid']);
}
- Cache::set($cachekey, $comment, CACHE_QUARTER_HOUR);
+ Cache::set($cachekey, $comment, Cache::QUARTER_HOUR);
return($comment);
}
$feeddata = trim($doc->saveXML());
$msg = ['feed' => $feeddata, 'last_update' => $last_update];
- Cache::set($cachekey, $msg, CACHE_QUARTER_HOUR);
+ Cache::set($cachekey, $msg, Cache::QUARTER_HOUR);
logger('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, LOGGER_DEBUG);
}
$data = jsonld_default_document_loader($url);
- Cache::set('documentLoader:' . $url, $data, CACHE_DAY);
+ Cache::set('documentLoader:' . $url, $data, Cache::DAY);
return $data;
}
}
}
}
- Cache::set("dirsearch:".$search, time(), CACHE_DAY);
+ Cache::set("dirsearch:".$search, time(), Cache::DAY);
}
/**
logger("Check server " . $server . " (" . $contact["network"] . ")");
$vital = PortableContact::checkServer($server, $contact["network"], true);
- Cache::set($cachekey_server . $server, $vital, CACHE_MINUTE);
+ Cache::set($cachekey_server . $server, $vital, Cache::MINUTE);
}
if (!is_null($vital) && !$vital) {
QueueModel::removeItem($q_item['id']);
} else {
QueueModel::updateTime($q_item['id']);
- Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_MINUTE);
+ Cache::set($cachekey_deadguy . $contact['notify'], true, Cache::MINUTE);
}
break;
if ($deliver_status == -1) {
QueueModel::updateTime($q_item['id']);
- Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_MINUTE);
+ Cache::set($cachekey_deadguy . $contact['notify'], true, Cache::MINUTE);
} else {
QueueModel::removeItem($q_item['id']);
}
QueueModel::removeItem($q_item['id']);
} else {
QueueModel::updateTime($q_item['id']);
- Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_MINUTE);
+ Cache::set($cachekey_deadguy . $contact['notify'], true, Cache::MINUTE);
}
break;