Issue Details (XML | Word | Printable)

Key: MDL-16387
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Minor Minor
Assignee: Eloy Lafuente (stronk7)
Reporter: Penny Leach
Votes: 0
Watchers: 4
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

provide boilerplate template for new source files

Created: 08/Sep/08 06:59 PM   Updated: 19/May/09 04:17 PM
Component/s: General
Affects Version/s: 2.0
Fix Version/s: 2.0

Issue Links:
Dependency
 

Participants: Eloy Lafuente (stronk7), Martin Dougiamas, Penny Leach and Tim Hunt
Security Level: None
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
provide two templates in examples/ directory or something to use to create new sourcefiles. libtemplate and scripttemplate. libtemplate just contains:
  • gpl header
  • appropriate phpdocs

scripttemplate contains the same as libtemplate, but additionally has example require_once(dirname(_FILE_)) . '/config.php); and require_login and require_caps or whatever with comments above them describing which ones to leave and which to comment out.

assigning to eloy since petr says he was tweaking headers recently.



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Penny Leach added a comment - 08/Sep/08 07:11 PM

Tim Hunt added a comment - 10/Sep/08 09:22 AM
If we are going to do this, then regrettably we need $Id$ on the first line.

And we should not use @author. CVS has all that information and more.


Martin Dougiamas added a comment - 18/May/09 02:42 PM - edited
For phpdoc, use a short description and a long description.
<?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/>.
 
 
/**
 * This is a one-line short description of the file
 *
 * You can have a rather longer description of the file as well, 
 * if you like, and it can span multiple lines.
 * 
 * @package   moodlecore
 * @copyright 2008 Kim Bloggs
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

See also: http://docs.moodle.org/en/Development:Coding_style#Files


Eloy Lafuente (stronk7) added a comment - 19/May/09 02:27 AM
BTW... have we already switched to GPL v3? I really didn't know! Shouldn't it include also MD global copyright, perhaps below the "This file is part of Moodle - http://moodle.org/" line?

Ciao


Martin Dougiamas added a comment - 19/May/09 04:05 PM
We hadn't switched to GPL v3 yet, but it's been discussed a long time ago and now is a good time to do it.

http://www.gnu.org/licenses/quick-guide-gplv3.html

About my "global" copyright I think it just confuses things to have two copyrights on every file. As long as there is one person and it's GPL then it's good for us all.

It's good to have lots of different people owning lots of different files (because the chances of Moodle ever leaving GPL become close to zero).


Eloy Lafuente (stronk7) added a comment - 19/May/09 04:17 PM
Closing as dupe of MDL-19235