@@ -141,19 +141,24 @@ basecommit=$(${gitcmd} rev-parse --verify ${baseref})
141141${gitcmd} checkout -q -B ${integrateto} _precheck $baseref
142142
143143# Get information about the branch where the patch is going to be integrated (from version.php).
144- branchline=$( grep " ^\$ branch\s*=\s*'[0-9]\+';" version.php || true)
144+ if [[ -d " public" || -f " public/version.php" ]]; then
145+ branchline=$( grep " ^\$ branch\s*=\s*'[0-9]\+';" public/version.php || true)
146+ else
147+ branchline=$( grep " ^\$ branch\s*=\s*'[0-9]\+';" version.php || true)
148+ fi
149+
145150if [[ -z " ${branchline} " ]]; then
146- echo " Error: Unable to find the branch information in version.php." | tee -a ${errorfile}
151+ echo " Error: Unable to find the branch information in version.php or public/version.php ." | tee -a ${errorfile}
147152 exit 1
148153fi
149154# Extract the branch version from the line.
150155if [[ " ${branchline} " =~ \$ branch[[:space:]]+= [[:space:]]+\' ([0-9]+)\'\; ]]; then
151156 versionbranch=${BASH_REMATCH[1]}
152157else
153- echo " Error: Unable to extract the branch version from version.php." | tee -a ${errorfile}
158+ echo " Error: Unable to extract the branch version from version.php or public/version.php ." | tee -a ${errorfile}
154159 exit 1
155160fi
156- echo " Info: The branch ${integrateto} has version.php \$ branch: ${versionbranch} " | tee -a ${errorfile}
161+ echo " Info: The branch ${integrateto} has version.php or public/version.php \$ branch: ${versionbranch} " | tee -a ${errorfile}
157162
158163# Do some cleanup onto the passed details
159164
@@ -319,9 +324,13 @@ if [[ ${versionbranch} -ge 405 ]]; then
319324 fi
320325fi
321326
322- # Add version.php and config-dist.php to patchset files because they
327+ # Add version.php or public/version.php and config-dist.php to patchset files because they
323328# allow us to find moodle dirroot and branch later.
324- echo " ${WORKSPACE} /version.php" >> ${WORKSPACE} /work/patchset.files
329+ if [[ -d " public" || -f " public/version.php" ]]; then
330+ echo " ${WORKSPACE} /public/version.php" >> ${WORKSPACE} /work/patchset.files
331+ else
332+ echo " ${WORKSPACE} /version.php" >> ${WORKSPACE} /work/patchset.files
333+ fi
325334echo " ${WORKSPACE} /config-dist.php" >> ${WORKSPACE} /work/patchset.files
326335
327336# Add linting config files to patchset files to avoid it being deleted for use later..
0 commit comments