Files
DelableInvoiceNinja/README.md
2026-06-14 00:08:35 +00:00

11 KiB
Raw Permalink Blame History

DelableInvoiceNinja

A local maintenance script for self-hosted Invoice Ninja installations.

DelableInvoiceNinja is intended to help server administrators apply local white-label customization changes to their own self-hosted Invoice Ninja instance only when they are authorized to do so.

⚠️ This project is not a free white-label license, not an Invoice Ninja license generator, and not a tool for bypassing Invoice Ninjas commercial licensing terms.


Invoice Ninja offers self-hosted builds, but removing Invoice Ninja branding from client-facing parts of the app may require a valid Invoice Ninja white-label license or other written authorization from Invoice Ninja LLC.

Before using this project, you are responsible for making sure you have the required permission, license, or authorization from Invoice Ninja LLC.

Do not use this project to bypass payment, licensing, white-label requirements, subscription checks, feature restrictions, or any other commercial controls.


What This Project Does

This project is designed for administrators who run their own self-hosted Invoice Ninja instance and want to automate local customization work after install or update.

Depending on your script version, this may include:

  • Creating a backup of the target Invoice Ninja file before modification
  • Locating specific Invoice Ninja source-code functions
  • Applying local patch changes
  • Running a PHP syntax check before replacing the file
  • Clearing Laravel / Invoice Ninja application caches
  • Logging patch activity to a local log file

What This Project Does Not Do

This project does not:

  • Grant you an Invoice Ninja white-label license
  • Grant you an Invoice Ninja Enterprise license
  • Authorize removal of Invoice Ninja branding
  • Authorize resale of Invoice Ninja as your own SaaS
  • Modify Invoice Ninjas official licensing terms
  • Provide legal advice
  • Guarantee compatibility with future Invoice Ninja versions
  • Protect you from broken updates, data loss, or license violations

Requirements

This project assumes:

  • You are running a self-hosted Invoice Ninja instance
  • You have shell access to the server
  • You have permission to modify the local Invoice Ninja files
  • You have a valid Invoice Ninja white-label license if removing branding
  • You understand that updates may overwrite local source-code modifications
  • You have a working backup before making changes

Typical server requirements:

  • Linux server
  • Python 3
  • PHP CLI
  • Invoice Ninja installed under /var/www/invoiceninja
  • Web server user such as www-data
  • Root or sudo access

Before running any patch script, back up your system.

At minimum, back up:

  • Invoice Ninja application files
  • .env
  • Database
  • Uploaded documents
  • Custom templates
  • Docker volumes, if using Docker
  • Web server configuration

Example:

sudo cp -a /var/www/invoiceninja /var/www/invoiceninja.backup.$(date +%F)

For database backups, use the correct tool for your database engine, such as mysqldump, mariadb-dump, pg_dump, or a full VM/container snapshot.


Configuration

The script uses hardcoded paths by default.

Example paths:

FILE_PATH = "/var/www/invoiceninja/app/Models/Account.php"
BACKUP_PATH = "/var/www/invoiceninja/app/Models/Account.php.bak"
LOG_FILE = "/var/log/ninja_patcher.log"
APP_DIR = "/var/www/invoiceninja"

If your Invoice Ninja installation is somewhere else, edit these paths before running the script.

Common install paths may include:

/var/www/invoiceninja
/opt/invoiceninja
/srv/invoiceninja

Docker users should usually patch inside the container or build a custom image instead of modifying random host paths.


Installation

Clone the repository:

git clone https://dock-it.dev/GigabiteStudios/DelableInvoiceNinja.git
cd DelableInvoiceNinja

Make the script executable:

chmod +x main.py

Usage

Run the script as root:

sudo ./main.py

Or:

sudo python3 main.py

The script will:

  1. Check that it is running as root
  2. Confirm the target Invoice Ninja file exists
  3. Validate that the expected class/function structure exists
  4. Create a backup
  5. Apply the patch
  6. Run php -l syntax validation
  7. Replace the original file only if validation passes
  8. Clear application caches using Artisan

Logs

The script writes logs to:

/var/log/ninja_patcher.log

To view logs:

sudo cat /var/log/ninja_patcher.log

Or follow live:

sudo tail -f /var/log/ninja_patcher.log

Rollback

If something breaks, restore the backup file:

sudo cp /var/www/invoiceninja/app/Models/Account.php.bak /var/www/invoiceninja/app/Models/Account.php

Then clear caches:

cd /var/www/invoiceninja
sudo -u www-data php artisan optimize:clear

If that does not fix the issue, restore your full Invoice Ninja backup or VM/container snapshot.


Updating Invoice Ninja

Invoice Ninja updates may overwrite modified files.

