diff --git a/admin/cli/install.php b/admin/cli/install.php index 3378948d7c3..0631be1c869 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -70,6 +70,8 @@ Options: problem encountered. --agree-license Indicates agreement with software license, required in non-interactive mode. +--allow-unstable Install even if the version is not marked as stable yet, + required in non-interactive mode. -h, --help Print out this help Example: @@ -136,9 +138,6 @@ $CFG->early_install_lang = true; $parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__)))); $CFG->admin = array_pop($parts); -require($CFG->dirroot.'/version.php'); -$CFG->target_release = $release; - //point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else //the problem is that we need specific version of quickforms and hacked excel files :-( ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path')); @@ -154,6 +153,9 @@ require_once($CFG->libdir.'/deprecatedlib.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/componentlib.class.php'); +require($CFG->dirroot.'/version.php'); +$CFG->target_release = $release; + //Database types $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), 'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'), @@ -193,6 +195,7 @@ list($options, $unrecognized) = cli_get_params( 'adminpass' => '', 'non-interactive' => false, 'agree-license' => false, + 'allow-unstable' => false, 'help' => false ), array( @@ -402,6 +405,27 @@ $CFG->langotherroot = $CFG->dataroot.'/lang'; $CFG->langlocalroot = $CFG->dataroot.'/lang'; get_string_manager(true); +// make sure we are installing stable release or require a confirmation +if (isset($maturity)) { + if (($maturity < MATURITY_STABLE) and !$options['allow-unstable']) { + $maturitylevel = get_string('maturity'.$maturity, 'admin'); + + if ($interactive) { + cli_separator(); + cli_heading(get_string('notice')); + echo get_string('maturitycorewarning', 'admin', $maturitylevel) . PHP_EOL; + echo get_string('continue') . PHP_LOL; + $prompt = get_string('cliyesnoprompt', 'admin'); + $input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin'))); + if ($input == get_string('clianswerno', 'admin')) { + exit(1); + } + } else { + cli_error(get_string('maturitycorewarning', 'admin')); + } + } +} + // ask for db type - show only drivers available if ($interactive) { $options['dbtype'] = strtolower($options['dbtype']); diff --git a/admin/cli/upgrade.php b/admin/cli/upgrade.php index 142f2d30514..0057426d39e 100644 --- a/admin/cli/upgrade.php +++ b/admin/cli/upgrade.php @@ -40,8 +40,16 @@ require_once($CFG->libdir.'/environmentlib.php'); // now get cli options -list($options, $unrecognized) = cli_get_params(array('non-interactive'=>false, 'help'=>false), - array('h'=>'help')); +list($options, $unrecognized) = cli_get_params( + array( + 'non-interactive' => false, + 'allow-unstable' => false, + 'help' => false + ), + array( + 'h' => 'help' + ) +); $interactive = empty($options['non-interactive']); @@ -59,6 +67,8 @@ Site defaults may be changed via local/defaults.php. Options: --non-interactive No interactive questions or confirmations +--allow-unstable Upgrade even if the version is not marked as stable yet, + required in non-interactive mode. -h, --help Print out this help Example: @@ -73,7 +83,7 @@ if (empty($CFG->version)) { cli_error(get_string('missingconfigversion', 'debug')); } -require("$CFG->dirroot/version.php"); // defines $version and $release +require("$CFG->dirroot/version.php"); // defines $version, $release and $maturity $CFG->target_release = $release; // used during installation and upgrades if ($version < $CFG->version) { @@ -93,6 +103,22 @@ if (!check_moodle_environment($version, $environment_results, false, ENV_SELECT_ exit(1); } +// make sure we are upgrading to a stable release or display a warning +if (isset($maturity)) { + if (($maturity < MATURITY_STABLE) and !$options['allow-unstable']) { + $maturitylevel = get_string('maturity'.$maturity, 'admin'); + + if ($interactive) { + cli_separator(); + cli_heading(get_string('notice')); + echo get_string('maturitycorewarning', 'admin', $maturitylevel) . PHP_EOL; + cli_separator(); + } else { + cli_error(get_string('maturitycorewarning', 'admin', $maturitylevel)); + } + } +} + if ($interactive) { echo html_to_text(get_string('upgradesure', 'admin', $newversion))."\n"; $prompt = get_string('cliyesnoprompt', 'admin'); diff --git a/admin/index.php b/admin/index.php index 14b6f243321..09f79472d30 100644 --- a/admin/index.php +++ b/admin/index.php @@ -86,7 +86,7 @@ if (!isset($CFG->version)) { $version = null; $release = null; -require("$CFG->dirroot/version.php"); // defines $version and $release +require("$CFG->dirroot/version.php"); // defines $version, $release and $maturity $CFG->target_release = $release; // used during installation and upgrades if (!$version or !$release) { @@ -135,9 +135,18 @@ if (!core_tables_exist()) { $PAGE->set_cacheable(false); echo $OUTPUT->header(); echo $OUTPUT->heading("Moodle $release"); + + if (isset($maturity)) { + // main version.php declares moodle code maturity + if ($maturity < MATURITY_STABLE) { + $maturitylevel = get_string('maturity'.$maturity, 'admin'); + echo $OUTPUT->box(get_string('maturitycorewarning', 'admin', $maturitylevel), 'generalbox maturitywarning'); + } + } + $releasenoteslink = get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'); $releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink); // extremely ugly validation hack - echo $OUTPUT->box($releasenoteslink, 'generalbox boxaligncenter boxwidthwide'); + echo $OUTPUT->box($releasenoteslink, 'generalbox releasenoteslink'); require_once($CFG->libdir.'/environmentlib.php'); if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) { @@ -194,6 +203,13 @@ if ($version > $CFG->version) { // upgrade $PAGE->set_heading($stradministration); $PAGE->set_cacheable(false); echo $OUTPUT->header(); + if (isset($maturity)) { + // main version.php declares moodle code maturity + if ($maturity < MATURITY_STABLE) { + $maturitylevel = get_string('maturity'.$maturity, 'admin'); + echo $OUTPUT->box(get_string('maturitycorewarning', 'admin', $maturitylevel), 'generalbox maturitywarning'); + } + } $continueurl = new moodle_url('index.php', array('confirmupgrade' => 1)); $cancelurl = new moodle_url('index.php'); echo $OUTPUT->confirm(get_string('upgradesure', 'admin', $a->newversion), $continueurl, $cancelurl); diff --git a/lang/en/admin.php b/lang/en/admin.php index d11e5ff52d9..178c85c3d24 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -680,6 +680,13 @@ $string['maintinprogress'] = 'Maintenance is in progress...'; $string['managelang'] = 'Manage'; $string['managelicenses'] = 'Manage licences'; $string['manageqtypes'] = 'Manage question types'; +$string['maturity50'] = 'Alpha'; +$string['maturity100'] = 'Beta'; +$string['maturity150'] = 'Release candidate'; +$string['maturity200'] = 'Stable version'; +$string['maturitycorewarning'] = 'You are going to install or upgrade Moodle to a version marked as "{$a}" +that is not considered as production-ready yet. Please make sure this is intentional +and that you are using correct checkout of Moodle source code.'; $string['maxbytes'] = 'Maximum uploaded file size'; $string['maxconsecutiveidentchars'] = 'Consecutive identical characters'; $string['maxeditingtime'] = 'Maximum time to edit posts'; diff --git a/lib/setuplib.php b/lib/setuplib.php index 12c543d6528..c4b07ee06d1 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -53,6 +53,14 @@ define('MEMORY_EXTRA', -3); /** Extremely large memory limit - not recommended for standard scripts */ define('MEMORY_HUGE', -4); +/** + * Software maturity levels used by the core and plugins + */ +define('MATURITY_ALPHA', 50); // internals can be tested using white box techniques +define('MATURITY_BETA', 100); // feature complete, ready for preview and testing +define('MATURITY_RC', 150); // tested, will be released unless there are fatal bugs +define('MATURITY_STABLE', 200); // ready for production deployment + /** * Simple class. It is usually used instead of stdClass because it looks * more familiar to Java developers ;-) Do not use for type checking of diff --git a/theme/standard/style/admin.css b/theme/standard/style/admin.css index 36b5694eb60..7beb53b6c84 100644 --- a/theme/standard/style/admin.css +++ b/theme/standard/style/admin.css @@ -23,6 +23,9 @@ #page-admin-index .adminerror, #page-admin-index .adminwarning {margin:20px;} +#page-admin-index .maturitywarning {margin-left:auto;margin-right:auto;text-align:center;width:60%;background-color:#ffd3d9;} +#page-admin-index .releasenoteslink {margin-left:auto;margin-right:auto;text-align:center;width:60%;} + #page-admin-enrol .enrolplugintable {width:700px;margin:1em auto;} #page-admin-report-capability-index #settingsform h2, @@ -144,4 +147,4 @@ table.flexible .r1 {background-color: #FAFAFA;} */ #page-admin-webservice-service_users .missingcaps {color: #ff6600;font-size: 90%;} #page-admin-setting-webservicetokens .missingcaps {color: #ff6600;font-size: 90%;} -#page-admin-webservice-service_functions .functiondesc {font-size: 90%;} \ No newline at end of file +#page-admin-webservice-service_functions .functiondesc {font-size: 90%;} diff --git a/version.php b/version.php index 67c36bab5b7..cf98cffa610 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,10 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2011030300.00; // YYYYMMDD = date of the last version bump - // XX = daily increments -$release = '2.0.2+ (Build: 20110303)'; // Human-friendly version name +$version = 2011030300.00; // YYYYMMDD = date of the last version bump + // XX = daily increments + +$release = '2.0.2+ (Build: 20110303)'; // Human-friendly version name + +$maturity = MATURITY_STABLE; // this version's maturity level