Skip to content

Commit

Permalink
MDL-50887 antivirus_clamav: Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin committed Feb 25, 2016
1 parent 146eeb7 commit 89a5878
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/antivirus/clamav/db/upgrade.php
@@ -0,0 +1,36 @@
<?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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* ClamAV antivirus plugin upgrade script.
*
* @package core
* @subpackage antivirus_clamav
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* Run all ClamAV plugin upgrade steps between the current DB version and the current version on disk.
*
* @param int $oldversion The old version of atto in the DB.
* @return bool
*/
function xmldb_antivirus_clamav_upgrade($oldversion) {
return true;
}
26 changes: 26 additions & 0 deletions lib/antivirus/clamav/lang/en/antivirus_clamav.php
@@ -0,0 +1,26 @@
<?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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Strings for component 'antivirus_clamav', language 'en'.
*
* @package core
* @subpackage antivirus_clamav
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['pluginname'] = 'ClamAV antivirus';
34 changes: 34 additions & 0 deletions lib/antivirus/clamav/lib.php
@@ -0,0 +1,34 @@
<?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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* ClamAV antivirus integration.
*
* @package core
* @subpackage antivirus_clamav
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

/**
* Class implemeting ClamAV antivirus.
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class antivirus_clamav extends antivirus {
}
38 changes: 38 additions & 0 deletions lib/antivirus/clamav/settings.php
@@ -0,0 +1,38 @@
<?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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* ClamAV admin settings.
*
* @package core
* @subpackage antivirus_clamav
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('antivirus_clamav/runclamonupload',
new lang_string('runclamavonupload', 'admin'), new lang_string('configrunclamavonupload', 'admin'), 0));
$settings->add(new admin_setting_configexecutable('antivirus_clamav/pathtoclam',
new lang_string('pathtoclam', 'admin'), new lang_string('configpathtoclam', 'admin'), ''));
$settings->add(new admin_setting_configdirectory('antivirus_clamav/quarantinedir',
new lang_string('quarantinedir', 'admin'), new lang_string('configquarantinedir', 'admin'), ''));
$options = array('donothing' => new lang_string('configclamdonothing', 'admin'),'actlikevirus' => new lang_string('configclamactlikevirus', 'admin'));
$settings->add(new admin_setting_configselect('antivirus_clamav/clamfailureonupload',
new lang_string('clamfailureonupload', 'admin'), new lang_string('configclamfailureonupload', 'admin'), 'donothing', $options));
}
30 changes: 30 additions & 0 deletions lib/antivirus/clamav/version.php
@@ -0,0 +1,30 @@
<?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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* ClamAV antivirus version file.
*
* @package core
* @subpackage antivirus_clamav
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

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

$plugin->version = 2015062500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2015061800; // Requires this Moodle version.
$plugin->component = 'antivirus_clamav'; // Full name of the plugin (used for diagnostics).

0 comments on commit 89a5878

Please sign in to comment.