// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
+// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
// //
// This program is free software; you can redistribute it and/or modify //
$result .= ' /// Launch create table for ' . $table->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && create_table($table);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch drop table for ' . $table->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && drop_table($table);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch rename table for ' . $table->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && rename_table($table, ' . "'NEWNAMEGOESHERE'" . ');' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
return $result;
}
+
+ /**
+ * This function will generate the PHP code needed to
+ * implement the upgrade_xxxx_savepoint() php calls in
+ * upgrade code generated from the editor
+ *
+ * @param XMLDBStructure structure object containing all the info
+ * @return string PHP code to be used to stabilish a savepoint
+ */
+ function upgrade_savepoint_php ($structure) {
+
+ $path = $structure->getPath();
+
+ $result = '';
+
+ switch ($path) {
+ case 'lib/db':
+ $result = XMLDB_LINEFEED .
+ ' /// Main savepoint reached' . XMLDB_LINEFEED .
+ ' upgrade_main_savepoint($result, XXXXXXXXXX);' . XMLDB_LINEFEED;
+ break;
+ }
+ return $result;
+ }
}
?>
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
// http://moodle.com //
// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
+// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
// //
// This program is free software; you can redistribute it and/or modify //
$result .= ' /// Launch add field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && add_field($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch drop field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && drop_field($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch rename field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && rename_field($table, $field, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch change of type for field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && change_field_type($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch change of precision for field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && change_field_precision($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch change of sign for field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && change_field_unsigned($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch change of nullability for field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && change_field_notnull($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch change of list of values for field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && change_field_enum($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch change of default for field ' . $field->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && change_field_default($table, $field);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch add key ' . $key->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && add_key($table, $key);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch drop key ' . $key->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && drop_key($table, $key);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch rename key ' . $key->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && rename_key($table, $key, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch add index ' . $index->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && add_index($table, $index);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch drop index ' . $index->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && drop_index($table, $index);' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
$result .= ' /// Launch rename index ' . $index->getName() . XMLDB_LINEFEED;
$result .= ' $result = $result && rename_index($table, $index, ' . "'" . 'NEWNAMEGOESHERE' . "'" . ');' . XMLDB_LINEFEED;
+ /// Add the proper upgrade_xxxx_savepoint call
+ $result .= $this->upgrade_savepoint_php ($structure);
+
/// Add standard PHP footer
$result .= XMLDB_PHP_FOOTER;
return $result;
}
+ /**
+ * This function will generate the PHP code needed to
+ * implement the upgrade_xxxx_savepoint() php calls in
+ * upgrade code generated from the editor
+ *
+ * @param XMLDBStructure structure object containing all the info
+ * @return string PHP code to be used to stabilish a savepoint
+ */
+ function upgrade_savepoint_php ($structure) {
+
+ $path = $structure->getPath();
+
+ $result = '';
+
+ switch ($path) {
+ case 'lib/db':
+ $result = XMLDB_LINEFEED .
+ ' /// Main savepoint reached' . XMLDB_LINEFEED .
+ ' upgrade_main_savepoint($result, XXXXXXXXXX);' . XMLDB_LINEFEED;
+ break;
+ }
+ return $result;
+ }
+
}
?>