Skip to content

Commit

Permalink
MDL-37686 xmldb: Fixed coding guidelines errors in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed Feb 7, 2013
1 parent 1918a24 commit a665e1b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions admin/tool/xmldb/actions/XMLDBAction.class.php
Expand Up @@ -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;
Expand Down
Expand Up @@ -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
Expand All @@ -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() . "', ";
Expand All @@ -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() . "', ";
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a665e1b

Please sign in to comment.