Skip to content
Browse files

MDL-37686 xmldb: Fixed coding guidelines errors in generated code

  • Loading branch information...
1 parent 1918a24 commit a665e1b0135911ecc808cf34413f831a0d56ae94 @FMCorz FMCorz committed
View
8 admin/tool/xmldb/actions/XMLDBAction.class.php
@@ -239,22 +239,22 @@ function upgrade_savepoint_php($structure) {
switch ($plugintype ) {
case 'lib': // has own savepoint function
$result = XMLDB_LINEFEED .
- ' // Main savepoint reached' . XMLDB_LINEFEED .
+ ' // Main savepoint reached.' . XMLDB_LINEFEED .
' upgrade_main_savepoint(true, XXXXXXXXXX);' . XMLDB_LINEFEED;
break;
case 'mod': // has own savepoint function
$result = XMLDB_LINEFEED .
- ' // ' . $pluginname . ' savepoint reached' . XMLDB_LINEFEED .
+ ' // ' . ucfirst($pluginname) . ' savepoint reached.' . XMLDB_LINEFEED .
' upgrade_mod_savepoint(true, XXXXXXXXXX, ' . "'$pluginname'" . ');' . XMLDB_LINEFEED;
break;
case 'block': // has own savepoint function
$result = XMLDB_LINEFEED .
- ' // ' . $pluginname . ' savepoint reached' . XMLDB_LINEFEED .
+ ' // ' . ucfirst($pluginname) . ' savepoint reached.' . XMLDB_LINEFEED .
' upgrade_block_savepoint(true, XXXXXXXXXX, ' . "'$pluginname'" . ');' . XMLDB_LINEFEED;
break;
default: // rest of plugins
$result = XMLDB_LINEFEED .
- ' // ' . $pluginname . ' savepoint reached' . XMLDB_LINEFEED .
+ ' // ' . ucfirst($pluginname) . ' savepoint reached.' . XMLDB_LINEFEED .
' upgrade_plugin_savepoint(true, XXXXXXXXXX, ' . "'$plugintype'" . ', ' . "'$pluginname'" . ');' . XMLDB_LINEFEED;
}
return $result;
View
18 admin/tool/xmldb/actions/view_structure_php/view_structure_php.class.php
@@ -170,10 +170,10 @@ function create_table_php($structure, $table) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define table ' . $table->getName() . ' to be created' . XMLDB_LINEFEED;
+ $result .= ' // Define table ' . $table->getName() . ' to be created.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= XMLDB_LINEFEED;
- $result .= ' // Adding fields to table ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Adding fields to table ' . $table->getName() . '.' . XMLDB_LINEFEED;
// Iterate over each field
foreach ($table->getFields() as $field) {
// The field header, with name
@@ -186,7 +186,7 @@ function create_table_php($structure, $table) {
// Iterate over each key
if ($keys = $table->getKeys()) {
$result .= XMLDB_LINEFEED;
- $result .= ' // Adding keys to table ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Adding keys to table ' . $table->getName() . '.' . XMLDB_LINEFEED;
foreach ($keys as $key) {
// The key header, with name
$result .= ' $table->add_key(' . "'" . $key->getName() . "', ";
@@ -199,7 +199,7 @@ function create_table_php($structure, $table) {
// Iterate over each index
if ($indexes = $table->getIndexes()) {
$result .= XMLDB_LINEFEED;
- $result .= ' // Adding indexes to table ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Adding indexes to table ' . $table->getName() . '.' . XMLDB_LINEFEED;
foreach ($indexes as $index) {
// The index header, with name
$result .= ' $table->add_index(' . "'" . $index->getName() . "', ";
@@ -212,7 +212,7 @@ function create_table_php($structure, $table) {
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Conditionally launch create table for ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Conditionally launch create table for ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' if (!$dbman->table_exists($table)) {' . XMLDB_LINEFEED;
$result .= ' $dbman->create_table($table);' . XMLDB_LINEFEED;
$result .= ' }' . XMLDB_LINEFEED;
@@ -250,12 +250,12 @@ function drop_table_php($structure, $table) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define table ' . $table->getName() . ' to be dropped' . XMLDB_LINEFEED;
+ $result .= ' // Define table ' . $table->getName() . ' to be dropped.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Conditionally launch drop table for ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Conditionally launch drop table for ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' if ($dbman->table_exists($table)) {' . XMLDB_LINEFEED;
$result .= ' $dbman->drop_table($table);' . XMLDB_LINEFEED;
$result .= ' }' . XMLDB_LINEFEED;
@@ -293,12 +293,12 @@ function rename_table_php($structure, $table) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define table ' . $table->getName() . ' to be renamed to NEWNAMEGOESHERE' . XMLDB_LINEFEED;
+ $result .= ' // Define table ' . $table->getName() . ' to be renamed to NEWNAMEGOESHERE.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch rename table for ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch rename table for ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->rename_table($table, ' . "'NEWNAMEGOESHERE'" . ');' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
View
54 admin/tool/xmldb/actions/view_table_php/view_table_php.class.php
@@ -314,13 +314,13 @@ function add_field_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define field ' . $field->getName() . ' to be added to ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Define field ' . $field->getName() . ' to be added to ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Conditionally launch add field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Conditionally launch add field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' if (!$dbman->field_exists($table, $field)) {'. XMLDB_LINEFEED;
$result .= ' $dbman->add_field($table, $field);' . XMLDB_LINEFEED;
$result .= ' }'. XMLDB_LINEFEED;
@@ -362,13 +362,13 @@ function drop_field_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define field ' . $field->getName() . ' to be dropped from ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Define field ' . $field->getName() . ' to be dropped from ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "'" . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Conditionally launch drop field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Conditionally launch drop field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' if ($dbman->field_exists($table, $field)) {' . XMLDB_LINEFEED;
$result .= ' $dbman->drop_field($table, $field);' . XMLDB_LINEFEED;
$result .= ' }' . XMLDB_LINEFEED;
@@ -410,13 +410,13 @@ function rename_field_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Rename field ' . $field->getName() . ' on table ' . $table->getName() . ' to NEWNAMEGOESHERE'. XMLDB_LINEFEED;
+ $result .= ' // Rename field ' . $field->getName() . ' on table ' . $table->getName() . ' to NEWNAMEGOESHERE.'. XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch rename field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch rename field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->rename_field($table, $field, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -465,13 +465,13 @@ function change_field_type_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Changing type of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $type . XMLDB_LINEFEED;
+ $result .= ' // Changing type of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $type . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch change of type for field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch change of type for field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->change_field_type($table, $field);' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -517,13 +517,13 @@ function change_field_precision_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Changing precision of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $precision . XMLDB_LINEFEED;
+ $result .= ' // Changing precision of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $precision . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
- $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " .$field->getPHP(true) . ');' . XMLDB_LINEFEED;
+ $result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch change of precision for field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch change of precision for field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->change_field_precision($table, $field);' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -565,13 +565,13 @@ function change_field_notnull_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Changing nullability of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $notnull . XMLDB_LINEFEED;
+ $result .= ' // Changing nullability of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $notnull . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch change of nullability for field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch change of nullability for field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->change_field_notnull($table, $field);' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -613,13 +613,13 @@ function change_field_default_php($structure, $table, $field) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Changing the default of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $default . XMLDB_LINEFEED;
+ $result .= ' // Changing the default of field ' . $field->getName() . ' on table ' . $table->getName() . ' to ' . $default . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $field = new xmldb_field(' . "'" . $field->getName() . "', " . $field->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch change of default for field ' . $field->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch change of default for field ' . $field->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->change_field_default($table, $field);' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -659,13 +659,13 @@ function add_key_php($structure, $table, $key) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define key ' . $key->getName() . ' ('. $key->getXMLDBKeyName($key->getType()) . ') to be added to ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Define key ' . $key->getName() . ' ('. $key->getXMLDBKeyName($key->getType()) . ') to be added to ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $key = new xmldb_key(' . "'" . $key->getName() . "', " . $key->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch add key ' . $key->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch add key ' . $key->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->add_key($table, $key);' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -705,13 +705,13 @@ function drop_key_php($structure, $table, $key) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define key ' . $key->getName() . ' ('. $key->getXMLDBKeyName($key->getType()) . ') to be dropped form ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Define key ' . $key->getName() . ' ('. $key->getXMLDBKeyName($key->getType()) . ') to be dropped form ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $key = new xmldb_key(' . "'" . $key->getName() . "', " . $key->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch drop key ' . $key->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch drop key ' . $key->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->drop_key($table, $key);' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -754,13 +754,13 @@ function rename_key_php($structure, $table, $key) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define key ' . $key->getName() . ' ('. $key->getXMLDBKeyName($key->getType()) . ') to be renamed to NEWNAMEGOESHERE' . XMLDB_LINEFEED;
+ $result .= ' // Define key ' . $key->getName() . ' ('. $key->getXMLDBKeyName($key->getType()) . ') to be renamed to NEWNAMEGOESHERE.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $key = new xmldb_key(' . "'" . $key->getName() . "', " . $key->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch rename key ' . $key->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch rename key ' . $key->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->rename_key($table, $key, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call
@@ -800,13 +800,13 @@ function add_index_php($structure, $table, $index) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define index ' . $index->getName() . ' ('. ($index->getUnique() ? 'unique' : 'not unique') . ') to be added to ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Define index ' . $index->getName() . ' ('. ($index->getUnique() ? 'unique' : 'not unique') . ') to be added to ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $index = new xmldb_index(' . "'" . $index->getName() . "', " . $index->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Conditionally launch add index ' . $index->getName() . XMLDB_LINEFEED;
+ $result .= ' // Conditionally launch add index ' . $index->getName() . '.' . XMLDB_LINEFEED;
$result .= ' if (!$dbman->index_exists($table, $index)) {' . XMLDB_LINEFEED;
$result .= ' $dbman->add_index($table, $index);' . XMLDB_LINEFEED;
$result .= ' }' . XMLDB_LINEFEED;
@@ -848,13 +848,13 @@ function drop_index_php($structure, $table, $index) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define index ' . $index->getName() . ' ('. ($index->getUnique() ? 'unique' : 'not unique') . ') to be dropped form ' . $table->getName() . XMLDB_LINEFEED;
+ $result .= ' // Define index ' . $index->getName() . ' ('. ($index->getUnique() ? 'unique' : 'not unique') . ') to be dropped form ' . $table->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $index = new xmldb_index(' . "'" . $index->getName() . "', " . $index->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Conditionally launch drop index ' . $index->getName() . XMLDB_LINEFEED;
+ $result .= ' // Conditionally launch drop index ' . $index->getName() . '.' . XMLDB_LINEFEED;
$result .= ' if ($dbman->index_exists($table, $index)) {' . XMLDB_LINEFEED;
$result .= ' $dbman->drop_index($table, $index);' . XMLDB_LINEFEED;
$result .= ' }' . XMLDB_LINEFEED;
@@ -899,13 +899,13 @@ function rename_index_php($structure, $table, $index) {
// Add contents
$result .= XMLDB_LINEFEED;
- $result .= ' // Define index ' . $index->getName() . ' ('. ($index->getUnique() ? 'unique' : 'not unique') . ') to be renamed to NEWNAMEGOESHERE' . XMLDB_LINEFEED;
+ $result .= ' // Define index ' . $index->getName() . ' ('. ($index->getUnique() ? 'unique' : 'not unique') . ') to be renamed to NEWNAMEGOESHERE.' . XMLDB_LINEFEED;
$result .= ' $table = new xmldb_table(' . "'" . $table->getName() . "'" . ');' . XMLDB_LINEFEED;
$result .= ' $index = new xmldb_index(' . "'" . $index->getName() . "', " . $index->getPHP(true) . ');' . XMLDB_LINEFEED;
// Launch the proper DDL
$result .= XMLDB_LINEFEED;
- $result .= ' // Launch rename index ' . $index->getName() . XMLDB_LINEFEED;
+ $result .= ' // Launch rename index ' . $index->getName() . '.' . XMLDB_LINEFEED;
$result .= ' $dbman->rename_index($table, $index, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
// Add the proper upgrade_xxxx_savepoint call

0 comments on commit a665e1b

Please sign in to comment.
Something went wrong with that request. Please try again.