namespace Friendica\Database;
use Friendica\Core\Config;
+use Friendica\Core\L10n;
use Friendica\Database\DBM;
use dba;
-require_once "boot.php";
+require_once 'boot.php';
require_once 'include/dba.php';
require_once 'include/enotify.php';
-require_once "include/text.php";
+require_once 'include/text.php';
/**
* @brief This class contain functions for the database management
*
* This class contains functions that doesn't need to know if pdo, mysqli or whatever is used.
*/
-class DBStructure {
+class DBStructure
+{
/*
* Converts all tables from MyISAM to InnoDB
*/
dbesc(dba::database_name()));
if (!DBM::is_result($r)) {
- echo t('There are no tables on MyISAM.')."\n";
+ echo L10n::t('There are no tables on MyISAM.')."\n";
return;
}
// every admin could had different language
foreach ($adminlist as $admin) {
$lang = (($admin['language'])?$admin['language']:'en');
- push_lang($lang);
+ L10n::pushLang($lang);
- $preamble = deindent(t("
+ $preamble = deindent(L10n::t("
The friendica developers released update %s recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
friendica developer if you can not help me on your own. My database might be invalid."));
- $body = t("The error message is\n[pre]%s[/pre]");
+ $body = L10n::t("The error message is\n[pre]%s[/pre]");
$preamble = sprintf($preamble, $update_id);
$body = sprintf($body, $error_message);
* @return string Error message
*/
private static function printUpdateError($message) {
- echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
+ echo L10n::t("\nError %d occurred during database update:\n%s\n",
dba::errorNo(), dba::errorMessage());
- return t('Errors encountered performing database changes: ').$message.EOL;
+ return L10n::t('Errors encountered performing database changes: ').$message.EOL;
}
/**
public static function update($verbose, $action, array $tables = null, array $definition = null) {
if ($action) {
Config::set('system', 'maintenance', 1);
- Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
+ Config::set('system', 'maintenance_reason', L10n::t(': Database update', DBM::date().' '.date('e')));
}
$errors = '';
}
if ($action) {
- Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
+ Config::set('system', 'maintenance_reason', L10n::t('%s: updating %s table.', DBM::date().' '.date('e'), $name));
// Ensure index conversion to unique removes duplicates
if ($is_unique && ($temp_name != $name)) {
"hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"pdesc" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
- "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01", "comment" => ""],
+ "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => ""],
"address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"uid_created" => ["uid","created"],
"uid_commented" => ["uid","commented"],
"uid_wall_created" => ["uid","wall","created"],
- "private_wall_commented" => ["private","wall","commented"],
+ "private_wall_origin_commented" => ["private","wall","origin","commented"],
]
];
$database["tokens"] = [
"guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
"username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
+ "legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
"nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"page-flags" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
"account-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
"prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
- "pwdreset" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
+ "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
+ "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
"maxreq" => ["type" => "int", "not null" => "1", "default" => "10", "comment" => ""],
"expire" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
"account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
]
];
- return($database);
+ return $database;
}
}