__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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/>.

/**
 * Running tasks table.
 *
 * @package    tool_task
 * @copyright  2019 The Open University
 * @copyright  2020 Mikhail Golenkov <golenkovm@gmail.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

namespace tool_task;

defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/tablelib.php');
use core\task\manager;

/**
 * Table to display list of running task.
 *
 * @copyright  2019 The Open University
 * @copyright  2020 Mikhail Golenkov <golenkovm@gmail.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class running_tasks_table extends \table_sql {

    /**
     * Constructor for the running tasks table.
     */
    public function __construct() {
        parent::__construct('runningtasks');

        $columnheaders = [
            'classname'    => get_string('classname', 'tool_task'),
            'type'         => get_string('tasktype', 'admin'),
            'time'         => get_string('taskage', 'tool_task'),
            'progress'     => get_string('progress', 'core'),
            'timestarted'  => get_string('started', 'tool_task'),
            'hostname'     => get_string('hostname', 'tool_task'),
            'pid'          => get_string('pid', 'tool_task'),
        ];
        $this->define_columns(array_keys($columnheaders));
        $this->define_headers(array_values($columnheaders));

        // The name column is a header.
        $this->define_header_column('classname');

        // This table is not collapsible.
        $this->collapsible(false);

        // Allow pagination.
        $this->pageable(true);
    }

    /**
     * Query the db. Store results in the table object for use by build_table.
     *
     * @param int $pagesize size of page for paginated displayed table.
     * @param bool $useinitialsbar do you want to use the initials bar. Bar
     * will only be used if there is a fullname column defined for the table.
     * @throws \dml_exception
     */
    public function query_db($pagesize, $useinitialsbar = true) {
        $sort = $this->get_sql_sort();
        $this->rawdata = \core\task\manager::get_running_tasks($sort);
    }

    /**
     * Format the classname cell.
     *
     * @param   \stdClass $row
     * @return  string
     */
    public function col_classname($row): string {
        $output = $row->classname;
        if ($row->type == 'scheduled') {
            if (class_exists($row->classname)) {
                $task = new $row->classname;
                if ($task instanceof \core\task\scheduled_task) {
                    $output .= \html_writer::tag('div', $task->get_name(), ['class' => 'task-class']);
                }
            }
        } else if ($row->type == 'adhoc') {
            $output .= \html_writer::tag('div',
                get_string('adhoctaskid', 'tool_task', $row->id), ['class' => 'task-class']);
        }
        return $output;
    }

    /**
     * Format the type cell.
     *
     * @param   \stdClass $row
     * @return  string
     * @throws  \coding_exception
     */
    public function col_type($row): string {
        if ($row->type == 'scheduled') {
            $output = \html_writer::span(get_string('scheduled', 'tool_task'), 'badge bg-primary text-white');
        } else if ($row->type == 'adhoc') {
            $output = \html_writer::span(get_string('adhoc', 'tool_task'), 'badge bg-dark text-white');
        } else {
            // This shouldn't ever happen.
            $output = '';
        }
        return $output;
    }

    /**
     * Format the time cell.
     *
     * @param   \stdClass $row
     * @return  string
     */
    public function col_time($row): string {
        global $OUTPUT;

        $taskmethod = "{$row->type}_task_from_record";
        $task = manager::$taskmethod($row);

        $result = $task->get_runtime_result();
        $extra = '';
        if ($result->get_status() != $result::OK) {
            $extra = '<br>';
            $extra .= $OUTPUT->check_result($result);
            $extra .= ' ';
            $extra .= $result->get_details();
        }

        return format_time($row->time) . $extra;
    }

    /**
     * Format the timestarted cell.
     *
     * @param   \stdClass $row
     * @return  string
     */
    public function col_timestarted($row): string {
        return userdate($row->timestarted);
    }

    /**
     * Format the progress column.
     *
     * @param \stdClass $row
     * @return string
     */
    public function col_progress($row): string {
        // Check to see if there is a stored progress record for this task.
        if ($row->type === 'adhoc') {
            $idnumber = \core\output\stored_progress_bar::convert_to_idnumber($row->classname, $row->id);
        } else {
            $idnumber = \core\output\stored_progress_bar::convert_to_idnumber($row->classname);
        }

        $bar = \core\output\stored_progress_bar::get_by_idnumber($idnumber);
        if ($bar) {
            return $bar->get_content();
        } else {
            return '-';
        }
    }

}

Filemanager

Name Type Size Permission Actions
check Folder 0777
privacy Folder 0777
edit_scheduled_task_form.php File 6.54 KB 0777
running_tasks_table.php File 5.63 KB 0777
scheduled_checker_task.php File 1.21 KB 0777
Filemanager