Skip to content

Instantly share code, notes, and snippets.

View andrewnicols's full-sized avatar

Andrew Lyons andrewnicols

  • Moodle Pty Ltd
  • Perth, Australia
View GitHub Profile
<?php
define('CLI_SCRIPT', true);
require_once('config.php');
$cmid = 16;
$users = [
11,
];

Folks, I didn't get a chance to finish this review. I've got some notes here, and I have a proposed (100% untested) branch at https://github.com/andrewnicols/moodle/commit/MDL-45910-master

Hi Nejc,

Thank you for working on this issue. I realise that i's quite a complex one and has been sitting for some time without much love. We appreciate your time and effort in looking into it.

On the whole the patch looks okay, but I can see that there are some cases which may be missed and will cause errors to be thrown. I also feel that there is a lot of duplication in this function which could easily be removed with a minor refactor and introduction of a new protected or private function to perform the rotation (e.g. {{rotate_image_by_angle}} taking {{string $source, int $angle, int $width, int $height}} and returning an array containing the final width, height, and image data).

I'd suggest that rather than checking a range for {{$exif['Orientation'] > 0 < 9}}, that you instead use something like {{array_key_exis

s2021-04-19 04:38:17.124+0000 [id=1032] WARNING hudson.model.RunMap#retrieve: could not load /var/jenkins_home/jobs/MAINT - AUTO - Set build description to failure causes/builds/7345
java.nio.channels.ClosedByInterruptException
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:164)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at java.io.FilterInputStream.read(FilterInputStream.java:83)
============================================================================
= Summary of entries.
============================================================================
= Classes: 12
= Horses: 292
= Unique Riders: 200
= Total entries (excluding scratchings): 491
============================================================================
#!/bin/bash
grep 'moodle-browser-config' config.php > /dev/null
if [ $? -ne 0 ]
then
echo Adding browsers
gsed -i '/^\$CFG->wwwroot.*=.*$/ a require_once(dirname(dirname(__DIR__)) . "\/moodle-browser-config/init.php");' config.php
else
echo Behat browser defitions already there
fi
<?php
namespace core_files;
abstract class archive_writer {
public static function get_stream_writer(string $filename, string $type, ?archive_options $options = null): self {
$classname = self::get_classname_for_type($type);
return $classname::stream_instance($filename, $options);
<?php
class core_dml_testcase extends database_driver_testcase {
/**
* Test the database instrumentation as SQL comment.
*/
public function test_instrument_sql() {
global $CFG;
require_once($CFG->dirroot . '/lib/tests/fixtures/test_dml_instrumentation_fixture.php');
$fixture = new \core\test_dml_instrumentation_fixture($this);
intro:
thankyou: Thank you for choosing Moodle!
webelieve: We believe that software, especially educational tools, should always be open and free. We rely on our community to support and help us to continuously improve our LMS.
supportthework: Support the work of our developers by making a <a href="{{{campaign.link}}}" target="_blank">donation</a>.
alttext: Donation banner
<?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,
// 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