# Coppermine Photo Gallery v1.5.x: Documentation and Manual

# Adding/renaming/removing files

## Target audience

This part of the documentation is not meant for end users of Coppermine, but only for developers. There is no support for this section, it comes as-is.

## Scope

This document is meant to explain what needs to be done by developers when adding / renaming / deleting files to/from the SVN during development stage.

## Naming conventions

Refer to the section "Naming Conventions" when adding new files or renaming existing files.

## Adding files

If a developer needs to add a new file to Coppermine's core, here's a list of things that needs to be done:

- Create the file locally on your client (within the working copy of your Subversion checkout), respecting the naming conventions
- If it is a non-binary (i.e. a text file), add the file header that will show that your file is part of the coppermine package. Currently, the file header for PHP files looks like this:

      /*************************
        Coppermine Photo Gallery
        ************************
        Copyright (c) 2003-2010 Coppermine Dev Team
        v1.0 originally written by Gregory Demar

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License version 3
        as published by the Free Software Foundation.

        ********************************************
        Coppermine version: 1.5.3
        $HeadURL$
        $Revision$
        $LastChangedBy$
        $Date$
      **********************************************/

  For other file types (e.g. sql files), different comment symbols might apply.
- Add the file to the SVN, using the add and then the commit command of your favorite SVN client
- In your SVN client, make sure that the file you have added has the needed SVN-properties. In RapidSVN (Linux-Client), do a right-click, properties and make sure that the name/value pair "svn:keywords"/"Author Date Id Revision HeadURL" exists. If it doesn't exist, create such an entry (using the "new" button on the properties dialog). This will make sure that the placeholder SVN variables within $-signs are populated properly. Take a look at existing files to see how this is done.
- Add an entry for your newly-created file in `includes/cpg15x.files.xml`. Details can be found in the section Versioncheck : XML structure
- If applicable, come up with instructions about your file in the documentation

## Renaming files

If a file name can not be kept (e.g. because of collision with naming conventions), it should be renamed instead of deleting the old one and creating a new one. The benfit of renaming is the fact that the version history will be kept in the Subversion repository.

Once a file has been renamed in SVN, you will have to make additional edits:

- Add an entry for your the new file name in `includes/cpg15x.files.xml`. Details can be found in the section Versioncheck : XML structure
- If the old file name already has gone into a prvious public release, you need to make sure that end users will not have an outdated, leftover copy of the file with the old name when performing an update. To accomplish this, you should edit `update.php`, find the definition of the array `$delete_file_array` and add the old file name to it.
  Additionally, you should edit `includes/cpg15x.files.xml` and flag the old name with the status "remove".
- If the old file name has not gone into a previous release, it's enough to edit `includes/cpg15x.files.xml` and just remove the record that refers to the old file name.

## Deleting files

In a nutshell: what has been said above about renaming files applies to deleting files as well: after having deleted the file in SVN, make sure to edit the XML file used for versioncheck and the array of files scheduled for deleting by the updater.

Keep in mind though that before deleting core PHP files, you should discuss this with your fellow devs first on the dev-only board.