Reads and stores the Winter CMS source manifest information.
The source manifest is a meta JSON file, stored on GitHub, that contains the hashsums of all module files across all builds of Winter CMS. This allows us to compare the Winter CMS installation against the expected file checksums and determine the installed build and whether it has been modified.
Since Winter CMS v1.1.1, a forks manifest is also used to determine at which point we forked a branch off to a new major release. This allows us to track concurrent histories - ie. the 1.0.x history vs. the 1.1.x history.
Array of builds, keyed by build number, with files for keys and hashes for values.
protected $forks : array
The version map where forks occurred.
protected $forksUrl : string
The URL to the forked version manifest
protected $source : string
The URL to the source manifest
__construct ($source =
null, $forks =
null, boolean $autoload =
public addBuild (int $build, System\Classes\FileManifest $manifest) : void
Adds a FileManifest instance as a build to this source manifest.
Changes between builds are calculated and stored with the build. Builds are stored in order of semantic versioning: ie. 1.1.1 > 1.1.0 > 1.0.468
The file manifest to add as a build.
compare (System\Classes\FileManifest $manifest, boolean $detailed =
Compares a file manifest with the source manifest.
This will determine the build of the Winter CMS installation.
This will return an array with the following information:
build: The build number we determined was most likely the build installed.
modified: Whether we detected any modifications between the installed build and the manifest.
confident: Whether we are at least 60% sure that this is the installed build. More modifications to to the code = less confidence.
changes: If $detailed is true, this will include the list of files modified, created and deleted.
The file manifest to compare against the source.
If true, the list of files modified, added and deleted will be included in the result.
public generate () : string
Generates the JSON data to be stored with the source manifest.
public getBuilds () : array
Gets all builds.
public getState (string | int $build) : array
Gets the filelist state at a selected build.
This method will list all expected files and hashsums at the specified build number. It does this by following the history, switching branches as necessary.
|$build||string | int||
string | int
Build version to get the filelist state for.
public loadForks () : static
Loads the forked version manifest file.
public loadSource () : static
Loads the manifest file.
public setForksSource (string $forks) : void
Sets the forked version manifest URL.
public setSource (string $source) : void
Sets the source manifest URL.
protected determineParent (string $build) : array | null
Determine the parent of the provided build number
protected getVersionInt (string $version) : integer
Converts a version string into an integer for comparison.
processChanges (System\Classes\FileManifest $manifest, FileManifest | string | int $previous =
Determines file changes between the specified build and the previous build.
Will return an array of added, modified and removed files.
The current build's file manifest.
|$previous||FileManifest | string | int||
FileManifest | string | int
Either a previous manifest, or the previous build number as an int or string, used to determine changes with this build.