I hope that this PHP source code example helps Atlassian Developer Communtiy. See at below:
<?php
class LifecycleController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function preDispatch(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
}
public function installedAction()
{
$config = Zend_Registry::get('config');
$applicationPath = Zend_Registry::get('applicationpath');
// action body
$file = file_get_contents('php://input');
$phpNative = Zend_Json::decode($file);
mkdir($applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl']), 0777, true);
$istalledfile = $applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl'])."/installed.txt";
if (! filesize($istalledfile))
file_put_contents($istalledfile, Zend_Json::encode($phpNative));
}
public function uninstalledAction()
{
$config = Zend_Registry::get('config');
$applicationPath = Zend_Registry::get('applicationpath');
// action body
$file = file_get_contents('php://input');
$phpNative = Zend_Json::decode($file);
mkdir($applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl']), 0777, true);
$istalledfile = $applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl'])."/licenced.txt";
//if (! filesize($istalledfile))
file_put_contents($istalledfile, Zend_Json::encode($phpNative));
unlink($applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl'])."/installed.txt");
}
public function enabledAction()
{
$config = Zend_Registry::get('config');
$applicationPath = Zend_Registry::get('applicationpath');
// action body
$file = file_get_contents('php://input');
$phpNative = Zend_Json::decode($file);
mkdir($applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl']), 0777, true);
$istalledfile = $applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl'])."/licenced.txt";
//if (! filesize($istalledfile))
file_put_contents($istalledfile, Zend_Json::encode($phpNative));
}
public function disabledAction()
{
$config = Zend_Registry::get('config');
$applicationPath = Zend_Registry::get('applicationpath');
// action body
$file = file_get_contents('php://input');
$phpNative = Zend_Json::decode($file);
mkdir($applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl']), 0777, true);
$istalledfile = $applicationPath."/../customers/".str_replace('https://', '', $phpNative['baseUrl'])."/licenced.txt";
//if (! filesize($istalledfile))
file_put_contents($istalledfile, Zend_Json::encode($phpNative));
}
}
This is just a Zend Framework 1.12.10 example PHP source code to to make App install, disable, enable and uninstall things.