function executeDatabaseScripts() { $allScripts = getScripts(); $errors = array(); foreach ($allScripts as $s) { // check whether scripts should be run if (isset($s["conditionFunction"])) { $f = $s["conditionFunction"]; $runScripts = $f($s["conditionData"]); } else { $runScripts = true; } if ($runScripts) { foreach ($s["scripts"] as $script) { mysql_query($script); Helper::WriteToLog($script); $error = getMySQLErrorIfAny(); if ($error) { Helper::WriteToLog($error); $errors[] = $error; } } } } if (count($errors) == 0) { DataAccess::SetSetting("DATABASE_VERSION", DOMA_VERSION); } return array("errors" => $errors); }
/** * Get Scripts for backend * * @since 3.1 * * @param boolean $footer Load only script with footer flag set */ function get_scripts_backend($footer = false) { getScripts(GSBACK, $footer); }
} list($fromVer, $fromRev) = explode('rev', $from, 2); echo "Current version: " . $fromVer . "rev" . $fromRev . "\n"; $to = $cli->getOption('t'); $toVer = null; $toRev = null; if ($to) { list($toVer, $toRev) = explode('-', $to, 2); if ($toVer < $fromVer || $toVer === $fromVer && $toRev && $fromRev && $toRev < $fromRev) { new Exception("ToVersion must be higher than fromVerision."); } echo "Updating to version " . $toVer . "rev" . $fromRev . "...\n"; } else { echo "Updating to last version...\n"; } $scripts = getScripts($dir, $fromVer, $fromRev, $toVer, $toRev); if (!empty($scripts)) { echo "Starting update scripts...\n"; foreach ($scripts as $script) { echo "Starting script {$script}...\n"; include $baseDir . DIRECTORY_SEPARATOR . $script . ".php"; echo "Script {$script} finished.\n"; } echo "Update success!!\n"; echo "Current version {$script}.\n"; $db->config->save(array('_id' => 'version', 'version' => $script, 'date' => new MongoDate())); } else { echo "Application is already updated!\n"; } echo "Bye!\n"; } catch (Exception $e) {
/** * Get Scripts for front end * * @since 3.1 * * @param boolean $footer Load only script with footer flag set */ function get_scripts_frontend($footer = false) { echo getScripts(GSFRONT, $footer); }
<head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <title>Hello this is my title</title> <meta name="generator" content="Bootply" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <link rel="stylesheet" href="<?php echo base_url(); ?> /application/views/resources/css/bootstrap.css" type="text/css" /> <!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link rel="stylesheet" href="<?php echo base_url(); ?> /application/views/resources/css/style.css" type="text/css" /> <?php getScripts(); ?> </head>