print_error('withoutversion', 'debug'); // without version, stop
}
-// Check if the main tables have been installed yet or not.
-if (!$tables = $DB->get_tables() ) { // No tables yet at all.
- $maintables = false;
-
-} else { // Check for missing main tables
- $maintables = true;
- $mtables = array('config', 'course', 'groupings'); // some tables used in 1.9 and 2.0, preferable something from the start and end of install.xml
- foreach ($mtables as $mtable) {
- if (!in_array($mtable, $tables)) {
- $maintables = false;
- break;
- }
- }
- unset($mtables);
-}
-unset($tables);
-
// Turn off xmlstrictheaders during upgrade.
$origxmlstrictheaders = !empty($CFG->xmlstrictheaders);
$CFG->xmlstrictheaders = false;
-if (!$maintables) {
+if (!core_tables_exist()) {
// hide errors from headers in case debug enabled in config.php
// fake some settings
}
if ($version > $CFG->version) { // upgrade
- require_once($CFG->libdir.'/db/upgrade.php'); // Defines upgrades
- require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
-
$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";
$strdatabasechecking = get_string('databasechecking', '', $a);
function upgrade_core($version, $verbose) {
global $CFG;
+ require_once($CFG->libdir.'/db/upgrade.php'); // Defines upgrades
+ require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
+
try {
// Upgrade current language pack if we can
if (empty($CFG->skiplangupgrade)) {
upgrade_handle_exception($ex);
}
}
+
+/**
+ * Checks if the main tables have been installed yet or not.
+ * @return bool
+ */
+function core_tables_exist() {
+ global $DB;
+
+ if (!$tables = $DB->get_tables() ) { // No tables yet at all.
+ return false;
+
+ } else { // Check for missing main tables
+ $mtables = array('config', 'course', 'groupings'); // some tables used in 1.9 and 2.0, preferable something from the start and end of install.xml
+ foreach ($mtables as $mtable) {
+ if (!in_array($mtable, $tables)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
\ No newline at end of file
flush();
$this->lastcall->pt = 0;
$this->lastcall->time = microtime(true);
+ if (CLI_SCRIPT) {
+ return; // temporary solution for cli scripts
+ }
$htmlcode = <<<EOT
<script type="text/javascript">
Number.prototype.fixed=function(n){
$this->lastcall->time = microtime(true);
$this->lastcall->pt = $percent;
$w = $this->percent * $this->width;
+ if (CLI_SCRIPT) {
+ return; // temporary solution for cli scripts
+ }
if ($es === null){
$es = "Infinity";
}
return $authtitle;
}
-?>