250 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
d9f7fe9c3f
MDL-77599 coding-style: Replace forbidden @const tags by @var
@const is not a valid phpdoc tag and @var should be used to
document both classes properties and constants (no matter how
weird that may sound, heh).

Link to (draft right now) PHP-FIG:

https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md#518-var

So, with this commit we are just replacing all uses by the correct
@var one. Note that the type is entirely optional, in fact I think
that there isn't much need of it for constants because it's obvious
for both humans and machines which the type is. But, as far as it's
also correct to specify it, we haven't modified that detail.

The only detail modified are the cases where the constant name was
specified in the phpdoc, that's not needed, hence, the names have
been removed from there when present (a couple of cases).
2023-07-03 15:58:16 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Ilya Tregubov
9ba9589f09 Merge branch 'MDL-74853-master' of https://github.com/marinaglancy/moodle 2022-12-01 08:55:34 +03:00
Marina Glancy
a800e7e62f MDL-74853 various: add second parameter to htmlentities functions
Default value of the $flag argument changed in PHP 8.1 from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE
To ensure consistent behavior across different PHP version the second parameter is now required for the functions:
htmlspecialchars(), htmlentities(), htmlspecialchars_decode(), html_entity_decode() and get_html_translation_table()
2022-11-28 16:12:20 +01:00
Eloy Lafuente (stronk7)
eeaaf131ac MDL-75977 xmldb: Avoid using null params on built-in DB functions
This changes a couple of cases, in postgres and oracle where we
were trying to calculate strlen() on null values (that causes a
PHP 8.1 warning).

Also, at the same time, fixing another case in xmldb_field, it
was detected that it had a bug around precision (being set to the
value of type), being used as object property, when it's not, so
it was also fixed by moving the code logic a little bit.

Note that the bug has been there since inception because there
isn't any code in Moodle using that ->precision property. It
was just detected thanks to PHP 8.2, but that's another story. :-)

Verified that with the patch:
- All DBs can be installed (phpunit install)
- Both DDL and DML pass without any ddl/dml warning (in all DBs).
2022-11-26 16:16:20 +01:00
David Mudrák
70b0df5891 MDL-70931 xmldb: Generate install.xml files with EOL and EOF
As discussed in MDLSITE-6397, all Moodle code files should end with
single Unix-style end of line character. Files created and edited
through the XMLDB editor should follow this rule, too.
2021-02-17 20:59:19 +01:00
Tim Hunt
54b2b1d27f MDL-63020 xmldb: Improve PHPdoc comments for better IDE autocomplete 2018-09-20 17:41:22 +01:00
Tim Hunt
f4e18a0ae7 MDL-62783 XMLDB: Generate PHP with [] arrays 2018-06-22 13:58:27 +01:00
Jun Pataleta
a2e7a47a6e MDL-61766 xmldb: Handle custom admin path 2018-03-29 18:29:32 +08:00
Eloy Lafuente (stronk7)
54a099e989 MDL-61150 xmldb: Let's check the PATH attribute of XMLDB files
Starting with Moodle 3.5 the XMLDB->PATH attribute is checked
to be correct and pointing to the correct plugin directory.

It only was used for writing PHP savepoints code, but better we
ask for strict correctness.

With this patch applied, neither the XMLDB Editor neither install
will be able to load a file with wrong PATH anymore.
2018-02-11 23:07:18 +01:00
David Mudrák
521252d642 MDL-32113 xmldb: Support numeric fields with precision up to 38 digits
The patch increases the maximum supported precision (total number of
digits) for numeric (decimal) fields to 38 digits (current limit on
Oracle and MSSQL).

