Skip to content

Commit

Permalink
Merge pull request #24 from CrymSonir/fix_moodle38
Browse files Browse the repository at this point in the history
Fix Travis script
  • Loading branch information
clementpr authored Oct 29, 2019
2 parents 2c3c645 + 2477069 commit 1009cfb
Show file tree
Hide file tree
Showing 31 changed files with 890 additions and 932 deletions.
71 changes: 42 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
notifications:
email:
on_success: change
on_failure: change
sudo: required

language: php

dist: xenial

services:
- mysql

php:
- "7.2"
node_js:
- "iojs"
- "7"
addons:
postgresql: "9.3"
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
- git clone git://github.com/moodle/moodle ../moodle && cd ../moodle
- sudo apt-get update > /dev/null
- travis_retry composer install
- mv ../moodle-block_admin_presets blocks/admin_presets
- cp config-dist.php config.php
- sh -c "sed -i -e s/'password'/''/ -e s/example.com/localhost/ -e s%192.168.1.250%localhost% -e s%127.0.0.1/moodle%localhost:8000% -e s%/home/example%$HOME% -e 's%\(\$CFG.*bht\)%\n\1%' -e 's%\(\$CFG.*behat_wwwroot.*http://localhost:8000\)%\n\1%' config.php"
- psql -c 'create database moodle;' -U postgres
- sed -i s/\'username\'/\'postgres\'/ config.php
- cat config.php
- mkdir -m777 $HOME/moodledata
- php -S localhost:8000 2> /dev/null > /dev/null &
- npm install -g grunt
- npm install -g grunt-cli
- npm install
- 7.2

env:
global:
- MOODLE_BRANCH=master
- IGNORE_PATHS=amd/build,amd/src/bootstrap.js
- IGNORE_NAMES=*.txt,moodle.css,moodle-rtl.css,moodle_min.css,editor.css,editor_min.css,Gruntfile.js
- DB=mysqli

matrix:
- php: 7.2
env: DB=mysqli TASK=PHPUNIT

cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm

before_install:
- cd ../..
- composer selfupdate
- composer create-project -n --no-dev moodlerooms/moodle-plugin-ci ci ^1
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"

install:
- moodle-plugin-ci install

script:
- grunt gherkinlint
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
- moodle-plugin-ci codechecker
- moodle-plugin-ci csslint
- moodle-plugin-ci jshint
#- moodle-plugin-ci phpunit
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Block to export and import Moodle administration settings

## Build status

