| [ Index ] |
PHP Cross Reference of Akelos Framework |
[Summary view] [Print] [Text view]
1 <?php 2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 3 4 // +----------------------------------------------------------------------+ 5 // | Akelos Framework - http://www.akelos.org | 6 // +----------------------------------------------------------------------+ 7 // | Copyright (c) 2002-2006, Akelos Media, S.L. & Bermi Ferrer Martinez | 8 // | Released under the GNU Lesser General Public License, see LICENSE.txt| 9 // +----------------------------------------------------------------------+ 10 11 /** 12 * @package ActiveSupport 13 * @subpackage Scripts 14 * @author Bermi Ferrer <bermi a.t akelos c.om> 15 * @copyright Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org 16 * @license GNU Lesser General Public License <http://www.gnu.org/copyleft/lesser.html> 17 */ 18 19 error_reporting(defined('AK_ERROR_REPORTING_ON_SCRIPTS') ? AK_ERROR_REPORTING_ON_SCRIPTS : 0); 20 require_once (AK_LIB_DIR.DS.'Ak.php'); 21 require_once (AK_LIB_DIR.DS.'AkObject.php'); 22 require_once (AK_LIB_DIR.DS.'AkInflector.php'); 23 defined('AK_SKIP_DB_CONNECTION') && AK_SKIP_DB_CONNECTION ? ($dsn='') : Ak::db(&$dsn); 24 array_shift($argv); 25 $options = $argv; 26 27 require_once (AK_LIB_DIR.DS.'AkInstaller.php'); 28 require_once (AK_LIB_DIR.DS.'utils'.DS.'generators'.DS.'AkelosGenerator.php'); 29 30 $installer = array_shift($options); 31 if(preg_match('/:{2}|\//', $installer)){ 32 $installer_class_name = AkInflector::camelize(AkInflector::demodulize($installer)).'Installer'; 33 }else{ 34 $installer_class_name = AkInflector::camelize($installer).'Installer'; 35 } 36 37 $command = count($options) > 0 ? array_shift($options) : 'usage'; 38 39 $installer = str_replace('::','/',$installer); 40 $file = AK_APP_DIR.DS.'installers'.DS.rtrim(join('/',array_map(array('AkInflector','underscore'), explode('/',$installer.'/'))),'/').'_installer.php'; 41 42 43 function ak_print_available_installers($files, $preffix = '') 44 { 45 foreach($files as $k => $file){ 46 if(is_string($file)){ 47 if(preg_match('/(.*)_installer\.php$/', $file, $match)){ 48 echo ' * '.$preffix.$match[1]."\n"; 49 } 50 }else{ 51 ak_print_available_installers($file, $k.'::'); 52 } 53 } 54 echo "\n"; 55 } 56 57 if($installer_class_name == 'Installer'){ 58 $files = Ak::dir(AK_APP_DIR.DS.'installers', array('recurse' => true)); 59 if(empty($files)){ 60 echo Ak::t("\n Could not find installers at %dir \n", array('%dir'=>AK_APP_DIR.DS.'installers')); 61 }else{ 62 echo Ak::t("\n You must supply a valid installer name like : \n"); 63 echo Ak::t("\n > ./script/migrate my_installer_name install\n\n"); 64 echo Ak::t(" Available installers are: \n\n"); 65 ak_print_available_installers($files); 66 } 67 }elseif(!file_exists($file)){ 68 echo Ak::t("\n\n Could not locate the installer file %file\n\n",array('%file'=>$file)); 69 }else{ 70 require_once($file); 71 if(!class_exists($installer_class_name)){ 72 echo Ak::t("\n\n Could not find load the installer. Class doesn't exists\n\n"); 73 }else{ 74 $installer = new $installer_class_name(); 75 if(!method_exists($installer,$command)){ 76 echo Ak::t("\n\n Could not find the method %method for the installer %installer\n\n", 77 array('%method'=>$command,'%installer'=>$installer_class_name)); 78 }else{ 79 $installer->$command($options); 80 } 81 } 82 } 83 84 85 echo "\n"; 86 87 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Oct 27 12:43:49 2008 | Cross-referenced by PHPXref 0.6 |