Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I very quickly drew up some initial thoughts before the morning meeting here at work. What do you think? Should this approach be considered and investigated more? It's some pseudo code discussion format here and it is in no way the complete set of functions and classes, but I think the primary ides is clear enough.</p> <pre><code>class Foo_Installer extends Zend_Module_Installer { // The modules bar and exporter are needed by this module protected $_dependencies = array('modules' =&gt; array('bar', 'exporter')); // Maybe this should be expanded to include versions like below. Prehaps even be able to // specify a formula of a version like '&gt;2.3 &amp;&amp; !2.4 &amp;&amp; !2.6' if 2.5 and 2.6 is not compatible // for some reason or another. protected $_dependencies = array('modules' =&gt; array('bar' =&gt; '1.0', 'exporter' =&gt; '2.3')); // Tell the installer what 'script' to use. Should be able to use sources such as xml, ini, yaml, db etc // The install script should contain sections for install/uninstall and update process protected $_installScript = 'fooInstall.xml'; // Place to look for files for update protected $_repo = 'http://www.foobar.com/repo'; } class Zend_Module_Installer { protected function _checkDependencies() { // Check if modules in $this-&gt;_dependencies are already installed } public function install() { $this-&gt;_checkDependencies(); // Parses the given source of the install script and returns installSteps $installSteps = $this-&gt;_getInstallSteps(); foreach($installSteps as $installStep) { $installStep-&gt;perform(); } } public function uninstall() { } public function update() { // Connect to repo and check for a newer version of the module. // I think that prehaps a standard should be that modules are distributed // as zip-archives so only one file needs to be downloaded. On a update server // a file named after a standard 'ie packages' could be present that could be // read to determine what packages and versions of these exist on the server // and if there is a new version avalible to download. // // If so we download, unzip, check dependencies, check if dependencies we don't // already have installet are avalible at the server, download these and itterate // until no more downloads are necessery. Then we start runnin the Update() // functions of the downloaded modules in the correct order. } protected function getInstallSteps() { // parses the installscript and instanciates Zend_Installer_Step objects } } // Base class for steps during installation // This apporach makes it easy to extend the installer to be able to do specific things // in specific enviroments. Prehaps configure a some external hardware or whatever. class Zend_Installer_Step { public function perform(); } // Functions to handle the actual logic of creating and deleting stuff. // Some could be standard and some could be application specific class Zend_Installer_Step_Create_File extends Zend_Installer_Step { } class Zend_Installer_Step_Delete_File extends Zend_Installer_Step { } class Zend_Installer_Step_Create_Folder extends Zend_Installer_Step { } class Zend_Installer_Step_Create_Db extends Zend_Installer_Step { } class Zend_Installer_Step_Create_Db_Table extends Zend_Installer_Step { } class Zend_Installer_Step_Create_Db_StoredProcedure extends Zend_Installer_Step { } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload