コード例 #1
0
ファイル: upgradelib.php プロジェクト: nicusX/moodle
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose) {
    global $CFG;

    raise_memory_limit(MEMORY_EXTRA);

    // upgrade all plugins types
    try {
        $plugintypes = get_plugin_types();
        foreach ($plugintypes as $type=>$location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: JackCanada/moodle-hacks
upgrade_local_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check for changes to RPC functions
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Upgrade all plugins for gradebook
upgrade_plugins('gradeexport', 'grade/export', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
upgrade_plugins('gradeimport', 'grade/import', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
upgrade_plugins('gradereport', 'grade/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all message output plugins and upgrade if necessary
upgrade_plugins('message', 'message/output', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all course report plugins and upgrade if necessary
upgrade_plugins('coursereport', 'course/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all admin report plugins and upgrade if necessary
upgrade_plugins('report', $CFG->admin . '/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
unset($_SESSION['installautopilot']);
/// Set up the blank site - to be customized later at the end of install.
if (!($site = get_site())) {
    // We are about to create the site "course"
    require_once $CFG->libdir . '/blocklib.php';
    $newsite = new object();
    $newsite->fullname = "";
    $newsite->shortname = "";
    $newsite->summary = NULL;
    $newsite->newsitems = 3;
    $newsite->numsections = 0;
    $newsite->category = 0;
    $newsite->format = 'site';
コード例 #3
0
ファイル: upgradelib.php プロジェクト: ajv/Offline-Caching
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose)
{
    global $CFG;
    // upgrade all plugins types
    try {
        $plugintypes = get_plugin_types();
        foreach ($plugintypes as $type => $location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
    // Check for changes to RPC functions
    if ($CFG->mnet_dispatcher_mode != 'off') {
        try {
            // this needs a full rewrite, sorry to mention that :-(
            // we have to make it part of standard WS framework
            require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
            upgrade_RPC_functions();
            // Return here afterwards
        } catch (Exception $ex) {
            upgrade_handle_exception($ex);
        }
    }
}
コード例 #4
0
ファイル: index.php プロジェクト: veritech/pare-project
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/blocklib.php";
upgrade_blocks_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check all blocks and load (or upgrade them if necessary)
/// first old *.php update and then the new upgrade.php script
upgrade_blocks_plugins("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check all enrolment plugins and upgrade if necessary
/// first old *.php update and then the new upgrade.php script
upgrade_plugins('enrol', 'enrol', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check all auth plugins and upgrade if necessary
upgrade_plugins('auth', 'auth', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all course formats and upgrade if necessary
upgrade_plugins('format', 'course/format', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check for local database customisations
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/locallib.php";
upgrade_local_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check for changes to RPC functions
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
unset($_SESSION['installautopilot']);
/// Set up the blank site - to be customized later at the end of install.
if (!($site = get_site())) {
    // We are about to create the site "course"
コード例 #5
0
ファイル: index.php プロジェクト: nicolasconnault/moodle2.0
    }
} else {
    if ($version < $CFG->version) {
        notify("WARNING!!!  The code you are using is OLDER than the version that made these databases!");
    }
}
/// Updated human-readable release version if necessary
if ($release != $CFG->release) {
    // Update the release version
    set_config("release", $release);
}
/// upgrade all plugins types
try {
    $plugintypes = get_plugin_types();
    foreach ($plugintypes as $type => $location) {
        upgrade_plugins($type, $location, 'print_upgrade_part_start', 'print_upgrade_part_end');
    }
} catch (Exception $ex) {
    upgrade_handle_exception($ex);
}
/// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
    try {
        // this needs a full rewrite, sorry to mention that :-(
        require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
        upgrade_RPC_functions();
        // Return here afterwards
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
}
コード例 #6
0
ファイル: upgradelib.php プロジェクト: dg711/moodle
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose)
{
    global $CFG;
    raise_memory_limit(MEMORY_EXTRA);
    // upgrade all plugins types
    try {
        // Reset caches before any output.
        cache_helper::purge_all(true);
        purge_all_caches();
        $plugintypes = core_component::get_plugin_types();
        foreach ($plugintypes as $type => $location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
        // Upgrade services.
        // This function gives plugins and subsystems a chance to add functions to existing built-in services.
        external_update_services();
        // Update cache definitions. Involves scanning each plugin for any changes.
        cache_helper::update_definitions();
        // Mark the site as upgraded.
        set_config('allversionshash', core_component::get_all_versions_hash());
        // Purge caches again, just to be sure we arn't holding onto old stuff now.
        cache_helper::purge_all(true);
        purge_all_caches();
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    } catch (Throwable $ex) {
        // Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5).
        upgrade_handle_exception($ex);
    }
}
コード例 #7
0
 /**
  * Adds and upgrades the selected plugins
  *
  * @param array $ingredients
  * @param string $path Path to the ingredient type file system
  * @param SimpleXMLElement $xml
  * @return array Problems during the ingredients deployment
  */
 public function deploy_ingredients($ingredients, $path, SimpleXMLElement $xml)
 {
     // Using the $ingredients array keys to maintain coherence with the main deployment method
     $problems = array();
     $pluginman = plugin_manager::instance();
     $plugintypespaths = get_plugin_types();
     $this->get_flavour_info($xml);
     foreach ($ingredients as $selection) {
         // [0] => ingredienttype, [1] => ingredientname
         $ingredientdata = explode('/', $selection);
         $type = $ingredientdata[0];
         $ingredient = $ingredientdata[1];
         if (empty($this->branches[$type]->branches[$ingredient])) {
             $problems[$selection]['pluginnotfound'] = $selection;
             continue;
         }
         $ingredientdata = $this->branches[$type]->branches[$ingredient];
         // Adapter to the restrictions array
         if (!empty($ingredientdata->restrictions)) {
             $problems[$selection] = $ingredientdata->restrictions;
             continue;
         }
         if (empty($xml->{$type}) || empty($xml->{$type}->{$ingredient})) {
             $problems[$selection]['pluginnotfound'] = $selection;
             continue;
         }
         // Deploy then
         $ingredientpath = $plugintypespaths[$type] . '/' . $ingredient;
         // Remove old dir if present
         if (file_exists($ingredientpath)) {
             // Report if the old plugin directory can't be removed
             if (!$this->unlink($ingredientpath)) {
                 $problems[$selection]['plugincantremove'] = $selection;
                 continue;
             }
         }
         // Copy the new contents where the flavour says
         $tmppath = $path . '/' . $xml->{$type}->{$ingredient}->path;
         if (!$this->copy($tmppath, $ingredientpath)) {
             debugging('From : ' . $tmppath . ' To: ' . $ingredientpath);
             $problems[$selection]['plugincopyerror'] = $selection;
         }
     }
     // Execute the moodle upgrade process
     try {
         foreach ($plugintypespaths as $type => $location) {
             upgrade_plugins($type, 'flavours_print_upgrade_void', 'flavours_print_upgrade_void', false);
         }
     } catch (Exception $ex) {
         abort_all_db_transactions();
         $info = get_exception_info($ex);
         upgrade_log(UPGRADE_LOG_ERROR, $ex->module, 'Exception: ' . get_class($ex), $info->message, $info->backtrace);
     }
     return $problems;
 }
コード例 #8
0
ファイル: upgradelib.php プロジェクト: vinoth4891/clinique
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose)
{
    global $CFG;
    raise_memory_limit(MEMORY_EXTRA);
    // upgrade all plugins types
    try {
        // Disable the use of cache stores here. We will reset the factory after we've performed the installation.
        // This ensures that we don't permanently cache anything during installation.
        cache_factory::disable_stores();
        $plugintypes = get_plugin_types();
        foreach ($plugintypes as $type => $location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
        // Update cache definitions. Involves scanning each plugin for any changes.
        cache_helper::update_definitions();
        // Reset the cache system to a normal state.
        cache_factory::reset();
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
}
コード例 #9
0
xmldb_main_install($version);
/// Continue with the instalation
// Install the roles system.
moodle_install_roles();
// Install core event handlers
events_update_definition();
// Install core message providers
message_update_providers();
message_update_providers('message');
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
admin_apply_default_settings(NULL, true);
/// upgrade all plugins types
$upgradedplugins = false;
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
    $upgradedplugins = upgrade_plugins($type, $location) || $upgradedplugins;
}
/// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
    require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
    upgrade_RPC_functions($return_url);
    // Return here afterwards
}
/// Check for local database customisations
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/locallib.php";
upgrade_local_db($return_url);
// Return here afterwards
/// just make sure upgrade logging is properly terminated
upgrade_finished();
/// make sure admin user is created - this is the last step because we need
コード例 #10
0
ファイル: test_tables.php プロジェクト: ajv/Offline-Caching
$DB->get_manager()->install_from_xmldb_file("{$CFG->libdir}/db/install.xml");
/// set all core default records and default settings
require_once "{$CFG->libdir}/db/install.php";
xmldb_main_install($version);
/// Continue with the instalation
// Install the roles system.
moodle_install_roles();
// Install core event handlers
events_update_definition();
// Install core message providers
message_update_providers();
message_update_providers('message');
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
admin_apply_default_settings(NULL, true);
/// upgrade all plugins types
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
    upgrade_plugins($type);
}
/// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
    require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
    upgrade_RPC_functions($return_url);
    // Return here afterwards
}
/// just make sure upgrade logging is properly terminated
upgrade_finished();
/// make sure admin user is created - this is the last step because we need
/// session to be working properly in order to edit admin account
create_admin_user();
redirect('index.php');
コード例 #11
0
ファイル: index.php プロジェクト: hotarucms/hotarucms
     setcookie("hotaru_key", "", time() - 3600, "/");
     // remove cookies from whole domain just in case of 1.4.2 cookies issue
     $parsed = parse_url(BASEURL);
     setcookie("hotaru_user", "", time() - 3600, "/", "." . $parsed['host']);
     setcookie("hotaru_key", "", time() - 3600, "/", "." . $parsed['host']);
     if ($action == 'upgrade') {
         upgrade_step_3($h);
     } else {
         //$db = init_database();
         register_admin($h);
         // Username and password for Admin user...
     }
     break;
 case 4:
     if ($action == 'upgrade') {
         upgrade_plugins($h);
     } else {
         installation_complete($h);
         // Delete "install" folder. Visit your site"
     }
     break;
 case 90:
     template($h, 'help.php');
     break;
 case 99:
     $dbuser_name = $h->cage->get->testAlnumLines('dbuser_name');
     $dbpassword_name = $h->cage->get->KeyExists('dbpassword_name');
     $dbname_name = $h->cage->get->testAlnumLines('dbname_name');
     $dbhost_name = $h->cage->get->testAlnumLines('dbhost_name');
     if (!$settings_file_exists) {
         $db = new ezSQL_mysql($dbuser_name, $dbpassword_name, $dbname_name, $dbhost_name);
コード例 #12
0
 // Don't return anywhere
 if ($verbose > CLI_NO) {
     print_heading(get_string('upgradinggradeimportplugin', 'install'), '', 1);
 }
 upgrade_plugins('gradeimport', 'grade/import', '');
 // Don't return anywhere
 if ($verbose > CLI_NO) {
     print_heading(get_string('upgradinggradereportplugin', 'install'), '', 1);
 }
 upgrade_plugins('gradereport', 'grade/report', '');
 // Don't return anywhere
 /// Check all message output plugins and upgrade if necessary
 if ($verbose > CLI_NO) {
     print_heading(get_string('upgradingmessageoutputpluggin', 'install'), '', 1);
 }
 upgrade_plugins('message', 'message/output', '');
 // Don't return anywhere
 /// just make sure upgrade logging is properly terminated
 upgrade_finished();
 /// Set up the site
 if (!($site = get_site())) {
     // We are about to create the site "course"
     if ($interactive == CLI_FULL || $interactive == CLI_SEMI && (!isset($INSTALL['sitefullname']) || !isset($INSTALL['siteshortname']) || !isset($INSTALL['sitesummary']) || !isset($INSTALL['sitenewsitems']))) {
         console_write('siteinfo');
         print_newline();
     }
     if ($interactive == CLI_FULL || $interactive == CLI_SEMI && !isset($INSTALL['sitefullname'])) {
         console_write('sitefullname');
         $sitefullname = read();
     } else {
         if (isset($INSTALL['sitefullname'])) {
コード例 #13
0
ファイル: upgradelib.php プロジェクト: Burick/moodle
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose) {
    global $CFG;

    raise_memory_limit(MEMORY_EXTRA);

    // upgrade all plugins types
    try {
        // Disable the use of cache stores here.
        // We don't reset this, the site can live without proper caching for life of this request.
        cache_factory::disable_stores();

        $plugintypes = get_plugin_types();
        foreach ($plugintypes as $type=>$location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
        // Update cache definitions. Involves scanning each plugin for any changes.
        cache_helper::update_definitions();
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
}
コード例 #14
0
ファイル: upgradelib.php プロジェクト: jtibbetts/moodle
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose) {
    global $CFG;

    raise_memory_limit(MEMORY_EXTRA);

    // upgrade all plugins types
    try {
        // Reset caches before any output.
        cache_helper::purge_all(true);
        purge_all_caches();

        $plugintypes = core_component::get_plugin_types();
        foreach ($plugintypes as $type=>$location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
        // Update cache definitions. Involves scanning each plugin for any changes.
        cache_helper::update_definitions();
        // Mark the site as upgraded.
        set_config('allversionshash', core_component::get_all_versions_hash());

        // Purge caches again, just to be sure we arn't holding onto old stuff now.
        cache_helper::purge_all(true);
        purge_all_caches();

    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
}
コード例 #15
0
ファイル: upgradelib.php プロジェクト: Jtgadbois/Pedadida
/**
 * Upgrade/install other parts of moodle
 * @param bool $verbose
 * @return void, may throw exception
 */
function upgrade_noncore($verbose) {
    global $CFG;

    raise_memory_limit(MEMORY_EXTRA);

    // upgrade all plugins types
    try {
        $plugintypes = get_plugin_types();
        foreach ($plugintypes as $type=>$location) {
            upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
        }
        // Update cache definitions. Involves scanning each plugin for any changes.
        cache_helper::update_definitions();
    } catch (Exception $ex) {
        upgrade_handle_exception($ex);
    }
}
コード例 #16
0
ファイル: lib.php プロジェクト: BackupTheBerlios/samouk-svn
/**
 * Executes upgrade scripts for assignment types when necessary
 */
function assignment_upgrade_submodules()
{
    global $CFG;
    /// Install/upgrade assignment types (it uses, simply, the standard plugin architecture)
    upgrade_plugins('assignment_type', 'mod/assignment/type', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
}
コード例 #17
0
upgrade_plugins('format', 'course/format', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check for local database customisations
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/locallib.php";
upgrade_local_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check for changes to RPC functions
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Upgrade all plugins for gradebook
upgrade_plugins('gradeexport', 'grade/export', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
upgrade_plugins('gradeimport', 'grade/import', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
upgrade_plugins('gradereport', 'grade/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all message output plugins and upgrade if necessary
upgrade_plugins('message', 'message/output', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
unset($_SESSION['installautopilot']);
/// Set up the blank site - to be customized later at the end of install.
if (!($site = get_site())) {
    // We are about to create the site "course"
    require_once $CFG->libdir . '/blocklib.php';
    $newsite = new object();
    $newsite->fullname = "";
    $newsite->shortname = "";
    $newsite->summary = NULL;
    $newsite->newsitems = 3;
    $newsite->numsections = 0;
    $newsite->category = 0;
    $newsite->format = 'site';