"REPOSITORY, UPGRADE/MDL-18354, upgrade/install repository plugins using moodle hook"
authordongsheng <dongsheng>
Tue, 10 Mar 2009 02:01:24 +0000 (02:01 +0000)
committerdongsheng <dongsheng>
Tue, 10 Mar 2009 02:01:24 +0000 (02:01 +0000)
lib/adminlib.php
repository/lib.php
repository/local/db/install.php [new file with mode: 0644]
repository/local/db/upgrade.php [new file with mode: 0644]
repository/local/version.php [new file with mode: 0644]
repository/upload/db/install.php [new file with mode: 0644]
repository/upload/db/upgrade.php [new file with mode: 0644]
repository/upload/version.php [new file with mode: 0644]

index 961cda2..e1f1c77 100644 (file)
@@ -106,6 +106,7 @@ function get_plugin_types() {
                  'coursereport'  => 'course/report',
                  'report'        => $CFG->admin.'/report',
                  'portfolio'     => 'portfolio/type',
+                 'repository'    => 'repository',
 
         // following types a very ugly hacks - we should not make exceptions like this - all plugins should be equal;
         // these plugins may cause problems such as when wanting to uninstall them
index 479f95c..79702e0 100644 (file)
@@ -1831,4 +1831,5 @@ function repository_setup_default_plugins() {
     if (is_int($local_plugin_id) or is_int($upload_plugin_id)) {
         print_box(get_string('setupdefaultplugins', 'repository'));
     }
+    return true;
 }
diff --git a/repository/local/db/install.php b/repository/local/db/install.php
new file mode 100644 (file)
index 0000000..971b551
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+function xmldb_repository_local_install() {
+    global $CFG;
+    $result = true;
+    require_once($CFG->dirroot.'/repository/lib.php');
+    $local_plugin = new repository_type('local', array(), true);
+    if(!$id = $local_plugin->create(true)) {
+        $result = false;
+    }
+    return $result;
+}
diff --git a/repository/local/db/upgrade.php b/repository/local/db/upgrade.php
new file mode 100644 (file)
index 0000000..fcba47b
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+function xmldb_repository_local_upgrade($oldversion) {
+    $result = true;
+    /**
+    if ($result && $oldversion < 2009031000) {
+    } 
+    */
+    return $result;
+}
diff --git a/repository/local/version.php b/repository/local/version.php
new file mode 100644 (file)
index 0000000..bcba240
--- /dev/null
@@ -0,0 +1,2 @@
+<?php
+$plugin->version = 2009031000;
diff --git a/repository/upload/db/install.php b/repository/upload/db/install.php
new file mode 100644 (file)
index 0000000..a3443dd
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+function xmldb_repository_upload_install() {
+    global $CFG;
+    $result = true;
+    require_once($CFG->dirroot.'/repository/lib.php');
+    $upload_plugin = new repository_type('upload', array(), true);
+    if (!$id = $upload_plugin->create(true)) {
+        $result = false;
+    }
+    return $result;
+}
diff --git a/repository/upload/db/upgrade.php b/repository/upload/db/upgrade.php
new file mode 100644 (file)
index 0000000..d9bf4d3
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+function xmldb_repository_upload_upgrade($oldversion) {
+    $result = true;
+    /**
+    if ($result && $oldversion < 2009031000) {
+    }
+    */
+    return $result;
+}
diff --git a/repository/upload/version.php b/repository/upload/version.php
new file mode 100644 (file)
index 0000000..bcba240
--- /dev/null
@@ -0,0 +1,2 @@
+<?php
+$plugin->version = 2009031000;