moosh icon indicating copy to clipboard operation
moosh copied to clipboard

Unable to determine branch version from

Open avidal-embajadur opened this issue 4 years ago • 1 comments

  • moosh version: lastest
  • moodle version: 3.10
    • database: MariaDB
  • php version: 7.4
  • operating system: Centos

Actual behaviour

when running the moosh command: `[root@hostone moosh]# moosh

Fatal error: Uncaught Exception: Unable to determine branch version from '/home/pacificoschool/public_html/version.php' in /home/castillodelrey/public_html/moosh/includes/functions.php:147 Stack trace: #0 /home/castillodelrey/public_html/moosh/moosh.php(74): moosh_moodle_version('/home/pacificos...') #1 {main} thrown in /home/castillodelrey/public_html/moosh/includes/functions.php on line 147 `

Expected behaviour

That the command is recognized in the terminal

Steps to reproduce

  1. install moosh form git on path moodle 3.10
  2. execute command moosh in terminal

avidal-embajadur avatar Apr 03 '21 14:04 avidal-embajadur

Hello. Same problem here, but mosh installed from packages

  • moosh version: lastest
  • moodle version: 3.11
  • database: MySQL 5.7.34-0ubuntu0.18.04.1
  • php version: 7.3.29-1+ubuntu18.04.1+deb.sury.org+1
  • operating system: Ubuntu 18.04

Seems that problems, is , again #343 the regexp used when try to extract moodle version.

A quick fix that I made (to verify, test and etc) :

moosh/includes/functions.php, Line 141

if (preg_match('/^\$branch\s+=\s+\'(\d\d\d)\'.*/', $line, $matches)) {

I had added an additional \d, but i guess a better aproach could be use

^\$branch\s+=\s+\'(\d+)\'.*

changeme avatar Jul 06 '21 15:07 changeme