Sunnysideup\UpgradeToSilverstripe4\ModuleUpgraderBaseWithVariables
Synopsis
class ModuleUpgraderBaseWithVariables
implements
ModuleUpgraderInterface
{
- // members
- protected array $argv = ;
- protected string $recipe = 'SS4';
- protected array $availableRecipes = ;
- protected array $taskSteps = ;
- protected array $listOfTasks = ;
- protected string $frameworkComposerRestraint = '';
- protected string $parentProjectForModule = '';
- protected string $parentProjectForModuleBranchOrTag = 'master';
- protected bool $restartSession = false;
- protected bool $runLastOneAgain = false;
- protected string $currentlyRunning = '';
- protected bool $isModuleUpgrade = true;
- protected string $defaultNamespaceForTasks = 'Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks';
- protected bool $runInteractively = true;
- protected bool $verbose = false;
- protected string $startFrom = '';
- protected string $endWith = '';
- protected string $onlyRun = '';
- protected bool $runIrreversibly = false;
- protected bool $outOfOrderTask = false;
- protected array $arrayOfModules = ;
- protected string $nameOfBranchForBaseCode = 'master';
- protected string $nameOfUpgradeStarterBranch = 'upgrades/starting-point';
- protected string $nameOfTempBranch = 'upgrades/temp-automated-upgrade-branch';
- protected string $vendorName = '';
- protected string $vendorNamespace = '';
- protected string $packageName = '';
- protected string $packageFolderNameForInstall = '';
- protected string $vendorAndPackageFolderNameForInstall = '';
- protected string $packageNamespace = '';
- protected string $gitLink = '';
- protected string $gitLinkAsHTTPS = '';
- protected string $gitLinkAsRawHTTPS = '';
- protected bool $upgradeAsFork = false;
- protected string $composerEnvironmentVars = '';
- protected string $logFolderDirLocation = '';
- protected string $aboveWebRootDirLocation = '/var/www';
- protected string $webRootName = 'upgradeto4';
- protected string $locationOfThisUpgrader = '';
- protected string $locationOfSSUpgradeModule = '';
- protected PHP2CommandLineSingleton|null $commandLineExec = NULL;
- protected SessionManagementInterface|null $sessionManager = NULL;
- protected string $sessionFileName = 'Session_For';
- protected bool $makeKeyNotes = false;
- protected string $originComposerFileLocation = '';
- protected bool $lastMethodHasBeenRun = false;
- protected string $logFileLocation = '';
- protected string $webRootDirLocation = '';
- protected string $themeDirLocation = '';
- protected array $moduleDirLocations = ;
- protected array $customVariablesForTasks = ;
- // methods
- public void __construct()
- public void __destruct()
- public ModuleUpgraderInterface addModule()
- public ModuleUpgraderInterface addToListOfTasks()
- public ModuleUpgraderInterface removeFromListOfTasks()
- public ModuleUpgraderInterface setRunImmediately()
- public string getLocationOfThisUpgrader()
- public string getLocationOfSSUpgradeModule()
- public void getSessionManager()
- public array getExistingModuleDirLocations()
- public ModuleUpgraderBaseWithVariables setBreakOnAllErrors()
- public bool getBreakOnAllErrors()
- public bool getIsProjectUpgrade()
- public void getExistingModuleDirLocationsWithThemeFolders()
- public string getExistingFirstModuleDirLocation()
- public void getNameOfBranchForBaseCodeForComposer()
- public array findNameSpaceAndCodeDirs()
- public void findMyCodeDir()
- public void getGitRootDir()
- public void getIsModuleUpgradeNice()
- public ModuleUpgraderInterface setVariableForTask()
- protected mixed positionForTask()
- protected void getPackageFolderNameBasic()
- protected PHP2CommandLineSingleton startPHP2CommandLine()
- protected void endPHP2CommandLine()
- // Inherited methods from GettersAndSetters
- public void __call()
- // Inherited methods from Misc
- public void newLine()
- public string checkIfPathExistsAndCleanItUp()
- public string cleanCamelCase()
- protected void URLExists()
- protected void isValidURL()
- protected void getCommandLineOrArgumentAsString()
- protected void getCommandLineOrArgumentAsBoolean()
Hierarchy
Uses
- Sunnysideup\UpgradeToSilverstripe4\Traits\GettersAndSetters
- Sunnysideup\UpgradeToSilverstripe4\Traits\Misc
Implements
Members
protected
- $aboveWebRootDirLocation
—
string
location of web root above module - $argv
- $arrayOfModules
—
array
specified like this: [ 'VendorName' => 'A', 'VendorNamespace' => 'A', 'PackageName' => 'Package1', 'PackageNamespace' => 'Package1', 'GitLink' => 'git@github.com:foor/bar-1.git', 'UpgradeAsFork' => false, 'NameOfBranchForBaseCode' => 'develop', ], [ 'VendorName' => 'A', 'VendorNamespace' => 'A', 'PackageName' => 'Package2', 'PackageNamespace' => 'Package2', 'GitLink' => 'git@github.com:foor/bar-2.git', 'UpgradeAsFork' => false, 'NameOfBranchForBaseCode' => 'master', ], required are: - VendorName - PacakageName The rest can be deduced (theoretically) - $availableRecipes
—
array
list of recipes available - $commandLineExec
—
Sunnysideup\UpgradeToSilverstripe4\PHP2CommandLineSingleton|null
Reference to the commandline printer that outputs everything to the command line - $composerEnvironmentVars
—
string
e.g. COMPOSER_HOME="/home/UserName" - $currentlyRunning
—
string
command that is currently running - $customVariablesForTasks
—
array
records variables for tasks, like this: [ 'TaskName' => [ 'VariableName' => 'VariableValue', ], ] - $defaultNamespaceForTasks
—
string
The default namespace for all tasks - $endWith
—
string
end the upgrade sequence after a particular task - $frameworkComposerRestraint
—
string
e.g. ^4.4 - $gitLink
—
string
git link for the module in ssh form e.g. git@github.com:sunnysideup/silverstripe-dynamiccache.git - $gitLinkAsHTTPS
—
string
git link for the module in https form e.g. https://github.com/sunnysideup/silverstripe-dynamiccache/ - $gitLinkAsRawHTTPS
—
string
git link for the module in raw https form e.g. https://raw.githubusercontent.com/sunnysideup/silverstripe-dynamiccache/ - $isModuleUpgrade
—
Sunnysideup\UpgradeToSilverstripe4\bool
are we upgrading a module or a whole project? - $lastMethodHasBeenRun
—
Sunnysideup\UpgradeToSilverstripe4\bool
Is this the last TASK we are running? - $listOfTasks
—
array
An array of all the 'taskName's of the tasks that you wish to run during the execution of this upgrader task. - $locationOfSSUpgradeModule
—
string
//e.g. 'upgrade-code' //e.g. '~/.composer/vendor/bin/upgrade-code' //e.g. '/var/www/silverstripe-upgrade_to_silverstripe_4/vendor/silverstripe/upgrader/bin/upgrade-code' - $locationOfThisUpgrader
—
string
//e.g. 'upgrade-code' //e.g. '~/.composer/vendor/bin/upgrade-code' //e.g. '/var/www/silverstripe-upgrade_to_silverstripe_4/vendor/silverstripe/upgrader/bin/upgrade-code' - $logFileLocation — string
- $logFolderDirLocation
—
string
The folder for storing the log file in used in setting the php2 command line printer up - $makeKeyNotes
—
Sunnysideup\UpgradeToSilverstripe4\bool
does the exec output Key Notes? - $moduleDirLocations
—
array
Directory that holds the module or project. - $nameOfBranchForBaseCode
—
string
name of the branch that exists as the starting point for upgrade - $nameOfTempBranch
—
string
name of the branch created to do the upgrade - $nameOfUpgradeStarterBranch
—
string
name of the branch to be created that we use a starter branch for upgrade - $onlyRun
—
string
only run this task ... - $originComposerFileLocation — string
- $outOfOrderTask
—
Sunnysideup\UpgradeToSilverstripe4\bool
is this out of order - i.e. no influence on next task - $packageFolderNameForInstall
—
string
e.g. install folder for package in SS3. - $packageName
—
string
Package name for the module - $packageNamespace
—
string
Name space for the modules package - $parentProjectForModule
—
string
e.g. git@github.com:sunnysideup/silverstripe-ecommerce_test.git - $parentProjectForModuleBranchOrTag
—
string
e.g. master or 4.2.2 - $recipe — string
- $restartSession
—
Sunnysideup\UpgradeToSilverstripe4\bool
Should the session details be deleted before we start? - $runInteractively
—
Sunnysideup\UpgradeToSilverstripe4\bool
if set to true it will run each step and then stop. - $runIrreversibly
—
Sunnysideup\UpgradeToSilverstripe4\bool
finish the run with a merge into master. - $runLastOneAgain
—
Sunnysideup\UpgradeToSilverstripe4\bool
Do we run the last step again? - $sessionFileName — string
- $sessionManager
—
Sunnysideup\UpgradeToSilverstripe4\SessionManagementInterface|null
Reference to the commandline printer that outputs everything to the command line - $startFrom
—
string
start the upgrade sequence at a particular task - $taskSteps
—
array
A list of task groups this will be set from recipe - so we need this! - $themeDirLocation
—
string
Combination of the web dir root name and the aboveWebRootDirLocation - $upgradeAsFork
—
Sunnysideup\UpgradeToSilverstripe4\bool
Should the upgrade to this module create a fork - $vendorAndPackageFolderNameForInstall
—
string
e.g. sunnysideup/my-cool-module - $vendorName
—
string
Name of module vendor - $vendorNamespace
—
string
module vendors namespace - $verbose
—
Sunnysideup\UpgradeToSilverstripe4\bool
Show ALL the information or just a little bit. - $webRootDirLocation
—
string
Combination of the web dir root name and the aboveWebRootDirLocation - $webRootName — string
Methods
protected
- endPHP2CommandLine() — deconstructs Command Line important as this outputs the whole thing
- getPackageFolderNameBasic()
- positionForTask() — What is the index of given task within the sequence
- startPHP2CommandLine() — Starts the logger. Extra checking may be put in here to see if you want to start the logger or not in different scenarios.
public
- __construct() — Starts the output to the commandline / browser
- __destruct() — Ends output to commandline / browser
- addModule() — Appends the given module in the form of all its module data that has to be formatted in an array to the array of modules that will be worked with during the upgrade procedure.
- addToListOfTasks() — Inserts another task to the list of tasks at a given position in the order of execution, if it is set TODO These parameter names need some more refining
- findMyCodeDir()
- findNameSpaceAndCodeDirs() — Locates the directory in which the code is kept within the module directory
- getBreakOnAllErrors() — Whether execution should come to a halt when an error is reached
- getExistingFirstModuleDirLocation() — returns path for module
- getExistingModuleDirLocations() — returns an array of existing paths
- getExistingModuleDirLocationsWithThemeFolders()
- getGitRootDir()
- getIsModuleUpgradeNice()
- getIsProjectUpgrade() — Whether execution should come to a halt when an error is reached
- getLocationOfSSUpgradeModule()
- getLocationOfThisUpgrader()
- getNameOfBranchForBaseCodeForComposer()
- getSessionManager()
- removeFromListOfTasks() — Removes the given task from the list of tasks to execute
- setBreakOnAllErrors() — Whether execution should come to a halt when an error is reached
- setRunImmediately()
- setVariableForTask() — Removes the given task from the list of tasks to execute
Inherited from Sunnysideup\UpgradeToSilverstripe4\Traits\GettersAndSetters
public
- __call() — creates magic getters and setters if you call $this->getFooBar() then it will get the variable FooBar even if the method getFooBar does not exist.
Inherited from Sunnysideup\UpgradeToSilverstripe4\Traits\Misc
protected
public
- checkIfPathExistsAndCleanItUp() — returns path in a consistent format e.g. /var/www
- cleanCamelCase() — Cleans an input string and returns a more natural human readable version
- newLine()