# WordPress Plugin SVN Setup Guide

This document contains all the commands and steps used to set up SVN for the WordPress plugin "lopaa" and deploy it to WordPress.org repository.

## Prerequisites
- Approved WordPress plugin from WordPress.org
- WordPress.org account with SVN access
- Linux system (Ubuntu/Debian)

## Step 1: Install SVN (Subversion)

### Check if SVN is installed
```bash
which svn
# Output: /usr/bin/svn (if installed) or "SVN not found"
```

### Install SVN (requires sudo privileges)
```bash
sudo apt update && sudo apt install subversion
```

**Explanation**: Subversion (SVN) is a version control system required for managing WordPress plugin repositories. WordPress.org uses SVN instead of Git for plugin hosting.

## Step 2: Check Out Your Plugin Repository

### Create and checkout your plugin's SVN repository
```bash
svn co https://plugins.svn.wordpress.org/lopaa lopaa-svn
```

**Explanation**:
- `svn co` = SVN checkout command
- `https://plugins.svn.wordpress.org/lopaa` = Your plugin's SVN repository URL
- `lopaa-svn` = Local directory name where repository will be downloaded
- This creates the standard WordPress plugin folder structure

**Output**:
```
A    lopaa-svn/assets
A    lopaa-svn/tags
A    lopaa-svn/trunk
Checked out revision 3367044.
```

## Step 3: Verify Repository Structure

### Check the created folder structure
```bash
ls -la lopaa-svn/
```

**Expected structure**:
- `trunk/` - Main development code (current version)
- `tags/` - Released versions (e.g., tags/1.0/, tags/1.1/)
- `assets/` - Plugin screenshots, banners, icons
- `.svn/` - SVN metadata (hidden folder)

## Step 4: Copy Plugin Files to Trunk

### Copy your plugin files to the trunk directory
```bash
cp -r lopaa/* lopaa-svn/trunk/
```

**Explanation**:
- `cp -r` = Copy recursively (includes subdirectories)
- `lopaa/*` = All files from your plugin directory
- `lopaa-svn/trunk/` = Destination (trunk is where active development happens)

### Verify files were copied
```bash
ls -la lopaa-svn/trunk/
```

## Step 5: Add Files to SVN Tracking

### Navigate to SVN directory and add all files
```bash
cd lopaa-svn
svn add trunk/*
```

**Explanation**:
- `svn add` = Adds files to SVN version control
- `trunk/*` = All files and directories in trunk
- Files must be added before they can be committed

**Output** (example):
```
A         trunk/assets
A         trunk/languages
A         trunk/license.txt
A         trunk/lopaa.php
A         trunk/readme.txt
A         trunk/uninstall.php
```

## Step 6: Check Status Before Commit

### Check which files are staged for commit
```bash
svn status
```

**Explanation**: Shows files that will be included in the commit. Files marked with 'A' are newly added.

## Step 7: Commit to WordPress.org Repository

### Commit your plugin to WordPress.org
```bash
svn ci -m 'Adding first version of lopaa plugin' --username sulopatech
```

**Explanation**:
- `svn ci` = SVN commit command
- `-m 'message'` = Commit message describing changes
- `--username sulopatech` = Your WordPress.org username
- You'll be prompted for your SVN password (set in WordPress.org account settings)

**Expected result**: Your plugin files are uploaded to WordPress.org servers.

## Step 8: Verify Successful Deployment

### Check commit history
```bash
svn log -l 3
```

**Output** (example):
```
------------------------------------------------------------------------
r3367048 | sulopatech | 2025-09-24 15:03:33 +0530 | 1 line

Adding first version of lopaa plugin
------------------------------------------------------------------------
```

### Update working copy to latest revision
```bash
svn update
```

### Check repository information
```bash
svn info
```

## Important WordPress Plugin Files

### Required files in trunk/:
- **Main plugin file** (e.g., `lopaa.php`) - Contains plugin header
- **readme.txt** - Plugin description, installation instructions, changelog
- **LICENSE** or **license.txt** - Plugin license

### Optional files:
- **uninstall.php** - Cleanup code when plugin is deleted
- **languages/** - Translation files
- **assets/** - CSS, JS, images used by plugin

## Future Updates and Version Management

### For plugin updates:
1. Make changes to files in `trunk/`
2. Add modified files: `svn add filename` (if new) or they're tracked automatically
3. Commit changes: `svn ci -m 'Update description' --username yourusername`

### For version releases:
```bash
# Create a tag for version 1.0
svn cp trunk tags/1.0
svn ci -m 'Tagging version 1.0' --username yourusername
```

### Check differences between versions:
```bash
svn diff trunk tags/1.0
```

## WordPress.org Plugin URLs

After successful deployment:
- **Plugin page**: https://wordpress.org/plugins/lopaa/
- **SVN repository**: https://plugins.svn.wordpress.org/lopaa/
- **Download**: Available through WordPress admin or direct download

## Troubleshooting

### Common issues:
1. **Authentication failed**: Check username/password in WordPress.org account
2. **Permission denied**: Ensure your account has access to the plugin
3. **Files not committed**: Make sure to `svn add` new files before commit
4. **Commit rejected**: Plugin may need approval or have guideline violations

### Useful SVN commands:
```bash
svn status          # Check working copy status
svn update          # Get latest changes from repository
svn revert file     # Undo local changes to file
svn remove file     # Remove file from version control
svn move old new    # Rename/move files
```

## Security Notes
- Never commit sensitive data (API keys, passwords, database credentials)
- Use WordPress coding standards and security best practices
- Test thoroughly before committing to trunk

---

**Setup completed**: 2025-09-24
**Plugin**: lopaa
**Author**: sulopatech
**Status**: Successfully deployed to WordPress.org