Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.86 KB

README.md

File metadata and controls

58 lines (40 loc) · 1.86 KB

WordPress Install Checker Module

A module that handles checking a WordPress installation to see if it is a fresh install and to fetch the estimated installation date.

This module uses the Newfold Module Loader to register new references into the dependency injection container. Only meant for use in Newfold brand plugins.

Module Responsibilities

  • Provides a way to check if a WordPress install is fresh, meaning no posts, pages, or users were created manually.
  • Provides a way to get the creation/installation date for a WordPress site.

Critical Paths

  • Ensure that a newly created site that hasn't been touched passes the isFreshInstallation() check.
  • Ensure that a newly created site with WooCommerce installed passes the isFreshInstallation() check.

Installation

1. Add the Newfold Satis to your composer.json.

composer config repositories.newfold composer https://newfold-labs.github.io/satis

2. Require the newfold-labs/wp-module-install-checker package.

composer require newfold-labs/wp-module-install-checker

Usage

<?php

use function NewfoldLabs\WP\ModuleLoader\container;

/**
* Returns a boolean indicating whether this is a fresh WordPress installation.
*/
$isFreshInstall = container()->get('isFreshInstallation');

/**
 * Returns a Unix timestamp representing the site creation date.
 */
$installationDate = container()->get('installationDate');

/**
 * Returns an InstallChecker class instance.
 */
 $installChecker = container()->get('installChecker');