Moodle

provide boilerplate template for new source files

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: General
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

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.

Issue Links

Activity

Hide
Penny Leach added a comment -
Show
Penny Leach added a comment - starting point: http://paste.dollyfish.net.nz/92a184
Hide
Tim Hunt added a comment -

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.

Show
Tim Hunt added a comment - 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.
Hide
Martin Dougiamas added a comment - - 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

Show
Martin Dougiamas added a comment - - 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
Hide
Eloy Lafuente (stronk7) added a comment -

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

Show
Eloy Lafuente (stronk7) added a comment - 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
Hide
Martin Dougiamas added a comment -

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).

Show
Martin Dougiamas added a comment - 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).
Hide
Eloy Lafuente (stronk7) added a comment -

Closing as dupe of MDL-19235

Show
Eloy Lafuente (stronk7) added a comment - Closing as dupe of MDL-19235

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: