[] (https://travis-ci.org/wormhit/InstallScripts) [] (https://scrutinizer-ci.com/g/wormhit/InstallScripts/) [] (https://coveralls.io/r/wormhit/InstallScripts?branch=master)
Module for Zend Framework 2 to perform script execution
It allow you to create scripts that needs to be executed from terminal.
"require": {
"wormhit/InstallScripts": "*"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/wormhit/InstallScripts.git"
}
]
php composer.phar update
config/application.config.php
<?php
return array(
'modules' => array(s
'...',
'InstallScripts'
),
);
config/autoload/instal.global.php
<?php
return array(
'InstallScripts' => array(
'StorageAdapter' => array(
'Adapter' => 'InstallScripts\StorageAdapter\FileStorageAdapter',
'Options' => array(
'file' => __DIR__ . '/../../data/install.json', // make sure directory is writable
)
),
'Scripts' => array(
// namespace => array( script files )
'Application' => array(
'Install\Transactions',
)
),
)
);
module/Application/src/Application/Install/Transactions.php
<?php
namespace Application\Install;
use InstallScripts\Script;
class Transactions extends Script
{
public function __construct()
{
set_time_limit(0);
}
/**
* @return array
*/
public function getVersions()
{
return array(
'0.0.1' => 'MoveDatabase',
'0.0.2' => 'SomethingElse',
);
}
/**
* Do some stuff
*/
public function MoveDatabase()
{
$e = $this->getMvcEvent();
// execute something
return true;
}
/**
* Do some other stuff
*/
public function SomethingElse()
{
return true;
}
}