public function is_ready() {
        if (empty($this->pathtopython)) {
            $settingurl = new \moodle_url('/admin/settings.php', array('section' => 'systempaths'));
            return get_string('pythonpathnotdefined', 'mlbackend_python', $settingurl->out());
        }

        // Check the installed pip package version.
        $cmd = "{$this->pathtopython} -m moodlemlbackend.version";

        $output = null;
        $exitcode = null;
        // Execute it sending the standard error to $output.
        $result = exec($cmd . ' 2>&1', $output, $exitcode);

        $vercheck = self::check_pip_package_version($result);

        if ($vercheck === 0) {
            return true;
        }

        if ($exitcode != 0) {
            return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
        }

        if ($result) {
            $a = [
                'installed' => $result,
                'required' => self::REQUIRED_PIP_PACKAGE_VERSION,
            ];

            if ($vercheck < 0) {
                return get_string('packageinstalledshouldbe', 'mlbackend_python', $a);

            } else if ($vercheck > 0) {
                return get_string('packageinstalledtoohigh', 'mlbackend_python', $a);
            }
        }

        return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
    }
public function is_ready() {
        if (empty($this->pathtopython)) {
            $settingurl = new \moodle_url('/admin/settings.php', array('section' => 'systempaths'));
            return get_string('pythonpathnotdefined', 'mlbackend_python', $settingurl->out());
        }

        // Check the installed pip package version.
        $cmd = "{$this->pathtopython} -m moodlemlbackend.version";

        $output = null;
        $exitcode = null;
        // Execute it sending the standard error to $output.
        $result = exec($cmd . ' 2>&1', $output, $exitcode);

        $vercheck = self::check_pip_package_version($result);

        if ($vercheck === 0) {
            return true;
        }

        if ($exitcode != 0) {
            return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
        }

        if ($result) {
            $a = [
                'installed' => $result,
                'required' => self::REQUIRED_PIP_PACKAGE_VERSION,
            ];

            if ($vercheck < 0) {
                return get_string('packageinstalledshouldbe', 'mlbackend_python', $a);

            } else if ($vercheck > 0) {
                return get_string('packageinstalledtoohigh', 'mlbackend_python', $a);
            }
        }

        return get_string('pythonpackagenotinstalled', 'mlbackend_python', $cmd);
    }
public function is_ready ( ) { if ( empty ( $ this -> pathtopython ) ) { $ settingurl = new \ moodle_url ( '/admin/settings.php' , array ( 'section' => 'systempaths' ) ) ; return get_string ( 'pythonpathnotdefined' , 'mlbackend_python' , $ settingurl -> out ( ) ) ; } // Check the installed pip package version. $ cmd = "{$this->pathtopython} -m moodlemlbackend.version" ; $ output = null ; $ exitcode = null ; // Execute it sending the standard error to $output. $ result = exec ( $ cmd . ' 2>&1' , $ output , $ exitcode ) ; $ vercheck = self :: check_pip_package_version ( $ result ) ; if ( $ vercheck === 0 ) { return true ; } if ( $ exitcode != 0 ) { return get_string ( 'pythonpackagenotinstalled' , 'mlbackend_python' , $ cmd ) ; } if ( $ result ) { $ a = [ 'installed' => $ result , 'required' => self :: REQUIRED_PIP_PACKAGE_VERSION , ] ; if ( $ vercheck < 0 ) { return get_string ( 'packageinstalledshouldbe' , 'mlbackend_python' , $ a ) ; } else if ( $ vercheck > 0 ) { return get_string ( 'packageinstalledtoohigh' , 'mlbackend_python' , $ a ) ; } } return get_string ( 'pythonpackagenotinstalled' , 'mlbackend_python' , $ cmd ) ; }
Is the plugin ready to be used?.

@return bool|string Returns true on success, a string detailing the error otherwise
Is the plugin ready to be used? .