Additionally, we add our own limit for the whole number part of numeric
fields so they are no longer than integer fields (20 digits). This is to
make it easier to eventually convert from one field type to another.
Note that PHP floats commonly support precision of roughly 15 digits
anyway.
2017-12-21 19:48:03 +01:00
David Mudrák
457eaef9ec MDL-32113 xmldb: Remove hard-coded exceptions for long number fields
We are going to unify the maximum supported precision of all numeric
fields to 38 digits (which are the current Oracle and MSSQL limits). Get
rid of hard-coded exceptions for longer fields.
2017-12-21 15:37:08 +01:00
Russell Smith
0b768e744f MDL-53495 database xmldb: Use real length restriction. 2016-06-08 11:06:16 +10:00
Eloy Lafuente (stronk7)
14559e1849 MDL-38972 xmldb: amend comments. 2013-04-24 02:09:34 +02:00
Petr Škoda
02e5f81c94 MDL-38972 detect key-index duplicates 2013-04-18 20:21:02 +02:00
Petr Škoda
76f2fcdedb MDL-37726 stop using PREVIOUS/NEXT in install.xml files 2013-01-29 22:32:24 +01:00
Petr Škoda
434f54044e MDL-34475 add default value to xmldb_field hash calculation 2012-07-23 21:34:44 +02:00
Petr Škoda
661dd35d89 MDL-33018 fix borked xmldb_index contructor
Thanks Eloy!
2012-07-06 08:19:50 +02:00
Petr Skoda
bd991d03cf MDL-33018 add general index type hints and use PostgreSQL varchar_pattern_ops index type for context.path
This significantly improves performance of accesslib queries,
credit for the discovery of this solution goes to Andrew Masterton from OU.
2012-07-06 08:19:39 +02:00
Petr Skoda
d8bf2a14b6 MDL-32003 last db related phpdocs cleanup commit 2012-06-17 22:56:30 +02:00
Petr Skoda
002252f714 MDL-32003 standardise null case 2012-06-17 22:56:30 +02:00
Petr Skoda
aaddfac50c MDL-32003 more xmldb phpdocs and PHP4-ism cleanup 2012-06-17 22:56:30 +02:00
Petr Skoda
a6d9d4efc2 MDL-32003 fix PHP4-isms in core xmldb code 2012-06-17 22:56:29 +02:00
Petr Skoda
ef7c3f108a MDL-32003 protect xmldb class internals
Use getters and setters instead!
2012-06-17 22:56:29 +02:00
Petr Skoda
01be2287c7 MDL-32003 drop unused statement constants
These were last used in 2.2 upgrade, not allowed any more.
2012-06-17 22:56:29 +02:00
Petr Skoda
94417438b3 MDL-32003 fix phpdocs in xmldb abstraction 2012-06-17 22:56:28 +02:00
Petr Skoda
436b961381 MDL-32112 use constants for field and table limits
For now using the same JS hardcoding trick Eloy did the last time...
2012-03-24 11:45:36 +01:00
Petr Skoda
7fd31fe86c MDL-32112 horrible hack that ignores invalid size for XMLDB_TYPE_NUMBER in numerical question type
The easies fix could be to use VARCHAR instead because this field is used only for reading and writing, no selects on this field it seems.
2012-03-24 11:40:15 +01:00
Petr Skoda
d3232735ee MDL-32112 validate float definition in sql_generator 2012-03-24 11:40:15 +01:00
Petr Skoda
54e71a43ba MDL-32112 validate number definition in sql_generator 2012-03-24 11:40:15 +01:00
Petr Skoda
720d605e61 MDL-32112 validate integer definition in sql_generator 2012-03-24 11:40:15 +01:00
Petr Skoda
f9090b195b MDL-32112 validate table name restrictions in sql_generator 2012-03-24 11:40:15 +01:00
Petr Skoda
6cfade8f5a MDL-32112 validate field name restrictions in sql_generator 2012-03-24 11:40:14 +01:00
Petr Skoda
e763c273eb MDL-29515 drop 1.9 xmldb classes and methods (deprecated since 2.0) 2012-03-17 19:27:13 +01:00
Petr Skoda
f13489df50 MDL-31985 remove LOB sizes from code and UI 2012-03-11 13:42:37 +01:00
Petr Skoda
05aae0a571 MDL-29514 drop support for enum data types 2012-03-10 21:36:48 +01:00
Petr Skoda
7e522ccbc8 MDL-27982 remove unsigned support from all UIs and APIs, keep only public API for BC 2012-03-06 12:02:11 +01:00
Eloy Lafuente (stronk7)
617a9bb4c3 MDL-29668 xmldb editor - fix PHP generation for foreign-unique keys 2011-10-08 21:49:56 +02:00
Eloy Lafuente (stronk7)
37b5d8b0c4 MDL-29321 syntax - fix switch() statement 2011-09-19 01:24:51 +02:00
Eloy Lafuente (stronk7)
b1c1eeaec9 MDL-29314 syntax - fix switch() statement 2011-09-19 01:21:57 +02:00
Petr Skoda
b610f1d4d7 MDL-29313 allow larger char fields 2011-09-16 08:55:23 +02:00
Petr Skoda
257ad88f89 MDL-29313 enforce varchar size limit 2011-09-16 08:49:42 +02:00
Petr Skoda
b2cfdcf697 MDL-29314 enforce index size limits 2011-09-16 08:45:06 +02:00
Sam Marshall
d854dff9ef xmldb MDL-24979 Made xmldb (a) not hide libxml errors permanently, (b) not incorrectly report previous errors with a later, working file 2010-11-01 13:35:27 +00:00
Petr Skoda
6496a019c9 MDL-24322 detecting duplicate keys/fields and indexes - this prevents infinite looks later in code 2010-09-21 10:42:20 +00:00
Petr Skoda
adc31ef5d9 spelling fixes 2010-09-18 11:00:48 +00:00
Petr Skoda
99edf902e8 removed some unused local variables 2010-09-18 10:59:29 +00:00
Petr Skoda
844239d3ed MDL-24092 removing STATEMENTS support from install.xml, use db/install.php or db/log.php instead 2010-09-06 11:11:32 +00:00
Petr Skoda
a4cdd6d2c8 MDL-23068 removing obsolete $result and removing empty upgrade files that would be probably never used at all + minor cleanup/fixing 2010-07-04 10:27:56 +00:00
Andrew Davis
c78a948e8c all areas MDL-20821 Replaced instances of ereg_replace and eregi_replace with preg_replace 2009-11-17 01:36:35 +00:00