-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev Added new console launcher that loads custom application class.
Dev Added custom application class that implements some required functions for use in LS.
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/php | ||
<?php | ||
/* | ||
* LimeSurvey (tm) | ||
* Copyright (C) 2011 The LimeSurvey Project Team / Carsten Schmitz | ||
* All rights reserved. | ||
* License: GNU/GPL License v2 or later, see LICENSE.php | ||
* LimeSurvey is free software. This version may have been modified pursuant | ||
* to the GNU General Public License, and as distributed it includes or | ||
* is derivative of works licensed under the GNU General Public License or | ||
* other free or open source software licenses. | ||
* See COPYRIGHT.php for copyright notices and details. | ||
* | ||
* | ||
* File edited by Sam Mousa for Marcel Minke. | ||
* This loader bypasses the default Yii loader and loads a custom console class instead. | ||
*/ | ||
if (!isset($argv[0])) die(); | ||
define('BASEPATH','.'); | ||
|
||
// Load configuration. | ||
$sCurrentDir=dirname(__FILE__); | ||
$config=require (dirname($sCurrentDir).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); | ||
$core = dirname($sCurrentDir) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR; | ||
unset ($config['defaultController']); | ||
unset ($config['config']); | ||
|
||
|
||
|
||
// fix for fcgi | ||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); | ||
|
||
defined('YII_DEBUG') or define('YII_DEBUG',true); | ||
|
||
require_once(dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'yii.php'); | ||
|
||
if(isset($config)) | ||
{ | ||
require_once($core . 'ConsoleApplication.php'); | ||
$app=Yii::createApplication('ConsoleApplication', $config); | ||
define('APPPATH', Yii::app()->getBasePath() . DIRECTORY_SEPARATOR); | ||
$app->commandRunner->addCommands(YII_PATH.'/cli/commands'); | ||
$env=@getenv('YII_CONSOLE_COMMANDS'); | ||
if(!empty($env)) | ||
$app->commandRunner->addCommands($env); | ||
} | ||
$app->run(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
|
||
class ConsoleApplication extends CConsoleApplication | ||
{ | ||
|
||
public $lang = null; | ||
|
||
public function __construct($config = null) { | ||
parent::__construct($config); | ||
} | ||
/** | ||
* This function is implemented since em_core_manager incorrectly requires | ||
* it to create urls. | ||
*/ | ||
public function getController() | ||
{ | ||
return $this; | ||
|
||
} | ||
|
||
|
||
/** | ||
* Returns a config variable from the config | ||
* | ||
* @access public | ||
* @param string $name | ||
* @return mixed | ||
*/ | ||
public function getConfig($name) | ||
{ | ||
return isset($this->$name) ? $this->$name : false; | ||
} | ||
|
||
|
||
} | ||
?> |