[![Build Status](https://travis-ci.org/DigiDago/moodle-block_admin_presets.png)](https://travis-ci.org/DigiDago/moodle-block_admin_presets)
[![Build Status](https://travis-ci.org/DigiDago/moodle-block_admin_presets.svg?branch=master)](https://travis-ci.org/DigiDago/moodle-block_admin_presets)

## Features

Expand Down
44 changes: 23 additions & 21 deletions block_admin_presets.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

class block_admin_presets extends block_list {

/**
Expand Down Expand Up @@ -53,31 +55,31 @@ public function get_content() {
}

$this->content->items[] = $OUTPUT->pix_icon("i/backup",
get_string('actionexport', 'block_admin_presets'),
"moodle", array("class" => "icon")) . '<a title="'.
get_string('actionexport', 'block_admin_presets').
'" href="'.$CFG->wwwroot.'/blocks/admin_presets/index.php?action=export">'.
get_string('actionexport', 'block_admin_presets').
'</a>';
get_string('actionexport', 'block_admin_presets'),
"moodle", array("class" => "icon")) . '<a title="' .
get_string('actionexport', 'block_admin_presets') .
'" href="' . $CFG->wwwroot . '/blocks/admin_presets/index.php?action=export">' .
get_string('actionexport', 'block_admin_presets') .
'</a>';

$this->content->items[] = $OUTPUT->pix_icon("i/restore",
get_string('actionimport', 'block_admin_presets'),
"moodle", array("class" => "icon")).
'<a title="'.get_string('actionimport', 'block_admin_presets').
'" href="'.$CFG->wwwroot.
'/blocks/admin_presets/index.php?action=import">'.
get_string('actionimport', 'block_admin_presets').
'</a>';
get_string('actionimport', 'block_admin_presets'),
"moodle", array("class" => "icon")) .
'<a title="' . get_string('actionimport', 'block_admin_presets') .
'" href="' . $CFG->wwwroot .
'/blocks/admin_presets/index.php?action=import">' .
get_string('actionimport', 'block_admin_presets') .
'</a>';

$this->content->items[] = $OUTPUT->pix_icon("i/repository",
get_string('actionbase', 'block_admin_presets'),
"moodle", array("class" => "icon")).
'<a title="'.
get_string('actionbase', 'block_admin_presets').
'" href="'.
$CFG->wwwroot.
'/blocks/admin_presets/index.php">'
.get_string('actionbase', 'block_admin_presets').'</a>';
get_string('actionbase', 'block_admin_presets'),
"moodle", array("class" => "icon")) .
'<a title="' .
get_string('actionbase', 'block_admin_presets') .
'" href="' .
$CFG->wwwroot .
'/blocks/admin_presets/index.php">'
. get_string('actionbase', 'block_admin_presets') . '</a>';

return $this->content;
}
Expand Down
27 changes: 11 additions & 16 deletions classes/event/preset_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,24 @@

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

class preset_deleted extends \core\event\base
{
class preset_deleted extends \core\event\base {

protected function init()
{
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name()
{
public static function get_name() {
return get_string('eventpresetdeleted', 'block_admin_presets');
}

public function get_description()
{
public function get_description() {
return "User {$this->userid} has deleted the preset with id {$this->objectid}.";
}

public function get_legacy_logdata()
{
public function get_legacy_logdata() {
return array($this->courseid, 'block_admin_presets', 'delete', '',
$this->objectid, $this->contextinstanceid);
$this->objectid, $this->contextinstanceid);
}

protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
14 changes: 7 additions & 7 deletions classes/event/preset_downloaded.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@

class preset_downloaded extends \core\event\base {

protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name() {
return get_string('eventpresetdownloaded', 'block_admin_presets');
}
Expand All @@ -36,6 +30,12 @@ public function get_description() {

public function get_url() {
return new \moodle_url('/blocks/admin_presets/index.php',
array('action' => 'export', 'mode' => 'download_xml', 'id' => $this->objectid, 'sesskey' => sesskey()));
array('action' => 'export', 'mode' => 'download_xml', 'id' => $this->objectid, 'sesskey' => sesskey()));
}

protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
16 changes: 8 additions & 8 deletions classes/event/preset_exported.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@

class preset_exported extends \core\event\base {

protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name() {
return get_string('eventpresetexported', 'block_admin_presets');
}
Expand All @@ -46,11 +40,17 @@ public function get_description() {

public function get_url() {
return new \moodle_url('/blocks/admin_presets/index.php',
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
}

public function get_legacy_logdata() {
return array($this->courseid, 'block_admin_presets', 'export', '',
$this->objectid, $this->contextinstanceid);
$this->objectid, $this->contextinstanceid);
}

protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
33 changes: 14 additions & 19 deletions classes/event/preset_imported.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,29 @@

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

class preset_imported extends \core\event\base
{
class preset_imported extends \core\event\base {

protected function init()
{
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name()
{
public static function get_name() {
return get_string('eventpresetimported', 'block_admin_presets');
}

public function get_description()
{
public function get_description() {
return "User {$this->userid} has imported the preset with id {$this->objectid}.";
}

public function get_url()
{
return new \moodle_url('/blocks/admin_presets/index.php', array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
public function get_url() {
return new \moodle_url('/blocks/admin_presets/index.php',
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
}

public function get_legacy_logdata()
{
public function get_legacy_logdata() {
return array($this->courseid, 'block_admin_presets', 'import', '',
$this->objectid, $this->contextinstanceid);
$this->objectid, $this->contextinstanceid);
}

protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
16 changes: 8 additions & 8 deletions classes/event/preset_loaded.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@

class preset_loaded extends \core\event\base {

protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name() {
return get_string('eventpresetloaded', 'block_admin_presets');
}
Expand All @@ -46,11 +40,17 @@ public function get_description() {

public function get_url() {
return new \moodle_url('/blocks/admin_presets/index.php',
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
}

public function get_legacy_logdata() {
return array($this->courseid, 'block_admin_presets', 'load', '',
$this->objectid, $this->contextinstanceid);
$this->objectid, $this->contextinstanceid);
}

protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
14 changes: 7 additions & 7 deletions classes/event/preset_previewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@

class preset_previewed extends \core\event\base {

protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name() {
return get_string('eventpresetpreviewed', 'block_admin_presets');
}
Expand All @@ -46,6 +40,12 @@ public function get_description() {

public function get_url() {
return new \moodle_url('/blocks/admin_presets/index.php',
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
array('action' => 'load', 'mode' => 'preview', 'id' => $this->objectid));
}

protected function init() {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
27 changes: 11 additions & 16 deletions classes/event/preset_reverted.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,24 @@

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

class preset_reverted extends \core\event\base
{
class preset_reverted extends \core\event\base {

protected function init()
{
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}

public static function get_name()
{
public static function get_name() {
return get_string('eventpresetreverted', 'block_admin_presets');
}

public function get_description()
{
public function get_description() {
return "User {$this->userid} has reverted the preset with id {$this->objectid}.";
}

public function get_legacy_logdata()
{
public function get_legacy_logdata() {
return array($this->courseid, 'block_admin_presets', 'rollback', '',
$this->objectid, $this->contextinstanceid);
$this->objectid, $this->contextinstanceid);
}

protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'block_admin_presets';
}
}
Loading

0 comments on commit 1009cfb

Please sign in to comment.