use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
define('FRIENDICA_VERSION', '2018.08-dev');
define('DFRN_PROTOCOL_VERSION', '2.23');
-define('DB_UPDATE_VERSION', 1277);
+define('DB_UPDATE_VERSION', 1281);
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
/**
* log levels
* @{
*/
-define('LOGGER_NORMAL', 0);
-define('LOGGER_TRACE', 1);
-define('LOGGER_DEBUG', 2);
-define('LOGGER_DATA', 3);
-define('LOGGER_ALL', 4);
+define('LOGGER_WARNING', 0);
+define('LOGGER_INFO', 1);
+define('LOGGER_TRACE', 2);
+define('LOGGER_DEBUG', 3);
+define('LOGGER_DATA', 4);
+define('LOGGER_ALL', 5);
/* @}*/
/**
* @}
*/
-/**
- * @name Contact_is
- *
- * Relationship types
- * @{
- */
-define('CONTACT_IS_FOLLOWER', 1);
-define('CONTACT_IS_SHARING', 2);
-define('CONTACT_IS_FRIEND', 3);
-/**
- * @}
- */
-
/**
* @name Update
*
* @}
*/
-/**
- * @name page/profile types
- *
- * PAGE_NORMAL is a typical personal profile account
- * PAGE_SOAPBOX automatically approves all friend requests as CONTACT_IS_SHARING, (readonly)
- * PAGE_COMMUNITY automatically approves all friend requests as CONTACT_IS_SHARING, but with
- * write access to wall and comments (no email and not included in page owner's ACL lists)
- * PAGE_FREELOVE automatically approves all friend requests as full friends (CONTACT_IS_FRIEND).
- *
- * @{
- */
-define('PAGE_NORMAL', 0);
-define('PAGE_SOAPBOX', 1);
-define('PAGE_COMMUNITY', 2);
-define('PAGE_FREELOVE', 3);
-define('PAGE_BLOG', 4);
-define('PAGE_PRVGROUP', 5);
-/**
- * @}
- */
-
-/**
- * @name account types
- *
- * ACCOUNT_TYPE_PERSON - the account belongs to a person
- * Associated page types: PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE
- *
- * ACCOUNT_TYPE_ORGANISATION - the account belongs to an organisation
- * Associated page type: PAGE_SOAPBOX
- *
- * ACCOUNT_TYPE_NEWS - the account is a news reflector
- * Associated page type: PAGE_SOAPBOX
- *
- * ACCOUNT_TYPE_COMMUNITY - the account is community forum
- * Associated page types: PAGE_COMMUNITY, PAGE_PRVGROUP
- *
- * ACCOUNT_TYPE_RELAY - the account is a relay
- * This will only be assigned to contacts, not to user accounts
- * @{
- */
-define('ACCOUNT_TYPE_PERSON', 0);
-define('ACCOUNT_TYPE_ORGANISATION', 1);
-define('ACCOUNT_TYPE_NEWS', 2);
-define('ACCOUNT_TYPE_COMMUNITY', 3);
-define('ACCOUNT_TYPE_RELAY', 4);
-/**
- * @}
- */
-
/**
* @name CP
*
* @}
*/
-/**
- * @name Protocols
- * @deprecated since version 3.6
- * @see Conversation
- *
- * Different protocols that we are storing
- * @{
- */
-define('PROTOCOL_UNKNOWN' , Conversation::PROTOCOL_UNKNOWN);
-define('PROTOCOL_DFRN' , Conversation::PROTOCOL_DFRN);
-define('PROTOCOL_DIASPORA' , Conversation::PROTOCOL_DIASPORA);
-define('PROTOCOL_OSTATUS_SALMON' , Conversation::PROTOCOL_OSTATUS_SALMON);
-define('PROTOCOL_OSTATUS_FEED' , Conversation::PROTOCOL_OSTATUS_FEED); // Deprecated
-define('PROTOCOL_GS_CONVERSATION', Conversation::PROTOCOL_GS_CONVERSATION); // Deprecated
-define('PROTOCOL_SPLITTED_CONV' , Conversation::PROTOCOL_SPLITTED_CONV);
-/**
- * @}
- */
-
/**
* @name Network constants
* @deprecated since version 3.6
return;
}
+ // run the pre_update_nnnn functions in update.php
+ for ($x = $stored + 1; $x <= $current; $x++) {
+ $r = run_update_function($x, 'pre_update');
+ if (!$r) {
+ break;
+ }
+ }
+
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
- // run update routine
- // it update the structure in one call
+ // update the structure in one call
$retval = DBStructure::update(false, true);
if ($retval) {
DBStructure::updateFail(
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
}
- // run any left update_nnnn functions in update.php
+ // run the update_nnnn functions in update.php
for ($x = $stored + 1; $x <= $current; $x++) {
- $r = run_update_function($x);
+ $r = run_update_function($x, 'update');
if (!$r) {
break;
}
return;
}
-function run_update_function($x)
+function run_update_function($x, $prefix)
{
- if (function_exists('update_' . $x)) {
+ $funcname = $prefix . '_' . $x;
+
+ if (function_exists($funcname)) {
// There could be a lot of processes running or about to run.
// We want exactly one process to run the update command.
// So store the fact that we're taking responsibility
// If the update fails or times-out completely you may need to
// delete the config entry to try again.
- $t = Config::get('database', 'update_' . $x);
+ $t = Config::get('database', $funcname);
if (!is_null($t)) {
return false;
}
- Config::set('database', 'update_' . $x, time());
+ Config::set('database', $funcname, time());
// call the specific update
-
- $func = 'update_' . $x;
- $retval = $func();
+ $retval = $funcname();
if ($retval) {
//send the administrator an e-mail
);
return false;
} else {
- Config::set('database', 'update_' . $x, 'success');
- Config::set('system', 'build', $x);
+ Config::set('database', $funcname, 'success');
+
+ if ($prefix == 'update') {
+ Config::set('system', 'build', $x);
+ }
+
return true;
}
} else {
- Config::set('database', 'update_' . $x, 'success');
- Config::set('system', 'build', $x);
+ Config::set('database', $funcname, 'success');
+
+ if ($prefix == 'update') {
+ Config::set('system', 'build', $x);
+ }
+
return true;
}
}
function check_addons(App $a)
{
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
- if (DBM::is_result($r)) {
+ if (DBA::isResult($r)) {
$installed = $r;
} else {
$installed = [];
intval($uid)
);
- if (DBM::is_result($p)) {
+ if (DBA::isResult($p)) {
$tmp_dob = substr($p[0]['dob'], 5);
if (intval($tmp_dob)) {
$y = DateTimeFormat::timezoneNow($tz, 'Y');
function curPageURL()
{
$pageURL = 'http';
- if ($_SERVER["HTTPS"] == "on") {
+ if (!empty($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
$pageURL .= "s";
}