MDL-23069 moving version and cron info into standard version.php - finally, yay!
authorPetr Skoda <skodak@moodle.org>
Sun, 4 Jul 2010 12:18:22 +0000 (12:18 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 4 Jul 2010 12:18:22 +0000 (12:18 +0000)
84 files changed:
admin/blocks.php
blocks/activity_modules/block_activity_modules.php
blocks/activity_modules/version.php [new file with mode: 0644]
blocks/admin_bookmarks/block_admin_bookmarks.php
blocks/admin_bookmarks/version.php [new file with mode: 0644]
blocks/blog_menu/block_blog_menu.php
blocks/blog_menu/version.php [new file with mode: 0644]
blocks/blog_recent/block_blog_recent.php
blocks/blog_recent/version.php [new file with mode: 0644]
blocks/blog_tags/block_blog_tags.php
blocks/blog_tags/version.php [new file with mode: 0644]
blocks/calendar_month/block_calendar_month.php
blocks/calendar_month/version.php [new file with mode: 0644]
blocks/calendar_upcoming/block_calendar_upcoming.php
blocks/calendar_upcoming/version.php [new file with mode: 0644]
blocks/comments/block_comments.php
blocks/comments/version.php [new file with mode: 0644]
blocks/community/block_community.php
blocks/community/version.php [new file with mode: 0644]
blocks/completionstatus/block_completionstatus.php
blocks/completionstatus/version.php [new file with mode: 0644]
blocks/course_list/block_course_list.php
blocks/course_list/version.php [new file with mode: 0644]
blocks/course_overview/block_course_overview.php
blocks/course_overview/version.php [new file with mode: 0644]
blocks/course_summary/block_course_summary.php
blocks/course_summary/version.php [new file with mode: 0644]
blocks/feedback/block_feedback.php
blocks/feedback/version.php [new file with mode: 0644]
blocks/glossary_random/block_glossary_random.php
blocks/glossary_random/version.php [new file with mode: 0644]
blocks/html/block_html.php
blocks/html/version.php [new file with mode: 0644]
blocks/login/block_login.php
blocks/login/version.php [new file with mode: 0644]
blocks/mentees/block_mentees.php
blocks/mentees/version.php [new file with mode: 0644]
blocks/messages/block_messages.php
blocks/messages/version.php [new file with mode: 0644]
blocks/mnet_hosts/block_mnet_hosts.php
blocks/mnet_hosts/version.php [new file with mode: 0644]
blocks/moodleblock.class.php
blocks/myprofile/block_myprofile.php
blocks/myprofile/version.php [new file with mode: 0644]
blocks/navigation/block_navigation.php
blocks/navigation/version.php [new file with mode: 0644]
blocks/news_items/block_news_items.php
blocks/news_items/version.php [new file with mode: 0644]
blocks/online_users/block_online_users.php
blocks/online_users/version.php [new file with mode: 0644]
blocks/participants/block_participants.php
blocks/participants/version.php [new file with mode: 0644]
blocks/private_files/block_private_files.php
blocks/private_files/version.php [new file with mode: 0644]
blocks/quiz_results/block_quiz_results.php
blocks/quiz_results/version.php [new file with mode: 0644]
blocks/recent_activity/block_recent_activity.php
blocks/recent_activity/version.php [new file with mode: 0644]
blocks/rss_client/block_rss_client.php
blocks/rss_client/version.php [new file with mode: 0644]
blocks/search/block_search.php
blocks/search/version.php [new file with mode: 0644]
blocks/search_forums/block_search_forums.php
blocks/search_forums/version.php [new file with mode: 0644]
blocks/section_links/block_section_links.php
blocks/section_links/version.php [new file with mode: 0644]
blocks/selfcompletion/block_selfcompletion.php
blocks/selfcompletion/version.php [new file with mode: 0644]
blocks/settings/block_settings.php
blocks/settings/version.php [new file with mode: 0644]
blocks/site_main_menu/block_site_main_menu.php
blocks/site_main_menu/version.php [new file with mode: 0644]
blocks/social_activities/block_social_activities.php
blocks/social_activities/version.php [new file with mode: 0644]
blocks/tag_flickr/block_tag_flickr.php
blocks/tag_flickr/version.php [new file with mode: 0644]
blocks/tag_youtube/block_tag_youtube.php
blocks/tag_youtube/version.php [new file with mode: 0644]
blocks/tags/block_tags.php
blocks/tags/version.php [new file with mode: 0644]
blocks/upgrade.txt
lang/en/error.php
lib/moodlelib.php
lib/upgradelib.php

index 1200244..be7738e 100644 (file)
         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;
             $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
index cc79818..75cfe1a 100644 (file)
@@ -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() {
diff --git a/blocks/activity_modules/version.php b/blocks/activity_modules/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 4c7c365..0b3b039 100644 (file)
@@ -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() {
diff --git a/blocks/admin_bookmarks/version.php b/blocks/admin_bookmarks/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index a6ca221..b431a39 100755 (executable)
@@ -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) {
diff --git a/blocks/blog_menu/version.php b/blocks/blog_menu/version.php
new file mode 100644 (file)
index 0000000..80440b6
--- /dev/null
@@ -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;
index 70c87d6..e9dc80c 100644 (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() {
diff --git a/blocks/blog_recent/version.php b/blocks/blog_recent/version.php
new file mode 100644 (file)
index 0000000..3cae55d
--- /dev/null
@@ -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;
index 7bbca1d..a5d8250 100644 (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');
     }
 
diff --git a/blocks/blog_tags/version.php b/blocks/blog_tags/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 7203740..67488c4 100644 (file)
@@ -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() {
diff --git a/blocks/calendar_month/version.php b/blocks/calendar_month/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 9716b08..21d63b4 100644 (file)
@@ -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() {
diff --git a/blocks/calendar_upcoming/version.php b/blocks/calendar_upcoming/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index a90fcab..f855ad3 100644 (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() {
diff --git a/blocks/comments/version.php b/blocks/comments/version.php
new file mode 100644 (file)
index 0000000..643149d
--- /dev/null
@@ -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;
index 2eb8dc6..d26670d 100644 (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()));
diff --git a/blocks/community/version.php b/blocks/community/version.php
new file mode 100644 (file)
index 0000000..7f14cbf
--- /dev/null
@@ -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;
index 90fd901..083debf 100644 (file)
@@ -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() {
diff --git a/blocks/completionstatus/version.php b/blocks/completionstatus/version.php
new file mode 100644 (file)
index 0000000..279b001
--- /dev/null
@@ -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;
index 0d52ebd..a658c74 100644 (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() {
diff --git a/blocks/course_list/version.php b/blocks/course_list/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index c9f1d1e..a183ee2 100644 (file)
@@ -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;
     }
 
     /**
diff --git a/blocks/course_overview/version.php b/blocks/course_overview/version.php
new file mode 100644 (file)
index 0000000..2e54a20
--- /dev/null
@@ -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;
index e223ca2..790a5e6 100644 (file)
@@ -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() {
diff --git a/blocks/course_summary/version.php b/blocks/course_summary/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 9d82dbf..825f678 100644 (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;
diff --git a/blocks/feedback/version.php b/blocks/feedback/version.php
new file mode 100644 (file)
index 0000000..59d59fc
--- /dev/null
@@ -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;
index da3688c..bff459c 100644 (file)
@@ -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() {
diff --git a/blocks/glossary_random/version.php b/blocks/glossary_random/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 91910a0..44eec67 100755 (executable)
@@ -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() {
diff --git a/blocks/html/version.php b/blocks/html/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 0981dd4..da53e5a 100644 (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() {
diff --git a/blocks/login/version.php b/blocks/login/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 9650862..45d9463 100755 (executable)
@@ -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() {
diff --git a/blocks/mentees/version.php b/blocks/mentees/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 7524fc6..32e50e5 100644 (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);
 
diff --git a/blocks/messages/version.php b/blocks/messages/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index c53741f..98cf00d 100644 (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() {
diff --git a/blocks/mnet_hosts/version.php b/blocks/mnet_hosts/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 4c2806f..a285ac2 100644 (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';
index a130f11..676e33d 100644 (file)
@@ -37,7 +37,6 @@ class block_myprofile extends block_base {
      */
     public function init() {
         $this->title   = get_string('pluginname', 'block_myprofile');
-        $this->version = 2009123100;
     }
 
     /**
diff --git a/blocks/myprofile/version.php b/blocks/myprofile/version.php
new file mode 100644 (file)
index 0000000..fa4218c
--- /dev/null
@@ -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;
index 36a4e6b..9c612f6 100644 (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;
     }
 
     /**
diff --git a/blocks/navigation/version.php b/blocks/navigation/version.php
new file mode 100644 (file)
index 0000000..ed16d20
--- /dev/null
@@ -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;
index 8ff1041..d28f380 100644 (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() {
diff --git a/blocks/news_items/version.php b/blocks/news_items/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 9cc727f..c817394 100644 (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
diff --git a/blocks/online_users/version.php b/blocks/online_users/version.php
new file mode 100644 (file)
index 0000000..d343c63
--- /dev/null
@@ -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;
index 277ab7e..7a056ca 100644 (file)
@@ -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() {
diff --git a/blocks/participants/version.php b/blocks/participants/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 7f69be0..cc8432e 100755 (executable)
@@ -31,7 +31,6 @@ class block_private_files extends block_base {
 
     function init() {
         $this->title = get_string('areauserpersonal', 'repository');
-        $this->version = 2010030100;
     }
 
     function specialization() {
diff --git a/blocks/private_files/version.php b/blocks/private_files/version.php
new file mode 100644 (file)
index 0000000..c9d9cb3
--- /dev/null
@@ -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;
index 08ee2ea..a6bb602 100644 (file)
@@ -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() {
diff --git a/blocks/quiz_results/version.php b/blocks/quiz_results/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 8653a09..c4d2f55 100644 (file)
@@ -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() {
diff --git a/blocks/recent_activity/version.php b/blocks/recent_activity/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 8a4d507..ff844b6 100644 (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() {
diff --git a/blocks/rss_client/version.php b/blocks/rss_client/version.php
new file mode 100644 (file)
index 0000000..edc9f2f
--- /dev/null
@@ -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)
index 79be3f1..ea8b782 100644 (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
diff --git a/blocks/search/version.php b/blocks/search/version.php
new file mode 100644 (file)
index 0000000..93d2182
--- /dev/null
@@ -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;
index 98220ef..02eef48 100644 (file)
@@ -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() {
diff --git a/blocks/search_forums/version.php b/blocks/search_forums/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 209ddb0..1e80286 100644 (file)
@@ -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) {
diff --git a/blocks/section_links/version.php b/blocks/section_links/version.php
new file mode 100644 (file)
index 0000000..7314aac
--- /dev/null
@@ -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;
index e19af5f..50567bf 100644 (file)
@@ -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() {
diff --git a/blocks/selfcompletion/version.php b/blocks/selfcompletion/version.php
new file mode 100644 (file)
index 0000000..279b001
--- /dev/null
@@ -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;
index 8be053c..c338cfa 100644 (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;
     }
 
     /**
diff --git a/blocks/settings/version.php b/blocks/settings/version.php
new file mode 100644 (file)
index 0000000..ed16d20
--- /dev/null
@@ -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;
index 02595c2..5f8891b 100644 (file)
@@ -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);
     }
diff --git a/blocks/site_main_menu/version.php b/blocks/site_main_menu/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 1e99653..af533f8 100644 (file)
@@ -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() {
diff --git a/blocks/social_activities/version.php b/blocks/social_activities/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 6dc97ce..93ca546 100644 (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;
         }
diff --git a/blocks/tag_flickr/version.php b/blocks/tag_flickr/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index 982f579..139298b 100644 (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;
diff --git a/blocks/tag_youtube/version.php b/blocks/tag_youtube/version.php
new file mode 100644 (file)
index 0000000..c9abcfe
--- /dev/null
@@ -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;
index c10c9e8..3cd2ba2 100644 (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)
diff --git a/blocks/tags/version.php b/blocks/tags/version.php
new file mode 100644 (file)
index 0000000..26eef27
--- /dev/null
@@ -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;
index 51e9950..6d3f42a 100644 (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:
 *
index 29f3084..10010ae 100755 (executable)
@@ -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';
index 602ffe6..70a2933 100644 (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;
         }
     }
index d388203..fa917e8 100644 (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)) {