|
Learning with Texts - Fork 2.4.0-fork
Learn foreign languages with texts
|
Connects to the database and check its state. More...
Functions | |
| do_mysqli_query ($sql) | |
| runsql ($sql, $m, $sqlerrdie=true) | |
| get_first_value ($sql) | |
| prepare_textdata ($s) | |
| prepare_textdata_js ($s) | |
| convert_string_to_sqlsyntax ($data) | |
| convert_string_to_sqlsyntax_nonull ($data) | |
| convert_string_to_sqlsyntax_notrim_nonull ($data) | |
| convert_regexp_to_sqlsyntax ($input) | |
| validateLang ($currentlang) | |
| validateText ($currenttext) | |
| validateTag ($currenttag, $currentlang) | |
| validateArchTextTag ($currenttag, $currentlang) | |
| validateTextTag ($currenttag, $currentlang) | |
| getSettingZeroOrOne ($key, $dft) | |
| getSetting ($key) | |
| getSettingWithDefault ($key) | |
| saveSetting ($k, $v) | |
| LWTTableCheck () | |
| LWTTableSet ($key, $val) | |
| LWTTableGet ($key) | |
| adjust_autoincr ($table, $key) | |
| optimizedb () | |
| set_word_count () | |
| parse_japanese_text ($text, $id) | |
| parse_standard_text ($text, $id, $lid) | |
| prepare_text_parsing ($text, $id, $lid) | |
| check_text_valid ($lid) | |
| update_default_values ($id, $lid, $sql) | |
| check_text ($sql, $rtlScript, $wl) | |
| check_text_with_expressions ($id, $lid, $wl, $wl_max, $mw_sql) | |
| splitCheckText ($text, $lid, $id) | |
| reparse_all_texts () | |
| update_database ($dbname) | |
| check_update_db ($debug, $tbpref, $dbname) | |
| connect_to_database ($server, $userid, $passwd, $dbname) | |
| get_database_prefixes (&$tbpref) | |
Variables | |
| $DBCONNECTION = connect_to_database($server, $userid, $passwd, $dbname) | |
| $tbpref = null | |
| $fixed_tbpref = get_database_prefixes($tbpref) | |
Connects to the database and check its state.
| adjust_autoincr | ( | $table, | |
| $key | |||
| ) |
Adjust the auto-incrementation in the database.
@global string $tbpref Database table prefix
| check_text | ( | $sql, | |
| $rtlScript, | |||
| $wl | |||
| ) |
Check a text and display statistics about it.
| {string} | $sql |
| {bool} | $rtlScript |
| {} | $wl |
| check_text_valid | ( | $lid | ) |
Echo the sentences in a text. Prepare JS data for words and word count.
@global string $tbpref Database table prefix
| check_text_with_expressions | ( | $id, | |
| $lid, | |||
| $wl, | |||
| $wl_max, | |||
| $mw_sql | |||
| ) |
Check a text that contains expressions.
| int | $id | Text ID |
| int | $lid | Language ID |
| int[] | $wl | Word length |
| int | $wl_max | Maximum word length |
| string | $mw_sql | SQL-formatted string |
@global string $tbpref Database table prefix
| check_update_db | ( | $debug, | |
| $tbpref, | |||
| $dbname | |||
| ) |
Check and/or update the database.
@global mysqli $DBCONNECTION Connection to the database
counter for cache rebuild
| connect_to_database | ( | $server, | |
| $userid, | |||
| $passwd, | |||
| $dbname | |||
| ) |
Make the connection to the database.
@psalm-suppress UndefinedDocblockClass
| convert_string_to_sqlsyntax | ( | $data | ) |
Prepares a string to be properly recognized as a string by SQL.
| string | $data | Input string |
| convert_string_to_sqlsyntax_nonull | ( | $data | ) |
Prepares a string to be properly recognized as a string by SQL.
| string | $data | Input string |
| convert_string_to_sqlsyntax_notrim_nonull | ( | $data | ) |
Prepares a string to be properly recognized as a string by SQL.
| string | $data | Input string |
| do_mysqli_query | ( | $sql | ) |
Do a SQL query to the database. It is a wrapper for mysqli_query function.
| string | $sql | Query using SQL syntax |
@global mysqli $DBCONNECTION COnnection to the database
| get_database_prefixes | ( | & | $tbpref | ) |
Get the prefixes for the database.
Is $tbpref set in connect.inc.php? Take it and $fixed_tbpref=1. If not: $fixed_tbpref=0. Is it set in table "_lwtgeneral"? Take it. If not: Use $tbpref = '' (no prefix, old/standard behaviour).
| string | null | $tbpref | Temporary database table prefix |
| get_first_value | ( | $sql | ) |
Return the record "value" in the first line of the database if found.
| string | $sql | MySQL query |
| getSetting | ( | $key | ) |
Get a setting from the database. It can also check for its validity.
| string | $key | Setting key. If $key is 'currentlanguage' or 'currenttext', we validate language/text. |
| getSettingWithDefault | ( | $key | ) |
Get the settings value for a specific key. Return a default value when possible
| string | $key | Settings key |
@global string $tbpref Table name prefix
| getSettingZeroOrOne | ( | $key, | |
| $dft | |||
| ) |
Convert a setting to 0 or 1
| string | $key | The input value |
| string | int | $dft | Default value to use, should be convertible to string |
@psalm-return 0|1
| LWTTableCheck | ( | ) |
Check if the _lwtgeneral table exists, create it if not.
| optimizedb | ( | ) |
Optimize the database.
@global string $trbpref Table prefix
| parse_japanese_text | ( | $text, | |
| $id | |||
| ) |
Parse a Japanese text using MeCab and add it to the database.
| {string} | $text Text to parse. |
| {int} | $id Text ID |
| parse_standard_text | ( | $text, | |
| $id, | |||
| $lid | |||
| ) |
Parse a text using the default tools. It is a not-japanese text.
| {string} | $text Text to parse |
| {int} | $id Text ID |
| {int} | $lid Language ID |
| prepare_text_parsing | ( | $text, | |
| $id, | |||
| $lid | |||
| ) |
Pre-parse the input text before a definitive parsing by a specialized parser.
| {string} | $text Text to parse |
| {int} | $id Text ID |
| {int} | $lid Language ID |
| reparse_all_texts | ( | ) |
Reparse all texts in order.
@global string $tbpref Database table prefix
| runsql | ( | $sql, | |
| $m, | |||
$sqlerrdie = true |
|||
| ) |
Run a SQL query, you can specify its behavior and error message.
| string | $sql | MySQL query |
| string | $m | Success phrase to prepend to the number of affected rows |
| bool | $sqlerrdie | To die on errors (default = TRUE) |
| saveSetting | ( | $k, | |
| $v | |||
| ) |
Save the setting identified by a key with a specific value.
| string | $k | Setting key |
| mixed | $v | Setting value, will get converted to string |
@global string $tbpref Table name prefix
| set_word_count | ( | ) |
Set the number of words for all languages
@global string $tbpref Database table prefix
| splitCheckText | ( | $text, | |
| $lid, | |||
| $id | |||
| ) |
Parse the input text.
| string | $text | Text to parse |
| string | $lid | Language ID (LgID from languages table) |
| int | $id | References whether the text is new to the database $id = -1 => Check, return protocol $id = -2 => Only return sentence array $id = TextID => Split: insert sentences/textitems entries in DB |
@global string $tbpref Database table prefix
@psalm-return non-empty-list<string>|null
| update_database | ( | $dbname | ) |
Update the database if it is using an outdate version.
| string | $dbname | Name of the database |
@global string $tbpref Database table prefix @global 0|1 $debug Output debug messages.
| update_default_values | ( | $id, | |
| $lid, | |||
| $sql | |||
| ) |
Change the default values for default language, default text, etc...
| {int} | $id New default text ID |
| {int} | $lid New default language ID |
| {string} | $sql |
| validateLang | ( | $currentlang | ) |
Validate a language ID
| string | $currentlang | Language ID to validate |
@global string $tbpref Table name prefix
| validateText | ( | $currenttext | ) |
Validate a text ID
| string | $currenttext | Text ID to validate |
@global string '' if the text is not valid, $currenttext otherwise
@global string $tbpref Table name prefix