MDL-23069 moving version and cron info into standard version.php - finally, yay!

This commit is contained in:
Petr Skoda
2010-07-04 12:18:22 +00:00
parent 411b8c238a
commit 8571833f0b
84 changed files with 763 additions and 114 deletions
+16 -4
View File
@@ -126,7 +126,16 @@
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$blockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new object();
$plugin->version = $block->version;
} else {
$plugin = new object();
$plugin->version = '???';
if (file_exists("$CFG->dirroot/blocks/$blockname/version.php")) {
include("$CFG->dirroot/blocks/$blockname/version.php");
}
if (!$blockobject = block_instance($block->name)) {
$incompatible[] = $block;
continue;
@@ -172,14 +181,17 @@
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($blockobject) {
$blockobject->get_version();
if ($block->version == $plugin->version) {
$version = $block->version;
} else {
$version = "$block->version ($plugin->version)";
}
$table->add_data(array(
'<span'.$class.'>'.$strblockname.'</span>',
$blocklist,
'<span'.$class.'>'.$block->version.'</span>',
'<span'.$class.'>'.$version.'</span>',
$visible,
$delete,
$settings
@@ -3,7 +3,6 @@
class block_activity_modules extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_activity_modules');
$this->version = 2007101509;
}
function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -8,7 +8,6 @@ class block_admin_bookmarks extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_admin_bookmarks');
$this->version = 2007101509;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+2 -3
View File
@@ -37,7 +37,6 @@ class block_blog_menu extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_blog_menu');
$this->version = 2009071700;
}
function instance_allow_multiple() {
@@ -57,7 +56,7 @@ class block_blog_menu extends block_base {
}
function get_content() {
// Check if we've already generated content
if (!empty($this->content)) {
return $this->content;
@@ -79,7 +78,7 @@ class block_blog_menu extends block_base {
}
return $this->content;
}
// Iterate the option types
$menulist = array();
foreach ($options as $types) {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009071700;
-1
View File
@@ -37,7 +37,6 @@ class block_blog_recent extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_blog_recent');
$this->content_type = BLOCK_TYPE_TEXT;
$this->version = 2009070900;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009070900;
+2 -1
View File
@@ -1,5 +1,7 @@
<?php
//TODO: fix these sloppy constant names or move them elsewhere!
define('BLOGDEFAULTTIMEWITHIN', 90);
define('BLOGDEFAULTNUMBEROFTAGS', 20);
define('BLOGDEFAULTSORT', 'name');
@@ -8,7 +10,6 @@ require_once($CFG->dirroot .'/blog/lib.php');
class block_blog_tags extends block_base {
function init() {
$this->version = 2007101509;
$this->title = get_string('pluginname', 'block_blog_tags');
}
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -3,7 +3,6 @@
class block_calendar_month extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_calendar_month');
$this->version = 2007101509;
}
function preferred_width() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -3,7 +3,6 @@
class block_calendar_upcoming extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_calendar_upcoming');
$this->version = 2007101509;
}
function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-1
View File
@@ -6,7 +6,6 @@ class block_comments extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_comments');
$this->version = 2009072000;
}
function specialization() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009072000;
+2 -3
View File
@@ -27,7 +27,6 @@
class block_community extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_community');
$this->version = 2010042701;
}
function user_can_addto($page) {
@@ -80,8 +79,8 @@ class block_community extends block_list {
$this->content->icons[] = '';
foreach ($courses as $course) {
//delete link
$deleteicon = html_writer::empty_tag('img',
array('src' => $OUTPUT->pix_url('i/cross_red_small'),
$deleteicon = html_writer::empty_tag('img',
array('src' => $OUTPUT->pix_url('i/cross_red_small'),
'alt' => get_string('removecommunitycourse', 'block_community')));
$deleteurl = new moodle_url($CFG->wwwroot.'/blocks/community/communitycourse.php',
array('remove'=>true, 'communityid'=> $course->id, 'sesskey' => sesskey()));
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2010042701;
@@ -34,7 +34,6 @@ class block_completionstatus extends block_base {
public function init() {
$this->title = get_string('completionstatus', 'block_completionstatus');
$this->version = 2009072800;
}
public function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009072800;
-1
View File
@@ -5,7 +5,6 @@ include_once($CFG->dirroot . '/course/lib.php');
class block_course_list extends block_list {
function init() {
$this->title = get_string('courses');
$this->version = 2007101509;
}
function has_config() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -33,7 +33,6 @@ class block_course_overview extends block_base {
*/
public function init() {
$this->title = get_string('pluginname', 'block_course_overview');
$this->version = 2010021100;
}
/**
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2010021100;
@@ -3,7 +3,6 @@
class block_course_summary extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_course_summary');
$this->version = 2007101509;
}
function specialization() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+6 -7
View File
@@ -8,36 +8,35 @@ class block_feedback extends block_base {
function init() {
$this->title = get_string('feedback', 'block_feedback');
$this->version = 2010050200;
}
function applicable_formats() {
return array('site' => true, 'course' => true);
}
function get_content() {
global $CFG, $OUTPUT;
if ($this->content !== NULL) {
return $this->content;
}
if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
$this->content = new stdClass;
$this->content->text = get_string('missing_feedback_module', 'block_feedback');
$this->content->footer = '';
return $this->content;
}
$courseid = $this->page->course->id;
if ($courseid <= 0) {
$courseid = SITEID;
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
if (empty($this->instance->pageid)) {
$this->instance->pageid = SITEID;
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2010050200;
@@ -6,10 +6,7 @@ define('BGR_NEXTONE', '2');
class block_glossary_random extends block_base {
function init() {
$this->title = get_string('pluginname','block_glossary_random');
$this->version = 2007101509;
}
function specialization() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-1
View File
@@ -27,7 +27,6 @@ class block_html extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_html');
$this->version = 2007101509;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-1
View File
@@ -3,7 +3,6 @@
class block_login extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_login');
$this->version = 2007101509;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-1
View File
@@ -4,7 +4,6 @@ class block_mentees extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_mentees');
$this->version = 2007101509;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+1 -2
View File
@@ -3,7 +3,6 @@
class block_messages extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_messages');
$this->version = 2007101509;
}
function get_content() {
@@ -52,7 +51,7 @@ class block_messages extends block_base {
$link = '/message/discussion.php?id='.$user->id;
$anchortagcontents = '<img class="iconsmall" src="'.$OUTPUT->pix_url('t/message') . '" alt="" />&nbsp;'.$user->count;
$action = new popup_action('click', $link, 'message_'.$user->id);
$anchortag = $OUTPUT->action_link($link, $anchortagcontents, $action);
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-1
View File
@@ -3,7 +3,6 @@
class block_mnet_hosts extends block_list {
function init() {
$this->title = get_string('pluginname','block_mnet_hosts') ;
$this->version = 2007101509;
}
function has_config() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+1 -33
View File
@@ -76,12 +76,6 @@ class block_base {
*/
var $edit_controls = NULL;
/**
* The current version that the block type defines.
* @var string $version
*/
var $version = NULL;
/**
* The initialized instance of this block object.
* @var block $instance
@@ -115,20 +109,12 @@ class block_base {
/// Class Functions
/**
* The class constructor
*
*/
function block_base() {
$this->init();
}
/**
* Fake constructor to keep PHP5 happy
*
*/
function __construct() {
$this->block_base();
$this->init();
}
/**
@@ -300,19 +286,6 @@ class block_base {
return $this->content_type;
}
/**
* Returns the class $version var value.
*
* Intentionally doesn't check if a version is set.
* This is already done in {@link _self_test()}
*
* @return string $this->version
*/
function get_version() {
// Intentionally doesn't check if a version is set. This is already done in _self_test()
return $this->version;
}
/**
* Returns true or false, depending on whether this block has any content to display
* and whether the user has permission to view the block
@@ -444,11 +417,6 @@ class block_base {
$errors[] = 'content_not_set';
$correct = false;
}*/
if ($this->get_version() === NULL) {
$errors[] = 'version_not_set';
$correct = false;
}
$formats = $this->applicable_formats();
if (empty($formats) || array_sum($formats) === 0) {
$errors[] = 'no_formats';
-1
View File
@@ -37,7 +37,6 @@ class block_myprofile extends block_base {
*/
public function init() {
$this->title = get_string('pluginname', 'block_myprofile');
$this->version = 2009123100;
}
/**
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009123100;
-1
View File
@@ -59,7 +59,6 @@ class block_navigation extends block_base {
global $CFG;
$this->blockname = get_class($this);
$this->title = get_string('pluginname', $this->blockname);
$this->version = 2009082800;
}
/**
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009082800;
-1
View File
@@ -3,7 +3,6 @@
class block_news_items extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_news_items');
$this->version = 2007101509;
}
function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+1 -2
View File
@@ -8,7 +8,6 @@
class block_online_users extends block_base {
function init() {
$this->title = get_string('pluginname','block_online_users');
$this->version = 2007101510;
}
function has_config() {return true;}
@@ -80,7 +79,7 @@ class block_online_users extends block_base {
$sql = "SELECT $userfields, MAX(ul.timeaccess) AS lastaccess
FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
JOIN ($esqljoin) euj ON euj.id = u.id
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101510;
@@ -3,7 +3,6 @@
class block_participants extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_participants');
$this->version = 2007101509;
}
function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -31,7 +31,6 @@ class block_private_files extends block_base {
function init() {
$this->title = get_string('areauserpersonal', 'repository');
$this->version = 2010030100;
}
function specialization() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2010030100;
@@ -10,7 +10,6 @@ define('B_QUIZRESULTS_GRADE_FORMAT_ABS', 3);
class block_quiz_results extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_quiz_results');
$this->version = 2007101509;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -3,7 +3,6 @@
class block_recent_activity extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_recent_activity');
$this->version = 2007101509;
}
function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-2
View File
@@ -27,8 +27,6 @@
function init() {
$this->title = get_string('feedstitle', 'block_rss_client');
$this->version = 2009072901;
$this->cron = 300; /// Set min time between cron executions to 300 secs (5 mins)
}
function preferred_width() {
+19
View File
@@ -0,0 +1,19 @@
<?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/>.
$plugin->version = 2009072901;
$plugin->cron = 300; /// Set min time between cron executions to 300 secs (5 mins)
-2
View File
@@ -15,8 +15,6 @@ class block_search extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_search');
$this->cron = 1;
$this->version = 2008031500;
} //init
// only one instance of this block is required
+19
View File
@@ -0,0 +1,19 @@
<?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/>.
$plugin->version = 2008031500;
$plugin->cron = 1;
@@ -3,7 +3,6 @@
class block_search_forums extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_search_forums');
$this->version = 2007101509;
}
function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -26,7 +26,6 @@ class block_section_links extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_section_links');
$this->version = 2007101511;
}
function instance_config($instance) {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101511;
@@ -37,7 +37,6 @@ class block_selfcompletion extends block_base {
public function init() {
$this->title = get_string('selfcompletion', 'block_selfcompletion');
$this->version = 2009072800;
}
public function get_content() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009072800;
-1
View File
@@ -50,7 +50,6 @@ class block_settings extends block_base {
function init() {
$this->blockname = get_class($this);
$this->title = get_string('pluginname', $this->blockname);
$this->version = 2009082800;
}
/**
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2009082800;
@@ -3,9 +3,8 @@
class block_site_main_menu extends block_list {
function init() {
$this->title = get_string('pluginname', 'block_site_main_menu');
$this->version = 2007101509;
}
function applicable_formats() {
return array('site' => true);
}
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
@@ -3,7 +3,6 @@
class block_social_activities extends block_list {
function init(){
$this->title = get_string('pluginname', 'block_social_activities');
$this->version = 2007101509;
}
function applicable_formats() {
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+4 -5
View File
@@ -1,8 +1,5 @@
<?php
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->libdir . '/filelib.php');
define('FLICKR_DEV_KEY', '4fddbdd7ff2376beec54d7f6afad425e');
define('DEFAULT_NUMBER_OF_PHOTOS', 6);
@@ -10,7 +7,6 @@ class block_tag_flickr extends block_base {
function init() {
$this->title = get_string('pluginname','block_tag_flickr');
$this->version = 2007101509;
}
function applicable_formats() {
@@ -30,9 +26,12 @@ class block_tag_flickr extends block_base {
}
function get_content() {
global $CFG, $USER;
//note: do NOT include files at the top of this file
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->libdir . '/filelib.php');
if ($this->content !== NULL) {
return $this->content;
}
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
+5 -4
View File
@@ -1,15 +1,11 @@
<?php
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->libdir . '/filelib.php');
define('DEFAULT_NUMBER_OF_VIDEOS', 5);
class block_tag_youtube extends block_base {
function init() {
$this->title = get_string('pluginname','block_tag_youtube');
$this->version = 2007101509;
}
function applicable_formats() {
@@ -32,6 +28,11 @@ class block_tag_youtube extends block_base {
}
function get_content() {
global $CFG;
//note: do NOT include files at the top of this file
require_once($CFG->dirroot.'/tag/lib.php');
require_once($CFG->libdir . '/filelib.php');
if ($this->content !== NULL) {
return $this->content;
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2007101509;
-1
View File
@@ -2,7 +2,6 @@
class block_tags extends block_base {
function init() {
$this->version = 2008063001;
$this->title = get_string('pluginname', 'block_tags');
// the cron function goes through all users, so only do daily
// (this creates rss feeds for personal course tags)
+18
View File
@@ -0,0 +1,18 @@
<?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/>.
$plugin->version = 2008063001;
+1
View File
@@ -16,6 +16,7 @@ required changes in code:
old global $THEME is fully replaced by $OUTPUT
* remove '_utf8' from language pack names, use new {$a} syntax in language packs
* use 'pluginname' lang pack identifier instead of 'blockname'
* move cron and version number into standard version.php
optional - no changes needed in older code:
*
+2 -2
View File
@@ -185,7 +185,7 @@ $string['dbsessionbroken'] = 'Serious database session problem detected.<br /><b
$string['dbsessionhandlerproblem'] = 'Setting up of database session failed.<br /><br />Please notify server administrator.';
$string['dbsessionmysqlpacketsize'] = 'Serious session error detected.<br /><br />Please notify administrator, this problem is most probably caused by small value in max_allowed_packet MySQL setting.';
$string['dbupdatefailed'] = 'Database update failed';
$string['ddldependencyerror'] = '{$a->targettype} "{$a->targetname}" cannot be modifed. Dependency found with {$a->offendingtype} "{$a->offendingname}"';
$string['ddldependencyerror'] = '{$a->targettype} "{$a->targetname}" cannot be modified. Dependency found with {$a->offendingtype} "{$a->offendingname}"';
$string['ddlexecuteerror'] = 'DDL sql execution error';
$string['ddlfieldalreadyexists'] = 'Field "{$a}" already exists';
$string['ddlfieldnotexist'] = 'Field "{$a->fieldname}" does not exist in table "{$a->tablename}"';
@@ -194,7 +194,7 @@ $string['ddltablenotexist'] = 'Table "{$a}" does not exist';
$string['ddlunknownerror'] = 'Unknown DDL library error';
$string['ddlxmlfileerror'] = 'XML database file errors found';
$string['destinationcmnotexit'] = 'The destination course module does not exist';
$string['detectedbrokenplugin'] = 'Plugin "{$a}" is defective, can not continue, sorry.';
$string['detectedbrokenplugin'] = 'Plugin "{$a}" is defective or outdated, can not continue, sorry.';
$string['dmlreadexception'] = 'Error reading from database';
$string['dmltransactionexception'] = 'Database transaction error';
$string['dmlwriteexception'] = 'Error writing to database';
+5 -8
View File
@@ -7553,18 +7553,15 @@ function moodle_needs_upgrading() {
if ($blockname === 'NEWBLOCK') { // Someone has unzipped the template, ignore it
continue;
}
if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
if (!is_readable($fullblock.'/version.php')) {
continue;
}
include_once($fullblock.'/block_'.$blockname.'.php');
$classname = 'block_'.$blockname;
if (!class_exists($classname)) {
continue;
}
$blockobj = new $classname;
$plugin = new object();
$plugin->version = NULL;
include($fullblock.'/version.php');
if (empty($installed[$blockname])) {
return true;
} else if ($blockobj->get_version() > $installed[$blockname]->version) {
} else if ($plugin->version > $installed[$blockname]->version) {
return true;
}
}
+10 -4
View File
@@ -568,10 +568,19 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
$component = 'block_'.$blockname;
if (!is_readable($fullblock.'/version.php')) {
throw new plugin_defective_exception('block/'.$blockname, 'Missing version.php file.');
}
$plugin = new object();
$plugin->version = NULL;
$plugin->cron = 0;
include($fullblock.'/version.php');
$block = $plugin;
if (!is_readable($fullblock.'/block_'.$blockname.'.php')) {
throw new plugin_defective_exception('block/'.$blockname, 'Missing main block class file.');
}
require_once($fullblock.'/block_'.$blockname.'.php');
include_once($fullblock.'/block_'.$blockname.'.php');
$classname = 'block_'.$blockname;
@@ -587,10 +596,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
throw new plugin_defective_exception($component, 'Self test failed.');
}
$block = new object(); // This may be used to update the db below
$block->name = $blockname; // The name MUST match the directory
$block->version = $blockobj->get_version();
$block->cron = !empty($blockobj->cron) ? $blockobj->cron : 0;
$block->multiple = $blockobj->instance_allow_multiple() ? 1 : 0;
if (empty($block->version)) {