Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
0f0ba611
Commit
0f0ba611
authored
Dec 08, 2010
by
Petr Skoda
Browse files
first part of upgrade
parent
28d16c16
Changes
6
Hide whitespace changes
Inline
Side-by-side
db/access.php
View file @
0f0ba611
<?php
// This file is part of Moodle - http://moodle.org/
//
// Capability definitions for the assignment module.
// 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.
//
// The capabilities are loaded into the database table when the module is
// installed or updated. Whenever the capability definitions are updated,
// the module version number should be bumped up.
// 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.
//
// The system has four possible values for a capability:
// CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Book module capability definition
*
* @package mod
* @subpackage book
* @copyright 2009-2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$mod_book_capabilities
=
array
(
...
...
@@ -18,7 +33,8 @@ $mod_book_capabilities = array(
'guest'
=>
CAP_ALLOW
,
'student'
=>
CAP_ALLOW
,
'teacher'
=>
CAP_ALLOW
,
'editingteacher'
=>
CAP_ALLOW
'editingteacher'
=>
CAP_ALLOW
,
'manager'
=>
CAP_ALLOW
,
)
),
...
...
@@ -27,7 +43,8 @@ $mod_book_capabilities = array(
'contextlevel'
=>
CONTEXT_MODULE
,
'legacy'
=>
array
(
'teacher'
=>
CAP_ALLOW
,
'editingteacher'
=>
CAP_ALLOW
'editingteacher'
=>
CAP_ALLOW
,
'manager'
=>
CAP_ALLOW
,
)
),
...
...
@@ -36,7 +53,8 @@ $mod_book_capabilities = array(
'captype'
=>
'write'
,
'contextlevel'
=>
CONTEXT_MODULE
,
'legacy'
=>
array
(
'editingteacher'
=>
CAP_ALLOW
'editingteacher'
=>
CAP_ALLOW
,
'manager'
=>
CAP_ALLOW
,
)
),
...
...
@@ -45,7 +63,8 @@ $mod_book_capabilities = array(
'captype'
=>
'write'
,
'contextlevel'
=>
CONTEXT_MODULE
,
'legacy'
=>
array
(
'editingteacher'
=>
CAP_ALLOW
'editingteacher'
=>
CAP_ALLOW
,
'manager'
=>
CAP_ALLOW
,
)
),
...
...
@@ -56,7 +75,8 @@ $mod_book_capabilities = array(
'guest'
=>
CAP_ALLOW
,
'student'
=>
CAP_ALLOW
,
'teacher'
=>
CAP_ALLOW
,
'editingteacher'
=>
CAP_ALLOW
'editingteacher'
=>
CAP_ALLOW
,
'manager'
=>
CAP_ALLOW
,
)
),
...
...
db/install.xml
View file @
0f0ba611
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB
PATH=
"mod/book/db"
VERSION=
"20
070924
"
COMMENT=
"XMLDB file for Moodle mod/book"
<XMLDB
PATH=
"mod/book/db"
VERSION=
"20
101208
"
COMMENT=
"XMLDB file for Moodle mod/book"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"../../../lib/xmldb/xmldb.xsd"
>
...
...
@@ -8,9 +8,10 @@
<FIELDS>
<FIELD
NAME=
"id"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
UNSIGNED=
"true"
SEQUENCE=
"true"
ENUM=
"false"
NEXT=
"course"
/>
<FIELD
NAME=
"course"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"id"
NEXT=
"name"
/>
<FIELD
NAME=
"name"
TYPE=
"char"
LENGTH=
"255"
NOTNULL=
"true"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"course"
NEXT=
"summary"
/>
<FIELD
NAME=
"summary"
TYPE=
"text"
LENGTH=
"medium"
NOTNULL=
"true"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"name"
NEXT=
"numbering"
/>
<FIELD
NAME=
"numbering"
TYPE=
"int"
LENGTH=
"4"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"summary"
NEXT=
"disableprinting"
/>
<FIELD
NAME=
"name"
TYPE=
"char"
LENGTH=
"255"
NOTNULL=
"true"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"course"
NEXT=
"intro"
/>
<FIELD
NAME=
"intro"
TYPE=
"text"
LENGTH=
"small"
NOTNULL=
"false"
SEQUENCE=
"false"
PREVIOUS=
"name"
NEXT=
"introformat"
/>
<FIELD
NAME=
"introformat"
TYPE=
"int"
LENGTH=
"4"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
PREVIOUS=
"intro"
NEXT=
"numbering"
/>
<FIELD
NAME=
"numbering"
TYPE=
"int"
LENGTH=
"4"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"introformat"
NEXT=
"disableprinting"
/>
<FIELD
NAME=
"disableprinting"
TYPE=
"int"
LENGTH=
"2"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"2"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"numbering"
NEXT=
"customtitles"
/>
<FIELD
NAME=
"customtitles"
TYPE=
"int"
LENGTH=
"2"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"disableprinting"
NEXT=
"timecreated"
/>
<FIELD
NAME=
"timecreated"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"true"
UNSIGNED=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
ENUM=
"false"
PREVIOUS=
"customtitles"
NEXT=
"timemodified"
/>
...
...
@@ -38,14 +39,4 @@
</KEYS>
</TABLE>
</TABLES>
<STATEMENTS>
<STATEMENT
NAME=
"insert log_display"
TYPE=
"insert"
TABLE=
"log_display"
COMMENT=
"Initial insert of records on table log_display"
>
<SENTENCES>
<SENTENCE
TEXT=
"(module, action, mtable, field) VALUES ('book', 'update', 'book', 'name')"
/>
<SENTENCE
TEXT=
"(module, action, mtable, field) VALUES ('book', 'view', 'book', 'name')"
/>
<SENTENCE
TEXT=
"(module, action, mtable, field) VALUES ('book', 'view all', 'book', 'name')"
/>
<SENTENCE
TEXT=
"(module, action, mtable, field) VALUES ('book', 'print', 'book', 'name')"
/>
</SENTENCES>
</STATEMENT>
</STATEMENTS>
</XMLDB>
db/log.php
0 → 100644
View file @
0f0ba611
<?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/>.
/**
* Definition of log events
*
* @package mod
* @subpackage book
* @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$logs
=
array
(
array
(
'module'
=>
'book'
,
'action'
=>
'update'
,
'mtable'
=>
'book'
,
'field'
=>
'name'
),
array
(
'module'
=>
'book'
,
'action'
=>
'view'
,
'mtable'
=>
'book'
,
'field'
=>
'name'
),
array
(
'module'
=>
'book'
,
'action'
=>
'view all'
,
'mtable'
=>
'book'
,
'field'
=>
'name'
),
array
(
'module'
=>
'book'
,
'action'
=>
'print'
,
'mtable'
=>
'book'
,
'field'
=>
'name'
),
);
db/upgrade.php
View file @
0f0ba611
<?php
// This file keeps track of upgrades to
// the assignment module
// This file is part of Moodle - http://moodle.org/
//
// Sometimes, changes between versions involve
// alterations to database structures and other
// major things that may break installations.
// 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.
//
// The upgrade function in this file will attempt
// to perform all the necessary actions to upgrade
// your older installtion to the current 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.
//
// If there's something it cannot do itself, it
// will tell you what you need to do.
//
// The commands in here will all be database-neutral,
// using the functions defined in lib/ddllib.php
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
function
xmldb_book_upgrade
(
$oldversion
=
0
)
{
/**
* Book module upgrade code
*
* @package mod
* @subpackage book
* @copyright 2009-2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
global
$CFG
,
$THEME
,
$db
;
defined
(
'MOODLE_INTERNAL'
)
||
die
;
$result
=
true
;
function
xmldb_book_upgrade
(
$oldversion
)
{
global
$CFG
,
$DB
;
require_once
(
"
$CFG->dirroot
/mod/book/db/upgradelib.php"
);
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
$dbman
=
$DB
->
get_manager
();
if
(
$result
&&
$oldversion
<
2007052001
)
{
if
(
$oldversion
<
2007052001
)
{
/// Changing type of field importsrc on table book_chapters to char
$table
=
new
XMLDBTable
(
'book_chapters'
);
$field
=
new
XMLDBField
(
'importsrc'
);
$field
->
setAttributes
(
XMLDB_TYPE_CHAR
,
'255'
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
null
,
null
,
'timemodified'
);
$table
=
new
xmldb_table
(
'book_chapters'
);
$field
=
new
xmldb_field
(
'importsrc'
,
XMLDB_TYPE_CHAR
,
'255'
,
null
,
XMLDB_NOTNULL
,
null
,
null
,
'timemodified'
);
/// Launch change of type for field importsrc
$result
=
$result
&&
change_field_type
(
$table
,
$field
);
$dbman
->
change_field_type
(
$table
,
$field
);
upgrade_mod_savepoint
(
true
,
2007052001
,
'book'
);
}
//===== 1.9.0 upgrade line ======//
if
(
$oldversion
<
2010120801
)
{
// Rename field summary on table book to intro
$table
=
new
xmldb_table
(
'book'
);
$field
=
new
xmldb_field
(
'summary'
,
XMLDB_TYPE_TEXT
,
'small'
,
null
,
null
,
null
,
null
,
'name'
);
// Launch rename field summary
$dbman
->
rename_field
(
$table
,
$field
,
'intro'
);
// book savepoint reached
upgrade_mod_savepoint
(
true
,
2010120801
,
'book'
);
}
return
$result
;
if
(
$oldversion
<
2010120802
)
{
// Define field introformat to be added to book
$table
=
new
xmldb_table
(
'book'
);
$field
=
new
xmldb_field
(
'introformat'
,
XMLDB_TYPE_INTEGER
,
'4'
,
XMLDB_UNSIGNED
,
XMLDB_NOTNULL
,
null
,
'0'
,
'intro'
);
// Launch add field introformat
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
// conditionally migrate to html format in intro
if
(
$CFG
->
texteditors
!==
'textarea'
)
{
$rs
=
$DB
->
get_recordset
(
'book'
,
array
(
'introformat'
=>
FORMAT_MOODLE
),
''
,
'id,intro,introformat'
);
foreach
(
$rs
as
$r
)
{
$r
->
intro
=
text_to_html
(
$r
->
intro
,
false
,
false
,
true
);
$r
->
introformat
=
FORMAT_HTML
;
$DB
->
update_record
(
'book'
,
$r
);
upgrade_set_timeout
();
}
$rs
->
close
();
}
// book savepoint reached
upgrade_mod_savepoint
(
true
,
2010120802
,
'book'
);
}
return
true
;
}
db/upgradelib.php
0 → 100644
View file @
0f0ba611
version.php
View file @
0f0ba611
...
...
@@ -4,8 +4,8 @@
/// Called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module
->
version
=
20
080814
02
;
// The current module version (Date: YYYYMMDDXX)
$module
->
requires
=
20
07101512
;
// Requires this Moodle version
$module
->
version
=
20
101208
02
;
// The current module version (Date: YYYYMMDDXX)
$module
->
requires
=
20
10120700
;
// Requires this Moodle version
$module
->
cron
=
0
;
// Period for cron to check this module (secs)
$release
=
"
1.5beta
"
;
// User-friendly version number
$release
=
"
2.0dev
"
;
// User-friendly version number
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment