Hi,
I think that Yii only left this feature, so i start the creation process.
A command that automate the extension install process.
[color="#FF0000"]Then, here is what is necessary on your server:[/color]
-
ZLib extension (for unpack process - almost all servers has it)
-
CURL library (for http process - almost all servers has it)
[color="#FF0000"]And here what you need download:[/color]
[color="#FF0000"]To install this command only extract the files in protected/commands/shell [/color]path.
-
protected
-
commands
-
shell
-
ExtensionCommand.php
-
… other files
-
-
[color="#FF0000"]To use the extension:[/color]
-
Enter in your application path (ex: d:\www\blog\)
-
Enter in Yii console:
yiic shell protected\config\main.php
-
Start the download process, this is the hardest part:
extension install swfobject
-
[color="#FF0000"]You will ask, "but how this magic is done?":[/color]
1 - Your extension last file version have to has the filename: <extension>_last.zip uploaded on extension Yii area.
2 - Your zip have to has this structure for your extension:
- <extension> dir
- InitExtension.php (i will explain)
- ... your extension files...
The InitExtension file, is a normal class, that have the public method "run", that is automatically called when the extension is downloaded and unpacked.
If you download the swfobjectextension, you will see the example file and how it works, is basically this:
<?php
class InitExtension extends CConsoleCommand
{
/**
* Run the main command method
* @param array
*/
public function run($args)
{
// prepare some vars
$files = array();
$currentDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$destDir = YiiBase::getPathOfAlias('ext.' . $args[1]) . DIRECTORY_SEPARATOR;
// show debug
echo("DEBUG: Creating extension dir...\n");
// create dirs
$this->ensureDirectory($destDir);
$this->ensureDirectory($destDir . 'assets' . DIRECTORY_SEPARATOR);
// show debug
echo("DEBUG: Copying extension files...\n");
// build file list
$files[] = array('source' => $currentDir . 'ESwfObject.php',
'target' => $destDir . 'ESwfObject.php');
$files[] = array('source' => $currentDir . 'assets' . DIRECTORY_SEPARATOR . 'expressInstall.swf',
'target' => $destDir . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'expressInstall.swf');
$files[] = array('source' => $currentDir . 'assets' . DIRECTORY_SEPARATOR . 'swfobject.js',
'target' => $destDir . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'swfobject.js' );
// copy files
$this->copyFiles($files);
}
}
So, i think that this ExtensionCommand will help us to follow a default structure to automate the extension install process for everyone.
What you think? This is ready!
And dont forget, you only need execute this command to install an extension:
extension install <extension-name>
Be sure that the extension is compatible with it.
Please, if you will post an extension you can follow this structure to help this process and specify in your description that is compatible with it.
License: FREE - BSD LICENSE