After updating Invoice Ninja:

  1. Verify your white-label/license status
  2. Review the updated source file
  3. Re-run the patch only if it is still compatible
  4. Check the logs
  5. Test invoices, quotes, client portal pages, emails, and PDFs

Do not blindly apply patches across major Invoice Ninja updates. Internal function names and behavior may change.


Docker Notes

If you run Invoice Ninja in Docker, changes made inside a running container may be lost when the container is recreated.

For Docker deployments, consider one of these approaches:

  • Use Invoice Ninjas supported license configuration where applicable
  • Build a custom image
  • Mount a controlled override file
  • Apply the patch as part of your container startup process
  • Keep a documented rollback path

Be careful when patching live containers.


Security Notes

This script modifies application source code and runs with elevated permissions.

Review the code before running it.

Do not run scripts from the internet as root unless you understand exactly what they do.

Recommended safety practices:

  • Run only on your own server
  • Review the diff before applying changes
  • Keep backups
  • Test on a staging instance first
  • Restrict file permissions
  • Do not expose patch scripts publicly on production servers
  • Remove the script from the server after use if it is no longer needed

Compatibility

This project may break when Invoice Ninja changes its internal file structure.

Known assumptions:

  • Invoice Ninja is installed at /var/www/invoiceninja
  • The target file exists at app/Models/Account.php
  • The expected PHP functions still exist
  • The web server user is www-data
  • PHP CLI is installed
  • Laravel Artisan commands are available

If any of these assumptions are wrong, edit the script before use.


Troubleshooting

Must be run as root

Run the script with sudo:

sudo python3 main.py

File missing

Check your Invoice Ninja install path and update FILE_PATH.

Invalid Account.php file structure

Your Invoice Ninja version may have changed. Do not force the patch. Review the file manually first.

PHP syntax check failed

The script detected invalid PHP and did not install the patched file. Check the generated temp file and logs.

Cache clear failed

Run manually:

cd /var/www/invoiceninja
sudo -u www-data php artisan optimize:clear

Patch disappears after update

Invoice Ninja updates can overwrite modified files. Re-check compatibility before reapplying.


Responsible Use

This project should only be used in environments where the administrator has the right to make the intended changes.

You should not use this project to:

  • Avoid paying for a white-label license
  • Misrepresent Invoice Ninja as your own software
  • Remove required attribution without permission
  • Resell Invoice Ninja hosting without authorization
  • Circumvent licensing or commercial restrictions

Support the developers of Invoice Ninja by purchasing the proper license when required.


This project is an unofficial, third-party tool intended only for use by administrators of self-hosted Invoice Ninja installations who are authorized to modify their own server files.

This project is not affiliated with, endorsed by, sponsored by, or approved by Invoice Ninja LLC. “Invoice Ninja” and related names, marks, and branding belong to their respective owners. Use of those names in this project is for identification and compatibility purposes only.

Invoice Ninjas self-hosted software is provided under Invoice Ninjas applicable license and self-hosting terms. Self-hosted users may be able to modify and extend the source code, but removing Invoice Ninja attributions, branding, or other client-facing marks may require a valid white-label license or written authorization from Invoice Ninja LLC.

Users are solely responsible for reviewing and complying with Invoice Ninjas current Terms of Service, self-hosting terms, license terms, trademark rules, and any other applicable agreements before using this project.

This project must not be used to bypass payment, licensing, white-label requirements, feature restrictions, subscription checks, or any other commercial controls unless the user has explicit authorization from Invoice Ninja LLC or a valid license that permits such use.

The maintainers of this project do not provide legal advice and make no representation that use of this project is lawful in any particular jurisdiction or situation. By using this project, you accept full responsibility for your own compliance with all applicable laws, licenses, contracts, and terms of service.

Do not use this project to resell, rebrand, white-label, host, bundle, or commercially offer Invoice Ninja as your own SaaS or service unless you have the required agreement or license from Invoice Ninja LLC.

Use at your own risk. The maintainers are not responsible for broken installations, lost data, failed updates, license violations, account issues, legal claims, or any other damages resulting from use or misuse of this project.


Project License

This project is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.

You may share and adapt this project under the terms of that license, provided that you give appropriate credit, indicate whether changes were made, and distribute adapted material under the same license.

See the repositorys LICENSE file for the full license text.

This projects license applies only to this repositorys original code and documentation. It does not grant rights to Invoice Ninja itself, Invoice Ninja branding, Invoice Ninja trademarks, Invoice Ninja commercial features, or any Invoice Ninja white-label rights.

This projects license does not override Invoice Ninjas license, Terms of Service, trademark rights, white-label requirements, or any agreement you may have with Invoice Ninja LLC.

--